Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

fix: show what an agent brings on its sheet

forwardxu3201d7c68042
diff --git a/apps/android/WhatsNew.md b/apps/android/WhatsNew.md
index c3d70b0d..0842a07b 100644
--- a/apps/android/WhatsNew.md
+++ b/apps/android/WhatsNew.md
@@ -12,7 +12,9 @@ else a generic "Bug fixes and improvements" line. Delete old sections.
### zh-Hant
- 新增 DeepSeek Harness(dsh):電腦上裝好 dsh 並存好 DeepSeek API 金鑰後,Bot 就能使用 DeepSeek 的模型。
- Cortex Code 與 Factory Droid 的圖示不再顯示錯誤。
+- 在「擴充套件」裡打開一個 Agent,登入下方會列出它自己的技能、連接器、規則和外掛。
### en-US
- New agent: DeepSeek Harness (dsh). With dsh installed and a DeepSeek API key saved on your computer, a bot can run on DeepSeek's models.
- The Cortex Code and Factory Droid logos no longer draw wrong.
+- Open an agent in Extensions to see its skills, connectors, rules and plugins.
diff --git a/apps/android/app/src/main/kotlin/com/codync/android/AgentBrings.kt b/apps/android/app/src/main/kotlin/com/codync/android/AgentBrings.kt
new file mode 100644
index 00000000..96837542
--- /dev/null
+++ b/apps/android/app/src/main/kotlin/com/codync/android/AgentBrings.kt
@@ -0,0 +1,114 @@
+package com.codync.android
+
+import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.shape.CircleShape
+import androidx.compose.material3.Text
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.text.style.TextOverflow
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.unit.dp
+import com.codync.android.design.*
+import kotlinx.serialization.json.JsonArray
+import kotlinx.serialization.json.JsonObject
+import kotlinx.serialization.json.buildJsonObject
+import kotlinx.serialization.json.contentOrNull
+import kotlinx.serialization.json.jsonPrimitive
+import kotlinx.serialization.json.put
+
+/** One skill, connector, rule or plugin the agent keeps for itself (`agentGear`). */
+internal data class GearItem(val name: String, val description: String, val detail: String)
+
+internal data class AgentGear(
+ val skills: List<GearItem>,
+ val connectors: List<GearItem>,
+ val rules: List<GearItem> = emptyList(),
+ val plugins: List<GearItem> = emptyList(),
+) {
+ val shows get() = skills.isNotEmpty() || connectors.isNotEmpty() || rules.isNotEmpty() || plugins.isNotEmpty()
+}
+
+/** What `backend` already has in the user's home. Codync's own skills and connectors are not in this list. */
+internal suspend fun AppStore.agentGear(backend: String): AgentGear {
+ val body = hostCall("agentGear", buildJsonObject { put("backend", backend) })
+ val obj = body as? JsonObject ?: return AgentGear(emptyList(), emptyList())
+ return AgentGear(obj.gearItems("skills"), obj.gearItems("connectors"), obj.gearItems("rules"), obj.gearItems("plugins"))
+}
+
+private fun JsonObject.gearItems(key: String): List<GearItem> {
+ val rows = this[key] as? JsonArray ?: return emptyList()
+ return rows.mapNotNull { row ->
+ val item = row as? JsonObject ?: return@mapNotNull null
+ val name = item["name"]?.jsonPrimitive?.contentOrNull?.trim().orEmpty()
+ if (name.isEmpty()) return@mapNotNull null
+ GearItem(name, item["description"]?.jsonPrimitive?.contentOrNull.orEmpty(), item["detail"]?.jsonPrimitive?.contentOrNull.orEmpty())
+ }
+}
+
+/** Skills, connectors, rules and plugins the agent already has, under Sign in on its sheet. */
+@Composable internal fun AgentBrings(backendId: String, store: AppStore) {
+ var gear by remember(backendId) { mutableStateOf<AgentGear?>(null) }
+ var failed by remember(backendId) { mutableStateOf(false) }
+ var open by remember(backendId) { mutableStateOf<String?>(null) }
+ LaunchedEffect(backendId) {
+ try {
+ gear = store.agentGear(backendId)
+ failed = false
+ } catch (failure: Exception) {
+ if (failure is kotlinx.coroutines.CancellationException) throw failure
+ failed = true
+ }
+ }
+ when {
+ failed -> CardSection { row { Text(tr("Couldn't load what this agent brings."), style = Type.footnote, color = Palette.danger) } }
+ gear?.shows == true -> {
+ val loaded = gear ?: return
+ val groups = listOf("Skills" to loaded.skills, "Connectors" to loaded.connectors, "Rules" to loaded.rules, "Plugins" to loaded.plugins)
+ CardSection("What the agent brings") {
+ for ((title, items) in groups) {
+ if (items.isEmpty()) continue
+ row {
+ Disclosure(open == title, { open = if (open == title) null else title }, label = {
+ Box(Modifier.size(26.dp).clip(CircleShape).background(Palette.bubbleAgent), contentAlignment = Alignment.Center) {
+ Symbol(icon(title), size = 13.dp, tint = Palette.text)
+ }
+ Text(tr(title), Modifier.weight(1f).padding(start = 10.dp), style = Type.body, color = Palette.text, maxLines = 1, overflow = TextOverflow.Ellipsis)
+ Text("${items.size}", Modifier.clip(CircleShape).background(Palette.bubbleAgent).padding(horizontal = 7.dp, vertical = 2.dp),
+ style = Type.caption.semibold.monospacedDigit, color = Palette.secondary)
+ }) {
+ Column(Modifier.fillMaxWidth().padding(top = 6.dp)) {
+ items.forEachIndexed { index, item ->
+ if (index > 0) Box(Modifier.padding(start = 36.dp).fillMaxWidth().height(0.5.dp).background(Palette.border))
+ val note = item.description.ifEmpty { item.detail }
+ Column(Modifier.fillMaxWidth().padding(start = 36.dp, top = 8.dp, bottom = 8.dp)) {
+ Text(item.name, style = Type.subheadline.semibold, color = Palette.text, maxLines = 1, overflow = TextOverflow.Ellipsis)
+ if (note.isNotEmpty()) Text(note, style = Type.caption, color = Palette.secondary, maxLines = 2, overflow = TextOverflow.Ellipsis)
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+private fun icon(title: String) = when (title) {
+ "Skills" -> "book.pages"
+ "Connectors" -> "point.3.connected.trianglepath.dotted"
+ "Rules" -> "list.bullet.rectangle"
+ else -> "square.grid.2x2"
+}
diff --git a/apps/android/app/src/main/kotlin/com/codync/android/AgentSheet.kt b/apps/android/app/src/main/kotlin/com/codync/android/AgentSheet.kt
index d7b2d3d2..e9ed3c57 100644
--- a/apps/android/app/src/main/kotlin/com/codync/android/AgentSheet.kt
+++ b/apps/android/app/src/main/kotlin/com/codync/android/AgentSheet.kt
@@ -88,7 +88,7 @@ internal fun agentRegistry(state: AppState, agent: String) = agentBackends(state
when {
shown == null -> Column(Modifier.fillMaxSize().background(Palette.background)) {
ModalHeader(backend.name)
- Overview(backend, auth, checking, authenticating, error, state, { route = it }, ::check) { method ->
+ Overview(backend, auth, checking, authenticating, error, state, store, { route = it }, ::check) { method ->
authenticating = method.id
scope.launch {
try { auth = store.agentAuthenticate(backend.id, method.id); error = null }
@@ -105,7 +105,7 @@ internal fun agentRegistry(state: AppState, agent: String) = agentBackends(state
}
@Composable private fun Overview(backend: AgentBackend, auth: AgentAuth?, checking: Boolean, authenticating: String?, error: String?, state: AppState,
- go: (SetupRoute) -> Unit, check: () -> Unit, authenticate: (AgentAuthMethod) -> Unit) {
+ store: AppStore, go: (SetupRoute) -> Unit, check: () -> Unit, authenticate: (AgentAuthMethod) -> Unit) {
val host = state.hostName
val signedIn = auth?.signedIn ?: backend.signedIn
val curated = backend.curated
@@ -176,6 +176,7 @@ internal fun agentRegistry(state: AppState, agent: String) = agentBackends(state
}
}
}
+ AgentBrings(backend.id, store)
error?.let { CardSection { row { SelectionContainer { ErrorRow(it) } } } }
}
}
diff --git a/apps/android/app/src/main/kotlin/com/codync/android/BotDetailsView.kt b/apps/android/app/src/main/kotlin/com/codync/android/BotDetailsView.kt
index 7c78e697..09b6b1df 100644
--- a/apps/android/app/src/main/kotlin/com/codync/android/BotDetailsView.kt
+++ b/apps/android/app/src/main/kotlin/com/codync/android/BotDetailsView.kt
@@ -40,7 +40,7 @@ import kotlinx.coroutines.delay
* (docs/plans/android-app.md).
*/
internal enum class DetailsTab(val title: String) {
- Details("Details"), Library("Library"), Settings("Settings"), Skills("Skills"), Connectors("Connectors"), Rules("Rules"), Plugins("Plugins"),
+ Details("Details"), Library("Library"), Settings("Settings"),
}
/**
@@ -50,8 +50,8 @@ internal enum class DetailsTab(val title: String) {
internal data class DetailsRequest(val tab: DetailsTab = DetailsTab.Details, val routineId: String? = null, val botId: String? = null)
/**
- * A bot's details (iOS `BotDetailsView`): who it is, then its details, library, settings, skills, connectors, rules and plugins.
- * Settings save as you edit.
+ * A bot's details (iOS `BotDetailsView`): who it is, then its details, library and settings.
+ * Settings save as you edit. What the agent brings is on the agent's own sheet.
* `openArtifact`: an artifact picked in the Library, for the chat's viewer.
*/
@Composable internal fun BotDetailsView(bot: Bot, request: DetailsRequest, state: AppState, store: AppStore, openArtifact: (OpenArtifact) -> Unit) {
@@ -71,16 +71,12 @@ internal data class DetailsRequest(val tab: DetailsTab = DetailsTab.Details, val
delay(600)
store.saveSettings(draft)
}
- val botTabs = listOfNotNull(DetailsTab.Details, DetailsTab.Library.takeIf { hasLibrary(state.hello?.text("version")) }, DetailsTab.Settings)
- val gearTabs = listOf(DetailsTab.Skills, DetailsTab.Connectors, DetailsTab.Rules, DetailsTab.Plugins)
+ val tabs = listOfNotNull(DetailsTab.Details, DetailsTab.Library.takeIf { hasLibrary(state.hello?.text("version")) }, DetailsTab.Settings)
Box(Modifier.fillMaxSize().background(Palette.background)) {
Column(Modifier.fillMaxSize().verticalScroll(rememberScrollState()).padding(start = 20.dp, end = 20.dp, bottom = 24.dp),
horizontalAlignment = Alignment.CenterHorizontally) {
Identity(bot, state)
- Column(Modifier.padding(top = 18.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(2.dp)) {
- TabChoice(tab, botTabs.map { it to it.title }, { tab = it })
- TabChoice(tab, gearTabs.map { it to it.title }, { tab = it })
- }
+ TabChoice(tab, tabs.map { it to it.title }, { tab = it }, Modifier.padding(top = 18.dp))
CompositionLocalProvider(LocalCardStyle provides CardStyle.Outlined) {
Box(Modifier.fillMaxWidth().padding(top = 20.dp)) {
when (tab) {
@@ -92,10 +88,6 @@ internal data class DetailsRequest(val tab: DetailsTab = DetailsTab.Details, val
}
DetailsTab.Library -> LibraryView(bot, state, store, openArtifact)
DetailsTab.Settings -> BotSettingsForm(state, store, draft, { draft = it }, FormPart.Rarely)
- DetailsTab.Skills -> BotGearPage(bot, state, store, draft, { draft = it }, GearKind.Skills)
- DetailsTab.Connectors -> BotGearPage(bot, state, store, draft, { draft = it }, GearKind.Connectors)
- DetailsTab.Rules -> BotGearPage(bot, state, store, draft, { draft = it }, GearKind.Rules)
- DetailsTab.Plugins -> BotGearPage(bot, state, store, draft, { draft = it }, GearKind.Plugins)
}
}
}
diff --git a/apps/android/app/src/main/kotlin/com/codync/android/BotGearPage.kt b/apps/android/app/src/main/kotlin/com/codync/android/BotGearPage.kt
deleted file mode 100644
index a45c3cb6..00000000
--- a/apps/android/app/src/main/kotlin/com/codync/android/BotGearPage.kt
+++ /dev/null
@@ -1,122 +0,0 @@
-package com.codync.android
-
-import androidx.compose.foundation.layout.Arrangement
-import androidx.compose.foundation.layout.Column
-import androidx.compose.runtime.Composable
-import androidx.compose.runtime.LaunchedEffect
-import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
-import androidx.compose.runtime.remember
-import androidx.compose.material3.Text
-import androidx.compose.runtime.setValue
-import androidx.compose.ui.unit.dp
-import com.codync.android.core.Bot
-import com.codync.android.core.BotDraft
-import com.codync.android.core.LinkState
-import com.codync.android.design.*
-import kotlinx.serialization.json.JsonArray
-import kotlinx.serialization.json.JsonObject
-import kotlinx.serialization.json.buildJsonObject
-import kotlinx.serialization.json.contentOrNull
-import kotlinx.serialization.json.jsonPrimitive
-import kotlinx.serialization.json.put
-
-/** One skill or connector the agent keeps for itself (`agentGear`). */
-internal data class GearItem(val name: String, val description: String, val detail: String)
-
-internal enum class GearKind { Skills, Connectors, Rules, Plugins }
-
-internal data class AgentGear(
- val skills: List<GearItem>,
- val connectors: List<GearItem>,
- val rules: List<GearItem> = emptyList(),
- val plugins: List<GearItem> = emptyList(),
-)
-
-/** What `backend` already has in `cwd`. Codync's own skills and connectors are not in this list. */
-internal suspend fun AppStore.agentGear(backend: String, cwd: String): AgentGear {
- val body = hostCall("agentGear", buildJsonObject {
- put("backend", backend)
- put("cwd", cwd)
- })
- val obj = body as? JsonObject ?: return AgentGear(emptyList(), emptyList())
- return AgentGear(obj.gearItems("skills"), obj.gearItems("connectors"), obj.gearItems("rules"), obj.gearItems("plugins"))
-}
-
-private fun JsonObject.gearItems(key: String): List<GearItem> {
- val rows = this[key] as? JsonArray ?: return emptyList()
- return rows.mapNotNull { row ->
- val item = row as? JsonObject ?: return@mapNotNull null
- val name = item["name"]?.jsonPrimitive?.contentOrNull?.trim().orEmpty()
- if (name.isEmpty()) return@mapNotNull null
- GearItem(name, item["description"]?.jsonPrimitive?.contentOrNull.orEmpty(), item["detail"]?.jsonPrimitive?.contentOrNull.orEmpty())
- }
-}
-
-/**
- * The Skills or Connectors page: what the bot's agent already brings, then the Codync ones passed on top.
- * `skills` picks the skills page; otherwise the page is connectors.
- */
-@Composable internal fun BotGearPage(bot: Bot, state: AppState, store: AppStore, draft: BotDraft, change: (BotDraft) -> Unit, kind: GearKind) {
- val online = state.actualConnection is LinkState.Ready
- val cwd = draft.cwd.ifEmpty { bot.cwd }
- val agent = backendName(state, draft.backend)
- var gear by remember(bot.id) { mutableStateOf<AgentGear?>(null) }
- var failed by remember(bot.id) { mutableStateOf(false) }
- var viewingSkill by remember { mutableStateOf<SkillRef?>(null) }
- LaunchedEffect(draft.backend, cwd, online) {
- gear = null
- failed = false
- if (!online) {
- failed = true
- return@LaunchedEffect
- }
- try {
- gear = store.agentGear(draft.backend, cwd)
- } catch (e: Exception) {
- if (e is kotlinx.coroutines.CancellationException) throw e
- failed = true
- }
- }
- LaunchedEffect(online) { if (online) store.refreshPlugins() }
- val passesOn = kind == GearKind.Skills || kind == GearKind.Connectors
- val items = when (kind) {
- GearKind.Skills -> gear?.skills.orEmpty()
- GearKind.Connectors -> gear?.connectors.orEmpty()
- GearKind.Rules -> gear?.rules.orEmpty()
- GearKind.Plugins -> gear?.plugins.orEmpty()
- }
- val intro = if (passesOn) "{agent} brings these. Codync adds its own on top, and those are what get passed to the agent." else "{agent} brings these."
- Column(verticalArrangement = Arrangement.spacedBy(28.dp)) {
- Text(tr(intro).replace("{agent}", agent), style = Type.footnote, color = Palette.secondary)
- CardSection(tr("From {agent}").replace("{agent}", agent)) {
- when {
- gear == null && !failed -> row { Text(tr("Loading…"), style = Type.body, color = Palette.secondary) }
- failed -> row { Text(tr("Couldn't load what this agent brings."), style = Type.body, color = Palette.danger) }
- items.isEmpty() -> row { Text(tr("None from this agent."), style = Type.body, color = Palette.secondary) }
- else -> for (item in items) row {
- val note = if (kind == GearKind.Connectors) item.detail else item.description
- Column(verticalArrangement = Arrangement.spacedBy(2.dp)) {
- Text(item.name, style = Type.body, color = Palette.text)
- if (note.isNotEmpty()) Text(note, style = Type.caption, color = Palette.secondary)
- }
- }
- }
- }
- if (passesOn) {
- val plugins = state.plugins
- if (kind == GearKind.Skills) {
- PluginToggles("From Codync", "No skills yet. Get some from Extensions, or write your own.",
- plugins?.skills.orEmpty().map { Triple(it.id, it.name, it.description) }, draft.skills.orEmpty(),
- { change(draft.copy(skills = it)) }, enabled = online) { id ->
- plugins?.skills?.firstOrNull { it.id == id }?.let { viewingSkill = SkillRef(it.id, it.name, it.description) }
- }
- } else {
- PluginToggles("From Codync", "No connectors yet. Add GitHub, Linear, Notion and more from Extensions.",
- plugins?.connectors.orEmpty().map { Triple(it.id, it.name, it.command ?: it.url.orEmpty()) },
- draft.connectors ?: plugins?.connectors.orEmpty().map { it.id }, { change(draft.copy(connectors = it)) }, enabled = online)
- }
- }
- }
- CodyncSheet(viewingSkill, { viewingSkill = null }) { SkillSheet(it, state, store) }
-}
diff --git a/apps/android/app/src/main/kotlin/com/codync/android/BotSettingsForm.kt b/apps/android/app/src/main/kotlin/com/codync/android/BotSettingsForm.kt
index 4e6527b5..f8d04422 100644
--- a/apps/android/app/src/main/kotlin/com/codync/android/BotSettingsForm.kt
+++ b/apps/android/app/src/main/kotlin/com/codync/android/BotSettingsForm.kt
@@ -80,6 +80,7 @@ internal enum class FormPart { All, Often, Rarely }
// The agent and its model are on the Details page; what's left is where it works.
CardSection("Workspace") { computerRow(state, online); placeRows(draft, change) { folders = true } }
CardSection("Activity") { notifyRow(draft, change); manageTeamRow(state, draft, change); reachRows(state, draft, change) }
+ Plugins(state, draft, change) { viewingSkill = it }
}
}
}
diff --git a/apps/desktop/src/renderer/store/bot-store.ts b/apps/desktop/src/renderer/store/bot-store.ts
index 94ae799a..1cf19233 100644
--- a/apps/desktop/src/renderer/store/bot-store.ts
+++ b/apps/desktop/src/renderer/store/bot-store.ts
@@ -380,11 +380,11 @@ export class BotStore extends BotSync {
return (await this.ready()).botConversation(botId, peerId)
}
- /** Skills and connectors `backend` already has in `cwd`, not the Codync ones this bot passes on. */
- async agentGear(backend: string, cwd: string): Promise<{ skills: AgentGearItem[]; connectors: AgentGearItem[]; rules: AgentGearItem[]; plugins: AgentGearItem[] }> {
+ /** What `backend` already has in the user's home, not the Codync skills and connectors a bot passes on. */
+ async agentGear(backend: string): Promise<{ skills: AgentGearItem[]; connectors: AgentGearItem[]; rules: AgentGearItem[]; plugins: AgentGearItem[] }> {
const client = this.client
if (!client) throw new Error("Couldn't load what this agent brings.")
- const value = await client.call<{ skills?: AgentGearItem[]; connectors?: AgentGearItem[]; rules?: AgentGearItem[]; plugins?: AgentGearItem[] }>('agentGear', { backend, cwd })
+ const value = await client.call<{ skills?: AgentGearItem[]; connectors?: AgentGearItem[]; rules?: AgentGearItem[]; plugins?: AgentGearItem[] }>('agentGear', { backend })
return { skills: value.skills ?? [], connectors: value.connectors ?? [], rules: value.rules ?? [], plugins: value.plugins ?? [] }
}
diff --git a/apps/desktop/src/renderer/views/bots/BotEditorView.tsx b/apps/desktop/src/renderer/views/bots/BotEditorView.tsx
index 400601b4..439585d7 100644
--- a/apps/desktop/src/renderer/views/bots/BotEditorView.tsx
+++ b/apps/desktop/src/renderer/views/bots/BotEditorView.tsx
@@ -281,8 +281,7 @@ function BotSettingsForm({ draft, onChange, error, plugins, part = 'all' }: {
<NetworkSwitches draft={draft} set={set} />
</CardSection>
- {part === 'all' ? (
- <>
+ <>
<PluginToggles
title="Connectors"
empty="No connectors yet. Add GitHub, Linear, Notion and more from Extensions."
@@ -298,8 +297,7 @@ function BotSettingsForm({ draft, onChange, error, plugins, part = 'all' }: {
onChange={(ids) => set('skills', ids)}
onInfo={(s) => setViewingSkill({ id: s.id, name: s.name, description: s.detail })}
/>
- </>
- ) : null}
+ </>
{error ? <Text size="footnote" tone="danger" className="fade-in">{error}</Text> : null}
</div>
<FormSheet open={viewingSkill !== null} onClose={() => setViewingSkill(null)}>
diff --git a/apps/desktop/src/renderer/views/bots/GearPage.tsx b/apps/desktop/src/renderer/views/bots/GearPage.tsx
deleted file mode 100644
index bc666b33..00000000
--- a/apps/desktop/src/renderer/views/bots/GearPage.tsx
+++ /dev/null
@@ -1,128 +0,0 @@
-import { useCallback, useEffect, useState } from 'react'
-import { draftOf, type BotDraft } from '@shared/models'
-import { CardSection } from '../../components/Controls'
-import { VStack } from '../../components/Stack'
-import { Text } from '../../components/Text'
-import { useTr } from '../../lib/use-language'
-import type { AgentGearItem } from '../../store/bot-store'
-import { useStore } from '../../store/context'
-import { FormSheet } from '../marketplace/pieces'
-import { SkillSheet, type SkillRef } from '../marketplace/SkillSheet'
-import { PluginToggles } from './BotEditorView'
-import { errorText, isValid, normalized, useFollowSaved, usePlugins } from './drafts'
-import './bots.css'
-
-/** The agent's own skills or connectors, then the Codync ones this bot passes on. */
-export function GearPage({ botId, kind }: { botId: string; kind: 'skills' | 'connectors' | 'rules' | 'plugins' }) {
- const tr = useTr()
- const store = useStore()
- const plugins = usePlugins(store)
- const [draft, setDraft] = useState<BotDraft | null>(null)
- const [gear, setGear] = useState<{ skills: AgentGearItem[]; connectors: AgentGearItem[]; rules: AgentGearItem[]; plugins: AgentGearItem[] } | null>(null)
- const [failed, setFailed] = useState(false)
- const [error, setError] = useState<string | null>(null)
- const [viewingSkill, setViewingSkill] = useState<SkillRef | null>(null)
- const change = useCallback((update: (d: BotDraft) => BotDraft) => setDraft((d) => (d ? update(d) : d)), [])
-
- useEffect(() => {
- const bot = store.bots.get(botId)
- setDraft(bot ? draftOf(bot) : null)
- }, [botId])
- useFollowSaved(store.bots.get(botId), change)
-
- const saved = store.bots.get(botId)
- const cwd = draft?.cwd || saved?.cwd || ''
- const backend = draft?.backend ?? ''
- const agent = store.hello?.backends.find((b) => b.id === backend)?.name ?? backend
- const online = store.connection.kind === 'online'
-
- useEffect(() => {
- if (!backend || !online) {
- setFailed(!online)
- return
- }
- let live = true
- setFailed(false)
- setGear(null)
- void store
- .agentGear(backend, cwd)
- .then((value) => {
- if (live) setGear(value)
- })
- .catch(() => {
- if (live) setFailed(true)
- })
- return () => {
- live = false
- }
- }, [store, store.client, backend, cwd, online])
-
- const apply = (next: BotDraft) => {
- setDraft(next)
- if (!isValid(next) || !online) return
- void store
- .save(normalized(next))
- .then(() => setError(null))
- .catch((e: unknown) => setError(errorText(e)))
- }
-
- if (!draft) return null
- const passesOn = kind === 'skills' || kind === 'connectors'
- const items = gear?.[kind] ?? []
- const fromAgent = tr('From {agent}').replace('{agent}', agent)
- const intro = passesOn
- ? '{agent} brings these. Codync adds its own on top, and those are what get passed to the agent.'
- : '{agent} brings these.'
- return (
- <div className="bot-form">
- <div className="bot-form-content">
- <Text size="footnote" tone="secondary">
- {tr(intro).replace('{agent}', agent)}
- </Text>
- <CardSection title={fromAgent}>
- {failed ? (
- <Text tone="danger">{tr("Couldn't load what this agent brings.")}</Text>
- ) : !gear ? (
- <Text tone="secondary">{tr('Loading…')}</Text>
- ) : items.length === 0 ? (
- <Text tone="secondary">{tr('None from this agent.')}</Text>
- ) : (
- items.map((item) => {
- const note = kind === 'connectors' ? item.detail : item.description
- return (
- <VStack key={item.name} gap={2}>
- <Text>{item.name}</Text>
- {note ? <Text size="caption" tone="secondary">{note}</Text> : null}
- </VStack>
- )
- })
- )}
- </CardSection>
- {kind === 'rules' || kind === 'plugins' ? null : kind === 'skills' ? (
- <PluginToggles
- title="From Codync"
- empty="No skills yet. Get some from Extensions, or write your own."
- items={(plugins?.skills ?? []).map((s) => ({ id: s.id, name: s.name, detail: s.description }))}
- selection={draft.skills ?? []}
- disabled={!online}
- onChange={(ids) => apply({ ...draft, skills: ids })}
- onInfo={(s) => setViewingSkill({ id: s.id, name: s.name, description: s.detail })}
- />
- ) : (
- <PluginToggles
- title="From Codync"
- empty="No connectors yet. Add GitHub, Linear, Notion and more from Extensions."
- items={(plugins?.connectors ?? []).map((c) => ({ id: c.id, name: c.name, detail: c.command ?? c.url ?? '' }))}
- selection={draft.connectors ?? []}
- disabled={!online}
- onChange={(ids) => apply({ ...draft, connectors: ids })}
- />
- )}
- {error ? <Text size="footnote" tone="danger">{error}</Text> : null}
- </div>
- <FormSheet open={viewingSkill !== null} onClose={() => setViewingSkill(null)}>
- {viewingSkill ? <SkillSheet key={viewingSkill.name} skill={viewingSkill} /> : null}
- </FormSheet>
- </div>
- )
-}
diff --git a/apps/desktop/src/renderer/views/marketplace/AgentBrings.tsx b/apps/desktop/src/renderer/views/marketplace/AgentBrings.tsx
new file mode 100644
index 00000000..e07108b6
--- /dev/null
+++ b/apps/desktop/src/renderer/views/marketplace/AgentBrings.tsx
@@ -0,0 +1,76 @@
+import { useEffect, useState } from 'react'
+import { CardSection, Disclosure } from '../../components/Controls'
+import { Icon } from '../../components/Icon'
+import { HStack } from '../../components/Stack'
+import { Text } from '../../components/Text'
+import { useTr } from '../../lib/use-language'
+import { useStore } from '../../store/context'
+import { type AgentGearItem } from '../../store/bot-store'
+import './marketplace.css'
+
+const ICONS = { Skills: 'book.pages', Connectors: 'point.3.connected.trianglepath.dotted', Rules: 'list.bullet.rectangle', Plugins: 'square.grid.2x2' } as const
+
+type Gear = { skills: AgentGearItem[]; connectors: AgentGearItem[]; rules: AgentGearItem[]; plugins: AgentGearItem[] }
+
+/** Skills, connectors, rules and plugins the agent already has, under Sign in on its sheet. */
+export function AgentBrings({ backendId }: { backendId: string }) {
+ const store = useStore()
+ const tr = useTr()
+ const [gear, setGear] = useState<Gear | null>(null)
+ const [failed, setFailed] = useState(false)
+ const [open, setOpen] = useState<string | null>(null)
+
+ useEffect(() => {
+ let cancel = false
+ setGear(null)
+ setFailed(false)
+ store.agentGear(backendId).then((loaded) => {
+ if (!cancel) setGear(loaded)
+ }).catch(() => {
+ if (!cancel) setFailed(true)
+ })
+ return () => { cancel = true }
+ }, [store, backendId])
+
+ if (failed) {
+ return <CardSection><Text size="footnote" tone="danger">{tr("Couldn't load what this agent brings.")}</Text></CardSection>
+ }
+ if (!gear) return null
+ const rows = [
+ ['Skills', gear.skills],
+ ['Connectors', gear.connectors],
+ ['Rules', gear.rules],
+ ['Plugins', gear.plugins],
+ ] as const
+ if (rows.every(([, items]) => items.length === 0)) return null
+ return (
+ <CardSection title="What the agent brings">
+ {rows.filter(([, items]) => items.length > 0).map(([title, items]) => (
+ <Disclosure
+ key={title}
+ expanded={open === title}
+ onToggle={() => setOpen(open === title ? null : title)}
+ label={(
+ <HStack as="span" className="agent-brings-row" gap={10}>
+ <span className="agent-brings-icon"><Icon name={ICONS[title]} size={13} /></span>
+ <Text>{tr(title)}</Text>
+ <span className="agent-brings-count">{items.length}</span>
+ </HStack>
+ )}
+ >
+ <div className="agent-brings-items">
+ {items.map((item) => {
+ const note = item.description || item.detail
+ return (
+ <div className="agent-brings-item" key={item.name}>
+ <Text size="subheadline" weight="semibold" truncate>{item.name}</Text>
+ {note ? <Text size="caption" tone="secondary" lines={2}>{note}</Text> : null}
+ </div>
+ )
+ })}
+ </div>
+ </Disclosure>
+ ))}
+ </CardSection>
+ )
+}
diff --git a/apps/desktop/src/renderer/views/marketplace/AgentSheet.tsx b/apps/desktop/src/renderer/views/marketplace/AgentSheet.tsx
index 03ed9707..bf6f6923 100644
--- a/apps/desktop/src/renderer/views/marketplace/AgentSheet.tsx
+++ b/apps/desktop/src/renderer/views/marketplace/AgentSheet.tsx
@@ -11,6 +11,7 @@ import { useStore } from '../../store/context'
import { useTr } from '../../lib/use-language'
import { errorText, market, type AgentAuth, type AuthMethod } from './market-models'
import { ErrorText, Field, ScreenHeader, SlideStack, WebLink, filled } from './pieces'
+import { AgentBrings } from './AgentBrings'
import { SetupTerminalView } from './SetupTerminal'
type SetupRoute = { kind: 'install' } | { kind: 'node' } | { kind: 'terminal'; method: AuthMethod | null } | { kind: 'keys'; method: AuthMethod }
@@ -247,6 +248,7 @@ export function AgentSheet({ initial, recheck = false }: { initial: Backend; rec
{signedIn !== true && auth?.detail ? <Text size="footnote" tone="secondary" className="selectable agent-auth-detail">{auth.detail}</Text> : null}
{options}
</CardSection>
+ <AgentBrings backendId={backend.id} />
{error ? <CardSection><ErrorText text={error} /></CardSection> : null}
</CardForm>
</SheetPage>
diff --git a/apps/desktop/src/renderer/views/marketplace/marketplace.css b/apps/desktop/src/renderer/views/marketplace/marketplace.css
index e4893192..a41ccb83 100644
--- a/apps/desktop/src/renderer/views/marketplace/marketplace.css
+++ b/apps/desktop/src/renderer/views/marketplace/marketplace.css
@@ -338,6 +338,54 @@
display: flex;
color: var(--secondary);
}
+/* What an agent brings: a glyph, the list name, and its count at the chevron. */
+.agent-brings-row {
+ flex: 1;
+ min-width: 0;
+}
+.disclosure-label:has(.agent-brings-row) > .spacer {
+ flex: none;
+ width: 8px;
+}
+.agent-brings-icon {
+ display: grid;
+ place-items: center;
+ flex: none;
+ width: 26px;
+ height: 26px;
+ border-radius: 50%;
+ background: var(--bubble-agent);
+ color: var(--text);
+}
+.agent-brings-count {
+ flex: none;
+ margin-left: auto;
+ min-width: 22px;
+ padding: 1px 7px;
+ border-radius: 999px;
+ background: var(--bubble-agent);
+ color: var(--secondary);
+ font-size: var(--text-caption);
+ font-weight: 600;
+ font-variant-numeric: tabular-nums;
+ text-align: center;
+ line-height: 18px;
+}
+.agent-brings-items {
+ display: flex;
+ flex-direction: column;
+ margin-top: 6px;
+ padding-left: 36px;
+}
+.agent-brings-item {
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
+ padding: 8px 0;
+}
+.agent-brings-item + .agent-brings-item {
+ box-shadow: inset 0 0.5px 0 var(--border);
+}
.agent-auth-detail {
white-space: pre-wrap;
}
diff --git a/apps/desktop/src/renderer/views/thread/DetailsPanel.tsx b/apps/desktop/src/renderer/views/thread/DetailsPanel.tsx
index ece12988..b8fd9643 100644
--- a/apps/desktop/src/renderer/views/thread/DetailsPanel.tsx
+++ b/apps/desktop/src/renderer/views/thread/DetailsPanel.tsx
@@ -10,7 +10,6 @@ import { Text } from '../../components/Text'
import { useStore } from '../../store/context'
import { useScreenViewed } from '../../store/analytics'
import { BotSettingsPanel } from '../bots/BotEditorView'
-import { GearPage } from '../bots/GearPage'
import { MemoryCard } from '../bots/MemoryView'
import { RoutinesView } from '../routines/RoutinesView'
import { LibraryView } from '../library/LibraryView'
@@ -20,7 +19,7 @@ import './details-panel.css'
import { useTr } from '../../lib/use-language'
-export type DetailsTab = 'details' | 'library' | 'memory' | 'settings' | 'skills' | 'connectors' | 'rules' | 'plugins'
+export type DetailsTab = 'details' | 'library' | 'memory' | 'settings'
const BOT_TABS: { id: DetailsTab; label: string }[] = [
{ id: 'details', label: 'Details' },
@@ -28,14 +27,8 @@ const BOT_TABS: { id: DetailsTab; label: string }[] = [
{ id: 'memory', label: 'Memory' },
{ id: 'settings', label: 'Settings' },
]
-const GEAR_TABS: { id: DetailsTab; label: string }[] = [
- { id: 'skills', label: 'Skills' },
- { id: 'connectors', label: 'Connectors' },
- { id: 'rules', label: 'Rules' },
- { id: 'plugins', label: 'Plugins' },
-]
-/** The inspector beside a conversation (Grok Bot's): who the bot is, then its details, library, memory, settings, skills and connectors. */
+/** The inspector beside a conversation (Grok Bot's): who the bot is, then its details, library, memory and settings. */
export function DetailsPanel({ botId, routineId, tab, setTab, editGroup, openArtifact, share, close }: {
botId: string
routineId: string | null
@@ -63,10 +56,7 @@ export function DetailsPanel({ botId, routineId, tab, setTab, editGroup, openArt
<GroupMembersList group={bot} editGroup={editGroup} />
) : (
<>
- <div className="details-tabs">
- <TabChoice label="Conversation details" selection={tab} options={hasLibrary(store.hostVersion?.version) ? BOT_TABS : BOT_TABS.filter((t) => t.id !== 'library')} onChange={setTab} />
- <TabChoice label="What the agent brings" selection={tab} options={GEAR_TABS} onChange={setTab} />
- </div>
+ <TabChoice label="Conversation details" selection={tab} options={hasLibrary(store.hostVersion?.version) ? BOT_TABS : BOT_TABS.filter((t) => t.id !== 'library')} onChange={setTab} />
<div key={tab} className="details-tab fade-in">
{tab === 'details' ? (
<>
@@ -78,8 +68,6 @@ export function DetailsPanel({ botId, routineId, tab, setTab, editGroup, openArt
<LibraryView botId={botId} openArtifact={openArtifact} />
) : tab === 'memory' ? (
<MemoryCard botId={botId} />
- ) : tab === 'skills' || tab === 'connectors' || tab === 'rules' || tab === 'plugins' ? (
- <GearPage botId={botId} kind={tab} />
) : (
<BotSettingsPanel botId={botId} part="rarely" />
)}
diff --git a/apps/desktop/src/renderer/views/thread/details-panel.css b/apps/desktop/src/renderer/views/thread/details-panel.css
index 906730eb..7e34d11f 100644
--- a/apps/desktop/src/renderer/views/thread/details-panel.css
+++ b/apps/desktop/src/renderer/views/thread/details-panel.css
@@ -18,14 +18,6 @@
background: linear-gradient(var(--background) 70%, transparent);
-webkit-app-region: drag;
}
-/* The bot's pages, then what its agent brings. One row of eight labels does not fit this panel. */
-.details-tabs {
- display: flex;
- flex-direction: column;
- align-items: center;
- gap: 2px;
-}
-
.details-actions {
position: absolute;
top: 11px;
diff --git a/apps/ios/Kit/Sources/CodyncKit/Models/Market.swift b/apps/ios/Kit/Sources/CodyncKit/Models/Market.swift
index e5da83be..6ec64ece 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Models/Market.swift
+++ b/apps/ios/Kit/Sources/CodyncKit/Models/Market.swift
@@ -244,9 +244,9 @@ public extension HostClient {
try await call("composioConnection", ["id": id], timeout: 30)
}
- /// What `backend` already has in `cwd`: its own skills and MCP connectors, not Codync's.
- func agentGear(backend: String, cwd: String) async throws -> AgentGear {
- try await call("agentGear", ["backend": backend, "cwd": cwd])
+ /// What `backend` already has in the user's home: skills, connectors, rules and plugins, not Codync's.
+ func agentGear(backend: String) async throws -> AgentGear {
+ try await call("agentGear", ["backend": backend])
}
func skills() async throws -> [InstalledSkill] {
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/de.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/de.json
index 6e320557..0e820762 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/de.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/de.json
@@ -443,7 +443,7 @@
"Rules": "Regeln",
"Plugins": "Plugins",
"Skills, connectors, rules and plugins belong to a bot, not a group": "Skills, Connectors, Regeln und Plugins gehören zu einem Bot, nicht zu einer Gruppe",
- "between details, library, memory, settings, skills, connectors, rules and plugins": "zwischen Details, Bibliothek, Gedächtnis, Einstellungen, Skills, Connectors, Regeln und Plugins",
+ "between details, library, memory and settings": "zwischen Details, Bibliothek, Gedächtnis und Einstellungen",
"space on / off · ⇧←→ page · esc": "Leertaste an / aus · ⇧←→ Seite · esc",
"⇧←→ page · esc": "⇧←→ Seite · esc",
"No skills yet. Get some from Extensions, or write your own.": "Noch keine Skills. Hole welche aus den Erweiterungen oder schreibe eigene.",
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/es.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/es.json
index 3e7907ed..566f5cc0 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/es.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/es.json
@@ -443,7 +443,7 @@
"Rules": "Reglas",
"Plugins": "Plugins",
"Skills, connectors, rules and plugins belong to a bot, not a group": "Las habilidades, conectores, reglas y plugins pertenecen a un bot, no a un grupo",
- "between details, library, memory, settings, skills, connectors, rules and plugins": "entre detalles, biblioteca, memoria, ajustes, habilidades, conectores, reglas y plugins",
+ "between details, library, memory and settings": "entre detalles, biblioteca, memoria y ajustes",
"space on / off · ⇧←→ page · esc": "espacio on / off · ⇧←→ página · esc",
"⇧←→ page · esc": "⇧←→ página · esc",
"No skills yet. Get some from Extensions, or write your own.": "Aún no hay habilidades. Consíguelas en Extensiones o escribe las tuyas.",
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/fr.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/fr.json
index 0989d018..c1ff1f52 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/fr.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/fr.json
@@ -443,7 +443,7 @@
"Rules": "Règles",
"Plugins": "Plugins",
"Skills, connectors, rules and plugins belong to a bot, not a group": "Les compétences, connecteurs, règles et plugins appartiennent à un bot, pas à un groupe",
- "between details, library, memory, settings, skills, connectors, rules and plugins": "entre détails, bibliothèque, mémoire, réglages, compétences, connecteurs, règles et plugins",
+ "between details, library, memory and settings": "entre détails, bibliothèque, mémoire et réglages",
"space on / off · ⇧←→ page · esc": "espace on / off · ⇧←→ page · esc",
"⇧←→ page · esc": "⇧←→ page · esc",
"No skills yet. Get some from Extensions, or write your own.": "Aucune compétence pour le moment. Ajoutez-en depuis Extensions ou écrivez les vôtres.",
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ja.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ja.json
index 40c9d380..01150b4a 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ja.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ja.json
@@ -443,7 +443,7 @@
"Rules": "ルール",
"Plugins": "プラグイン",
"Skills, connectors, rules and plugins belong to a bot, not a group": "スキル、コネクタ、ルール、プラグインはグループではなくボットに属します",
- "between details, library, memory, settings, skills, connectors, rules and plugins": "詳細、ライブラリ、メモリ、設定、スキル、コネクタ、ルール、プラグインの間",
+ "between details, library, memory and settings": "詳細、ライブラリ、メモリ、設定の間",
"space on / off · ⇧←→ page · esc": "space オン/オフ · ⇧←→ ページ · esc",
"⇧←→ page · esc": "⇧←→ ページ · esc",
"No skills yet. Get some from Extensions, or write your own.": "まだスキルはありません。拡張機能からいくつかを取得するか、独自に作成します。",
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ko.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ko.json
index 39c6d68f..0f5f41e6 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ko.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ko.json
@@ -443,7 +443,7 @@
"Rules": "규칙",
"Plugins": "플러그인",
"Skills, connectors, rules and plugins belong to a bot, not a group": "기술, 커넥터, 규칙, 플러그인은 그룹이 아닌 봇에 속합니다",
- "between details, library, memory, settings, skills, connectors, rules and plugins": "상세, 라이브러리, 메모리, 설정, 기술, 커넥터, 규칙, 플러그인 사이",
+ "between details, library, memory and settings": "상세, 라이브러리, 메모리, 설정 사이",
"space on / off · ⇧←→ page · esc": "space 켜기/끄기 · ⇧←→ 페이지 · esc",
"⇧←→ page · esc": "⇧←→ 페이지 · esc",
"No skills yet. Get some from Extensions, or write your own.": "아직 스킬이 없습니다. Extensions에서 일부를 가져오거나 직접 작성해 보세요.",
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hans.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hans.json
index 53805d38..ed495576 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hans.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hans.json
@@ -443,7 +443,7 @@
"Rules": "规则",
"Plugins": "插件",
"Skills, connectors, rules and plugins belong to a bot, not a group": "技能、连接器、规则和插件属于 Bot,不属于群聊",
- "between details, library, memory, settings, skills, connectors, rules and plugins": "在详情、资料库、记忆、设置、技能、连接器、规则和插件之间切换",
+ "between details, library, memory and settings": "在详情、资料库、记忆和设置之间切换",
"space on / off · ⇧←→ page · esc": "空格 开/关 · ⇧←→ 翻页 · esc",
"⇧←→ page · esc": "⇧←→ 翻页 · esc",
"No skills yet. Get some from Extensions, or write your own.": "还没有技能。到「扩展」里找,或自己写。",
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hant.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hant.json
index 7705b2e5..8581da73 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hant.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hant.json
@@ -443,7 +443,7 @@
"Rules": "規則",
"Plugins": "外掛",
"Skills, connectors, rules and plugins belong to a bot, not a group": "技能、連接器、規則和插件屬於 Bot,不屬於群聊",
- "between details, library, memory, settings, skills, connectors, rules and plugins": "在詳情、資料庫、記憶、設定、技能、連接器、規則和插件之間切換",
+ "between details, library, memory and settings": "在詳情、資料庫、記憶和設定之間切換",
"space on / off · ⇧←→ page · esc": "空白鍵 開/關 · ⇧←→ 翻頁 · esc",
"⇧←→ page · esc": "⇧←→ 翻頁 · esc",
"No skills yet. Get some from Extensions, or write your own.": "還沒有技能。到「擴充套件」裡找,或自己寫。",
diff --git a/apps/ios/Kit/Sources/CodyncUI/Bots/BotDetailsView.swift b/apps/ios/Kit/Sources/CodyncUI/Bots/BotDetailsView.swift
index 240efb55..775e7f6c 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Bots/BotDetailsView.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Bots/BotDetailsView.swift
@@ -3,7 +3,7 @@ import SwiftUI
/// The details sheet's pages, as on the desktop inspector.
enum DetailsTab: Hashable {
- case details, library, memory, settings, skills, connectors, rules, plugins
+ case details, library, memory, settings
}
/// What to open the details sheet on.
@@ -16,8 +16,8 @@ struct DetailsRequest: Identifiable {
var botId: String?
}
-/// A bot's details (Grok Bot's): who it is, then its details, library, memory, settings, skills,
-/// connectors, rules and plugins. Settings save as you edit.
+/// A bot's details (Grok Bot's): who it is, then its details, library, memory and settings.
+/// Settings save as you edit. What the agent brings is on the agent's own sheet.
struct BotDetailsView: View {
let botId: String
let routineId: String?
@@ -44,11 +44,8 @@ struct BotDetailsView: View {
ScrollView {
VStack(spacing: 0) {
if let bot { identity(bot) }
- VStack(spacing: 2) {
- TabChoice(selection: $tab, options: [(.details, "Details")] + (model.hasLibrary ? [(.library, "Library")] : [])
- + [(.memory, "Memory"), (.settings, "Settings")])
- TabChoice(selection: $tab, options: [(.skills, "Skills"), (.connectors, "Connectors"), (.rules, "Rules"), (.plugins, "Plugins")])
- }
+ TabChoice(selection: $tab, options: [(.details, "Details")] + (model.hasLibrary ? [(.library, "Library")] : [])
+ + [(.memory, "Memory"), (.settings, "Settings")])
.padding(.top, 18)
page.padding(.top, 20)
.environment(\.cardStyle, .outlined)
@@ -147,14 +144,6 @@ struct BotDetailsView: View {
if let draft = Binding($draft) {
BotSettingsForm(draft: draft, error: saveError, scrolls: false, part: .rarely)
}
- case .skills:
- if let draft = Binding($draft) { BotGearPage(draft: draft, kind: .skills, saveError: saveError) }
- case .connectors:
- if let draft = Binding($draft) { BotGearPage(draft: draft, kind: .connectors, saveError: saveError) }
- case .rules:
- if let draft = Binding($draft) { BotGearPage(draft: draft, kind: .rules, saveError: saveError) }
- case .plugins:
- if let draft = Binding($draft) { BotGearPage(draft: draft, kind: .plugins, saveError: saveError) }
}
}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Bots/BotEditorView.swift b/apps/ios/Kit/Sources/CodyncUI/Bots/BotEditorView.swift
index ceb5b835..78686054 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Bots/BotEditorView.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Bots/BotEditorView.swift
@@ -246,8 +246,8 @@ struct BotSettingsForm: View {
}
}
- // The details sheet shows these on their own tabs. The full editor keeps the switches here.
- if part == .all {
+ // Settings and the full editor. The details page (often) stops before this.
+ if part != .often {
PluginToggles(
title: "Connectors",
empty: "No connectors yet. Add GitHub, Linear, Notion and more from Extensions.",
diff --git a/apps/ios/Kit/Sources/CodyncUI/Bots/BotGearPage.swift b/apps/ios/Kit/Sources/CodyncUI/Bots/BotGearPage.swift
deleted file mode 100644
index b6d4e89f..00000000
--- a/apps/ios/Kit/Sources/CodyncUI/Bots/BotGearPage.swift
+++ /dev/null
@@ -1,110 +0,0 @@
-import CodyncKit
-import SwiftUI
-
-/// What the bot's agent already brings, and the Codync skills or connectors passed on top of that.
-struct BotGearPage: View {
- @Binding var draft: BotDraft
- var kind: Kind
- var saveError: String?
- @Environment(BotStore.self) private var model
- @State private var viewingSkill: SkillRef?
-
- enum Kind { case skills, connectors, rules, plugins
-
- var passesOn: Bool {
- switch self {
- case .skills, .connectors: true
- case .rules, .plugins: false
- }
- }
- }
-
- private var bot: Bot? { draft.id.flatMap { model.bots[$0] } }
-
- /// A personal workspace keeps its folder on the saved bot; a draft only has a folder once one is chosen.
- private var cwd: String { draft.cwd.isEmpty ? (bot?.cwd ?? "") : draft.cwd }
-
- private var agent: String { model.backendName(draft.backend) }
-
- private var agentItems: [AgentGearItem] {
- switch kind {
- case .skills: model.agentGear?.skills ?? []
- case .connectors: model.agentGear?.connectors ?? []
- case .rules: model.agentGear?.rules ?? []
- case .plugins: model.agentGear?.plugins ?? []
- }
- }
-
- private var intro: String {
- let key = kind.passesOn
- ? "{agent} brings these. Codync adds its own on top, and those are what get passed to the agent."
- : "{agent} brings these."
- return L10n.tr(key).replacingOccurrences(of: "{agent}", with: agent)
- }
-
- var body: some View {
- VStack(alignment: .leading, spacing: 28) {
- Text(intro)
- .font(.footnote)
- .foregroundStyle(Palette.secondary)
- agentSection
- if kind.passesOn {
- codyncSection.disabled(model.isOffline)
- }
- if let saveError {
- Text(saveError).font(.footnote).foregroundStyle(Palette.danger)
- }
- }
- .task(id: "\(draft.backend)|\(cwd)|\(model.connection == .online)") { await load() }
- .codyncSheet(item: $viewingSkill) { SkillSheet(skill: $0) }
- }
-
- private var agentSection: some View {
- CardSection(L10n.tr("From {agent}").replacingOccurrences(of: "{agent}", with: agent)) {
- if model.agentGear == nil, !model.agentGearFailed {
- Text(L10n.tr("Loading…")).foregroundStyle(Palette.secondary)
- } else if model.agentGearFailed {
- Text(L10n.tr("Couldn't load what this agent brings.")).foregroundStyle(Palette.danger)
- } else if agentItems.isEmpty {
- Text(L10n.tr("None from this agent.")).foregroundStyle(Palette.secondary)
- } else {
- ForEach(agentItems) { item in
- VStack(alignment: .leading, spacing: 2) {
- Text(item.name).foregroundStyle(Palette.text)
- let note = kind == .connectors ? item.detail : item.description
- if !note.isEmpty {
- Text(note).font(.caption).foregroundStyle(Palette.secondary)
- }
- }
- }
- }
- }
- }
-
- @ViewBuilder private var codyncSection: some View {
- switch kind {
- case .skills:
- PluginToggles(
- title: "From Codync",
- empty: "No skills yet. Get some from Extensions, or write your own.",
- items: model.installedSkills.map { ($0.id, $0.name, $0.description) },
- selection: Binding(get: { draft.skills ?? [] }, set: { draft.skills = $0 }),
- info: { id in viewingSkill = model.installedSkills.first { $0.id == id }.map(SkillRef.init) }
- )
- case .connectors:
- PluginToggles(
- title: "From Codync",
- empty: "No connectors yet. Add GitHub, Linear, Notion and more from Extensions.",
- items: model.installedConnectors.map { ($0.id, $0.name, $0.command ?? $0.url ?? "") },
- selection: Binding(get: { draft.connectors ?? [] }, set: { draft.connectors = $0 })
- )
- case .rules, .plugins:
- EmptyView()
- }
- }
-
- private func load() async {
- await model.refreshPlugins()
- await model.loadAgentGear(backend: draft.backend, cwd: cwd)
- }
-}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Marketplace/AgentBrings.swift b/apps/ios/Kit/Sources/CodyncUI/Marketplace/AgentBrings.swift
new file mode 100644
index 00000000..824249a8
--- /dev/null
+++ b/apps/ios/Kit/Sources/CodyncUI/Marketplace/AgentBrings.swift
@@ -0,0 +1,104 @@
+import CodyncKit
+import SwiftUI
+
+/// Skills, connectors, rules and plugins the agent already has, under Sign in on its sheet.
+struct AgentBrings: View {
+ let backendId: String
+ @Environment(BotStore.self) private var model
+ @State private var gear: AgentGear?
+ @State private var failed = false
+ @State private var skills = false
+ @State private var connectors = false
+ @State private var rules = false
+ @State private var plugins = false
+
+ var body: some View {
+ Group {
+ if failed {
+ CardSection {
+ Text(L10n.tr("Couldn't load what this agent brings."))
+ .font(.footnote)
+ .foregroundStyle(Palette.danger)
+ }
+ } else if let gear, gear.shows {
+ CardSection("What the agent brings") {
+ VStack(alignment: .leading, spacing: 14) {
+ row("Skills", gear.skills, $skills)
+ row("Connectors", gear.connectors, $connectors)
+ row("Rules", gear.rules, $rules)
+ row("Plugins", gear.plugins, $plugins)
+ }
+ }
+ }
+ }
+ .task(id: backendId) { await load() }
+ }
+
+ @ViewBuilder private func row(_ title: String, _ items: [AgentGearItem], _ open: Binding<Bool>) -> some View {
+ if !items.isEmpty {
+ Disclosure(isExpanded: open) {
+ VStack(alignment: .leading, spacing: 0) {
+ ForEach(Array(items.enumerated()), id: \.element.id) { index, item in
+ VStack(alignment: .leading, spacing: 2) {
+ Text(item.name).font(.subheadline.weight(.semibold)).lineLimit(1)
+ let note = item.description.isEmpty ? item.detail : item.description
+ if !note.isEmpty {
+ Text(note).font(.caption).foregroundStyle(Palette.secondary).lineLimit(2)
+ }
+ }
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .padding(.vertical, 8)
+ .padding(.leading, 36)
+ .overlay(alignment: .top) {
+ if index > 0 {
+ Rectangle().fill(Palette.border).frame(height: 0.5).padding(.leading, 36)
+ }
+ }
+ }
+ }
+ } label: {
+ HStack(spacing: 10) {
+ Image(systemName: icon(title))
+ .font(.system(size: 13, weight: .semibold))
+ .foregroundStyle(Palette.text)
+ .frame(width: 26, height: 26)
+ .background(Palette.bubbleAgent, in: Circle())
+ Text(L10n.tr(title))
+ Spacer(minLength: 8)
+ Text("\(items.count)")
+ .font(.caption.weight(.semibold))
+ .monospacedDigit()
+ .foregroundStyle(Palette.secondary)
+ .padding(.horizontal, 7)
+ .padding(.vertical, 2)
+ .background(Palette.bubbleAgent, in: Capsule())
+ }
+ .layoutPriority(1)
+ }
+ }
+ }
+
+ private func icon(_ title: String) -> String {
+ switch title {
+ case "Skills": "book.pages"
+ case "Connectors": "point.3.connected.trianglepath.dotted"
+ case "Rules": "list.bullet.rectangle"
+ default: "square.grid.2x2"
+ }
+ }
+
+ private func load() async {
+ failed = false
+ gear = nil
+ do {
+ gear = try await model.agentBrings(backendId)
+ } catch is CancellationError {
+ } catch {
+ failed = true
+ }
+ }
+}
+
+extension AgentGear {
+ fileprivate var shows: Bool { !skills.isEmpty || !connectors.isEmpty || !rules.isEmpty || !plugins.isEmpty }
+}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Marketplace/AgentSheet.swift b/apps/ios/Kit/Sources/CodyncUI/Marketplace/AgentSheet.swift
index 53375051..22393638 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Marketplace/AgentSheet.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Marketplace/AgentSheet.swift
@@ -142,6 +142,7 @@ struct AgentSheet: View {
}
}
signInSection
+ AgentBrings(backendId: backend.id)
if let error {
CardSection { Text(L10n.tr(error)).foregroundStyle(Palette.danger).textSelection(.enabled) }
}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Store/BotStore+Plugins.swift b/apps/ios/Kit/Sources/CodyncUI/Store/BotStore+Plugins.swift
index 0e28c121..e4dd20ee 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Store/BotStore+Plugins.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Store/BotStore+Plugins.swift
@@ -80,26 +80,9 @@ extension BotStore {
try await ready().skillDetails(skill.request)
}
- /// Reads the skills and connectors `backend` already has in `cwd`. A newer request wins.
- public func loadAgentGear(backend: String, cwd: String) async {
- let key = "\(backend)\n\(cwd)"
- agentGearRequest = key
- agentGear = nil
- agentGearFailed = false
- guard let client else {
- agentGearFailed = true
- return
- }
- do {
- let loaded = try await client.agentGear(backend: backend, cwd: cwd)
- guard !Task.isCancelled, agentGearRequest == key else { return }
- agentGear = loaded
- } catch is CancellationError {
- return
- } catch {
- guard !Task.isCancelled, agentGearRequest == key else { return }
- agentGearFailed = true
- }
+ /// What `backend` already has in the user's home.
+ public func agentBrings(_ backend: String) async throws -> AgentGear {
+ try await ready().agentGear(backend: backend)
}
/// Re-detects agents on the computer (after an install or sign-in).
diff --git a/apps/ios/Kit/Sources/CodyncUI/Store/BotStore.swift b/apps/ios/Kit/Sources/CodyncUI/Store/BotStore.swift
index 84e186de..235c7af6 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Store/BotStore.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Store/BotStore.swift
@@ -70,10 +70,6 @@ public final class BotStore {
/// Installed on the computer, for the Plugins screen and bot settings.
public internal(set) var installedConnectors: [InstalledConnector] = []
public internal(set) var installedSkills: [InstalledSkill] = []
- /// What the open bot's agent already has on disk. `nil` while that read is in flight.
- public internal(set) var agentGear: AgentGear?
- public internal(set) var agentGearFailed = false
- var agentGearRequest: String?
/// Bots whose older history has been fully paged in.
public internal(set) var historyComplete: Set<String> = []
var composerDrafts: [String: String] = [:]
diff --git a/apps/ios/WhatsNew.md b/apps/ios/WhatsNew.md
index ffc1643f..f25a1d59 100644
--- a/apps/ios/WhatsNew.md
+++ b/apps/ios/WhatsNew.md
@@ -16,6 +16,7 @@ a version without one gets a generic "Bug fixes and improvements" line. Delete o
- 電腦卡片最下方的「Codync」會顯示那台電腦的版本;有新版時可以直接點「更新」,從手機叫那台電腦更新。
- 電腦卡片多了網路按鈕(Beta):一台電腦可以加入多個網路,這裡列出每個網路裡有哪些電腦、是否在線、各自提供哪些 Bot、誰可以傳訊息給這裡的 Bot,以及雲端助理是否開啟。網路的建立與邀請要在電腦上的 Codync 進行。
- Bot 設定多了「提供給網路」與「雲端助理可聯繫」兩個開關,決定其他電腦上的 Bot 與 ChatGPT、Claude 能不能找到它。
+- 在「擴充套件」裡打開一個 Agent,登入下方會列出它自己的技能、連接器、規則和外掛。
### en-US
- New agent: DeepSeek Harness (dsh). With dsh installed and a DeepSeek API key saved on your computer, a bot can run on DeepSeek's models.
@@ -25,3 +26,4 @@ a version without one gets a generic "Bug fixes and improvements" line. Delete o
- Codync at the bottom of a computer's card shows the version it runs; when a newer one is out, tap Update to have that computer update from your phone.
- A network button (beta) on each computer's card: a computer can be in several networks, and it shows each one's computers, whether each answers, the bots it offers, who may message the bots here, and whether cloud assistants are on. You set up and invite computers in Codync on a computer.
- Bot settings have Offered to the network and Reachable by cloud assistants, so you choose whether bots on your other computers, ChatGPT or Claude can find a bot.
+- Open an agent in Extensions. Under Sign in, see the skills, connectors, rules and plugins it already has.
diff --git a/docs/plans/android-app.md b/docs/plans/android-app.md
index 46d45d7f..46f52072 100644
--- a/docs/plans/android-app.md
+++ b/docs/plans/android-app.md
@@ -19,10 +19,10 @@ emulator against a real host; device acceptance is listed separately.
| Roster | Ported: rows, menus, pin/hide/delete, New session (bots only), groups, drag to reorder (host-synced order) and TalkBack Move up/down, computer header, pull to refresh (also in Computer management) | Multiple computers |
| Conversation | Ported: bubbles, Markdown/code, permissions, reactions, quote replies, Full conversation, bot-to-bot exchange lines and their conversation, routine notices that open their routine, files a bot shares (verified download, then the share sheet), sent images full size, pull down to reconnect, jump to latest, read receipts for every conversation on screen | Physical keyboard and TalkBack |
| Composer | Ported: files/photos/paste (groups too, image thumbnails, Paste only when the clipboard holds files), `/` commands (Fast mode, skills listed fresh on `/`), @mentions in groups, call/send/stop/interrupt button | Dictation ([voice call](../features/voice-call.md)): the mic, its recording pill, the engine menu beside it (On device, or OpenAI / Gemini transcribed on the user's key with *Transcribing…*) and the *Couldn't dictate* dialog |
-| Bot and group editors | Ported: avatar, profile, agent and model options, Fast mode, workspace folder picker, permissions, activity, connectors, skills (with their details); the bot details sheet (`BotDetailsView`, from the chat's title, a routine notice or Add a fallback): Details (instructions, agent, Use the computer, Routines), Library, Settings, Skills and Connectors (the agent's own, plus Codync's switches), Rules and Plugins (what the agent already has, read only), saved as you edit, Create template; a group's title opens its editor | The details' Memory tab (see Memory) |
+| Bot and group editors | Ported: avatar, profile, agent and model options, Fast mode, workspace folder picker, permissions, activity, connectors, skills (with their details); the bot details sheet (`BotDetailsView`, from the chat's title, a routine notice or Add a fallback): Details (instructions, agent, Use the computer, Routines), Library, Settings (Codync's skill and connector switches), saved as you edit, Create template; a group's title opens its editor. An agent's own skills, connectors, rules and plugins are on its sheet in Extensions, under Sign in | The details' Memory tab (see Memory) |
| Memory | Broken since 2.18.0: the screen calls removed host methods (see [Not ported yet](#not-ported-yet)); it shows only in the roster's Edit profile, and the bot details have no Memory tab until the port | Port the read-only memory screen from `MemoryView.swift`, `MemoryFilesView.swift` and `MemoryInfoSheet.swift`, without add, edit, pin or forget |
| Routines | Ported: list with switches, editor (schedule, webhook panel, run settings), test run, delete | Live provider/routine acceptance |
-| Extensions | Ported: agents (install, sign-in, setup terminal), registry connectors, Composio apps, skills, installed list, custom connector, own skill, credentials, chat connection request card | Real provider OAuth, 1Password |
+| Extensions | Ported: agents (install, sign-in, setup terminal, and the skills, connectors, rules and plugins that agent already has), registry connectors, Composio apps, skills, installed list, custom connector, own skill, credentials, chat connection request card | Real provider OAuth, 1Password |
| Voice | Ported: call bar (provider name, fallback notice), Voice chat settings (engine, mode, models, voice, minutes this month), on device (the call's language through Android's on-device recognizer, Vosk English as the fallback, replies read by an offline voice for their language), OpenAI Realtime (WebRTC), Gemini Live, Speech mode, fallback to on device, group calls | Both providers with a real key on a device; a live microphone on a device |
| State/widgets | Ported: Widget (with the animated Add a widget guide), Live update and Status bar pages, Usage sheet, Choose the look; Provider usage, Usage limits, Bots and Team widgets with launcher Edit widget and picker previews (Android 15+); the Bots Quick Settings tile (iOS's Control Center control) | Physical launcher refresh |
| Notifications | Ported: alerts as conversations with the bot's face (a group's face and its speaking member), conversation shortcuts, what happened ("Task complete") as sub text | Android's conversation layout doesn't draw sub text; background delivery needs FCM in the deployment |
diff --git a/host/Cargo.lock b/host/Cargo.lock
index b42e496f..51bf6cf3 100644
--- a/host/Cargo.lock
+++ b/host/Cargo.lock
@@ -753,6 +753,7 @@ dependencies = [
"tracing",
"tracing-subscriber",
"unicode-width",
+ "url",
"uuid",
"windows-sys 0.61.2",
"x25519-dalek",
diff --git a/host/Cargo.toml b/host/Cargo.toml
index e9029f33..6f93513f 100644
--- a/host/Cargo.toml
+++ b/host/Cargo.toml
@@ -56,6 +56,7 @@ tokio-tungstenite = { version = "0.29", features = ["rustls-tls-webpki-roots"] }
tracing = "0.1.44"
tracing-subscriber = { version = "0.3.23", features = ["env-filter"] }
unicode-width = "0.2"
+url = "2.5.8"
uuid = { version = "1.26.1", features = ["v4", "v7"] }
x25519-dalek = { version = "3.0.0", features = ["static_secrets"] }
diff --git a/host/src/agent/gear.rs b/host/src/agent/gear.rs
deleted file mode 100644
index d77b4cff..00000000
--- a/host/src/agent/gear.rs
+++ /dev/null
@@ -1,519 +0,0 @@
-//! An agent's own skills, MCP connectors, rules and plugins, read from the config it keeps on disk.
-//!
-//! Codync's skills and connectors are a separate list: clients show them beside these
-//! and pass along the ones the bot has switched on. Rules and plugins are the agent's own;
-//! Codync does not add either. This never starts the agent.
-//! MCP environment variables, headers and tokens stay in the files.
-
-use serde_json::{Map, Value, json};
-use std::io::Read;
-use std::path::{Path, PathBuf};
-
-const MAX_SKILLS: usize = 200;
-const MAX_DEPTH: usize = 3;
-const SKILL_BYTES: u64 = 8 * 1024;
-const MCP_BYTES: u64 = 256 * 1024;
-const NAME_CHARS: usize = 80;
-const DETAIL_CHARS: usize = 180;
-
-struct Item {
- name: String,
- description: String,
- detail: String,
-}
-
-/// `{ skills, connectors, rules, plugins }` for `backend` working in `cwd`.
-/// An empty `cwd` lists only what the agent keeps for the user, not a project.
-/// Each entry is `{name, description}` except connectors, which use `{name, detail}`.
-pub async fn list(backend: &str, cwd: &str) -> Value {
- let backend = backend.to_owned();
- let cwd = cwd.to_owned();
- match tokio::task::spawn_blocking(move || scan(&backend, &cwd)).await {
- Ok(value) => value,
- Err(e) => {
- tracing::warn!(error = format!("{e:#}"), "listing an agent's skills and connectors");
- json!({"skills": [], "connectors": [], "rules": [], "plugins": []})
- }
- }
-}
-
-fn scan(backend: &str, cwd: &str) -> Value {
- let home = dirs::home_dir().unwrap_or_default();
- let project = (!cwd.is_empty()).then(|| Path::new(cwd));
- let (skills, connectors) = collect(backend, &home, project);
- let (rules, plugins) = super::gear_catalog::list(backend, &home, project);
- json!({
- "skills": skills.iter().map(|s| json!({"name": s.name, "description": s.description})).collect::<Vec<_>>(),
- "connectors": connectors.iter().map(|c| json!({"name": c.name, "detail": c.detail})).collect::<Vec<_>>(),
- "rules": rules.iter().map(|s| json!({"name": s.name, "description": s.description})).collect::<Vec<_>>(),
- "plugins": plugins.iter().map(|s| json!({"name": s.name, "description": s.description})).collect::<Vec<_>>(),
- })
-}
-
-fn collect(backend: &str, home: &Path, cwd: Option<&Path>) -> (Vec<Item>, Vec<Item>) {
- let mut skills = Vec::new();
- for root in skill_roots(backend, home, cwd) {
- walk_skills(&root, 0, &mut skills);
- }
- let mut connectors = Vec::new();
- for file in mcp_files(backend, home, cwd) {
- read_mcp(&file, &mut connectors);
- }
- dedupe(&mut skills);
- dedupe(&mut connectors);
- (skills, connectors)
-}
-
-/// Home directories first, then the project, so a project entry of the same name replaces it.
-fn skill_roots(backend: &str, home: &Path, cwd: Option<&Path>) -> Vec<PathBuf> {
- let mut roots = Vec::new();
- push_rel(&mut roots, home, home_skills(backend));
- if let Some(cwd) = cwd {
- push_rel(&mut roots, cwd, project_skills(backend));
- }
- roots
-}
-
-fn home_skills(backend: &str) -> &'static [&'static str] {
- match backend {
- "cursor" => &[
- ".cursor/skills-cursor",
- ".cursor/skills",
- ".cursor/cloud-skills",
- ".agents/skills",
- ".claude/skills",
- ".codex/skills",
- ".grok/skills",
- ],
- "claude" | "copilot" => &[".claude/skills", ".agents/skills"],
- "codex" => &[".codex/skills", ".agents/skills"],
- "grok" => &[".grok/skills", ".agents/skills"],
- "codebuddy" | "workbuddy" => &[".codebuddy/skills", ".claude/skills", ".agents/skills"],
- "gemini" | "antigravity" => &[".gemini/skills", ".agents/skills"],
- _ => &[".agents/skills"],
- }
-}
-
-fn project_skills(backend: &str) -> &'static [&'static str] {
- match backend {
- "cursor" => &[
- ".cursor/skills",
- ".cursor/skills-cursor",
- ".cursor/plugins",
- ".agents/skills",
- ".claude/skills",
- ".codex/skills",
- ".grok/skills",
- ],
- "claude" | "copilot" => &[".claude/skills", ".claude/plugins", ".agents/skills"],
- "codex" => &[".codex/skills", ".agents/skills"],
- "grok" => &[".grok/skills", ".agents/skills"],
- "codebuddy" | "workbuddy" => &[".codebuddy/skills", ".claude/skills", ".agents/skills"],
- "gemini" | "antigravity" => &[".gemini/skills", ".agents/skills"],
- _ => &[".agents/skills", ".claude/skills"],
- }
-}
-
-fn mcp_files(backend: &str, home: &Path, cwd: Option<&Path>) -> Vec<PathBuf> {
- let mut files = Vec::new();
- push_rel(&mut files, home, home_mcp(backend));
- if let Some(cwd) = cwd {
- push_rel(&mut files, cwd, project_mcp(backend));
- }
- files
-}
-
-fn home_mcp(backend: &str) -> &'static [&'static str] {
- match backend {
- "cursor" => &[".cursor/mcp.json"],
- "claude" => &[".claude.json", ".claude/settings.json"],
- "codex" => &[".codex/config.toml"],
- "copilot" => &[".copilot/mcp-config.json"],
- "codebuddy" | "workbuddy" => &[".codebuddy/mcp.json", ".codebuddy/settings.json"],
- "gemini" | "antigravity" => &[".gemini/settings.json"],
- "grok" => &[".grok/mcp.json"],
- _ => &[],
- }
-}
-
-fn project_mcp(backend: &str) -> &'static [&'static str] {
- match backend {
- "cursor" => &[".cursor/mcp.json"],
- "claude" => &[".mcp.json", ".claude/settings.json", ".claude/settings.local.json"],
- "codex" => &[".codex/config.toml"],
- "copilot" => &[".mcp.json", ".vscode/mcp.json"],
- "codebuddy" | "workbuddy" => &[".codebuddy/mcp.json", ".mcp.json"],
- "gemini" | "antigravity" => &[".gemini/settings.json", ".mcp.json"],
- _ => &[".mcp.json"],
- }
-}
-
-fn push_rel(out: &mut Vec<PathBuf>, base: &Path, rels: &[&str]) {
- if base.as_os_str().is_empty() {
- return;
- }
- for rel in rels {
- out.push(base.join(rel));
- }
-}
-
-fn walk_skills(dir: &Path, depth: usize, out: &mut Vec<Item>) {
- if depth > MAX_DEPTH || out.len() >= MAX_SKILLS {
- return;
- }
- let Ok(entries) = std::fs::read_dir(dir) else { return };
- for entry in entries.flatten() {
- if out.len() >= MAX_SKILLS {
- return;
- }
- let path = entry.path();
- if skipped_dir(&path, &entry.file_name().to_string_lossy()) {
- continue;
- }
- let skill = path.join("SKILL.md");
- if skill.is_file() {
- if let Some(item) = skill_item(&skill, &entry.file_name().to_string_lossy()) {
- out.push(item);
- }
- } else {
- walk_skills(&path, depth + 1, out);
- }
- }
-}
-
-fn skipped_dir(path: &Path, name: &str) -> bool {
- if name.starts_with('.') || matches!(name, "node_modules" | "dist" | "target" | "__pycache__") {
- return true;
- }
- std::fs::symlink_metadata(path).is_ok_and(|meta| meta.file_type().is_symlink() || !meta.is_dir())
-}
-
-fn skill_item(path: &Path, folder: &str) -> Option<Item> {
- let text = read_limited(path, SKILL_BYTES)?;
- let (name, description) = front_matter(&text);
- let name = clip(&name.unwrap_or_else(|| folder.to_owned()), NAME_CHARS);
- if name.is_empty() {
- return None;
- }
- Some(Item { name, description: clip(&description.unwrap_or_default(), DETAIL_CHARS), detail: String::new() })
-}
-
-fn front_matter(md: &str) -> (Option<String>, Option<String>) {
- let Some(rest) = md.strip_prefix("---\n").or_else(|| md.strip_prefix("---\r\n")) else {
- return (None, None);
- };
- let Some((head, _)) = rest.split_once("\n---").or_else(|| rest.split_once("\r\n---")) else {
- return (None, None);
- };
- let mut name = None;
- let mut description = None;
- for line in head.lines() {
- let Some((key, value)) = line.split_once(':') else { continue };
- if key.chars().any(char::is_whitespace) {
- continue;
- }
- let value = bare(value);
- if value.is_empty() || value.starts_with('|') || value.starts_with('>') {
- continue;
- }
- match key.trim() {
- "name" if name.is_none() => name = Some(value.to_owned()),
- "description" if description.is_none() => description = Some(value.to_owned()),
- _ => {}
- }
- }
- (name, description)
-}
-
-fn bare(value: &str) -> &str {
- value.trim().trim_matches(['"', '\'']).trim()
-}
-
-fn read_mcp(path: &Path, out: &mut Vec<Item>) {
- if std::fs::symlink_metadata(path).is_ok_and(|meta| meta.is_dir()) {
- return;
- }
- let Some(text) = read_limited(path, MCP_BYTES) else { return };
- if path.extension().is_some_and(|ext| ext == "toml") {
- out.extend(mcp_toml(&text));
- return;
- }
- let Ok(value) = serde_json::from_str::<Value>(&text) else { return };
- let Some(servers) = servers_object(path, &value) else { return };
- for (name, server) in servers {
- let Some(server) = server.as_object() else { continue };
- let name = clip(name, NAME_CHARS);
- if name.is_empty() {
- continue;
- }
- out.push(Item { name, description: String::new(), detail: server_detail(server) });
- }
-}
-
-fn servers_object<'a>(path: &Path, value: &'a Value) -> Option<&'a Map<String, Value>> {
- if let Some(servers) = value.get("mcpServers").and_then(Value::as_object) {
- return Some(servers);
- }
- let name = path.file_name()?.to_str()?;
- if !matches!(name, "mcp.json" | "mcp-config.json") {
- return None;
- }
- value.get("servers").and_then(Value::as_object).or_else(|| value.as_object())
-}
-
-/// The command or URL a person can recognize. A flag that looks like a token is left out
-/// together with the value after it, and a URL loses its user, query and fragment. A URL
-/// whose path still looks like a token is omitted.
-fn server_detail(server: &Map<String, Value>) -> String {
- if let Some(url) = server.get("url").and_then(Value::as_str).filter(|url| !url.is_empty()) {
- return clip(&visible_url(url), DETAIL_CHARS);
- }
- clip(&command_text(server), DETAIL_CHARS)
-}
-
-fn command_text(server: &Map<String, Value>) -> String {
- let mut parts = Vec::new();
- match server.get("command") {
- Some(Value::String(command)) if !command.is_empty() => parts.push(command.clone()),
- Some(Value::Array(command)) => parts.extend(command.iter().filter_map(|v| v.as_str().map(str::to_owned))),
- _ => {}
- }
- if let Some(args) = server.get("args").and_then(Value::as_array) {
- parts.extend(args.iter().filter_map(|v| v.as_str().map(str::to_owned)));
- }
- let mut kept = Vec::new();
- let mut skip_value = false;
- for part in parts {
- if skip_value {
- skip_value = false;
- continue;
- }
- if looks_secret(&part) {
- skip_value = true;
- continue;
- }
- kept.push(part);
- }
- kept.join(" ")
-}
-
-/// A URL with its user, query and fragment removed. Empty when the rest still looks like a token.
-fn visible_url(url: &str) -> String {
- let url = public_url(url);
- if looks_secret(&url) { String::new() } else { url }
-}
-
-fn public_url(url: &str) -> String {
- let Some((scheme, rest)) = url.split_once("://") else {
- return url.split(['?', '#']).next().unwrap_or(url).to_owned();
- };
- let rest = rest.split('@').next_back().unwrap_or(rest);
- let rest = rest.split(['?', '#']).next().unwrap_or(rest);
- format!("{scheme}://{rest}")
-}
-
-fn looks_secret(part: &str) -> bool {
- let lower = part.to_ascii_lowercase();
- ["token", "secret", "password", "api_key", "apikey", "authorization"].iter().any(|needle| lower.contains(needle))
-}
-
-/// `[mcp_servers.name]` tables. A later `url` replaces `command`. Nested tables are skipped.
-fn mcp_toml(text: &str) -> Vec<Item> {
- let mut out = Vec::new();
- let mut name: Option<String> = None;
- let mut detail = String::new();
- let flush = |name: &mut Option<String>, detail: &mut String, out: &mut Vec<Item>| {
- if let Some(name) = name.take() {
- let name = clip(&name, NAME_CHARS);
- if !name.is_empty() {
- out.push(Item { name, description: String::new(), detail: clip(detail, DETAIL_CHARS) });
- }
- }
- detail.clear();
- };
- for line in text.lines() {
- let trimmed = line.trim();
- if trimmed.is_empty() || trimmed.starts_with('#') {
- continue;
- }
- if let Some(next) = toml_header(trimmed) {
- flush(&mut name, &mut detail, &mut out);
- name = match next {
- TomlTable::Server(server) => Some(server),
- TomlTable::Other => None,
- };
- continue;
- }
- if name.is_none() {
- continue;
- }
- if let Some(url) = toml_value(trimmed, "url") {
- detail = visible_url(&url);
- } else if detail.is_empty()
- && let Some(command) = toml_value(trimmed, "command")
- && !looks_secret(&command)
- {
- detail = command;
- }
- }
- flush(&mut name, &mut detail, &mut out);
- out
-}
-
-/// A `[table]` line: one MCP server, or any other table. `None` is not a header.
-enum TomlTable {
- Server(String),
- Other,
-}
-
-fn toml_header(line: &str) -> Option<TomlTable> {
- let inner = line.strip_prefix('[')?.strip_suffix(']')?.trim().trim_matches('"');
- let Some(rest) = inner.strip_prefix("mcp_servers.") else {
- return Some(TomlTable::Other);
- };
- if rest.is_empty() || rest.contains('.') {
- return Some(TomlTable::Other);
- }
- Some(TomlTable::Server(rest.to_owned()))
-}
-
-fn toml_value(line: &str, key: &str) -> Option<String> {
- let rest = line.strip_prefix(key)?.trim_start();
- let rest = rest.strip_prefix('=')?.trim();
- let value = bare(rest);
- (!value.is_empty()).then(|| value.to_owned())
-}
-
-fn dedupe(items: &mut Vec<Item>) {
- let mut index = std::collections::HashMap::<String, usize>::new();
- let mut kept = Vec::new();
- for item in items.drain(..) {
- if let Some(at) = index.get(&item.name).copied() {
- kept[at] = item;
- } else {
- index.insert(item.name.clone(), kept.len());
- kept.push(item);
- }
- }
- *items = kept;
-}
-
-fn clip(text: &str, max: usize) -> String {
- let collapsed = text.split_whitespace().collect::<Vec<_>>().join(" ");
- if collapsed.chars().count() <= max { collapsed } else { collapsed.chars().take(max).collect() }
-}
-
-fn read_limited(path: &Path, cap: u64) -> Option<String> {
- let file = std::fs::File::open(path).ok()?;
- let mut file = file.take(cap);
- let mut text = String::new();
- file.read_to_string(&mut text).ok()?;
- Some(text)
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
-
- fn scratch() -> PathBuf {
- let dir = std::env::temp_dir().join(format!("codync-gear-{}", uuid::Uuid::new_v4()));
- std::fs::create_dir_all(&dir).expect("temp dir");
- dir
- }
-
- #[test]
- fn a_project_server_replaces_the_home_one_and_tokens_stay_out() {
- let root = scratch();
- let home = root.join("home");
- let cwd = root.join("proj");
- std::fs::create_dir_all(home.join(".cursor")).expect("home");
- std::fs::create_dir_all(cwd.join(".cursor/skills/review")).expect("skill");
- std::fs::write(
- home.join(".cursor/mcp.json"),
- r#"{"mcpServers":{"github":{"command":"npx","args":["-y","server"],"env":{"GITHUB_TOKEN":"secret-token"}}}}"#,
- )
- .expect("home mcp");
- std::fs::write(
- cwd.join(".cursor/mcp.json"),
- r#"{"mcpServers":{"github":{"url":"https://user:[email protected]/mcp?token=secret-token"},"linear":{"command":"linear-mcp"},"hidden":{"url":"https://example.test/secret-token"}}}"#,
- )
- .expect("project mcp");
- std::fs::write(
- cwd.join(".cursor/skills/review/SKILL.md"),
- "---\nname: review\ndescription: Review a diff\n---\n# Review\n",
- )
- .expect("skill");
- let (skills, connectors) = collect("cursor", &home, Some(&cwd));
- assert_eq!(skills.len(), 1);
- assert_eq!(skills[0].name, "review");
- assert_eq!(skills[0].description, "Review a diff");
- assert_eq!(connectors.iter().map(|c| c.name.as_str()).collect::<Vec<_>>(), ["github", "linear", "hidden"]);
- assert_eq!(connectors[0].detail, "https://example.test/mcp");
- assert_eq!(connectors[2].detail, "");
- let dumped =
- serde_json::to_string(&json!(connectors.iter().map(|c| &c.detail).collect::<Vec<_>>())).expect("json");
- assert!(!dumped.contains("secret-token"), "{dumped}");
- let _ = std::fs::remove_dir_all(root);
- }
-
- #[test]
- fn codex_toml_and_a_generic_project_are_listed() {
- let root = scratch();
- let home = root.join("home");
- let cwd = root.join("proj");
- std::fs::create_dir_all(home.join(".codex")).expect("codex");
- std::fs::create_dir_all(cwd.join(".agents/skills/ship")).expect("skill");
- std::fs::write(
- home.join(".codex/config.toml"),
- "[mcp_servers.github]\ncommand = \"github-mcp\"\n\n[mcp_servers.github.env]\nTOKEN = \"secret-token\"\n",
- )
- .expect("toml");
- std::fs::write(cwd.join(".mcp.json"), r#"{"mcpServers":{"docs":{"command":"docs-mcp"}}}"#).expect("mcp");
- std::fs::write(cwd.join(".agents/skills/ship/SKILL.md"), "---\nname: ship\ndescription: Ship it\n---\n")
- .expect("skill");
- let (codex_skills, codex_connectors) = collect("codex", &home, Some(&cwd));
- assert!(codex_skills.iter().any(|s| s.name == "ship"));
- assert_eq!(codex_connectors.len(), 1);
- assert_eq!(codex_connectors[0].name, "github");
- assert_eq!(codex_connectors[0].detail, "github-mcp");
- assert!(!codex_connectors.iter().any(|c| c.detail.contains("secret-token") || c.name.contains("secret-token")));
- let (generic_skills, generic_connectors) = collect("codebuddy", &home, Some(&cwd));
- assert!(generic_skills.iter().any(|s| s.name == "ship"));
- assert!(generic_connectors.iter().any(|c| c.name == "docs" && c.detail == "docs-mcp"));
- let _ = std::fs::remove_dir_all(root);
- }
-
- #[test]
- fn a_token_flag_and_a_toml_url_leave_the_credential_out() {
- let root = scratch();
- let home = root.join("home");
- std::fs::create_dir_all(home.join(".cursor")).expect("cursor");
- std::fs::create_dir_all(home.join(".codex")).expect("codex");
- std::fs::write(
- home.join(".cursor/mcp.json"),
- r#"{"mcpServers":{"github":{"command":"npx","args":["--token","abc123","-y","server"]}}}"#,
- )
- .expect("mcp");
- let (_, connectors) = collect("cursor", &home, None);
- assert_eq!(connectors[0].detail, "npx -y server");
- assert!(!connectors[0].detail.contains("abc123"));
- std::fs::write(
- home.join(".codex/config.toml"),
- "[mcp_servers.github]\nurl = \"https://alice:[email protected]/mcp?key=xyz\"\n",
- )
- .expect("toml");
- let (_, connectors) = collect("codex", &home, None);
- assert_eq!(connectors[0].detail, "https://example.test/mcp");
- assert!(!connectors[0].detail.contains("abc123") && !connectors[0].detail.contains("alice"));
- let _ = std::fs::remove_dir_all(root);
- }
-
- #[test]
- fn a_missing_config_is_an_empty_list() {
- let root = scratch();
- let (skills, connectors) = collect("cursor", &root.join("no-home"), Some(&root.join("no-proj")));
- assert!(skills.is_empty());
- assert!(connectors.is_empty());
- let _ = std::fs::remove_dir_all(root);
- }
-}
diff --git a/host/src/agent/gear/connectors.rs b/host/src/agent/gear/connectors.rs
new file mode 100644
index 00000000..7528c1f3
--- /dev/null
+++ b/host/src/agent/gear/connectors.rs
@@ -0,0 +1,263 @@
+//! MCP servers an agent configures in the user's home. A detail is the command, or
+//! only a URL's origin: a path can carry a key (`/api/mcp/s/<key>/mcp`).
+
+use serde_json::{Map, Value};
+use std::path::Path;
+
+use super::{MAX_ITEMS, MCP_BYTES, NAME_CHARS, TEXT_CHARS, clip, homes, read_limited};
+
+use super::Named;
+
+pub(super) fn list(backend: &str, home: &Path) -> Vec<Named> {
+ let mut out = Vec::new();
+ for file in homes(home, files(backend)) {
+ read_file(&file, &mut out);
+ }
+ super::dedupe(&mut out);
+ out.truncate(MAX_ITEMS);
+ out
+}
+
+fn files(backend: &str) -> &'static [&'static str] {
+ match backend {
+ "cursor" => &[".cursor/mcp.json"],
+ "claude" => &[".claude.json", ".claude/settings.json"],
+ "codex" => &[".codex/config.toml"],
+ "copilot" => &[".copilot/mcp-config.json"],
+ "codebuddy" | "workbuddy" => &[".codebuddy/mcp.json", ".codebuddy/settings.json"],
+ "gemini" | "antigravity" => &[".gemini/settings.json"],
+ "grok" => &[".grok/mcp.json"],
+ _ => &[],
+ }
+}
+
+fn read_file(path: &Path, out: &mut Vec<Named>) {
+ if std::fs::metadata(path).is_ok_and(|meta| meta.is_dir()) {
+ return;
+ }
+ let Some(text) = read_limited(path, MCP_BYTES) else { return };
+ if path.extension().is_some_and(|ext| ext == "toml") {
+ out.extend(mcp_toml(&text));
+ return;
+ }
+ let Ok(value) = serde_json::from_str::<Value>(&text) else { return };
+ let Some(servers) = servers_object(path, &value) else { return };
+ for (name, server) in servers {
+ let Some(server) = server.as_object() else { continue };
+ if server.get("enabled").and_then(Value::as_bool) == Some(false) {
+ continue;
+ }
+ let name = clip(name, NAME_CHARS);
+ if name.is_empty() {
+ continue;
+ }
+ out.push(Named { name, description: String::new(), detail: server_detail(server) });
+ }
+}
+
+fn servers_object<'a>(path: &Path, value: &'a Value) -> Option<&'a Map<String, Value>> {
+ if let Some(servers) = value.get("mcpServers").and_then(Value::as_object) {
+ return Some(servers);
+ }
+ let name = path.file_name()?.to_str()?;
+ if !matches!(name, "mcp.json" | "mcp-config.json") {
+ return None;
+ }
+ value.get("servers").and_then(Value::as_object).or_else(|| value.as_object())
+}
+
+fn server_detail(server: &Map<String, Value>) -> String {
+ if let Some(url) = server.get("url").and_then(Value::as_str).filter(|url| !url.is_empty()) {
+ return clip(&visible_url(url), TEXT_CHARS);
+ }
+ clip(&command_text(server), TEXT_CHARS)
+}
+
+fn command_text(server: &Map<String, Value>) -> String {
+ let mut parts = Vec::new();
+ match server.get("command") {
+ Some(Value::String(command)) if !command.is_empty() => parts.push(command.clone()),
+ Some(Value::Array(command)) => parts.extend(command.iter().filter_map(|v| v.as_str().map(str::to_owned))),
+ _ => {}
+ }
+ if let Some(args) = server.get("args").and_then(Value::as_array) {
+ parts.extend(args.iter().filter_map(|v| v.as_str().map(str::to_owned)));
+ }
+ keep_public(&parts)
+}
+
+/// A flag named like a credential, the value after it, and a long letter-and-digit run.
+fn keep_public(parts: &[String]) -> String {
+ let mut kept = Vec::new();
+ let mut skip_value = false;
+ for part in parts {
+ if skip_value {
+ skip_value = false;
+ continue;
+ }
+ if credential_flag(part) {
+ skip_value = true;
+ continue;
+ }
+ if token_run(part) {
+ continue;
+ }
+ kept.push(part.as_str());
+ }
+ kept.join(" ")
+}
+
+fn credential_flag(part: &str) -> bool {
+ let raw = part.trim().trim_matches(['"', '\'']);
+ if !raw.starts_with('-') {
+ return false;
+ }
+ let name = raw.trim_start_matches('-').to_ascii_lowercase().replace('-', "_");
+ name.split('_')
+ .filter(|seg| !seg.is_empty())
+ .any(|seg| matches!(seg, "token" | "secret" | "password" | "authorization" | "apikey" | "auth" | "key"))
+ || name.contains("api_key")
+}
+
+/// A bare argument that is a long mix of letters and digits, such as an API key.
+fn token_run(part: &str) -> bool {
+ let s = part.trim().trim_matches(['"', '\'']);
+ if s.starts_with('-') || s.chars().count() < 20 {
+ return false;
+ }
+ s.chars().all(|c| c.is_ascii_alphanumeric() || c == '_' || c == '-' || c == '.')
+ && s.chars().any(|c| c.is_ascii_alphabetic())
+ && s.chars().any(|c| c.is_ascii_digit())
+}
+
+/// Scheme and host only. The path, user and query stay out.
+fn visible_url(raw: &str) -> String {
+ let Ok(url) = url::Url::parse(raw) else { return String::new() };
+ match url.origin() {
+ url::Origin::Tuple(..) => url.origin().ascii_serialization(),
+ url::Origin::Opaque(_) => String::new(),
+ }
+}
+
+/// `[mcp_servers.name]` tables. `enabled = false` leaves the server out. Nested tables are skipped.
+fn mcp_toml(text: &str) -> Vec<Named> {
+ let mut out = Vec::new();
+ let mut name: Option<String> = None;
+ let mut detail = String::new();
+ let mut disabled = false;
+ let flush = |name: &mut Option<String>, detail: &mut String, disabled: &mut bool, out: &mut Vec<Named>| {
+ if let Some(name) = name.take()
+ && !*disabled
+ {
+ let name = clip(&name, NAME_CHARS);
+ if !name.is_empty() {
+ out.push(Named { name, description: String::new(), detail: clip(detail, TEXT_CHARS) });
+ }
+ }
+ detail.clear();
+ *disabled = false;
+ };
+ for line in text.lines() {
+ let trimmed = line.trim();
+ if trimmed.is_empty() || trimmed.starts_with('#') {
+ continue;
+ }
+ if let Some(next) = toml_header(trimmed) {
+ flush(&mut name, &mut detail, &mut disabled, &mut out);
+ name = match next {
+ TomlTable::Server(server) => Some(server),
+ TomlTable::Other => None,
+ };
+ continue;
+ }
+ if name.is_none() {
+ continue;
+ }
+ if toml_value(trimmed, "enabled").as_deref() == Some("false") {
+ disabled = true;
+ } else if let Some(url) = toml_value(trimmed, "url") {
+ detail = visible_url(&url);
+ } else if detail.is_empty()
+ && let Some(command) = toml_value(trimmed, "command")
+ {
+ detail = keep_public(&split_command(&command));
+ }
+ }
+ flush(&mut name, &mut detail, &mut disabled, &mut out);
+ out
+}
+
+fn split_command(command: &str) -> Vec<String> {
+ command.split_whitespace().map(str::to_owned).collect()
+}
+
+enum TomlTable {
+ Server(String),
+ Other,
+}
+
+fn toml_header(line: &str) -> Option<TomlTable> {
+ let inner = line.strip_prefix('[')?.strip_suffix(']')?.trim().trim_matches('"');
+ let Some(rest) = inner.strip_prefix("mcp_servers.") else {
+ return Some(TomlTable::Other);
+ };
+ if rest.is_empty() || rest.contains('.') {
+ return Some(TomlTable::Other);
+ }
+ Some(TomlTable::Server(rest.to_owned()))
+}
+
+fn toml_value(line: &str, key: &str) -> Option<String> {
+ let rest = line.strip_prefix(key)?.trim_start();
+ let rest = rest.strip_prefix('=')?.trim();
+ let value = rest.trim().trim_matches(['"', '\'']).trim();
+ (!value.is_empty()).then(|| value.to_owned())
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ fn scratch() -> std::path::PathBuf {
+ let dir = std::env::temp_dir().join(format!("codync-gear-mcp-{}", uuid::Uuid::new_v4()));
+ std::fs::create_dir_all(&dir).expect("temp dir");
+ dir
+ }
+
+ #[test]
+ fn a_large_claude_file_and_a_secret_argument_stay_readable() {
+ let root = scratch();
+ let home = root.join("home");
+ std::fs::create_dir_all(home.join(".claude")).expect("claude");
+ let pad = "x".repeat(300 * 1024);
+ let body = format!(
+ r#"{{"history":"{pad}","mcpServers":{{"github":{{"command":"npx","args":["--api-key","abc123","-y","server","sk-abc123def456ghij78"]}},"off":{{"command":"nope","enabled":false}},"zap":{{"url":"https://user:[email protected]/api/mcp/s/secret-token/mcp?token=1"}}}}}}"#
+ );
+ std::fs::write(home.join(".claude.json"), body).expect("claude.json");
+ let connectors = list("claude", &home);
+ assert_eq!(connectors.iter().map(|c| c.name.as_str()).collect::<Vec<_>>(), ["github", "zap"]);
+ assert_eq!(connectors[0].detail, "npx -y server");
+ assert_eq!(connectors[1].detail, "https://hooks.zapier.com");
+ let dumped = format!("{} {}", connectors[0].detail, connectors[1].detail);
+ assert!(!dumped.contains("abc123") && !dumped.contains("secret"), "{dumped}");
+ let _ = std::fs::remove_dir_all(root);
+ }
+
+ #[test]
+ fn a_disabled_codex_server_is_left_out() {
+ let root = scratch();
+ let home = root.join("home");
+ std::fs::create_dir_all(home.join(".codex")).expect("codex");
+ std::fs::write(
+ home.join(".codex/config.toml"),
+ "[mcp_servers.github]\ncommand = \"github-mcp\"\nenabled = false\n\n[mcp_servers.docs]\nurl = \"https://alice:[email protected]/mcp?key=xyz\"\n\n[mcp_servers.docs.env]\nTOKEN = \"secret-token\"\n",
+ )
+ .expect("toml");
+ let connectors = list("codex", &home);
+ assert_eq!(connectors.len(), 1);
+ assert_eq!(connectors[0].name, "docs");
+ assert_eq!(connectors[0].detail, "https://example.test");
+ assert!(!connectors[0].detail.contains("abc123") && !connectors[0].detail.contains("alice"));
+ let _ = std::fs::remove_dir_all(root);
+ }
+}
diff --git a/host/src/agent/gear/mod.rs b/host/src/agent/gear/mod.rs
new file mode 100644
index 00000000..1fb67b79
--- /dev/null
+++ b/host/src/agent/gear/mod.rs
@@ -0,0 +1,101 @@
+//! What an agent already brings, read from the user's home. This never starts the agent,
+//! and it does not look in a project: those lists belong to the agent, not to a bot.
+//!
+//! MCP environment variables, headers and tokens stay in the files. A connector's
+//! detail is a command with credentials removed, or only a URL's origin.
+
+mod connectors;
+mod plugins;
+mod rules;
+mod skills;
+
+use serde_json::{Value, json};
+use std::io::Read;
+use std::path::{Path, PathBuf};
+
+const MAX_ITEMS: usize = 200;
+const MAX_DEPTH: usize = 3;
+const NAME_CHARS: usize = 80;
+const TEXT_CHARS: usize = 180;
+const SKILL_BYTES: u64 = 8 * 1024;
+/// Claude's `~/.claude.json` also stores every project's history, so a small cap
+/// cuts the file in half and the JSON no longer parses.
+const MCP_BYTES: u64 = 32 * 1024 * 1024;
+
+pub(super) struct Named {
+ pub name: String,
+ pub description: String,
+ pub detail: String,
+}
+
+/// `{ skills, connectors, rules, plugins }` for `backend`, from the user's home only.
+/// Each entry is `{name, description}` except connectors, which use `{name, detail}`.
+pub async fn list(backend: &str) -> Value {
+ let backend = backend.to_owned();
+ match tokio::task::spawn_blocking(move || scan(&backend)).await {
+ Ok(value) => value,
+ Err(e) => {
+ tracing::warn!(error = format!("{e:#}"), "listing what an agent brings");
+ json!({"skills": [], "connectors": [], "rules": [], "plugins": []})
+ }
+ }
+}
+
+fn scan(backend: &str) -> Value {
+ let home = dirs::home_dir().unwrap_or_default();
+ let skills = skills::list(backend, &home);
+ let connectors = connectors::list(backend, &home);
+ let rules = rules::list(backend, &home);
+ let plugins = plugins::list(backend, &home);
+ json!({
+ "skills": skills.iter().map(|s| json!({"name": s.name, "description": s.description})).collect::<Vec<_>>(),
+ "connectors": connectors.iter().map(|c| json!({"name": c.name, "detail": c.detail})).collect::<Vec<_>>(),
+ "rules": rules.iter().map(|s| json!({"name": s.name, "description": s.description})).collect::<Vec<_>>(),
+ "plugins": plugins.iter().map(|s| json!({"name": s.name, "description": s.description})).collect::<Vec<_>>(),
+ })
+}
+
+pub(super) fn homes(base: &Path, rels: &[&str]) -> Vec<PathBuf> {
+ if base.as_os_str().is_empty() {
+ return Vec::new();
+ }
+ rels.iter().map(|rel| base.join(rel)).collect()
+}
+
+pub(super) fn dedupe(items: &mut Vec<Named>) {
+ let mut index = std::collections::HashMap::<String, usize>::new();
+ let mut kept = Vec::new();
+ for item in items.drain(..) {
+ if let Some(at) = index.get(&item.name).copied() {
+ kept[at] = item;
+ } else {
+ index.insert(item.name.clone(), kept.len());
+ kept.push(item);
+ }
+ }
+ *items = kept;
+}
+
+pub(super) fn clip(text: &str, max: usize) -> String {
+ let collapsed = text.split_whitespace().collect::<Vec<_>>().join(" ");
+ if collapsed.chars().count() <= max { collapsed } else { collapsed.chars().take(max).collect() }
+}
+
+/// The start of a file, as text. A cap that lands inside a character still returns
+/// the valid prefix; `read_to_string` would drop the whole file.
+pub(super) fn read_limited(path: &Path, cap: u64) -> Option<String> {
+ let mut file = std::fs::File::open(path).ok()?.take(cap);
+ let mut bytes = Vec::new();
+ file.read_to_end(&mut bytes).ok()?;
+ Some(String::from_utf8_lossy(&bytes).into_owned())
+}
+
+pub(super) fn skipped_name(name: &str) -> bool {
+ name.starts_with('.')
+ || matches!(name, "node_modules" | "dist" | "target" | "__pycache__" | "cache" | "marketplaces")
+}
+
+/// A directory, following a symlink. `MAX_DEPTH` stops a link back to a parent.
+pub(super) fn is_dir(path: &Path) -> bool {
+ std::fs::metadata(path).is_ok_and(|meta| meta.is_dir())
+}
diff --git a/host/src/agent/gear/plugins.rs b/host/src/agent/gear/plugins.rs
new file mode 100644
index 00000000..82e58218
--- /dev/null
+++ b/host/src/agent/gear/plugins.rs
@@ -0,0 +1,276 @@
+//! Plugins an agent has installed for the user. Claude also lists project installs
+//! and plugins its settings turn off; those stay out. A manifest's other fields
+//! (hooks, tokens) stay in the file.
+
+use serde_json::Value;
+use std::collections::HashSet;
+use std::path::Path;
+
+use super::{MAX_DEPTH, MAX_ITEMS, MCP_BYTES, NAME_CHARS, TEXT_CHARS, clip, homes, is_dir, read_limited, skipped_name};
+
+use super::Named;
+
+const MANIFESTS: &[&str] = &[
+ ".cursor-plugin/plugin.json",
+ ".claude-plugin/plugin.json",
+ ".codebuddy-plugin/plugin.json",
+ ".codex-plugin/plugin.json",
+ ".copilot-plugin/plugin.json",
+ "plugin.json",
+];
+
+pub(super) fn list(backend: &str, home: &Path) -> Vec<Named> {
+ let mut out = Vec::new();
+ match backend {
+ "claude" => {
+ read_installed(&home.join(".claude/plugins/installed_plugins.json"), &mut out, true, &disabled_claude(home));
+ }
+ "copilot" => read_copilot(home, &mut out),
+ "codex" => read_codex(home, &mut out),
+ _ => {
+ for file in homes(home, indexes(backend)) {
+ read_installed(&file, &mut out, false, &HashSet::new());
+ }
+ }
+ }
+ super::dedupe(&mut out);
+ out.truncate(MAX_ITEMS);
+ out
+}
+
+fn indexes(backend: &str) -> &'static [&'static str] {
+ match backend {
+ "cursor" => &[".cursor/plugins/installed_plugins.json"],
+ "codebuddy" | "workbuddy" => &[".codebuddy/plugins/installed_plugins.json"],
+ _ => &[],
+ }
+}
+
+fn disabled_claude(home: &Path) -> HashSet<String> {
+ let Some(text) = read_limited(&home.join(".claude/settings.json"), MCP_BYTES) else { return HashSet::new() };
+ let Ok(value) = serde_json::from_str::<Value>(&text) else { return HashSet::new() };
+ value
+ .get("enabledPlugins")
+ .and_then(Value::as_object)
+ .into_iter()
+ .flatten()
+ .filter(|(_, on)| on.as_bool() == Some(false))
+ .map(|(key, _)| key.clone())
+ .collect()
+}
+
+fn read_installed(path: &Path, out: &mut Vec<Named>, user_only: bool, disabled: &HashSet<String>) {
+ let Some(text) = read_limited(path, MCP_BYTES) else { return };
+ let Ok(value) = serde_json::from_str::<Value>(&text) else { return };
+ let Some(plugins) = value.get("plugins").and_then(Value::as_object) else { return };
+ for (key, entry) in plugins {
+ if out.len() >= MAX_ITEMS || disabled.contains(key) {
+ continue;
+ }
+ let Some(install) = chosen_install(entry, user_only) else { continue };
+ let fallback = key.split('@').next().unwrap_or(key);
+ let item = install
+ .get("installPath")
+ .and_then(Value::as_str)
+ .filter(|path| !path.is_empty())
+ .and_then(|dir| manifest_under(Path::new(dir)))
+ .unwrap_or_else(|| Named {
+ name: clip(fallback, NAME_CHARS),
+ description: String::new(),
+ detail: String::new(),
+ });
+ if !item.name.is_empty() {
+ out.push(item);
+ }
+ }
+}
+
+fn chosen_install(entry: &Value, user_only: bool) -> Option<&serde_json::Map<String, Value>> {
+ let rows: Vec<&serde_json::Map<String, Value>> = match entry {
+ Value::Array(rows) => rows.iter().filter_map(Value::as_object).collect(),
+ Value::Object(row) => vec![row],
+ _ => return None,
+ };
+ if user_only {
+ rows.into_iter().find(|row| row.get("scope").and_then(Value::as_str) == Some("user"))
+ } else {
+ rows.into_iter().next()
+ }
+}
+
+fn read_copilot(home: &Path, out: &mut Vec<Named>) {
+ let path = home.join(".copilot/installed-plugins");
+ if path.is_file() {
+ read_installed(&path, out, false, &HashSet::new());
+ return;
+ }
+ walk_plugins(&path, 0, out);
+}
+
+fn read_codex(home: &Path, out: &mut Vec<Named>) {
+ let Some(text) = read_limited(&home.join(".codex/config.toml"), MCP_BYTES) else { return };
+ let cache = home.join(".codex/plugins/cache");
+ let mut current: Option<(String, String)> = None;
+ let mut disabled = false;
+ let flush = |current: &mut Option<(String, String)>, disabled: &mut bool, out: &mut Vec<Named>| {
+ if let Some((name, market)) = current.take()
+ && !*disabled
+ && out.len() < MAX_ITEMS
+ {
+ let dir = cache.join(&market).join(&name);
+ let item = manifest_under(&dir).unwrap_or(Named {
+ name: clip(&name, NAME_CHARS),
+ description: String::new(),
+ detail: String::new(),
+ });
+ if !item.name.is_empty() {
+ out.push(item);
+ }
+ }
+ *disabled = false;
+ };
+ for line in text.lines() {
+ let trimmed = line.trim();
+ if let Some((name, market)) = codex_header(trimmed) {
+ flush(&mut current, &mut disabled, out);
+ current = Some((name, market));
+ continue;
+ }
+ if current.is_some()
+ && trimmed
+ .strip_prefix("enabled")
+ .is_some_and(|rest| rest.trim().trim_start_matches('=').trim().trim_matches('"') == "false")
+ {
+ disabled = true;
+ }
+ }
+ flush(&mut current, &mut disabled, out);
+}
+
+fn codex_header(line: &str) -> Option<(String, String)> {
+ let inner = line.strip_prefix('[')?.strip_suffix(']')?.trim();
+ let rest = inner.strip_prefix("plugins.")?.trim_matches('"');
+ if rest.is_empty() || rest.contains('.') {
+ return None;
+ }
+ let (name, market) = rest.split_once('@')?;
+ (!name.is_empty() && !market.is_empty()).then(|| (name.to_owned(), market.to_owned()))
+}
+
+fn walk_plugins(dir: &Path, depth: usize, out: &mut Vec<Named>) {
+ if depth > MAX_DEPTH || out.len() >= MAX_ITEMS || !is_dir(dir) {
+ return;
+ }
+ if let Some(item) = manifest_here(dir) {
+ out.push(item);
+ return;
+ }
+ let Ok(entries) = std::fs::read_dir(dir) else { return };
+ for entry in entries.flatten() {
+ if out.len() >= MAX_ITEMS {
+ return;
+ }
+ let name = entry.file_name();
+ let name = name.to_string_lossy();
+ if skipped_name(&name) {
+ continue;
+ }
+ let path = entry.path();
+ if is_dir(&path) {
+ walk_plugins(&path, depth + 1, out);
+ }
+ }
+}
+
+fn manifest_here(dir: &Path) -> Option<Named> {
+ MANIFESTS.iter().map(|rel| dir.join(rel)).find(|path| path.is_file()).and_then(|path| plugin_meta(&path))
+}
+
+fn manifest_under(dir: &Path) -> Option<Named> {
+ if let Some(item) = manifest_here(dir) {
+ return Some(item);
+ }
+ let mut children =
+ std::fs::read_dir(dir).ok()?.flatten().map(|e| e.path()).filter(|p| is_dir(p)).collect::<Vec<_>>();
+ children.sort();
+ children.into_iter().rev().find_map(|child| {
+ let name = child.file_name()?.to_string_lossy();
+ if skipped_name(&name) { None } else { manifest_here(&child) }
+ })
+}
+
+fn plugin_meta(path: &Path) -> Option<Named> {
+ let text = read_limited(path, MCP_BYTES)?;
+ let value: Value = serde_json::from_str(&text).ok()?;
+ let obj = value.as_object()?;
+ let fallback = path.parent().and_then(|dir| dir.file_name()).and_then(|n| n.to_str()).unwrap_or("plugin");
+ let name = obj.get("name").and_then(Value::as_str).filter(|n| !n.is_empty()).unwrap_or(fallback);
+ let name = clip(name, NAME_CHARS);
+ if name.is_empty() {
+ return None;
+ }
+ let description = obj.get("description").and_then(Value::as_str).unwrap_or("");
+ Some(Named { name, description: clip(description, TEXT_CHARS), detail: String::new() })
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ fn scratch() -> std::path::PathBuf {
+ let dir = std::env::temp_dir().join(format!("codync-gear-plugins-{}", uuid::Uuid::new_v4()));
+ std::fs::create_dir_all(&dir).expect("temp dir");
+ dir
+ }
+
+ #[test]
+ fn claude_keeps_user_plugins_that_are_still_on() {
+ let root = scratch();
+ let home = root.join("home");
+ let plug = root.join("plug");
+ std::fs::create_dir_all(plug.join(".claude-plugin")).expect("plug");
+ std::fs::create_dir_all(home.join(".claude/plugins")).expect("index");
+ std::fs::write(
+ plug.join(".claude-plugin/plugin.json"),
+ r#"{"name":"browser","description":"Drive a browser","token":"secret-token"}"#,
+ )
+ .expect("manifest");
+ let index = format!(
+ r#"{{"plugins":{{"browser@local":[{{"scope":"user","installPath":"{}"}}],"local-only@local":[{{"scope":"project","installPath":"{}"}}],"off@local":[{{"scope":"user","installPath":"{}"}}]}}}}"#,
+ plug.display(),
+ plug.display(),
+ plug.display()
+ );
+ std::fs::write(home.join(".claude/plugins/installed_plugins.json"), index).expect("index");
+ std::fs::write(
+ home.join(".claude/settings.json"),
+ r#"{"enabledPlugins":{"off@local":false,"browser@local":true}}"#,
+ )
+ .expect("settings");
+ let plugins = list("claude", &home);
+ assert_eq!(plugins.len(), 1);
+ assert_eq!(plugins[0].name, "browser");
+ assert_eq!(plugins[0].description, "Drive a browser");
+ assert!(!format!("{} {}", plugins[0].name, plugins[0].description).contains("secret-token"));
+ let _ = std::fs::remove_dir_all(root);
+ }
+
+ #[test]
+ fn a_disabled_codex_plugin_is_left_out() {
+ let root = scratch();
+ let home = root.join("home");
+ let plug = home.join(".codex/plugins/cache/openai-bundled/docs/1/.codex-plugin");
+ std::fs::create_dir_all(&plug).expect("cache");
+ std::fs::write(plug.join("plugin.json"), r#"{"name":"docs","description":"Write docs"}"#).expect("manifest");
+ std::fs::write(
+ home.join(".codex/config.toml"),
+ "[plugins.\"docs@openai-bundled\"]\n\n[plugins.\"browser@openai-bundled\"]\nenabled = false\n\n[plugins.\"docs@openai-bundled\".env]\nTOKEN = \"secret-token\"\n",
+ )
+ .expect("config");
+ let plugins = list("codex", &home);
+ assert_eq!(plugins.len(), 1);
+ assert_eq!(plugins[0].name, "docs");
+ assert!(!plugins[0].description.contains("secret-token"));
+ let _ = std::fs::remove_dir_all(root);
+ }
+}
diff --git a/host/src/agent/gear/rules.rs b/host/src/agent/gear/rules.rs
new file mode 100644
index 00000000..e5141a1c
--- /dev/null
+++ b/host/src/agent/gear/rules.rs
@@ -0,0 +1,86 @@
+//! Instruction files an agent keeps in the user's home. Copilot's file is
+//! `~/.copilot/copilot-instructions.md`, not Claude's rules.
+
+use std::path::Path;
+
+use super::{MAX_DEPTH, MAX_ITEMS, NAME_CHARS, TEXT_CHARS, clip, homes, is_dir, read_limited, skipped_name};
+use crate::market::front_matter;
+
+use super::Named;
+
+const RULE_BYTES: u64 = 64 * 1024;
+
+pub(super) fn list(backend: &str, home: &Path) -> Vec<Named> {
+ let mut out = Vec::new();
+ for dir in homes(home, dirs(backend)) {
+ walk(&dir, 0, &mut out);
+ }
+ for file in homes(home, files(backend)) {
+ if let Some(item) = rule_file(&file) {
+ out.push(item);
+ }
+ }
+ super::dedupe(&mut out);
+ out
+}
+
+fn dirs(backend: &str) -> &'static [&'static str] {
+ match backend {
+ "cursor" => &[".cursor/rules"],
+ "claude" => &[".claude/rules"],
+ "codebuddy" | "workbuddy" => &[".codebuddy/rules"],
+ "gemini" | "antigravity" => &[".gemini/rules"],
+ "grok" => &[".grok/rules"],
+ _ => &[],
+ }
+}
+
+fn files(backend: &str) -> &'static [&'static str] {
+ match backend {
+ "copilot" => &[".copilot/copilot-instructions.md"],
+ _ => &[],
+ }
+}
+
+fn walk(dir: &Path, depth: usize, out: &mut Vec<Named>) {
+ if depth > MAX_DEPTH || out.len() >= MAX_ITEMS || !is_dir(dir) {
+ return;
+ }
+ let Ok(entries) = std::fs::read_dir(dir) else { return };
+ for entry in entries.flatten() {
+ if out.len() >= MAX_ITEMS {
+ return;
+ }
+ let name = entry.file_name();
+ let name = name.to_string_lossy();
+ if skipped_name(&name) {
+ continue;
+ }
+ let path = entry.path();
+ if is_dir(&path) {
+ walk(&path, depth + 1, out);
+ } else if is_rule(&path)
+ && let Some(item) = rule_file(&path)
+ {
+ out.push(item);
+ }
+ }
+}
+
+fn is_rule(path: &Path) -> bool {
+ matches!(path.extension().and_then(|ext| ext.to_str()), Some("md" | "mdc" | "markdown"))
+}
+
+fn rule_file(path: &Path) -> Option<Named> {
+ if !path.is_file() {
+ return None;
+ }
+ let text = read_limited(path, RULE_BYTES)?;
+ let (name, description) = front_matter(&text);
+ let fallback = path.file_name().and_then(|n| n.to_str()).unwrap_or("rule");
+ let name = clip(&name.unwrap_or_else(|| fallback.to_owned()), NAME_CHARS);
+ if name.is_empty() {
+ return None;
+ }
+ Some(Named { name, description: clip(&description.unwrap_or_default(), TEXT_CHARS), detail: String::new() })
+}
diff --git a/host/src/agent/gear/skills.rs b/host/src/agent/gear/skills.rs
new file mode 100644
index 00000000..8f607e34
--- /dev/null
+++ b/host/src/agent/gear/skills.rs
@@ -0,0 +1,140 @@
+//! Skill folders an agent keeps in the user's home. A symlink to a folder is followed;
+//! `MAX_DEPTH` stops a loop. Claude reads `~/.claude/skills` only. Codex and Cursor also
+//! read `~/.agents/skills`. Copilot keeps its own `~/.copilot/skills`.
+
+use std::path::Path;
+
+use super::{
+ MAX_DEPTH, MAX_ITEMS, NAME_CHARS, SKILL_BYTES, TEXT_CHARS, clip, homes, is_dir, read_limited, skipped_name,
+};
+use crate::market::front_matter;
+
+use super::Named;
+
+pub(super) fn list(backend: &str, home: &Path) -> Vec<Named> {
+ let mut out = Vec::new();
+ for root in homes(home, roots(backend)) {
+ walk(&root, 0, &mut out);
+ }
+ super::dedupe(&mut out);
+ out
+}
+
+fn roots(backend: &str) -> &'static [&'static str] {
+ match backend {
+ "cursor" => &[
+ ".cursor/skills-cursor",
+ ".cursor/skills",
+ ".cursor/cloud-skills",
+ ".agents/skills",
+ ".claude/skills",
+ ".codex/skills",
+ ".grok/skills",
+ ],
+ "claude" => &[".claude/skills"],
+ "copilot" => &[".copilot/skills"],
+ "codex" => &[".codex/skills", ".agents/skills"],
+ "grok" => &[".grok/skills", ".agents/skills"],
+ "codebuddy" | "workbuddy" => &[".codebuddy/skills", ".claude/skills", ".agents/skills"],
+ "gemini" | "antigravity" => &[".gemini/skills", ".agents/skills"],
+ _ => &[".agents/skills"],
+ }
+}
+
+fn walk(dir: &Path, depth: usize, out: &mut Vec<Named>) {
+ if depth > MAX_DEPTH || out.len() >= MAX_ITEMS || !is_dir(dir) {
+ return;
+ }
+ let Ok(entries) = std::fs::read_dir(dir) else { return };
+ for entry in entries.flatten() {
+ if out.len() >= MAX_ITEMS {
+ return;
+ }
+ let name = entry.file_name();
+ let name = name.to_string_lossy();
+ if skipped_name(&name) {
+ continue;
+ }
+ let path = entry.path();
+ if !is_dir(&path) {
+ continue;
+ }
+ let skill = path.join("SKILL.md");
+ if skill.is_file() {
+ if let Some(item) = skill_item(&skill, &name) {
+ out.push(item);
+ }
+ } else {
+ walk(&path, depth + 1, out);
+ }
+ }
+}
+
+fn skill_item(path: &Path, folder: &str) -> Option<Named> {
+ let text = read_limited(path, SKILL_BYTES)?;
+ let (name, description) = front_matter(&text);
+ let name = clip(&name.unwrap_or_else(|| folder.to_owned()), NAME_CHARS);
+ if name.is_empty() {
+ return None;
+ }
+ Some(Named { name, description: clip(&description.unwrap_or_default(), TEXT_CHARS), detail: String::new() })
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ fn scratch() -> std::path::PathBuf {
+ let dir = std::env::temp_dir().join(format!("codync-gear-skills-{}", uuid::Uuid::new_v4()));
+ std::fs::create_dir_all(&dir).expect("temp dir");
+ dir
+ }
+
+ #[test]
+ fn claude_reads_its_own_skills_and_follows_a_symlink() {
+ let root = scratch();
+ let home = root.join("home");
+ let real = root.join("real");
+ std::fs::create_dir_all(home.join(".claude/skills")).expect("claude");
+ std::fs::create_dir_all(home.join(".agents/skills/imported")).expect("agents");
+ std::fs::create_dir_all(&real).expect("real");
+ std::fs::write(home.join(".agents/skills/imported/SKILL.md"), "---\nname: imported\ndescription: No\n---\n")
+ .expect("imported");
+ std::fs::write(real.join("SKILL.md"), "---\nname: linked\ndescription: >\n Review\n a diff\n---\n# 说明\n")
+ .expect("linked");
+ std::os::unix::fs::symlink(&real, home.join(".claude/skills/linked")).expect("symlink");
+ let skills = list("claude", &home);
+ assert_eq!(skills.iter().map(|s| s.name.as_str()).collect::<Vec<_>>(), ["linked"]);
+ assert_eq!(skills[0].description, "Review a diff");
+ let _ = std::fs::remove_dir_all(root);
+ }
+
+ #[test]
+ fn copilot_does_not_read_claude_skills() {
+ let root = scratch();
+ let home = root.join("home");
+ std::fs::create_dir_all(home.join(".copilot/skills/ship")).expect("copilot");
+ std::fs::create_dir_all(home.join(".claude/skills/other")).expect("claude");
+ std::fs::write(home.join(".copilot/skills/ship/SKILL.md"), "---\nname: ship\ndescription: Ship it\n---\n")
+ .expect("ship");
+ std::fs::write(home.join(".claude/skills/other/SKILL.md"), "---\nname: other\ndescription: No\n---\n")
+ .expect("other");
+ let skills = list("copilot", &home);
+ assert_eq!(skills.iter().map(|s| s.name.as_str()).collect::<Vec<_>>(), ["ship"]);
+ let _ = std::fs::remove_dir_all(root);
+ }
+
+ #[test]
+ fn a_skill_file_cut_inside_a_character_still_counts() {
+ let root = scratch();
+ let home = root.join("home");
+ let dir = home.join(".claude/skills/notes");
+ std::fs::create_dir_all(&dir).expect("dir");
+ // 8192 bytes lands inside the last 你, which used to drop the whole file.
+ std::fs::write(dir.join("SKILL.md"), "你".repeat(2731)).expect("skill");
+ let skills = list("claude", &home);
+ assert_eq!(skills.len(), 1);
+ assert_eq!(skills[0].name, "notes");
+ let _ = std::fs::remove_dir_all(root);
+ }
+}
diff --git a/host/src/agent/gear_catalog.rs b/host/src/agent/gear_catalog.rs
deleted file mode 100644
index bb6d87dc..00000000
--- a/host/src/agent/gear_catalog.rs
+++ /dev/null
@@ -1,487 +0,0 @@
-//! Rules and plugins an agent already has on disk. Names and descriptions only:
-//! a plugin manifest's other fields (hooks, MCP, tokens) stay in the file.
-
-use serde_json::Value;
-use std::io::Read;
-use std::path::Path;
-
-const MAX_ITEMS: usize = 200;
-const MAX_DEPTH: usize = 3;
-const FILE_BYTES: u64 = 64 * 1024;
-const TEXT_CHARS: usize = 180;
-
-pub(super) struct Named {
- pub name: String,
- pub description: String,
-}
-
-pub(super) fn list(backend: &str, home: &Path, cwd: Option<&Path>) -> (Vec<Named>, Vec<Named>) {
- let mut rules = Vec::new();
- let mut plugins = Vec::new();
- gather(backend, home, false, &mut rules, &mut plugins);
- if let Some(cwd) = cwd {
- gather(backend, cwd, true, &mut rules, &mut plugins);
- }
- dedupe(&mut plugins);
- (present(rules), plugins)
-}
-
-/// `project` is set when `base` is the bot's folder. Home is scanned first, so the same rule path
-/// in the project replaces the home one. A different path stays, even when the title matches.
-fn gather(backend: &str, base: &Path, project: bool, rules: &mut Vec<Rule>, plugins: &mut Vec<Named>) {
- if base.as_os_str().is_empty() {
- return;
- }
- let (dirs, files) = if project {
- (project_rule_dirs(backend), project_rule_files(backend))
- } else {
- (home_rule_dirs(backend), home_rule_files(backend))
- };
- for rel in dirs {
- walk_rules(&base.join(rel), base, 0, rules);
- }
- for rel in files {
- if let Some(item) = rule_file(&base.join(rel), base) {
- rules.push(item);
- }
- }
- if project {
- for rel in project_plugin_dirs(backend) {
- walk_plugins(&base.join(rel), 0, plugins);
- }
- } else {
- for rel in home_plugin_indexes(backend) {
- read_installed(&base.join(rel), plugins);
- }
- if backend == "codex" {
- read_codex_plugins(base, plugins);
- }
- }
-}
-
-fn home_rule_dirs(backend: &str) -> &'static [&'static str] {
- match backend {
- "cursor" => &[".cursor/rules"],
- "claude" | "copilot" => &[".claude/rules"],
- "codebuddy" | "workbuddy" => &[".codebuddy/rules"],
- _ => &[],
- }
-}
-
-fn project_rule_dirs(backend: &str) -> &'static [&'static str] {
- match backend {
- "cursor" => &[".cursor/rules"],
- "claude" | "copilot" => &[".claude/rules"],
- "codebuddy" | "workbuddy" => &[".codebuddy/rules"],
- "gemini" | "antigravity" => &[".gemini/rules"],
- "grok" => &[".grok/rules"],
- "codex" => &[],
- _ => &[".agents/rules"],
- }
-}
-
-/// Instruction files the agent reads from the home directory, outside its rules folder.
-fn home_rule_files(backend: &str) -> &'static [&'static str] {
- match backend {
- "claude" | "copilot" => &[".claude/CLAUDE.md"],
- "codex" => &[".codex/AGENTS.md"],
- "grok" => &[".grok/AGENTS.md"],
- "codebuddy" | "workbuddy" => &[".codebuddy/CODEBUDDY.md", ".codebuddy/AGENTS.md"],
- "gemini" | "antigravity" => &[".gemini/GEMINI.md"],
- _ => &[],
- }
-}
-
-fn project_rule_files(backend: &str) -> &'static [&'static str] {
- match backend {
- "cursor" => &[".cursorrules", "AGENTS.md", "CLAUDE.md", "CLAUDE.local.md"],
- "claude" | "copilot" => &["CLAUDE.md", "CLAUDE.local.md", "AGENTS.md"],
- "codex" | "grok" => &["AGENTS.md"],
- "codebuddy" | "workbuddy" => &["AGENTS.md", "CODEBUDDY.md"],
- "gemini" | "antigravity" => &["GEMINI.md", "AGENTS.md"],
- _ => &["AGENTS.md", "CLAUDE.md"],
- }
-}
-
-fn home_plugin_indexes(backend: &str) -> &'static [&'static str] {
- match backend {
- "cursor" => &[".cursor/plugins/installed_plugins.json"],
- "claude" | "copilot" => &[".claude/plugins/installed_plugins.json"],
- "codebuddy" | "workbuddy" => &[".codebuddy/plugins/installed_plugins.json"],
- _ => &[],
- }
-}
-
-fn project_plugin_dirs(backend: &str) -> &'static [&'static str] {
- match backend {
- "cursor" => &[".cursor/plugins"],
- "claude" | "copilot" => &[".claude/plugins"],
- "codebuddy" | "workbuddy" => &[".codebuddy/plugins"],
- "codex" => &[".codex/plugins"],
- _ => &[],
- }
-}
-
-fn walk_rules(dir: &Path, base: &Path, depth: usize, out: &mut Vec<Rule>) {
- if depth > MAX_DEPTH || out.len() >= MAX_ITEMS || skipped(dir) {
- return;
- }
- let Ok(entries) = std::fs::read_dir(dir) else { return };
- for entry in entries.flatten() {
- if out.len() >= MAX_ITEMS {
- return;
- }
- let name = entry.file_name();
- let name = name.to_string_lossy();
- if name.starts_with('.') || matches!(name.as_ref(), "node_modules" | "dist" | "target") {
- continue;
- }
- let path = entry.path();
- if path.is_dir() {
- walk_rules(&path, base, depth + 1, out);
- } else if is_rule_file(&path)
- && let Some(item) = rule_file(&path, base)
- {
- out.push(item);
- }
- }
-}
-
-fn is_rule_file(path: &Path) -> bool {
- matches!(path.extension().and_then(|ext| ext.to_str()), Some("md" | "mdc" | "markdown"))
-}
-
-struct Rule {
- name: String,
- description: String,
- /// Path under the rules folder, or under home/project for a standalone file. Home and project
- /// copies of this path are one rule; `frontend/style.mdc` and `backend/style.mdc` are not.
- key: String,
-}
-
-fn rule_file(path: &Path, base: &Path) -> Option<Rule> {
- if !path.is_file() {
- return None;
- }
- let text = read_limited(path, FILE_BYTES)?;
- let (name, description) = front_matter(&text);
- let key = rule_key(path, base);
- let fallback = path.file_name().and_then(|n| n.to_str()).unwrap_or("rule");
- let name = clip(&name.unwrap_or_else(|| fallback.to_owned()), 80);
- if name.is_empty() {
- return None;
- }
- Some(Rule { name, description: clip(&description.unwrap_or_default(), TEXT_CHARS), key })
-}
-
-/// The rule's identity: the path inside a rules directory, otherwise the path from `base`.
-fn rule_key(path: &Path, base: &Path) -> String {
- const ROOTS: &[&str] =
- &[".cursor/rules/", ".claude/rules/", ".codebuddy/rules/", ".gemini/rules/", ".grok/rules/", ".agents/rules/"];
- let rel = path.strip_prefix(base).unwrap_or(path);
- let text = rel.components().map(|c| c.as_os_str().to_string_lossy()).collect::<Vec<_>>().join("/");
- for root in ROOTS {
- if let Some(rest) = text.strip_prefix(root)
- && !rest.is_empty()
- {
- return rest.to_owned();
- }
- }
- if text.is_empty() { "rule".to_owned() } else { text }
-}
-
-fn front_matter(md: &str) -> (Option<String>, Option<String>) {
- let Some(rest) = md.strip_prefix("---\n").or_else(|| md.strip_prefix("---\r\n")) else {
- return (None, None);
- };
- let Some((head, _)) = rest.split_once("\n---").or_else(|| rest.split_once("\r\n---")) else {
- return (None, None);
- };
- let mut name = None;
- let mut description = None;
- for line in head.lines() {
- let Some((key, value)) = line.split_once(':') else { continue };
- if key.chars().any(char::is_whitespace) {
- continue;
- }
- let value = value.trim().trim_matches(['"', '\'']).trim();
- if value.is_empty() {
- continue;
- }
- match key.trim() {
- "name" if name.is_none() => name = Some(value.to_owned()),
- "description" if description.is_none() => description = Some(value.to_owned()),
- _ => {}
- }
- }
- (name, description)
-}
-
-const MANIFESTS: &[&str] = &[
- ".cursor-plugin/plugin.json",
- ".claude-plugin/plugin.json",
- ".codebuddy-plugin/plugin.json",
- ".codex-plugin/plugin.json",
- "plugin.json",
-];
-
-fn walk_plugins(dir: &Path, depth: usize, out: &mut Vec<Named>) {
- if depth > MAX_DEPTH || out.len() >= MAX_ITEMS || skipped(dir) {
- return;
- }
- if let Some(item) = manifest_here(dir) {
- out.push(item);
- return;
- }
- let Ok(entries) = std::fs::read_dir(dir) else { return };
- for entry in entries.flatten() {
- if out.len() >= MAX_ITEMS {
- return;
- }
- let name = entry.file_name();
- let name = name.to_string_lossy();
- if name.starts_with('.')
- || matches!(name.as_ref(), "node_modules" | "cache" | "marketplaces" | "dist" | "target")
- {
- continue;
- }
- let path = entry.path();
- if path.is_dir() {
- walk_plugins(&path, depth + 1, out);
- }
- }
-}
-
-fn read_installed(path: &Path, out: &mut Vec<Named>) {
- let Some(text) = read_limited(path, FILE_BYTES) else { return };
- let Ok(value) = serde_json::from_str::<Value>(&text) else { return };
- let Some(plugins) = value.get("plugins").and_then(Value::as_object) else { return };
- for (key, entry) in plugins {
- if out.len() >= MAX_ITEMS {
- return;
- }
- let fallback = key.split('@').next().unwrap_or(key);
- let item = entry_path(entry)
- .and_then(|dir| manifest_under(Path::new(dir)))
- .unwrap_or_else(|| Named { name: clip(fallback, 80), description: String::new() });
- if !item.name.is_empty() {
- out.push(item);
- }
- }
-}
-
-fn entry_path(value: &Value) -> Option<&str> {
- let obj = value.as_array().and_then(|rows| rows.iter().find_map(Value::as_object)).or_else(|| value.as_object())?;
- obj.get("installPath").and_then(Value::as_str).filter(|path| !path.is_empty())
-}
-
-/// `[plugins."name@marketplace"]` in Codex config. Nested tables are not plugins.
-fn read_codex_plugins(home: &Path, out: &mut Vec<Named>) {
- let Some(text) = read_limited(&home.join(".codex/config.toml"), FILE_BYTES) else { return };
- let cache = home.join(".codex/plugins/cache");
- for line in text.lines() {
- if out.len() >= MAX_ITEMS {
- return;
- }
- let Some((name, market)) = codex_plugin_header(line.trim()) else { continue };
- let dir = cache.join(&market).join(&name);
- let item = manifest_under(&dir).unwrap_or(Named { name: clip(&name, 80), description: String::new() });
- if !item.name.is_empty() {
- out.push(item);
- }
- }
-}
-
-fn codex_plugin_header(line: &str) -> Option<(String, String)> {
- let inner = line.strip_prefix('[')?.strip_suffix(']')?.trim();
- let rest = inner.strip_prefix("plugins.")?.trim_matches('"');
- if rest.is_empty() || rest.contains('.') {
- return None;
- }
- let (name, market) = rest.split_once('@')?;
- (!name.is_empty() && !market.is_empty()).then(|| (name.to_owned(), market.to_owned()))
-}
-
-fn manifest_here(dir: &Path) -> Option<Named> {
- MANIFESTS.iter().map(|rel| dir.join(rel)).find(|path| path.is_file()).and_then(|path| plugin_meta(&path))
-}
-
-fn manifest_under(dir: &Path) -> Option<Named> {
- if let Some(item) = manifest_here(dir) {
- return Some(item);
- }
- let mut children =
- std::fs::read_dir(dir).ok()?.flatten().map(|e| e.path()).filter(|p| p.is_dir()).collect::<Vec<_>>();
- children.sort();
- children.into_iter().rev().find_map(|child| {
- let name = child.file_name()?.to_string_lossy();
- if name.starts_with('.') || name == "node_modules" { None } else { manifest_here(&child) }
- })
-}
-
-fn plugin_meta(path: &Path) -> Option<Named> {
- let text = read_limited(path, FILE_BYTES)?;
- let value: Value = serde_json::from_str(&text).ok()?;
- let obj = value.as_object()?;
- let fallback = path.parent().and_then(|dir| dir.file_name()).and_then(|n| n.to_str()).unwrap_or("plugin");
- let name = obj.get("name").and_then(Value::as_str).filter(|n| !n.is_empty()).unwrap_or(fallback);
- let name = clip(name, 80);
- if name.is_empty() {
- return None;
- }
- let description = obj.get("description").and_then(Value::as_str).unwrap_or("");
- Some(Named { name, description: clip(description, TEXT_CHARS) })
-}
-
-fn skipped(path: &Path) -> bool {
- std::fs::symlink_metadata(path).is_ok_and(|meta| meta.file_type().is_symlink())
-}
-
-/// One row per rule path. A repeated title keeps the path, so two `style.mdc` files both show.
-fn present(mut rules: Vec<Rule>) -> Vec<Named> {
- let mut index = std::collections::HashMap::<String, usize>::new();
- let mut kept = Vec::new();
- for rule in rules.drain(..) {
- if let Some(at) = index.get(&rule.key).copied() {
- kept[at] = rule;
- } else {
- index.insert(rule.key.clone(), kept.len());
- kept.push(rule);
- }
- }
- let mut counts = std::collections::HashMap::<String, usize>::new();
- for rule in &kept {
- *counts.entry(rule.name.clone()).or_insert(0) += 1;
- }
- kept.into_iter()
- .map(|rule| {
- let shared = counts[&rule.name] > 1;
- let name = if shared { clip(&rule.key, 80) } else { rule.name };
- Named { name, description: rule.description }
- })
- .collect()
-}
-
-fn dedupe(items: &mut Vec<Named>) {
- let mut index = std::collections::HashMap::<String, usize>::new();
- let mut kept = Vec::new();
- for item in items.drain(..) {
- if let Some(at) = index.get(&item.name).copied() {
- kept[at] = item;
- } else {
- index.insert(item.name.clone(), kept.len());
- kept.push(item);
- }
- }
- *items = kept;
-}
-
-fn clip(text: &str, max: usize) -> String {
- let collapsed = text.split_whitespace().collect::<Vec<_>>().join(" ");
- if collapsed.chars().count() <= max { collapsed } else { collapsed.chars().take(max).collect() }
-}
-
-fn read_limited(path: &Path, cap: u64) -> Option<String> {
- let mut file = std::fs::File::open(path).ok()?.take(cap);
- let mut text = String::new();
- file.read_to_string(&mut text).ok()?;
- Some(text)
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
- use std::path::PathBuf;
-
- fn scratch() -> PathBuf {
- let dir = std::env::temp_dir().join(format!("codync-gear-catalog-{}", uuid::Uuid::new_v4()));
- std::fs::create_dir_all(&dir).expect("temp dir");
- dir
- }
-
- #[test]
- fn a_project_rule_replaces_the_home_one_and_a_plugin_keeps_only_its_name() {
- let root = scratch();
- let home = root.join("home");
- let cwd = root.join("proj");
- let plug = root.join("plug");
- std::fs::create_dir_all(home.join(".cursor/rules")).expect("rules");
- std::fs::create_dir_all(cwd.join(".cursor/rules")).expect("project rules");
- std::fs::create_dir_all(plug.join(".cursor-plugin")).expect("plugin");
- std::fs::write(
- home.join(".cursor/rules/style.mdc"),
- "---\nname: style\ndescription: Home style\n---\n# Style\n",
- )
- .expect("home rule");
- std::fs::write(cwd.join(".cursor/rules/style.mdc"), "---\nname: style\ndescription: Project style\n---\n")
- .expect("project rule");
- std::fs::write(cwd.join("AGENTS.md"), "# Agents\n").expect("agents");
- std::fs::write(
- plug.join(".cursor-plugin/plugin.json"),
- r#"{"name":"browser","description":"Drive a browser","token":"secret-token"}"#,
- )
- .expect("manifest");
- std::fs::create_dir_all(home.join(".cursor/plugins")).expect("index dir");
- let index = serde_json::json!({
- "plugins": { "browser@local": [{ "installPath": plug.display().to_string() }] }
- });
- std::fs::write(
- home.join(".cursor/plugins/installed_plugins.json"),
- serde_json::to_string(&index).expect("index"),
- )
- .expect("index");
- let (rules, plugins) = list("cursor", &home, Some(&cwd));
- assert_eq!(rules.iter().map(|r| r.name.as_str()).collect::<Vec<_>>(), ["style", "AGENTS.md"]);
- assert_eq!(rules[0].description, "Project style");
- assert_eq!(plugins.len(), 1);
- assert_eq!(plugins[0].name, "browser");
- assert_eq!(plugins[0].description, "Drive a browser");
- let dumped = format!("{} {}", plugins[0].name, plugins[0].description);
- assert!(!dumped.contains("secret-token"), "{dumped}");
- let _ = std::fs::remove_dir_all(root);
- }
-
- #[test]
- fn a_home_instruction_is_listed_and_nested_rules_stay_separate() {
- let root = scratch();
- let home = root.join("home");
- let cwd = root.join("proj");
- std::fs::create_dir_all(home.join(".claude")).expect("claude home");
- std::fs::create_dir_all(&cwd).expect("project");
- std::fs::write(home.join(".claude/CLAUDE.md"), "# Global\n").expect("home claude");
- std::fs::write(cwd.join("CLAUDE.md"), "# Project\n").expect("project claude");
- let (rules, _) = list("claude", &home, Some(&cwd));
- let names: Vec<_> = rules.iter().map(|r| r.name.as_str()).collect();
- assert!(names.contains(&".claude/CLAUDE.md"), "{names:?}");
- assert!(names.contains(&"CLAUDE.md"), "{names:?}");
- std::fs::create_dir_all(cwd.join(".cursor/rules/frontend")).expect("front");
- std::fs::create_dir_all(cwd.join(".cursor/rules/backend")).expect("back");
- std::fs::write(cwd.join(".cursor/rules/frontend/style.mdc"), "# Front\n").expect("front rule");
- std::fs::write(cwd.join(".cursor/rules/backend/style.mdc"), "# Back\n").expect("back rule");
- let (rules, _) = list("cursor", &home, Some(&cwd));
- let names: Vec<_> = rules.iter().map(|r| r.name.as_str()).collect();
- assert!(names.contains(&"frontend/style.mdc"), "{names:?}");
- assert!(names.contains(&"backend/style.mdc"), "{names:?}");
- let _ = std::fs::remove_dir_all(root);
- }
-
- #[test]
- fn codex_lists_the_plugins_its_config_names() {
- let root = scratch();
- let home = root.join("home");
- let plug = home.join(".codex/plugins/cache/openai-bundled/docs/1/.codex-plugin");
- std::fs::create_dir_all(&plug).expect("cache");
- std::fs::write(plug.join("plugin.json"), r#"{"name":"docs","description":"Write docs"}"#).expect("manifest");
- std::fs::write(
- home.join(".codex/config.toml"),
- "[plugins.\"docs@openai-bundled\"]\n\n[plugins.\"docs@openai-bundled\".env]\nTOKEN = \"secret-token\"\n",
- )
- .expect("config");
- let (_, plugins) = list("codex", &home, None);
- assert_eq!(plugins.len(), 1);
- assert_eq!(plugins[0].name, "docs");
- assert_eq!(plugins[0].description, "Write docs");
- assert!(!format!("{:?}", plugins[0].description).contains("secret-token"));
- let _ = std::fs::remove_dir_all(root);
- }
-}
diff --git a/host/src/agent/mod.rs b/host/src/agent/mod.rs
index f56ef5a6..b229a0a3 100644
--- a/host/src/agent/mod.rs
+++ b/host/src/agent/mod.rs
@@ -8,7 +8,6 @@ pub mod bot;
pub mod config;
pub mod fallback;
pub mod gear;
-mod gear_catalog;
pub mod new_bot;
pub mod node;
pub mod own_memory;
diff --git a/host/src/api/marketplace.rs b/host/src/api/marketplace.rs
index cc7a7b99..97b52ae7 100644
--- a/host/src/api/marketplace.rs
+++ b/host/src/api/marketplace.rs
@@ -169,10 +169,8 @@ pub(super) async fn call(hub: &Arc<Hub>, caller: &Caller, method: &str, b: Value
json!({})
}
"skills" => market::list_skills(&hub.store),
- // What this agent already has on disk. Codync's own skills and connectors stay on the bot.
- "agentGear" => {
- crate::agent::gear::list(b["backend"].as_str().unwrap_or(""), b["cwd"].as_str().unwrap_or("")).await
- }
+ // What this agent already has in the user's home. Codync's own skills and connectors stay on the bot.
+ "agentGear" => crate::agent::gear::list(b["backend"].as_str().unwrap_or("")).await,
"skillDetails" => market::skill_details(&hub.store, &b).await?,
"installSkill" => {
let before = Installed::Skills.ids(&hub.store)?;
diff --git a/host/src/market/mod.rs b/host/src/market/mod.rs
index e1d2358f..784c8a45 100644
--- a/host/src/market/mod.rs
+++ b/host/src/market/mod.rs
@@ -33,6 +33,7 @@ mod updates;
pub use install::{add_custom_connector, import_connectors, install_connector, list_connectors, remove_connector};
pub use registry::{browse_connectors, connector_info, refresh_first_page};
+pub(crate) use skills::front_matter;
pub use skills::{
add_custom_skill, browse_skills, expand_command, install_skill, list_skills, remove_skill, skill_details,
skills_brief, slash_command, turn_on_installed_once, update_custom_skill,
diff --git a/host/src/market/skills.rs b/host/src/market/skills.rs
index 8193b15f..6f45c108 100644
--- a/host/src/market/skills.rs
+++ b/host/src/market/skills.rs
@@ -13,8 +13,8 @@ static SKILLS_LOCK: Mutex<()> = Mutex::new(());
/// `Skill::source` of a skill written in Codync rather than downloaded.
const CUSTOM: &str = "custom";
-/// `name` and `description` from a SKILL.md front matter.
-fn front_matter(md: &str) -> (Option<String>, Option<String>) {
+/// `name` and `description` from a SKILL.md front matter, including a folded `description: >` block.
+pub(crate) fn front_matter(md: &str) -> (Option<String>, Option<String>) {
let mut name = None;
let mut description = None;
let mut lines = md.lines();
diff --git a/host/src/tui/app/overlay_keys.rs b/host/src/tui/app/overlay_keys.rs
index aa53809f..a93fc9ac 100644
--- a/host/src/tui/app/overlay_keys.rs
+++ b/host/src/tui/app/overlay_keys.rs
@@ -124,7 +124,7 @@ impl App {
Overlay::Routines(l) => self.routines_key(l, k),
Overlay::Routine(f) => self.routine_key(f, k),
Overlay::Library(l) => self.library_key(l, k),
- Overlay::Gear(g) => self.gear_key(g, k),
+ Overlay::Gear(g) => Self::gear_key(g, k),
Overlay::Market(m) => self.market_key(m, k),
Overlay::Agent(a) => self.agent_key(a, k),
Overlay::Fields(f) => self.fields_key(f, k),
diff --git a/host/src/tui/manage/agent.rs b/host/src/tui/manage/agent.rs
index 91e236e3..37f89a4c 100644
--- a/host/src/tui/manage/agent.rs
+++ b/host/src/tui/manage/agent.rs
@@ -58,6 +58,7 @@ impl App {
}
}
rows.push(SetupRow::Check);
+ rows.push(SetupRow::Brings);
rows
}
@@ -102,6 +103,11 @@ impl App {
);
}
},
+ Some(SetupRow::Brings) => {
+ self.overlays.push(Overlay::Agent(a));
+ self.open_agent_gear(&backend);
+ return None;
+ }
Some(SetupRow::Check) | None => {
a.busy = true;
a.error = None;
diff --git a/host/src/tui/manage/gear.rs b/host/src/tui/manage/gear.rs
index c645e758..e5dac3a9 100644
--- a/host/src/tui/manage/gear.rs
+++ b/host/src/tui/manage/gear.rs
@@ -1,214 +1,119 @@
-//! A bot's Skills, Connectors, Rules and Plugins pages. Skills and connectors also list what Codync passes on.
+//! A read-only sheet of what one agent already brings: skills, connectors, rules and plugins.
use crossterm::event::{KeyCode, KeyEvent};
use serde_json::{Value, json};
-use super::super::app::{After, App, Overlay};
-use super::{Page, Reply};
+use super::super::app::{App, Overlay};
+use super::Reply;
-/// Which gear page is open. Skills and connectors also list what Codync passes on.
-/// Rules and plugins are only what the agent already has.
-#[derive(Clone, Copy, PartialEq, Eq, Debug)]
-pub enum GearKind {
- Skills,
- Connectors,
- Rules,
- Plugins,
-}
-
-impl GearKind {
- pub fn page(self) -> Page {
- match self {
- Self::Skills => Page::Skills,
- Self::Connectors => Page::Connectors,
- Self::Rules => Page::Rules,
- Self::Plugins => Page::Plugins,
- }
- }
-
- /// Codync can pass skills and connectors on. Rules and plugins stay the agent's.
- pub fn passes_on(self) -> bool {
- matches!(self, Self::Skills | Self::Connectors)
- }
-
- fn field(self) -> Option<&'static str> {
- match self {
- Self::Skills => Some("skills"),
- Self::Connectors => Some("connectors"),
- Self::Rules | Self::Plugins => None,
- }
- }
-}
-
-/// One skill or connector the agent keeps for itself.
+/// One skill, connector, rule or plugin the agent keeps for itself.
#[derive(Clone, Debug)]
pub struct GearItem {
pub name: String,
pub detail: String,
}
-/// The Skills or Connectors page of one bot.
+/// The four lists, once `agentGear` has answered.
+#[derive(Clone, Debug)]
+pub struct GearLists {
+ pub skills: Vec<GearItem>,
+ pub connectors: Vec<GearItem>,
+ pub rules: Vec<GearItem>,
+ pub plugins: Vec<GearItem>,
+}
+
+/// What one agent brings, opened from its sign-in sheet.
pub struct Gear {
- pub bot: String,
- pub kind: GearKind,
+ pub backend: String,
/// `None` until `agentGear` answers.
- pub agent_skills: Option<Vec<GearItem>>,
- pub agent_connectors: Option<Vec<GearItem>>,
- pub agent_rules: Option<Vec<GearItem>>,
- pub agent_plugins: Option<Vec<GearItem>>,
+ pub lists: Option<GearLists>,
pub failed: bool,
pub cursor: usize,
}
+pub enum GearRow {
+ Heading(&'static str),
+ Note,
+ Item(usize, usize),
+}
+
impl Gear {
- pub fn agent(&self) -> Option<&[GearItem]> {
- match self.kind {
- GearKind::Skills => self.agent_skills.as_deref(),
- GearKind::Connectors => self.agent_connectors.as_deref(),
- GearKind::Rules => self.agent_rules.as_deref(),
- GearKind::Plugins => self.agent_plugins.as_deref(),
- }
+ fn sections(&self) -> [(&'static str, &[GearItem]); 4] {
+ let empty: &[GearItem] = &[];
+ let lists = self.lists.as_ref();
+ [
+ ("Skills", lists.map_or(empty, |l| l.skills.as_slice())),
+ ("Connectors", lists.map_or(empty, |l| l.connectors.as_slice())),
+ ("Rules", lists.map_or(empty, |l| l.rules.as_slice())),
+ ("Plugins", lists.map_or(empty, |l| l.plugins.as_slice())),
+ ]
}
- /// One scrollable list: the agent's rows, then Codync's switches when this page has them.
- pub fn rows(&self, toggles: usize) -> Vec<GearRow> {
- let mut rows = vec![GearRow::AgentHeading];
- match self.agent() {
- Some(items) if !self.failed && !items.is_empty() => rows.extend((0..items.len()).map(GearRow::Agent)),
- _ => rows.push(GearRow::AgentNote),
+ pub fn rows(&self) -> Vec<GearRow> {
+ if self.lists.is_none() || self.failed {
+ return vec![GearRow::Note];
}
- if !self.kind.passes_on() {
- return rows;
+ let mut rows = Vec::new();
+ for (section, (label, items)) in self.sections().into_iter().enumerate() {
+ if items.is_empty() {
+ continue;
+ }
+ rows.push(GearRow::Heading(label));
+ rows.extend((0..items.len()).map(|index| GearRow::Item(section, index)));
}
- rows.push(GearRow::CodyncHeading);
- if toggles == 0 {
- rows.push(GearRow::CodyncNote);
- } else {
- rows.extend((0..toggles).map(GearRow::Toggle));
+ if rows.is_empty() { vec![GearRow::Note] } else { rows }
+ }
+
+ pub fn count_of(&self, label: &str) -> usize {
+ let Some(lists) = &self.lists else { return 0 };
+ match label {
+ "Skills" => lists.skills.len(),
+ "Connectors" => lists.connectors.len(),
+ "Rules" => lists.rules.len(),
+ "Plugins" => lists.plugins.len(),
+ _ => 0,
}
- rows
}
-}
-/// A line on the Skills or Connectors page. `Toggle` is an index into the installed Codync list.
-#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub enum GearRow {
- AgentHeading,
- AgentNote,
- Agent(usize),
- CodyncHeading,
- CodyncNote,
- Toggle(usize),
+ pub fn item(&self, section: usize, index: usize) -> Option<&GearItem> {
+ self.sections().get(section).and_then(|(_, items)| items.get(index))
+ }
}
pub(super) fn items(value: &Value) -> Vec<GearItem> {
- value
- .as_array()
- .map(|rows| {
- rows.iter()
- .filter_map(|row| {
- let name = row["name"].as_str()?.trim();
- if name.is_empty() {
- return None;
- }
- let detail = row["description"]
- .as_str()
- .filter(|s| !s.is_empty())
- .or_else(|| row["detail"].as_str())
- .unwrap_or("")
- .to_owned();
- Some(GearItem { name: name.to_owned(), detail })
- })
- .collect()
- })
- .unwrap_or_default()
+ value.as_array().map_or(Vec::new(), |rows| {
+ rows.iter()
+ .filter_map(|row| {
+ let name = row["name"].as_str()?.trim();
+ if name.is_empty() {
+ return None;
+ }
+ let detail = row["description"]
+ .as_str()
+ .filter(|s| !s.is_empty())
+ .or_else(|| row["detail"].as_str())
+ .unwrap_or("")
+ .to_owned();
+ Some(GearItem { name: name.to_owned(), detail })
+ })
+ .collect()
+ })
}
impl App {
- pub(in crate::tui) fn open_gear(&mut self, kind: GearKind) {
- let Some(bot) = self.bot().filter(|bot| !bot.group) else {
- self.flash("Skills, connectors, rules and plugins belong to a bot, not a group");
- return;
- };
- let id = bot.id.clone();
- let backend = bot.backend.clone();
- let cwd = bot.cwd.clone();
- self.sheet("agentGear", json!({"backend": backend, "cwd": cwd}), Reply::Gear(id.clone()));
- self.call("connectors", json!({}), After::Connectors);
- self.call("skills", json!({}), After::Skills);
- self.overlays.push(Overlay::Gear(Gear {
- bot: id,
- kind,
- agent_skills: None,
- agent_connectors: None,
- agent_rules: None,
- agent_plugins: None,
- failed: false,
- cursor: 1,
- }));
+ pub(in crate::tui) fn open_agent_gear(&mut self, backend: &str) {
+ self.overlays.push(Overlay::Gear(Gear { backend: backend.to_owned(), lists: None, failed: false, cursor: 0 }));
+ self.sheet("agentGear", json!({"backend": backend}), Reply::Gear(backend.to_owned()));
}
- pub(in crate::tui) fn gear_key(&mut self, mut gear: Gear, key: KeyEvent) -> Option<Overlay> {
- if let Some(page) = gear.kind.page().step(key) {
- self.open_page(page);
- return None;
- }
- let rows = gear.rows(self.gear_toggles(&gear).len());
- let last = rows.len().saturating_sub(1);
- gear.cursor = gear.cursor.min(last);
- match key.code {
+ pub(in crate::tui) fn gear_key(mut gear: Gear, k: KeyEvent) -> Option<Overlay> {
+ let rows = gear.rows();
+ match k.code {
KeyCode::Esc | KeyCode::Char('q') => return None,
- KeyCode::Down | KeyCode::Char('j') => gear.cursor = (gear.cursor + 1).min(last),
+ KeyCode::Down | KeyCode::Char('j') => gear.cursor = (gear.cursor + 1).min(rows.len().saturating_sub(1)),
KeyCode::Up | KeyCode::Char('k') => gear.cursor = gear.cursor.saturating_sub(1),
- KeyCode::Char(' ') | KeyCode::Enter => {
- if let Some(GearRow::Toggle(index)) = rows.get(gear.cursor) {
- self.toggle_gear(&gear, *index);
- }
- }
_ => {}
}
Some(Overlay::Gear(gear))
}
-
- /// Installed Codync connectors or skills, and whether this bot passes each one on.
- pub(in crate::tui) fn gear_toggles(&self, gear: &Gear) -> Vec<(String, String, bool)> {
- let Some(bot) = self.bots.get(&gear.bot) else { return Vec::new() };
- let (installed, enabled) = match gear.kind {
- GearKind::Skills => (&self.market.1, &bot.skills),
- GearKind::Connectors => (&self.market.0, &bot.connectors),
- GearKind::Rules | GearKind::Plugins => return Vec::new(),
- };
- installed
- .iter()
- .map(|item| (item.id.clone(), item.name.clone(), enabled.iter().any(|id| id == &item.id)))
- .collect()
- }
-
- fn toggle_gear(&mut self, gear: &Gear, index: usize) {
- let (bot_id, field, ids) = {
- let Some(bot) = self.bots.get(&gear.bot) else { return };
- let installed = match gear.kind {
- GearKind::Skills => &self.market.1,
- GearKind::Connectors => &self.market.0,
- GearKind::Rules | GearKind::Plugins => return,
- };
- let Some(item) = installed.get(index) else { return };
- let id = item.id.clone();
- let mut ids = match gear.kind {
- GearKind::Skills => bot.skills.clone(),
- GearKind::Connectors => bot.connectors.clone(),
- GearKind::Rules | GearKind::Plugins => return,
- };
- if ids.iter().any(|have| have == &id) {
- ids.retain(|have| have != &id);
- } else {
- ids.push(id);
- }
- let Some(field) = gear.kind.field() else { return };
- (gear.bot.clone(), field, ids)
- };
- let mut body = json!({"id": bot_id});
- body[field] = json!(ids);
- self.call("updateBot", body, After::Nothing);
- }
}
diff --git a/host/src/tui/manage/mod.rs b/host/src/tui/manage/mod.rs
index d96ebfe9..1511f89a 100644
--- a/host/src/tui/manage/mod.rs
+++ b/host/src/tui/manage/mod.rs
@@ -24,7 +24,7 @@ mod when;
pub use analytics::AnalyticsSheet;
pub use fields::handoff_fields;
-pub use gear::{Gear, GearKind, GearRow};
+pub use gear::{Gear, GearRow};
pub use library::{ArtifactTitles, LibraryItem};
pub use memory::{MemoryMode, MemorySheet, Scroll, Section};
pub use network::{NetReply, NetworkSheet, Recovery, Step};
@@ -55,7 +55,7 @@ pub enum Reply {
RoutineSaved,
/// A bot's Library (`library {botId}`).
Library(String),
- /// What an agent brings on its own (`agentGear`), for the bot's Skills, Connectors, Rules or Plugins page.
+ /// What an agent brings on its own (`agentGear`), for its sign-in sheet.
Gear(String),
/// A routine's webhook URL and key: copied as a ready-to-run curl.
Webhook,
@@ -181,6 +181,8 @@ pub enum SetupRow {
Login,
Method(Value),
Check,
+ /// Opens the read-only lists of what this agent already brings.
+ Brings,
}
pub struct Input {
diff --git a/host/src/tui/manage/pages.rs b/host/src/tui/manage/pages.rs
index 91a33c49..a0d8a0da 100644
--- a/host/src/tui/manage/pages.rs
+++ b/host/src/tui/manage/pages.rs
@@ -1,7 +1,6 @@
//! A bot's pages of details, as in the desktop inspector and the iPhone's details: Details (whether it
//! may use the computer, and its routines), Library (the artifacts it made and the files shared in its
-//! chat), Memory and Settings, then what the agent brings: Skills, Connectors, Rules and Plugins.
-//! Shift+←→ moves between them.
+//! chat), Memory and Settings. Shift+←→ moves between them. What an agent brings is on its own sheet.
use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
@@ -13,23 +12,10 @@ pub enum Page {
Library,
Memory,
Settings,
- Skills,
- Connectors,
- Rules,
- Plugins,
}
impl Page {
- pub const ALL: [Self; 8] = [
- Self::Details,
- Self::Library,
- Self::Memory,
- Self::Settings,
- Self::Skills,
- Self::Connectors,
- Self::Rules,
- Self::Plugins,
- ];
+ pub const ALL: [Self; 4] = [Self::Details, Self::Library, Self::Memory, Self::Settings];
pub fn label(self) -> &'static str {
match self {
@@ -37,10 +23,6 @@ impl Page {
Self::Library => "Library",
Self::Memory => "Memory",
Self::Settings => "Settings",
- Self::Skills => "Skills",
- Self::Connectors => "Connectors",
- Self::Rules => "Rules",
- Self::Plugins => "Plugins",
}
}
@@ -67,10 +49,6 @@ impl App {
Page::Library => self.open_library(),
Page::Memory => self.open_memory(),
Page::Settings => self.edit_bot(),
- Page::Skills => self.open_gear(super::GearKind::Skills),
- Page::Connectors => self.open_gear(super::GearKind::Connectors),
- Page::Rules => self.open_gear(super::GearKind::Rules),
- Page::Plugins => self.open_gear(super::GearKind::Plugins),
}
}
}
@@ -85,12 +63,8 @@ mod tests {
assert_eq!(Page::Details.step(key(KeyCode::Right)), Some(Page::Library));
assert_eq!(Page::Memory.step(key(KeyCode::Left)), Some(Page::Library));
assert_eq!(Page::Library.step(key(KeyCode::Left)), Some(Page::Details));
- assert_eq!(Page::Settings.step(key(KeyCode::Right)), Some(Page::Skills));
- assert_eq!(Page::Skills.step(key(KeyCode::Right)), Some(Page::Connectors));
- assert_eq!(Page::Connectors.step(key(KeyCode::Right)), Some(Page::Rules));
- assert_eq!(Page::Rules.step(key(KeyCode::Right)), Some(Page::Plugins));
- assert_eq!(Page::Plugins.step(key(KeyCode::Left)), Some(Page::Rules));
- assert_eq!(Page::Plugins.step(key(KeyCode::Right)), None);
+ assert_eq!(Page::Settings.step(key(KeyCode::Left)), Some(Page::Memory));
+ assert_eq!(Page::Settings.step(key(KeyCode::Right)), None);
assert_eq!(Page::Details.step(key(KeyCode::Left)), None);
assert_eq!(
Page::Memory.step(KeyEvent::new(KeyCode::Right, KeyModifiers::NONE)),
diff --git a/host/src/tui/manage/replies.rs b/host/src/tui/manage/replies.rs
index 5805bf48..2a76e981 100644
--- a/host/src/tui/manage/replies.rs
+++ b/host/src/tui/manage/replies.rs
@@ -88,17 +88,18 @@ impl App {
}
}
Reply::Library(bot) => self.library_loaded(&bot, v["items"].as_array().map_or(&[], Vec::as_slice)),
- Reply::Gear(bot) => {
- let skills = super::gear::items(&v["skills"]);
- let connectors = super::gear::items(&v["connectors"]);
+ Reply::Gear(backend) => {
+ let lists = super::gear::GearLists {
+ skills: super::gear::items(&v["skills"]),
+ connectors: super::gear::items(&v["connectors"]),
+ rules: super::gear::items(&v["rules"]),
+ plugins: super::gear::items(&v["plugins"]),
+ };
for overlay in &mut self.overlays {
if let Overlay::Gear(gear) = overlay
- && gear.bot == bot
+ && gear.backend == backend
{
- gear.agent_skills = Some(skills.clone());
- gear.agent_connectors = Some(connectors.clone());
- gear.agent_rules = Some(super::gear::items(&v["rules"]));
- gear.agent_plugins = Some(super::gear::items(&v["plugins"]));
+ gear.lists = Some(lists.clone());
gear.failed = false;
}
}
@@ -309,15 +310,17 @@ impl App {
}
self.flash(&e);
}
- Reply::Gear(bot) => {
+ Reply::Gear(backend) => {
for o in &mut self.overlays {
if let Overlay::Gear(gear) = o
- && gear.bot == *bot
+ && gear.backend == *backend
{
- gear.agent_skills.get_or_insert_with(Vec::new);
- gear.agent_connectors.get_or_insert_with(Vec::new);
- gear.agent_rules.get_or_insert_with(Vec::new);
- gear.agent_plugins.get_or_insert_with(Vec::new);
+ gear.lists.get_or_insert_with(|| super::gear::GearLists {
+ skills: Vec::new(),
+ connectors: Vec::new(),
+ rules: Vec::new(),
+ plugins: Vec::new(),
+ });
gear.failed = true;
}
}
@@ -373,11 +376,7 @@ impl App {
Overlay::Library(l) => {
calls.push(("library", json!({"botId": l.bot}), After::Sheet(Reply::Library(l.bot.clone()))));
}
- Overlay::Gear(gear) => {
- gear_ids.push(gear.bot.clone());
- calls.push(("connectors", json!({}), After::Connectors));
- calls.push(("skills", json!({}), After::Skills));
- }
+ Overlay::Gear(gear) => gear_ids.push(gear.backend.clone()),
Overlay::Market(_) | Overlay::Form(_) => {
calls.push(("connectors", json!({}), After::Connectors));
calls.push(("skills", json!({}), After::Skills));
@@ -385,14 +384,8 @@ impl App {
_ => {}
}
}
- for id in gear_ids {
- if let Some(bot) = self.bots.get(&id) {
- calls.push((
- "agentGear",
- json!({"backend": bot.backend, "cwd": bot.cwd}),
- After::Sheet(Reply::Gear(id)),
- ));
- }
+ for backend in gear_ids {
+ calls.push(("agentGear", json!({"backend": backend}), After::Sheet(Reply::Gear(backend))));
}
calls.dedup_by(|a, b| a.0 == b.0 && a.1 == b.1);
for (m, body, after) in calls {
diff --git a/host/src/tui/sheets.rs b/host/src/tui/sheets.rs
index db32835c..e3ac9d81 100644
--- a/host/src/tui/sheets.rs
+++ b/host/src/tui/sheets.rs
@@ -69,27 +69,18 @@ fn name_of(app: &App, bot: &str) -> String {
app.bots.get(bot).map_or_else(String::new, |b| b.name.clone())
}
-/// A bot's pages on two lines: the bot (Details, Library, Memory, Settings), then what its agent
-/// brings (Skills, Connectors, Rules, Plugins). Returns the area under them.
+/// A bot's pages on the top line (Details, Library, Memory, Settings) with this one marked.
+/// Returns the area under it.
pub fn page_tabs(buf: &mut Buffer, inner: Rect, current: Page) -> Rect {
let t = theme();
- let rows: [&[Page]; 2] = [
- &[Page::Details, Page::Library, Page::Memory, Page::Settings],
- &[Page::Skills, Page::Connectors, Page::Rules, Page::Plugins],
- ];
- for (row, pages) in rows.iter().enumerate() {
- let mut x = inner.x;
- let y = inner.y.saturating_add(u16::try_from(row).unwrap_or(0));
- for page in *pages {
- let style = if *page == current { t.text.patch(t.sel) } else { t.secondary.patch(t.panel) };
- let tab = tr(page.label());
- x = put(buf, x, y, inner.right().saturating_sub(x), &format!(" {tab} "), style) + 1;
- }
- if row == 0 {
- rput(buf, inner.right(), y, "⇧←→ page", t.dim.patch(t.panel));
- }
+ let mut x = inner.x;
+ for page in Page::ALL {
+ let style = if page == current { t.text.patch(t.sel) } else { t.secondary.patch(t.panel) };
+ let tab = tr(page.label());
+ x = put(buf, x, inner.y, inner.right().saturating_sub(x), &format!(" {tab} "), style) + 1;
}
- Rect::new(inner.x, inner.y.saturating_add(3), inner.width, inner.height.saturating_sub(3))
+ rput(buf, inner.right(), inner.y, "⇧←→ page", t.dim.patch(t.panel));
+ Rect::new(inner.x, inner.y + 2, inner.width, inner.height.saturating_sub(2))
}
pub fn routines(buf: &mut Buffer, area: Rect, app: &App, l: &RoutineList) {
@@ -335,6 +326,7 @@ pub fn agent(buf: &mut Buffer, area: Rect, app: &App, a: &AgentSetup) {
format!("Downloads {name} on {} if it needs to, then checks its sign-in.", app.host),
),
SetupRow::Check => ("↻", "Check again".to_owned(), String::new()),
+ SetupRow::Brings => ("≡", "What the agent brings".to_owned(), String::new()),
};
let title = tr(&title);
let detail = tr(&detail);
diff --git a/host/src/tui/sheets/gear_view.rs b/host/src/tui/sheets/gear_view.rs
index d322563b..07b2ec8c 100644
--- a/host/src/tui/sheets/gear_view.rs
+++ b/host/src/tui/sheets/gear_view.rs
@@ -1,31 +1,22 @@
-//! The Skills, Connectors, Rules and Plugins pages. Skills and connectors also list Codync's switches.
-//! Every row is one list, so the cursor scrolls agent rows that do not fit.
+//! What an agent already brings, read only. One list, so the cursor scrolls rows that do not fit.
-use super::{App, Buffer, Rect, centered, footer, frame_box, name_of, page_tabs, put, row, theme, truncate, window};
+use super::{App, Buffer, Rect, centered, footer, frame_box, put, row, theme, truncate, window};
use crate::tui::l10n::tr;
-use crate::tui::manage::{Gear, GearKind, GearRow};
+use crate::tui::manage::{Gear, GearRow};
pub fn draw(buf: &mut Buffer, area: Rect, app: &App, gear: &Gear) {
let t = theme();
let frame = centered(area, 90, 28);
- let title = name_of(app, &gear.bot);
+ let title = app.agent_name(&gear.backend);
let inner = frame_box(buf, frame, t.text, t.panel, Some((&title, t.text)));
- let inner = page_tabs(buf, inner, gear.kind.page());
- let agent = app.bots.get(&gear.bot).map(|bot| app.agent_name(&bot.backend)).unwrap_or_default();
- let intro = if gear.kind.passes_on() {
- tr("{agent} brings these. Codync adds its own on top, and those are what get passed to the agent.")
- } else {
- tr("{agent} brings these.")
- }
- .replace("{agent}", &agent);
let mut y = inner.y;
let bottom = inner.bottom().saturating_sub(2);
+ let intro = tr("What the agent brings");
if y < bottom {
put(buf, inner.x, y, inner.width, &intro, t.secondary.patch(t.panel));
y += 2;
}
- let toggles = app.gear_toggles(gear);
- let rows = gear.rows(toggles.len());
+ let rows = gear.rows();
let room = usize::from(bottom.saturating_sub(y));
let cursor = gear.cursor.min(rows.len().saturating_sub(1));
for (offset, line) in rows.iter().enumerate().skip(window(cursor, room)).take(room) {
@@ -34,44 +25,26 @@ pub fn draw(buf: &mut Buffer, area: Rect, app: &App, gear: &Gear) {
}
let base = row(buf, inner, y, offset == cursor);
let (text, style) = match line {
- GearRow::AgentHeading => (tr("From {agent}").replace("{agent}", &agent), t.bold.patch(base)),
- GearRow::AgentNote => {
- let failed = gear.agent().is_some() && gear.failed;
- (agent_note(gear), if failed { t.red.patch(base) } else { t.dim.patch(base) })
+ GearRow::Heading(label) => (format!("{} {}", tr(label), gear.count_of(label)), t.bold.patch(base)),
+ GearRow::Note => {
+ let text = if gear.lists.is_none() && !gear.failed {
+ tr("Loading…")
+ } else if gear.failed {
+ tr("Couldn't load what this agent brings.")
+ } else {
+ tr("None from this agent.")
+ };
+ (text.into(), if gear.failed { t.red.patch(base) } else { t.dim.patch(base) })
}
- GearRow::Agent(index) => {
- let Some(item) = gear.agent().and_then(|items| items.get(*index)) else { continue };
+ GearRow::Item(section, index) => {
+ let Some(item) = gear.item(*section, *index) else { continue };
let text =
if item.detail.is_empty() { item.name.clone() } else { format!("{} {}", item.name, item.detail) };
(text, t.text.patch(base))
}
- GearRow::CodyncHeading => (tr("From Codync").into(), t.bold.patch(base)),
- GearRow::CodyncNote => {
- let empty = match gear.kind {
- GearKind::Skills => "No skills yet. Get some from Extensions, or write your own.",
- GearKind::Connectors => "No connectors yet. Add GitHub, Linear, Notion and more from Extensions.",
- GearKind::Rules | GearKind::Plugins => "None from this agent.",
- };
- (tr(empty).into(), t.dim.patch(base))
- }
- GearRow::Toggle(index) => {
- let Some((_, name, on)) = toggles.get(*index) else { continue };
- (format!("{} {name}", if *on { "☑" } else { "☐" }), t.text.patch(base))
- }
};
put(buf, inner.x, y, inner.width, &truncate(&text, usize::from(inner.width)), style);
y += 1;
}
- let hint = if gear.kind.passes_on() { "space on / off · ⇧←→ page · esc" } else { "⇧←→ page · esc" };
- footer(buf, inner, None, hint);
-}
-
-fn agent_note(gear: &Gear) -> String {
- if gear.agent().is_none() {
- tr("Loading…").into()
- } else if gear.failed {
- tr("Couldn't load what this agent brings.").into()
- } else {
- tr("None from this agent.").into()
- }
+ footer(buf, inner, None, "esc");
}
diff --git a/host/src/tui/view/help.rs b/host/src/tui/view/help.rs
index 0e74ba01..2da3c1ef 100644
--- a/host/src/tui/view/help.rs
+++ b/host/src/tui/view/help.rs
@@ -63,7 +63,7 @@ const HELP: [(&str, &str, &str); 69] = [
("BOTS", "R", "details: routines, computer"),
("BOTS", "B", "details: switch back to the bot's own agent"),
("BOTS", "L", "library: artifacts and files; open, save, rename"),
- ("BOTS", "⇧← ⇧→", "between details, library, memory, settings, skills, connectors, rules and plugins"),
+ ("BOTS", "⇧← ⇧→", "between details, library, memory and settings"),
("BOTS", "A", "extensions, sign-in"),
("BOTS", "x", "delete bot or group"),
("VIEW", "t", "trace pane"),
diff --git a/web/content/docs/bots.mdx b/web/content/docs/bots.mdx
index 7f779ef5..56e483a3 100644
--- a/web/content/docs/bots.mdx
+++ b/web/content/docs/bots.mdx
@@ -18,10 +18,10 @@ The host on your computer runs every bot. A bot's agent starts when you send it
## Where to change a bot's settings
-- **iPhone:** open the bot's chat and tap its name at the top. The first row of tabs is **Details**, **Library**, **Memory** and **Settings**. The second row is **Skills**, **Connectors**, **Rules** and **Plugins**. **Details** shows its instructions, agent, model and routines; **Settings** shows the rest. **Skills** and **Connectors** show what that agent already brings, and the Codync ones passed on top. **Rules** and **Plugins** show what that agent already brings; Codync does not add its own. Changes save as you edit. You can also touch and hold the bot in the list and choose **Edit profile**.
-- **Desktop:** click the bot's name at the top of the chat to open the details panel, with the same two rows of tabs. Changes save as you edit. You can also right-click the bot in the sidebar and choose **Edit Profile…**
+- **iPhone:** open the bot's chat and tap its name at the top. The tabs are **Details**, **Library**, **Memory** and **Settings**. **Details** shows its instructions, agent, model and routines; **Settings** shows the rest, including the Codync skills and connectors it passes on. Changes save as you edit. You can also touch and hold the bot in the list and choose **Edit profile**.
+- **Desktop:** click the bot's name at the top of the chat to open the details panel, with the same tabs. Changes save as you edit. You can also right-click the bot in the sidebar and choose **Edit Profile…**
- **Android:** the same sheet, without **Memory** until that screen is ported.
-- **Terminal UI:** select the bot and press `e` for settings. Shift+Left and Shift+Right move between the same pages, including **Skills**, **Connectors**, **Rules** and **Plugins**. Press Ctrl+S to save, or Esc to drop your changes.
+- **Terminal UI:** select the bot and press `e` for settings. Shift+Left and Shift+Right move between **Details**, **Library**, **Memory** and **Settings**. Press Ctrl+S to save, or Esc to drop your changes.
## Profile
@@ -76,7 +76,9 @@ How approval cards work: [Conversations](/docs/conversations#approval-cards).
## Connectors and skills
-The **Skills** and **Connectors** tabs list two groups. The first is named for the agent (From Claude Code, for example): the skills it already has, and the MCP servers in its config for this bot's folder. Those rows are there to read; Codync does not turn them on or off. **From Codync** is what Codync adds on top and passes to the agent. Each of those has a switch. A new bot starts with all of them on; turn off what a bot shouldn't use. A skill a bot writes for itself is on only for that bot until you turn it on for others. The full editor (Edit profile) still has the same switches. **Rules** and **Plugins** list only what that agent already has in its own files, such as Cursor rules or an installed plugin. Codync does not add rules or plugins, and those rows have no switch. See [Connectors and skills](/docs/connectors-and-skills).
+**Settings** lists the Codync skills and connectors this bot passes on. Each has a switch. A new bot starts with all of them on; turn off what a bot shouldn't use. A skill a bot writes for itself is on only for that bot until you turn it on for others. The full editor (Edit profile) has the same switches.
+
+What the agent already has — its own skills, connectors, rules and plugins — is on that agent's page: **Extensions → Agents**, under **Sign in**. Each list opens to show its name and a short description. Those lists are read only, and they come from the agent's files in your home folder, not from a project. Codync does not add rules or plugins of its own. See [Connectors and skills](/docs/connectors-and-skills).
## Memory and routines
diff --git a/web/content/docs/connectors-and-skills.mdx b/web/content/docs/connectors-and-skills.mdx
index 93ef39cf..7a583e64 100644
--- a/web/content/docs/connectors-and-skills.mdx
+++ b/web/content/docs/connectors-and-skills.mdx
@@ -76,15 +76,15 @@ The cards themselves hold no credentials. You can answer them in the iPhone app,
## Turn connectors and skills on or off per bot
-A connector or skill you add is turned on for every bot, and new bots start with all of them on (without a credential store, as on a [headless Linux server](/docs/linux-servers#limits-on-a-headless-server), new bots start with no connectors). To turn one off for a bot, open the bot and choose **Skills** or **Connectors**. The top group is what that agent already brings. The **From Codync** group is what Codync passes on; each switch there is one you added.
+A connector or skill you add is turned on for every bot, and new bots start with all of them on (without a credential store, as on a [headless Linux server](/docs/linux-servers#limits-on-a-headless-server), new bots start with no connectors). To turn one off for a bot, open the bot and choose **Settings**. Each switch there is one Codync passes on.
-- **Desktop app:** click the bot's name at the top of the chat, then **Skills** or **Connectors**.
-- **iPhone and Android:** tap the bot's name at the top of the chat, then the **Skills** or **Connectors** tab.
-- **Terminal UI:** Shift+Right from settings opens **Skills**, then **Connectors**, **Rules** and **Plugins**. Space toggles a Codync row. The settings form (`e`) still has the same fields.
+- **Desktop app:** click the bot's name at the top of the chat, then **Settings**.
+- **iPhone and Android:** tap the bot's name at the top of the chat, then **Settings**.
+- **Terminal UI:** press `e` on the bot. The settings form has the same switches.
The bot picks up the change on its next turn, in the same conversation.
-**Rules** and **Plugins** are the same kind of list, without a **From Codync** group: the rules files and installed plugins that agent already has. Codync does not pass extra ones on.
+What that agent already brings is on its own page, not the bot's. Open **Extensions → Agents**, choose the agent, and look under **Sign in**. **Skills**, **Connectors**, **Rules** and **Plugins** each show a count and open to the list. The section is left out when the agent has none of them. Those rows are read only. In the terminal, the same lists open from **What the agent brings** on the agent's sign-in sheet.
## Skills