opencode-tbot 0.1.22 → 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/plugin.js +10 -4
- package/dist/plugin.js.map +1 -1
- package/package.json +1 -1
package/dist/plugin.js
CHANGED
|
@@ -1407,8 +1407,14 @@ async function resolveOpenCodeConfigFilePath(configPath) {
|
|
|
1407
1407
|
function isMissingFileError(error) {
|
|
1408
1408
|
return error instanceof Error && "code" in error && error.code === "ENOENT";
|
|
1409
1409
|
}
|
|
1410
|
+
function isSelectableAgent(agent) {
|
|
1411
|
+
return !agent.hidden && agent.mode !== "subagent";
|
|
1412
|
+
}
|
|
1413
|
+
function getSelectableAgents(agents) {
|
|
1414
|
+
return agents.filter((agent) => isSelectableAgent(agent));
|
|
1415
|
+
}
|
|
1410
1416
|
function resolveSelectedAgent(agents, requestedAgentName) {
|
|
1411
|
-
const visibleAgents = agents
|
|
1417
|
+
const visibleAgents = getSelectableAgents(agents);
|
|
1412
1418
|
if (requestedAgentName) {
|
|
1413
1419
|
const requestedAgent = visibleAgents.find((agent) => agent.name === requestedAgentName);
|
|
1414
1420
|
if (requestedAgent) return requestedAgent;
|
|
@@ -1455,7 +1461,7 @@ var ListAgentsUseCase = class {
|
|
|
1455
1461
|
}
|
|
1456
1462
|
async execute(input) {
|
|
1457
1463
|
let [binding, agents] = await Promise.all([this.sessionRepo.getByChatId(input.chatId), this.opencodeClient.listAgents()]);
|
|
1458
|
-
const visibleAgents = agents
|
|
1464
|
+
const visibleAgents = getSelectableAgents(agents);
|
|
1459
1465
|
const currentAgent = resolveSelectedAgent(visibleAgents, binding?.agentName);
|
|
1460
1466
|
if (binding?.agentName && currentAgent?.name !== binding.agentName) binding = await clearStoredAgentSelection(this.sessionRepo, binding);
|
|
1461
1467
|
return {
|
|
@@ -1735,7 +1741,7 @@ var SwitchAgentUseCase = class {
|
|
|
1735
1741
|
}
|
|
1736
1742
|
async execute(input) {
|
|
1737
1743
|
const [binding, agents] = await Promise.all([this.sessionRepo.getByChatId(input.chatId), this.opencodeClient.listAgents()]);
|
|
1738
|
-
const agent = agents.find((item) => item.name === input.agentName &&
|
|
1744
|
+
const agent = agents.find((item) => item.name === input.agentName && isSelectableAgent(item));
|
|
1739
1745
|
if (!agent) return { found: false };
|
|
1740
1746
|
await this.sessionRepo.setCurrent({
|
|
1741
1747
|
chatId: input.chatId,
|
|
@@ -3419,7 +3425,7 @@ function compareVariantNames(left, right) {
|
|
|
3419
3425
|
return leftIndex - rightIndex;
|
|
3420
3426
|
}
|
|
3421
3427
|
function formatAgentLabel(agent) {
|
|
3422
|
-
return
|
|
3428
|
+
return agent.name;
|
|
3423
3429
|
}
|
|
3424
3430
|
function formatModelListLine(model, displayIndex) {
|
|
3425
3431
|
return `${displayIndex}. ${formatModelLabel(model)}`;
|