opencode-tbot 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/plugin.js +33 -25
- package/dist/plugin.js.map +1 -1
- package/package.json +1 -1
package/dist/plugin.js
CHANGED
|
@@ -962,13 +962,14 @@ var GetPathUseCase = class {
|
|
|
962
962
|
//#endregion
|
|
963
963
|
//#region src/use-cases/get-status.usecase.ts
|
|
964
964
|
var GetStatusUseCase = class {
|
|
965
|
-
constructor(getHealthUseCase, getPathUseCase, listLspUseCase, listMcpUseCase, listSessionsUseCase, sessionRepo) {
|
|
965
|
+
constructor(getHealthUseCase, getPathUseCase, listLspUseCase, listMcpUseCase, listSessionsUseCase, sessionRepo, voiceTranscriptionEnabled) {
|
|
966
966
|
this.getHealthUseCase = getHealthUseCase;
|
|
967
967
|
this.getPathUseCase = getPathUseCase;
|
|
968
968
|
this.listLspUseCase = listLspUseCase;
|
|
969
969
|
this.listMcpUseCase = listMcpUseCase;
|
|
970
970
|
this.listSessionsUseCase = listSessionsUseCase;
|
|
971
971
|
this.sessionRepo = sessionRepo;
|
|
972
|
+
this.voiceTranscriptionEnabled = voiceTranscriptionEnabled;
|
|
972
973
|
}
|
|
973
974
|
async execute(input) {
|
|
974
975
|
const [health, path, lsp, mcp] = await Promise.allSettled([
|
|
@@ -983,6 +984,7 @@ var GetStatusUseCase = class {
|
|
|
983
984
|
health: mapSettledResult(health),
|
|
984
985
|
path: pathResult,
|
|
985
986
|
plugins,
|
|
987
|
+
voiceRecognition: { enabled: this.voiceTranscriptionEnabled },
|
|
986
988
|
workspace,
|
|
987
989
|
lsp: mapSettledResult(lsp),
|
|
988
990
|
mcp: mapSettledResult(mcp)
|
|
@@ -1601,7 +1603,7 @@ function createContainer(config, opencodeClient, logger) {
|
|
|
1601
1603
|
const listLspUseCase = new ListLspUseCase(sessionRepo, opencodeClient);
|
|
1602
1604
|
const listMcpUseCase = new ListMcpUseCase(sessionRepo, opencodeClient);
|
|
1603
1605
|
const listSessionsUseCase = new ListSessionsUseCase(sessionRepo, opencodeClient);
|
|
1604
|
-
const getStatusUseCase = new GetStatusUseCase(getHealthUseCase, getPathUseCase, listLspUseCase, listMcpUseCase, listSessionsUseCase, sessionRepo);
|
|
1606
|
+
const getStatusUseCase = new GetStatusUseCase(getHealthUseCase, getPathUseCase, listLspUseCase, listMcpUseCase, listSessionsUseCase, sessionRepo, config.openrouter.configured);
|
|
1605
1607
|
const listModelsUseCase = new ListModelsUseCase(sessionRepo, opencodeClient);
|
|
1606
1608
|
const renameSessionUseCase = new RenameSessionUseCase(sessionRepo, opencodeClient, logger);
|
|
1607
1609
|
const sendPromptUseCase = new SendPromptUseCase(sessionRepo, opencodeClient, logger, foregroundSessionTracker);
|
|
@@ -2668,7 +2670,7 @@ function presentStatusMarkdownSection(title, lines) {
|
|
|
2668
2670
|
return [`## ${title}`, ...lines].join("\n");
|
|
2669
2671
|
}
|
|
2670
2672
|
function presentStatusPlainOverviewLines(input, copy, layout) {
|
|
2671
|
-
const lines = [presentPlainStatusBullet(layout.connectivityLabel, input.health.status === "error" ? layout.errorStatus : formatHealthBadge(input.health.data.healthy, layout))];
|
|
2673
|
+
const lines = [presentPlainStatusBullet(layout.connectivityLabel, input.health.status === "error" ? layout.errorStatus : formatHealthBadge(input.health.data.healthy, layout)), presentPlainStatusBullet(layout.voiceRecognitionLabel, formatVoiceRecognitionBadge(input.voiceRecognition.enabled))];
|
|
2672
2674
|
if (input.health.status === "error") return [
|
|
2673
2675
|
...lines,
|
|
2674
2676
|
...presentStatusPlainErrorDetailLines(input.health.error, copy, layout),
|
|
@@ -2681,7 +2683,7 @@ function presentStatusPlainOverviewLines(input, copy, layout) {
|
|
|
2681
2683
|
];
|
|
2682
2684
|
}
|
|
2683
2685
|
function presentStatusMarkdownOverviewLines(input, copy, layout) {
|
|
2684
|
-
const lines = [presentMarkdownStatusBullet(layout.connectivityLabel, input.health.status === "error" ? layout.errorStatus : formatHealthBadge(input.health.data.healthy, layout))];
|
|
2686
|
+
const lines = [presentMarkdownStatusBullet(layout.connectivityLabel, input.health.status === "error" ? layout.errorStatus : formatHealthBadge(input.health.data.healthy, layout)), presentMarkdownStatusBullet(layout.voiceRecognitionLabel, formatVoiceRecognitionBadge(input.voiceRecognition.enabled))];
|
|
2685
2687
|
if (input.health.status === "error") return [
|
|
2686
2688
|
...lines,
|
|
2687
2689
|
...presentStatusMarkdownErrorDetailLines(input.health.error, copy, layout),
|
|
@@ -2695,21 +2697,21 @@ function presentStatusMarkdownOverviewLines(input, copy, layout) {
|
|
|
2695
2697
|
}
|
|
2696
2698
|
function presentStatusPlainWorkspaceLines(input, copy, layout) {
|
|
2697
2699
|
if (input.workspace.status === "error") return presentStatusPlainErrorLines(input.workspace.error, copy, layout);
|
|
2698
|
-
return [presentPlainStatusBullet(layout.currentProjectLabel, input.workspace.data.currentProject), presentPlainStatusBullet(layout.currentSessionLabel, input.workspace.data.currentSession ??
|
|
2700
|
+
return [presentPlainStatusBullet(layout.currentProjectLabel, input.workspace.data.currentProject), presentPlainStatusBullet(layout.currentSessionLabel, input.workspace.data.currentSession ?? layout.defaultSessionValue)];
|
|
2699
2701
|
}
|
|
2700
2702
|
function presentStatusMarkdownWorkspaceLines(input, copy, layout) {
|
|
2701
2703
|
if (input.workspace.status === "error") return presentStatusMarkdownErrorLines(input.workspace.error, copy, layout);
|
|
2702
|
-
return [presentMarkdownStatusBullet(layout.currentProjectLabel, input.workspace.data.currentProject, { codeValue: true }), presentMarkdownStatusBullet(layout.currentSessionLabel, input.workspace.data.currentSession ??
|
|
2704
|
+
return [presentMarkdownStatusBullet(layout.currentProjectLabel, input.workspace.data.currentProject, { codeValue: true }), presentMarkdownStatusBullet(layout.currentSessionLabel, input.workspace.data.currentSession ?? layout.defaultSessionValue)];
|
|
2703
2705
|
}
|
|
2704
2706
|
function presentStatusPlainPluginLines(input, copy, layout) {
|
|
2705
2707
|
if (input.plugins.status === "error") return presentStatusPlainErrorLines(input.plugins.error, copy, layout);
|
|
2706
2708
|
if (input.plugins.data.plugins.length === 0) return [...presentPlainEmptyStatusLines(layout.noPluginsMessage, layout)];
|
|
2707
|
-
return
|
|
2709
|
+
return input.plugins.data.plugins.map((plugin) => `- ${plugin}`);
|
|
2708
2710
|
}
|
|
2709
2711
|
function presentStatusMarkdownPluginLines(input, copy, layout) {
|
|
2710
2712
|
if (input.plugins.status === "error") return presentStatusMarkdownErrorLines(input.plugins.error, copy, layout);
|
|
2711
2713
|
if (input.plugins.data.plugins.length === 0) return [...presentMarkdownEmptyStatusLines(layout.noPluginsMessage, layout)];
|
|
2712
|
-
return
|
|
2714
|
+
return input.plugins.data.plugins.map((plugin) => `- \`${plugin}\``);
|
|
2713
2715
|
}
|
|
2714
2716
|
function presentStatusPlainLspLines(input, copy, layout) {
|
|
2715
2717
|
if (input.lsp.status === "error") return presentStatusPlainErrorLines(input.lsp.error, copy, layout);
|
|
@@ -2738,24 +2740,12 @@ function presentStatusMarkdownLspLines(input, copy, layout) {
|
|
|
2738
2740
|
function presentStatusPlainMcpLines(input, copy, layout) {
|
|
2739
2741
|
if (input.mcp.status === "error") return presentStatusPlainErrorLines(input.mcp.error, copy, layout);
|
|
2740
2742
|
if (input.mcp.data.statuses.length === 0) return presentPlainEmptyStatusLines(copy.mcp.none, layout);
|
|
2741
|
-
return input.mcp.data.statuses.flatMap(({ name, status }) => presentPlainStatusGroup(name,
|
|
2742
|
-
label: layout.statusLabel,
|
|
2743
|
-
value: formatMcpStatusBadge(status, layout)
|
|
2744
|
-
}, {
|
|
2745
|
-
label: layout.mcpNotesLabel,
|
|
2746
|
-
value: formatMcpStatusNotes(status, copy, layout)
|
|
2747
|
-
}]));
|
|
2743
|
+
return input.mcp.data.statuses.flatMap(({ name, status }) => presentPlainStatusGroup(name, getMcpStatusDetailLines(status, copy, layout)));
|
|
2748
2744
|
}
|
|
2749
2745
|
function presentStatusMarkdownMcpLines(input, copy, layout) {
|
|
2750
2746
|
if (input.mcp.status === "error") return presentStatusMarkdownErrorLines(input.mcp.error, copy, layout);
|
|
2751
2747
|
if (input.mcp.data.statuses.length === 0) return presentMarkdownEmptyStatusLines(copy.mcp.none, layout);
|
|
2752
|
-
return input.mcp.data.statuses.flatMap(({ name, status }) => presentMarkdownStatusGroup(name,
|
|
2753
|
-
label: layout.statusLabel,
|
|
2754
|
-
value: formatMcpStatusBadge(status, layout)
|
|
2755
|
-
}, {
|
|
2756
|
-
label: layout.mcpNotesLabel,
|
|
2757
|
-
value: formatMcpStatusNotes(status, copy, layout)
|
|
2758
|
-
}], { codeName: true }));
|
|
2748
|
+
return input.mcp.data.statuses.flatMap(({ name, status }) => presentMarkdownStatusGroup(name, getMcpStatusDetailLines(status, copy, layout), { codeName: true }));
|
|
2759
2749
|
}
|
|
2760
2750
|
function presentStatusPlainErrorLines(error, copy, layout) {
|
|
2761
2751
|
return [presentPlainStatusBullet(layout.statusLabel, layout.errorStatus), ...presentStatusPlainErrorDetailLines(error, copy, layout)];
|
|
@@ -2793,6 +2783,9 @@ function splitStatusLines(text) {
|
|
|
2793
2783
|
function formatHealthBadge(healthy, layout) {
|
|
2794
2784
|
return healthy ? "🟢" : layout.errorStatus;
|
|
2795
2785
|
}
|
|
2786
|
+
function formatVoiceRecognitionBadge(enabled) {
|
|
2787
|
+
return enabled ? "🟢" : "⚪";
|
|
2788
|
+
}
|
|
2796
2789
|
function formatLspStatusBadge(status) {
|
|
2797
2790
|
switch (status.status) {
|
|
2798
2791
|
case "connected": return "🟢";
|
|
@@ -2810,10 +2803,23 @@ function formatMcpStatusBadge(status, layout) {
|
|
|
2810
2803
|
}
|
|
2811
2804
|
return status;
|
|
2812
2805
|
}
|
|
2806
|
+
function getMcpStatusDetailLines(status, copy, layout) {
|
|
2807
|
+
const notes = formatMcpStatusNotes(status, copy, layout);
|
|
2808
|
+
return notes ? [{
|
|
2809
|
+
label: layout.statusLabel,
|
|
2810
|
+
value: formatMcpStatusBadge(status, layout)
|
|
2811
|
+
}, {
|
|
2812
|
+
label: layout.mcpNotesLabel,
|
|
2813
|
+
value: notes
|
|
2814
|
+
}] : [{
|
|
2815
|
+
label: layout.statusLabel,
|
|
2816
|
+
value: formatMcpStatusBadge(status, layout)
|
|
2817
|
+
}];
|
|
2818
|
+
}
|
|
2813
2819
|
function formatMcpStatusNotes(status, copy, layout) {
|
|
2814
2820
|
switch (status.status) {
|
|
2815
2821
|
case "connected": return layout.okLabel;
|
|
2816
|
-
case "disabled": return
|
|
2822
|
+
case "disabled": return null;
|
|
2817
2823
|
case "needs_auth": return copy.mcp.needsAuth;
|
|
2818
2824
|
case "failed": return status.error;
|
|
2819
2825
|
case "needs_client_registration": return status.error;
|
|
@@ -2830,9 +2836,9 @@ function normalizeStatusInlineValue(value) {
|
|
|
2830
2836
|
function getStatusLayoutCopy(copy) {
|
|
2831
2837
|
if (copy.systemStatus.title === BOT_COPY.systemStatus.title) return {
|
|
2832
2838
|
connectivityLabel: "Connectivity",
|
|
2833
|
-
configuredPluginsLabel: "Configured Plugins",
|
|
2834
2839
|
currentProjectLabel: "Current Project",
|
|
2835
2840
|
currentSessionLabel: "Current Session",
|
|
2841
|
+
defaultSessionValue: "OpenCode Default",
|
|
2836
2842
|
detailsLabel: "Details",
|
|
2837
2843
|
errorStatus: "🔴",
|
|
2838
2844
|
lspTitle: "🧠 LSP",
|
|
@@ -2850,13 +2856,14 @@ function getStatusLayoutCopy(copy) {
|
|
|
2850
2856
|
rootLabel: "Root",
|
|
2851
2857
|
statusLabel: "Status",
|
|
2852
2858
|
tbotVersionLabel: "opencode-tbot Version",
|
|
2859
|
+
voiceRecognitionLabel: "Voice Recognition",
|
|
2853
2860
|
workspaceTitle: "📁 Workspace"
|
|
2854
2861
|
};
|
|
2855
2862
|
return {
|
|
2856
2863
|
connectivityLabel: "连通性",
|
|
2857
|
-
configuredPluginsLabel: "已配置插件",
|
|
2858
2864
|
currentProjectLabel: "当前项目",
|
|
2859
2865
|
currentSessionLabel: "当前会话",
|
|
2866
|
+
defaultSessionValue: "OpenCode 默认",
|
|
2860
2867
|
detailsLabel: "详情",
|
|
2861
2868
|
errorStatus: "🔴",
|
|
2862
2869
|
lspTitle: "🧠 LSP",
|
|
@@ -2874,6 +2881,7 @@ function getStatusLayoutCopy(copy) {
|
|
|
2874
2881
|
rootLabel: "根目录",
|
|
2875
2882
|
statusLabel: "状态",
|
|
2876
2883
|
tbotVersionLabel: "opencode-tbot版本",
|
|
2884
|
+
voiceRecognitionLabel: "语音识别",
|
|
2877
2885
|
workspaceTitle: "📁 工作区"
|
|
2878
2886
|
};
|
|
2879
2887
|
}
|