opencode-agent-modes 0.3.2 → 0.4.0

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/index.js CHANGED
@@ -13987,21 +13987,38 @@ class ModeManager {
13987
13987
  return;
13988
13988
  }
13989
13989
  const drifted = await this.hasConfigDrift(preset);
13990
- if (!drifted) {
13990
+ if (drifted) {
13991
+ await this.updateOpencodeConfig(preset.model, preset.opencode);
13992
+ if (preset["oh-my-opencode"]) {
13993
+ await this.updateOhMyOpencodeConfig(preset["oh-my-opencode"]);
13994
+ }
13995
+ const modeName = this.config.currentMode;
13996
+ setTimeout(() => {
13997
+ this.client.tui.showToast({
13998
+ body: {
13999
+ title: "agent-mode-switcher",
14000
+ message: `applied "${modeName}" mode.
14001
+ restart opencode to take effect.`,
14002
+ variant: "warning",
14003
+ duration: 5000
14004
+ }
14005
+ }).catch(() => {});
14006
+ }, 3000);
13991
14007
  return;
13992
14008
  }
13993
- await this.updateOpencodeConfig(preset.model, preset.opencode);
13994
- if (preset["oh-my-opencode"]) {
13995
- await this.updateOhMyOpencodeConfig(preset["oh-my-opencode"]);
14009
+ if (this.config.showToastOnStartup) {
14010
+ const modeName = this.config.currentMode;
14011
+ setTimeout(() => {
14012
+ this.client.tui.showToast({
14013
+ body: {
14014
+ title: "agent-mode-switcher",
14015
+ message: `current mode: ${modeName}`,
14016
+ variant: "info",
14017
+ duration: 3000
14018
+ }
14019
+ }).catch(() => {});
14020
+ }, 3000);
13996
14021
  }
13997
- this.client.tui.showToast({
13998
- body: {
13999
- title: "Mode Applied",
14000
- message: `Applied "${this.config.currentMode}" mode. Restart opencode to take effect.`,
14001
- variant: "warning",
14002
- duration: 5000
14003
- }
14004
- }).catch(() => {});
14005
14022
  }
14006
14023
  async hasConfigDrift(preset) {
14007
14024
  const opencodeConfig = await loadOpencodeConfig();
@@ -69,6 +69,12 @@ export declare class ModeManager {
69
69
  * files are updated to match the expected preset values,
70
70
  * and a toast notification prompts the user to restart.
71
71
  *
72
+ * When no drift is detected and `showToastOnStartup` is enabled,
73
+ * an informational toast displays the current mode name.
74
+ *
75
+ * Toast notifications are delayed via `setTimeout` to allow the
76
+ * OpenCode UI to fully initialize before sending them.
77
+ *
72
78
  * @private
73
79
  */
74
80
  private applyCurrentModeIfNeeded;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-agent-modes",
3
- "version": "0.3.2",
3
+ "version": "0.4.0",
4
4
  "description": "OpenCode plugin to switch agent modes between performance and economy presets",
5
5
  "module": "src/index.ts",
6
6
  "main": "dist/index.js",