mastracode 0.3.0 → 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.
Files changed (102) hide show
  1. package/CHANGELOG.md +132 -0
  2. package/README.md +60 -12
  3. package/dist/agents/instructions.d.ts.map +1 -1
  4. package/dist/agents/model.d.ts +4 -1
  5. package/dist/agents/model.d.ts.map +1 -1
  6. package/dist/auth/claude-max-warning.d.ts +9 -0
  7. package/dist/auth/claude-max-warning.d.ts.map +1 -0
  8. package/dist/{chunk-7TFV3VBB.cjs → chunk-C4X3C2DL.cjs} +1091 -607
  9. package/dist/chunk-C4X3C2DL.cjs.map +1 -0
  10. package/dist/{chunk-7K5VFY2N.cjs → chunk-K4WJUBEC.cjs} +151 -48
  11. package/dist/chunk-K4WJUBEC.cjs.map +1 -0
  12. package/dist/{chunk-HHX6BKLR.js → chunk-M5LKPQB4.js} +12 -11
  13. package/dist/chunk-M5LKPQB4.js.map +1 -0
  14. package/dist/{chunk-V4HZ2AVV.js → chunk-REVOTI2T.js} +143 -38
  15. package/dist/chunk-REVOTI2T.js.map +1 -0
  16. package/dist/{chunk-C6XKRHRK.cjs → chunk-S5ZLN7DR.cjs} +6 -2
  17. package/dist/chunk-S5ZLN7DR.cjs.map +1 -0
  18. package/dist/{chunk-VRZZSUQE.js → chunk-SM3QCOA7.js} +6 -3
  19. package/dist/chunk-SM3QCOA7.js.map +1 -0
  20. package/dist/{chunk-LYETHS2L.js → chunk-X3BGE7CL.js} +877 -394
  21. package/dist/chunk-X3BGE7CL.js.map +1 -0
  22. package/dist/{chunk-VZFPT5N7.cjs → chunk-Z4QRXVST.cjs} +62 -61
  23. package/dist/chunk-Z4QRXVST.cjs.map +1 -0
  24. package/dist/cli.cjs +20 -10
  25. package/dist/cli.cjs.map +1 -1
  26. package/dist/cli.js +14 -4
  27. package/dist/cli.js.map +1 -1
  28. package/dist/docs/SKILL.md +30 -0
  29. package/dist/docs/assets/SOURCE_MAP.json +11 -0
  30. package/dist/docs/references/docs-mastra-code-configuration.md +299 -0
  31. package/dist/docs/references/docs-mastra-code-customization.md +228 -0
  32. package/dist/docs/references/docs-mastra-code-modes.md +104 -0
  33. package/dist/docs/references/docs-mastra-code-overview.md +135 -0
  34. package/dist/docs/references/docs-mastra-code-tools.md +229 -0
  35. package/dist/docs/references/reference-mastra-code-createMastraCode.md +108 -0
  36. package/dist/index.cjs +2 -2
  37. package/dist/index.js +1 -1
  38. package/dist/onboarding/onboarding-inline.d.ts +5 -0
  39. package/dist/onboarding/onboarding-inline.d.ts.map +1 -1
  40. package/dist/onboarding/settings.d.ts +3 -0
  41. package/dist/onboarding/settings.d.ts.map +1 -1
  42. package/dist/providers/openai-codex.d.ts +5 -1
  43. package/dist/providers/openai-codex.d.ts.map +1 -1
  44. package/dist/schema.d.ts +7 -1
  45. package/dist/schema.d.ts.map +1 -1
  46. package/dist/storage-PO4VN5NF.cjs +24 -0
  47. package/dist/{storage-JFFX7LJJ.cjs.map → storage-PO4VN5NF.cjs.map} +1 -1
  48. package/dist/storage-PQOHJLBI.js +3 -0
  49. package/dist/{storage-52Y5MKTG.js.map → storage-PQOHJLBI.js.map} +1 -1
  50. package/dist/tui/claude-max-warning.d.ts +18 -0
  51. package/dist/tui/claude-max-warning.d.ts.map +1 -0
  52. package/dist/tui/command-dispatch.d.ts.map +1 -1
  53. package/dist/tui/commands/index.d.ts +1 -0
  54. package/dist/tui/commands/index.d.ts.map +1 -1
  55. package/dist/tui/commands/login.d.ts.map +1 -1
  56. package/dist/tui/commands/models-pack.d.ts.map +1 -1
  57. package/dist/tui/commands/settings.d.ts.map +1 -1
  58. package/dist/tui/commands/skills.d.ts.map +1 -1
  59. package/dist/tui/commands/theme.d.ts +6 -0
  60. package/dist/tui/commands/theme.d.ts.map +1 -0
  61. package/dist/tui/commands/think.d.ts +1 -1
  62. package/dist/tui/commands/think.d.ts.map +1 -1
  63. package/dist/tui/components/banner.d.ts.map +1 -1
  64. package/dist/tui/components/diff-output.d.ts.map +1 -1
  65. package/dist/tui/components/help-overlay.d.ts.map +1 -1
  66. package/dist/tui/components/obi-loader.d.ts.map +1 -1
  67. package/dist/tui/components/settings.d.ts +1 -0
  68. package/dist/tui/components/settings.d.ts.map +1 -1
  69. package/dist/tui/components/shell-output.d.ts.map +1 -1
  70. package/dist/tui/components/task-progress.d.ts.map +1 -1
  71. package/dist/tui/components/thinking-settings.d.ts +11 -22
  72. package/dist/tui/components/thinking-settings.d.ts.map +1 -1
  73. package/dist/tui/components/tool-execution-enhanced.d.ts.map +1 -1
  74. package/dist/tui/detect-theme.d.ts +17 -0
  75. package/dist/tui/detect-theme.d.ts.map +1 -0
  76. package/dist/tui/event-dispatch.d.ts.map +1 -1
  77. package/dist/tui/handlers/agent-lifecycle.d.ts.map +1 -1
  78. package/dist/tui/index.d.ts +2 -2
  79. package/dist/tui/index.d.ts.map +1 -1
  80. package/dist/tui/mastra-tui.d.ts +8 -0
  81. package/dist/tui/mastra-tui.d.ts.map +1 -1
  82. package/dist/tui/render-messages.d.ts.map +1 -1
  83. package/dist/tui/setup.d.ts.map +1 -1
  84. package/dist/tui/status-line.d.ts.map +1 -1
  85. package/dist/tui/theme.d.ts +33 -20
  86. package/dist/tui/theme.d.ts.map +1 -1
  87. package/dist/tui.cjs +27 -19
  88. package/dist/tui.js +2 -2
  89. package/dist/utils/project.d.ts +5 -0
  90. package/dist/utils/project.d.ts.map +1 -1
  91. package/dist/utils/slash-command-processor.d.ts.map +1 -1
  92. package/package.json +8 -8
  93. package/dist/chunk-7K5VFY2N.cjs.map +0 -1
  94. package/dist/chunk-7TFV3VBB.cjs.map +0 -1
  95. package/dist/chunk-C6XKRHRK.cjs.map +0 -1
  96. package/dist/chunk-HHX6BKLR.js.map +0 -1
  97. package/dist/chunk-LYETHS2L.js.map +0 -1
  98. package/dist/chunk-V4HZ2AVV.js.map +0 -1
  99. package/dist/chunk-VRZZSUQE.js.map +0 -1
  100. package/dist/chunk-VZFPT5N7.cjs.map +0 -1
  101. package/dist/storage-52Y5MKTG.js +0 -3
  102. package/dist/storage-JFFX7LJJ.cjs +0 -24
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunk7K5VFY2N_cjs = require('./chunk-7K5VFY2N.cjs');
4
- var chunkC6XKRHRK_cjs = require('./chunk-C6XKRHRK.cjs');
3
+ var chunkK4WJUBEC_cjs = require('./chunk-K4WJUBEC.cjs');
4
+ var chunkS5ZLN7DR_cjs = require('./chunk-S5ZLN7DR.cjs');
5
5
  var chunkMT3YCFCC_cjs = require('./chunk-MT3YCFCC.cjs');
6
6
  var piTui = require('@mariozechner/pi-tui');
7
7
  var chalk10 = require('chalk');
@@ -40,6 +40,9 @@ var path4__namespace = /*#__PURE__*/_interopNamespace(path4);
40
40
  var os__namespace = /*#__PURE__*/_interopNamespace(os);
41
41
  var yaml__namespace = /*#__PURE__*/_interopNamespace(yaml);
42
42
 
43
+ // src/auth/claude-max-warning.ts
44
+ var ANTHROPIC_OAUTH_PROVIDER_ID = "anthropic";
45
+ var CLAUDE_MAX_OAUTH_WARNING_MESSAGE = "OAuth with a Claude Max plan is a grey area. Anthropic has reportedly banned users for using Claude max credentials outside of Claude Code, and it may violate Anthropic Terms of Service. Proceed at your own risk.";
43
46
  var OnboardingInlineComponent = class extends piTui.Container {
44
47
  tui;
45
48
  options;
@@ -99,6 +102,10 @@ var OnboardingInlineComponent = class extends piTui.Container {
99
102
  this.selectedOmPack = packs[0];
100
103
  }
101
104
  }
105
+ /** Update whether the user has any provider access (e.g. after a login). */
106
+ updateHasProviderAccess(hasAccess) {
107
+ this.options.hasProviderAccess = hasAccess;
108
+ }
102
109
  // ---------------------------------------------------------------------------
103
110
  // Rendering helpers
104
111
  // ---------------------------------------------------------------------------
@@ -115,6 +122,8 @@ var OnboardingInlineComponent = class extends piTui.Container {
115
122
  return this.renderWelcome();
116
123
  case "auth":
117
124
  return this.renderAuth();
125
+ case "claudeMaxWarning":
126
+ return this.renderClaudeMaxWarning();
118
127
  case "modePack":
119
128
  return this.renderModePack();
120
129
  case "omPack":
@@ -128,7 +137,7 @@ var OnboardingInlineComponent = class extends piTui.Container {
128
137
  stepCount = 0;
129
138
  makeBox() {
130
139
  this.clearStep();
131
- this.stepBox = new piTui.Box(1, 1, (text) => chunk7K5VFY2N_cjs.theme.bg("toolPendingBg", text));
140
+ this.stepBox = new piTui.Box(1, 1, (text) => chunkK4WJUBEC_cjs.theme.bg("toolPendingBg", text));
132
141
  if (this.stepCount > 0) {
133
142
  this.addChild(new piTui.Spacer(1));
134
143
  }
@@ -141,16 +150,16 @@ var OnboardingInlineComponent = class extends piTui.Container {
141
150
  // ---------------------------------------------------------------------------
142
151
  renderWelcome() {
143
152
  const box = this.makeBox();
144
- box.addChild(new piTui.Text(chunk7K5VFY2N_cjs.bold(chunk7K5VFY2N_cjs.fg("accent", "\u{1F44B} Welcome to Mastra Code")), 0, 0));
153
+ box.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", "\u{1F44B} Welcome to Mastra Code")), 0, 0));
145
154
  box.addChild(new piTui.Spacer(1));
146
- box.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("text", "Let's configure your models and preferences."), 0, 0));
155
+ box.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("text", "Let's configure your models and preferences."), 0, 0));
147
156
  box.addChild(new piTui.Text(chalk10__default.default.white("You can re-run this anytime with /setup."), 0, 0));
148
157
  box.addChild(new piTui.Spacer(1));
149
158
  const items = [
150
- { value: "continue", label: ` ${chunk7K5VFY2N_cjs.fg("success", "Continue")}` },
151
- { value: "skip", label: ` ${chunk7K5VFY2N_cjs.fg("dim", "Skip")}` }
159
+ { value: "continue", label: ` ${chunkK4WJUBEC_cjs.theme.fg("success", "Continue")}` },
160
+ { value: "skip", label: ` ${chunkK4WJUBEC_cjs.theme.fg("dim", "Skip")}` }
152
161
  ];
153
- this.selectList = new piTui.SelectList(items, items.length, chunk7K5VFY2N_cjs.getSelectListTheme());
162
+ this.selectList = new piTui.SelectList(items, items.length, chunkK4WJUBEC_cjs.getSelectListTheme());
154
163
  this.selectList.onSelect = (item) => {
155
164
  if (item.value === "continue") {
156
165
  this.collapseStep("Welcome");
@@ -173,25 +182,31 @@ var OnboardingInlineComponent = class extends piTui.Container {
173
182
  // ---------------------------------------------------------------------------
174
183
  renderAuth() {
175
184
  const box = this.makeBox();
176
- box.addChild(new piTui.Text(chunk7K5VFY2N_cjs.bold(chunk7K5VFY2N_cjs.fg("accent", "\u{1F511} Authentication")), 0, 0));
185
+ box.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", "\u{1F511} Authentication")), 0, 0));
177
186
  box.addChild(new piTui.Spacer(1));
178
187
  const providers = this.options.authProviders;
179
188
  if (providers.length === 0) {
180
- box.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("dim", "No OAuth providers available. Skipping."), 0, 0));
189
+ box.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("dim", "No OAuth providers available. Skipping."), 0, 0));
181
190
  setTimeout(() => this.renderStep("modePack"), 100);
182
191
  return;
183
192
  }
184
- box.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("text", "Log in with an AI provider to use your subscription:"), 0, 0));
193
+ box.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("text", "Log in with an AI provider to use your subscription,"), 0, 0));
194
+ box.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("text", "or skip if you have API keys configured as environment variables."), 0, 0));
185
195
  box.addChild(new piTui.Spacer(1));
186
196
  const items = providers.map((p) => ({
187
197
  value: p.value,
188
- label: p.loggedIn ? ` ${p.label} ${chunk7K5VFY2N_cjs.fg("success", "\u2713 logged in")}` : ` ${p.label}`
198
+ label: p.loggedIn ? ` ${p.label} ${chunkK4WJUBEC_cjs.theme.fg("success", "\u2713 logged in")}` : ` ${p.label}`
189
199
  }));
190
- items.push({ value: "__skip", label: ` ${chunk7K5VFY2N_cjs.fg("dim", "Skip (configure later with /login)")}` });
191
- this.selectList = new piTui.SelectList(items, Math.min(items.length, 8), chunk7K5VFY2N_cjs.getSelectListTheme());
200
+ items.push({
201
+ value: "__skip",
202
+ label: ` ${chunkK4WJUBEC_cjs.theme.fg("dim", "Skip (use API keys or configure later with /login)")}`
203
+ });
204
+ this.selectList = new piTui.SelectList(items, Math.min(items.length, 8), chunkK4WJUBEC_cjs.getSelectListTheme());
192
205
  this.selectList.onSelect = (item) => {
193
206
  if (item.value === "__skip") {
194
207
  this.renderStep("modePack");
208
+ } else if (item.value === ANTHROPIC_OAUTH_PROVIDER_ID) {
209
+ this.renderStep("claudeMaxWarning");
195
210
  } else {
196
211
  this.loginRequested = true;
197
212
  this.loginProvider = item.value;
@@ -205,7 +220,39 @@ var OnboardingInlineComponent = class extends piTui.Container {
205
220
  };
206
221
  box.addChild(this.selectList);
207
222
  box.addChild(new piTui.Spacer(1));
208
- box.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("dim", "\u2191\u2193 navigate \xB7 Enter select \xB7 Esc skip"), 0, 0));
223
+ box.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("dim", "\u2191\u2193 navigate \xB7 Enter select \xB7 Esc skip"), 0, 0));
224
+ }
225
+ // ---------------------------------------------------------------------------
226
+ // Step: Claude Max OAuth Warning
227
+ // ---------------------------------------------------------------------------
228
+ renderClaudeMaxWarning() {
229
+ const box = this.makeBox();
230
+ box.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("warning", "\u26A0 Claude Max OAuth Warning")), 0, 0));
231
+ box.addChild(new piTui.Spacer(1));
232
+ box.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("text", CLAUDE_MAX_OAUTH_WARNING_MESSAGE), 0, 0));
233
+ box.addChild(new piTui.Spacer(1));
234
+ const items = [
235
+ { value: "continue", label: ` ${chunkK4WJUBEC_cjs.theme.fg("success", "Continue")}` },
236
+ { value: "cancel", label: ` ${chunkK4WJUBEC_cjs.theme.fg("dim", "Cancel")}` }
237
+ ];
238
+ this.selectList = new piTui.SelectList(items, items.length, chunkK4WJUBEC_cjs.getSelectListTheme());
239
+ this.selectList.onSelect = (item) => {
240
+ if (item.value === "continue") {
241
+ this.loginRequested = true;
242
+ this.loginProvider = ANTHROPIC_OAUTH_PROVIDER_ID;
243
+ this.options.onLogin(ANTHROPIC_OAUTH_PROVIDER_ID, () => {
244
+ this.renderStep("modePack");
245
+ });
246
+ } else {
247
+ this.renderStep("auth");
248
+ }
249
+ };
250
+ this.selectList.onCancel = () => {
251
+ this.renderStep("auth");
252
+ };
253
+ box.addChild(this.selectList);
254
+ box.addChild(new piTui.Spacer(1));
255
+ box.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("dim", "\u2191\u2193 navigate \xB7 Enter select \xB7 Esc go back"), 0, 0));
209
256
  }
210
257
  // ---------------------------------------------------------------------------
211
258
  // Step: Mode pack
@@ -214,34 +261,35 @@ var OnboardingInlineComponent = class extends piTui.Container {
214
261
  modePackDetail;
215
262
  renderModePack() {
216
263
  const packs = this.options.modePacks;
217
- const hasProviderPack = packs.some((p) => !p.id.startsWith("custom"));
218
- if (!hasProviderPack) {
264
+ if (!this.options.hasProviderAccess) {
219
265
  const box2 = this.makeBox();
220
- box2.addChild(new piTui.Text(chunk7K5VFY2N_cjs.bold(chunk7K5VFY2N_cjs.fg("error", "No model providers configured")), 0, 0));
266
+ box2.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("error", "No model providers configured")), 0, 0));
221
267
  box2.addChild(new piTui.Spacer(1));
222
- box2.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("text", "To use Mastra Code you need at least one API key or OAuth login"), 0, 0));
223
- box2.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("text", "for Anthropic, OpenAI, or another supported provider."), 0, 0));
268
+ box2.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("text", "To use Mastra Code you need at least one API key or OAuth login"), 0, 0));
269
+ box2.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("text", "for Anthropic, OpenAI, or another supported provider."), 0, 0));
224
270
  box2.addChild(new piTui.Spacer(1));
225
271
  box2.addChild(
226
- new piTui.Text(chunk7K5VFY2N_cjs.fg("dim", "See https://mastra.ai/docs/models for supported providers and API key env vars."), 0, 0)
272
+ new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("dim", "See https://mastra.ai/models for supported providers and API key env vars."), 0, 0)
227
273
  );
228
274
  box2.addChild(new piTui.Spacer(1));
229
- box2.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("dim", "Set an API key and restart, or run /login to authenticate via OAuth."), 0, 0));
275
+ box2.addChild(
276
+ new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("dim", "Set an API key and restart, or run /login to authenticate via OAuth."), 0, 0)
277
+ );
230
278
  this._finished = true;
231
279
  setTimeout(() => process.exit(1), 3e3);
232
280
  return;
233
281
  }
234
282
  const box = this.makeBox();
235
- box.addChild(new piTui.Text(chunk7K5VFY2N_cjs.bold(chunk7K5VFY2N_cjs.fg("accent", "Model Packs")), 0, 0));
283
+ box.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", "Model Packs")), 0, 0));
236
284
  box.addChild(new piTui.Spacer(1));
237
- box.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("text", "Choose default models for each mode (build / plan / fast):"), 0, 0));
285
+ box.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("text", "Choose default models for each mode (build / plan / fast):"), 0, 0));
238
286
  box.addChild(new piTui.Spacer(1));
239
287
  const prevId = this.options.previous?.modePackId ?? null;
240
288
  const items = packs.map((p) => ({
241
289
  value: p.id,
242
- label: ` ${p.name} ${chunk7K5VFY2N_cjs.fg("dim", p.description)}${p.id === prevId ? chunk7K5VFY2N_cjs.fg("dim", " (current)") : ""}`
290
+ label: ` ${p.name} ${chunkK4WJUBEC_cjs.theme.fg("dim", p.description)}${p.id === prevId ? chunkK4WJUBEC_cjs.theme.fg("dim", " (current)") : ""}`
243
291
  }));
244
- this.selectList = new piTui.SelectList(items, items.length, chunk7K5VFY2N_cjs.getSelectListTheme());
292
+ this.selectList = new piTui.SelectList(items, items.length, chunkK4WJUBEC_cjs.getSelectListTheme());
245
293
  const prevIdx = prevId ? packs.findIndex((p) => p.id === prevId) : -1;
246
294
  if (prevIdx > 0) this.selectList.setSelectedIndex(prevIdx);
247
295
  this.selectList.onSelect = (item) => {
@@ -250,12 +298,12 @@ var OnboardingInlineComponent = class extends piTui.Container {
250
298
  this.runCustomPackFlow();
251
299
  } else {
252
300
  this.selectedModePack = pack;
253
- this.collapseStep(`Model pack \u2192 ${chunk7K5VFY2N_cjs.bold(this.selectedModePack.name)}`);
301
+ this.collapseStep(`Model pack \u2192 ${chunkK4WJUBEC_cjs.theme.bold(this.selectedModePack.name)}`);
254
302
  this.renderStep("omPack");
255
303
  }
256
304
  };
257
305
  this.selectList.onCancel = () => {
258
- this.collapseStep(`Model pack \u2192 ${chunk7K5VFY2N_cjs.bold(this.selectedModePack.name)} (default)`);
306
+ this.collapseStep(`Model pack \u2192 ${chunkK4WJUBEC_cjs.theme.bold(this.selectedModePack.name)} (default)`);
259
307
  this.renderStep("omPack");
260
308
  };
261
309
  this.selectList.onSelectionChange = (item) => {
@@ -268,18 +316,18 @@ var OnboardingInlineComponent = class extends piTui.Container {
268
316
  const initialId = prevIdx > 0 ? packs[prevIdx].id : packs[0].id;
269
317
  this.updateModePackDetail(packs, initialId);
270
318
  box.addChild(new piTui.Spacer(1));
271
- box.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("dim", "\u2191\u2193 navigate \xB7 Enter select \xB7 Esc use default"), 0, 0));
319
+ box.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("dim", "\u2191\u2193 navigate \xB7 Enter select \xB7 Esc use default"), 0, 0));
272
320
  }
273
321
  updateModePackDetail(packs, highlightedId) {
274
322
  const pack = packs.find((p) => p.id === highlightedId);
275
323
  if (!pack || !this.modePackDetail) return;
276
324
  if (pack.id === "custom") {
277
- this.modePackDetail.setText(chunk7K5VFY2N_cjs.fg("dim", " You'll pick a model for each mode in the next steps."));
325
+ this.modePackDetail.setText(chunkK4WJUBEC_cjs.theme.fg("dim", " You'll pick a model for each mode in the next steps."));
278
326
  } else {
279
327
  const detail = [
280
- ` ${chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.blue)("plan")} \u2192 ${chunk7K5VFY2N_cjs.fg("text", pack.models.plan)}`,
281
- ` ${chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.purple)("build")} \u2192 ${chunk7K5VFY2N_cjs.fg("text", pack.models.build)}`,
282
- ` ${chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.green)("fast")} \u2192 ${chunk7K5VFY2N_cjs.fg("text", pack.models.fast)}`
328
+ ` ${chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.blue)("plan")} \u2192 ${chunkK4WJUBEC_cjs.theme.fg("text", pack.models.plan)}`,
329
+ ` ${chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.purple)("build")} \u2192 ${chunkK4WJUBEC_cjs.theme.fg("text", pack.models.build)}`,
330
+ ` ${chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.green)("fast")} \u2192 ${chunkK4WJUBEC_cjs.theme.fg("text", pack.models.fast)}`
283
331
  ].join("\n");
284
332
  this.modePackDetail.setText(detail);
285
333
  }
@@ -292,9 +340,9 @@ var OnboardingInlineComponent = class extends piTui.Container {
292
340
  this.selectList = void 0;
293
341
  this.collapseStep("Model pack \u2192 Custom");
294
342
  const modes = [
295
- { id: "plan", label: "plan", color: chunk7K5VFY2N_cjs.mastra.blue },
296
- { id: "build", label: "build", color: chunk7K5VFY2N_cjs.mastra.purple },
297
- { id: "fast", label: "fast", color: chunk7K5VFY2N_cjs.mastra.green }
343
+ { id: "plan", label: "plan", color: chunkK4WJUBEC_cjs.mastra.blue },
344
+ { id: "build", label: "build", color: chunkK4WJUBEC_cjs.mastra.purple },
345
+ { id: "fast", label: "fast", color: chunkK4WJUBEC_cjs.mastra.green }
298
346
  ];
299
347
  const models = { build: "", plan: "", fast: "" };
300
348
  for (const mode of modes) {
@@ -303,7 +351,7 @@ var OnboardingInlineComponent = class extends piTui.Container {
303
351
  if (!modelId) {
304
352
  const fallback = this.options.modePacks.find((p) => p.id !== "custom") ?? this.options.modePacks[0];
305
353
  this.selectedModePack = fallback;
306
- this.collapseStep(`Model pack \u2192 ${chunk7K5VFY2N_cjs.bold(this.selectedModePack.name)} (cancelled custom)`);
354
+ this.collapseStep(`Model pack \u2192 ${chunkK4WJUBEC_cjs.theme.bold(this.selectedModePack.name)} (cancelled custom)`);
307
355
  this.renderStep("omPack");
308
356
  this.tui.requestRender();
309
357
  return;
@@ -317,7 +365,7 @@ var OnboardingInlineComponent = class extends piTui.Container {
317
365
  models: { build: models.build, plan: models.plan, fast: models.fast }
318
366
  };
319
367
  this.collapseStep(
320
- `Model pack \u2192 ${chunk7K5VFY2N_cjs.bold("Custom")} ${chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.blue)("plan")} ${models.plan} ${chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.purple)("build")} ${models.build} ${chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.green)("fast")} ${models.fast}`
368
+ `Model pack \u2192 ${chunkK4WJUBEC_cjs.theme.bold("Custom")} ${chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.blue)("plan")} ${models.plan} ${chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.purple)("build")} ${models.build} ${chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.green)("fast")} ${models.fast}`
321
369
  );
322
370
  this.renderStep("omPack");
323
371
  this.tui.requestRender();
@@ -332,17 +380,17 @@ var OnboardingInlineComponent = class extends piTui.Container {
332
380
  return;
333
381
  }
334
382
  const box = this.makeBox();
335
- box.addChild(new piTui.Text(chunk7K5VFY2N_cjs.bold(chunk7K5VFY2N_cjs.fg("accent", "\u{1F9E0} Observational Memory")), 0, 0));
383
+ box.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", "\u{1F9E0} Observational Memory")), 0, 0));
336
384
  box.addChild(new piTui.Spacer(1));
337
- box.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("text", "Choose the model for observational memory:"), 0, 0));
338
- box.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("dim", "https://mastra.ai/docs/memory/observational-memory"), 0, 0));
385
+ box.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("text", "Choose the model for observational memory:"), 0, 0));
386
+ box.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("dim", "https://mastra.ai/docs/memory/observational-memory"), 0, 0));
339
387
  box.addChild(new piTui.Spacer(1));
340
388
  const prevOmId = this.options.previous?.omPackId ?? null;
341
389
  const items = omPacks.map((p) => ({
342
390
  value: p.id,
343
- label: ` ${p.name} ${chunk7K5VFY2N_cjs.fg("dim", p.description)}${p.id === prevOmId ? chunk7K5VFY2N_cjs.fg("dim", " (current)") : ""}`
391
+ label: ` ${p.name} ${chunkK4WJUBEC_cjs.theme.fg("dim", p.description)}${p.id === prevOmId ? chunkK4WJUBEC_cjs.theme.fg("dim", " (current)") : ""}`
344
392
  }));
345
- this.selectList = new piTui.SelectList(items, items.length, chunk7K5VFY2N_cjs.getSelectListTheme());
393
+ this.selectList = new piTui.SelectList(items, items.length, chunkK4WJUBEC_cjs.getSelectListTheme());
346
394
  const prevOmIdx = prevOmId ? omPacks.findIndex((p) => p.id === prevOmId) : -1;
347
395
  if (prevOmIdx > 0) this.selectList.setSelectedIndex(prevOmIdx);
348
396
  this.selectList.onSelect = (item) => {
@@ -351,32 +399,32 @@ var OnboardingInlineComponent = class extends piTui.Container {
351
399
  this.runCustomOmFlow();
352
400
  } else {
353
401
  this.selectedOmPack = pack;
354
- this.collapseStep(`Observational memory \u2192 ${chunk7K5VFY2N_cjs.bold(this.selectedOmPack.name)}`);
402
+ this.collapseStep(`Observational memory \u2192 ${chunkK4WJUBEC_cjs.theme.bold(this.selectedOmPack.name)}`);
355
403
  this.renderStep("yolo");
356
404
  }
357
405
  };
358
406
  this.selectList.onCancel = () => {
359
- this.collapseStep(`Observational memory \u2192 ${chunk7K5VFY2N_cjs.bold(this.selectedOmPack.name)} (default)`);
407
+ this.collapseStep(`Observational memory \u2192 ${chunkK4WJUBEC_cjs.theme.bold(this.selectedOmPack.name)} (default)`);
360
408
  this.renderStep("yolo");
361
409
  };
362
410
  box.addChild(this.selectList);
363
411
  box.addChild(new piTui.Spacer(1));
364
- box.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("dim", "\u2191\u2193 navigate \xB7 Enter select \xB7 Esc use default"), 0, 0));
412
+ box.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("dim", "\u2191\u2193 navigate \xB7 Enter select \xB7 Esc use default"), 0, 0));
365
413
  }
366
414
  async runCustomOmFlow() {
367
415
  this.selectList = void 0;
368
- this.collapseStep(`Observational memory \u2192 ${chunk7K5VFY2N_cjs.bold("Custom")}`);
416
+ this.collapseStep(`Observational memory \u2192 ${chunkK4WJUBEC_cjs.theme.bold("Custom")}`);
369
417
  const modelId = await this.options.onSelectModel("Select model for observational memory");
370
418
  if (modelId) {
371
419
  this.selectedOmPack = { id: "custom", name: "Custom", description: "User-selected model", modelId };
372
- this.collapseStep(`Observational memory \u2192 ${chunk7K5VFY2N_cjs.bold("Custom")} ${modelId}`);
420
+ this.collapseStep(`Observational memory \u2192 ${chunkK4WJUBEC_cjs.theme.bold("Custom")} ${modelId}`);
373
421
  } else {
374
422
  const fallback = this.options.omPacks.find((p) => p.id !== "custom");
375
423
  if (fallback) {
376
424
  this.selectedOmPack = fallback;
377
- this.collapseStep(`Observational memory \u2192 ${chunk7K5VFY2N_cjs.bold(fallback.name)} (cancelled custom)`);
425
+ this.collapseStep(`Observational memory \u2192 ${chunkK4WJUBEC_cjs.theme.bold(fallback.name)} (cancelled custom)`);
378
426
  } else {
379
- this.collapseStep(`Observational memory \u2192 ${chunk7K5VFY2N_cjs.bold("Custom")} (cancelled)`);
427
+ this.collapseStep(`Observational memory \u2192 ${chunkK4WJUBEC_cjs.theme.bold("Custom")} (cancelled)`);
380
428
  }
381
429
  }
382
430
  this.renderStep("yolo");
@@ -387,39 +435,39 @@ var OnboardingInlineComponent = class extends piTui.Container {
387
435
  // ---------------------------------------------------------------------------
388
436
  renderYolo() {
389
437
  const box = this.makeBox();
390
- box.addChild(new piTui.Text(chunk7K5VFY2N_cjs.bold(chunk7K5VFY2N_cjs.fg("accent", "\u26A1 Tool Approval")), 0, 0));
438
+ box.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", "\u26A1 Tool Approval")), 0, 0));
391
439
  box.addChild(new piTui.Spacer(1));
392
- box.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("text", "YOLO mode auto-approves all tool calls (edits, commands, etc)."), 0, 0));
393
- box.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("text", "You can toggle this anytime with Ctrl+Y or /yolo."), 0, 0));
440
+ box.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("text", "YOLO mode auto-approves all tool calls (edits, commands, etc)."), 0, 0));
441
+ box.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("text", "You can toggle this anytime with Ctrl+Y or /yolo."), 0, 0));
394
442
  box.addChild(new piTui.Spacer(1));
395
443
  const prevYolo = this.options.previous?.yolo ?? null;
396
- const currentOn = prevYolo === true ? chunk7K5VFY2N_cjs.fg("dim", " (current)") : "";
397
- const currentOff = prevYolo === false ? chunk7K5VFY2N_cjs.fg("dim", " (current)") : "";
444
+ const currentOn = prevYolo === true ? chunkK4WJUBEC_cjs.theme.fg("dim", " (current)") : "";
445
+ const currentOff = prevYolo === false ? chunkK4WJUBEC_cjs.theme.fg("dim", " (current)") : "";
398
446
  const items = [
399
447
  {
400
448
  value: "on",
401
- label: ` ${chunk7K5VFY2N_cjs.fg("success", "Enable YOLO")} ${chunk7K5VFY2N_cjs.fg("dim", "(recommended \u2014 auto-approve everything)")}${currentOn}`
449
+ label: ` ${chunkK4WJUBEC_cjs.theme.fg("success", "Enable YOLO")} ${chunkK4WJUBEC_cjs.theme.fg("dim", "(recommended \u2014 auto-approve everything)")}${currentOn}`
402
450
  },
403
451
  {
404
452
  value: "off",
405
- label: ` ${chunk7K5VFY2N_cjs.fg("warning", "Disable YOLO")} ${chunk7K5VFY2N_cjs.fg("dim", "(ask before each tool call)")}${currentOff}`
453
+ label: ` ${chunkK4WJUBEC_cjs.theme.fg("warning", "Disable YOLO")} ${chunkK4WJUBEC_cjs.theme.fg("dim", "(ask before each tool call)")}${currentOff}`
406
454
  }
407
455
  ];
408
- this.selectList = new piTui.SelectList(items, items.length, chunk7K5VFY2N_cjs.getSelectListTheme());
456
+ this.selectList = new piTui.SelectList(items, items.length, chunkK4WJUBEC_cjs.getSelectListTheme());
409
457
  if (prevYolo === false) this.selectList.setSelectedIndex(1);
410
458
  this.selectList.onSelect = (item) => {
411
459
  this.selectedYolo = item.value === "on";
412
460
  const label = this.selectedYolo ? "enabled" : "disabled";
413
- this.collapseStep(`YOLO mode \u2192 ${chunk7K5VFY2N_cjs.bold(label)}`);
461
+ this.collapseStep(`YOLO mode \u2192 ${chunkK4WJUBEC_cjs.theme.bold(label)}`);
414
462
  this.renderStep("done");
415
463
  };
416
464
  this.selectList.onCancel = () => {
417
- this.collapseStep(`YOLO mode \u2192 ${chunk7K5VFY2N_cjs.bold("enabled")} (default)`);
465
+ this.collapseStep(`YOLO mode \u2192 ${chunkK4WJUBEC_cjs.theme.bold("enabled")} (default)`);
418
466
  this.renderStep("done");
419
467
  };
420
468
  box.addChild(this.selectList);
421
469
  box.addChild(new piTui.Spacer(1));
422
- box.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("dim", "\u2191\u2193 navigate \xB7 Enter select \xB7 Esc use default"), 0, 0));
470
+ box.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("dim", "\u2191\u2193 navigate \xB7 Enter select \xB7 Esc use default"), 0, 0));
423
471
  }
424
472
  // ---------------------------------------------------------------------------
425
473
  // Step: Done
@@ -427,21 +475,21 @@ var OnboardingInlineComponent = class extends piTui.Container {
427
475
  renderDone() {
428
476
  this._finished = true;
429
477
  const box = this.makeBox();
430
- box.addChild(new piTui.Text(chunk7K5VFY2N_cjs.bold(chunk7K5VFY2N_cjs.fg("success", "\u2713 Setup complete!")), 0, 0));
478
+ box.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("success", "\u2713 Setup complete!")), 0, 0));
431
479
  box.addChild(new piTui.Spacer(1));
432
480
  const lines = [
433
- `Model pack: ${chunk7K5VFY2N_cjs.bold(this.selectedModePack.name)}`,
434
- ` ${chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.blue)("plan")} \u2192 ${this.selectedModePack.models.plan}`,
435
- ` ${chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.purple)("build")} \u2192 ${this.selectedModePack.models.build}`,
436
- ` ${chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.green)("fast")} \u2192 ${this.selectedModePack.models.fast}`,
437
- `Observational memory: ${chunk7K5VFY2N_cjs.bold(this.selectedOmPack.name)}`,
438
- `YOLO mode: ${chunk7K5VFY2N_cjs.bold(this.selectedYolo ? "enabled" : "disabled")}`
481
+ `Model pack: ${chunkK4WJUBEC_cjs.theme.bold(this.selectedModePack.name)}`,
482
+ ` ${chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.blue)("plan")} \u2192 ${this.selectedModePack.models.plan}`,
483
+ ` ${chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.purple)("build")} \u2192 ${this.selectedModePack.models.build}`,
484
+ ` ${chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.green)("fast")} \u2192 ${this.selectedModePack.models.fast}`,
485
+ `Observational memory: ${chunkK4WJUBEC_cjs.theme.bold(this.selectedOmPack.name)}`,
486
+ `YOLO mode: ${chunkK4WJUBEC_cjs.theme.bold(this.selectedYolo ? "enabled" : "disabled")}`
439
487
  ];
440
488
  for (const line of lines) {
441
- box.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("text", line), 0, 0));
489
+ box.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("text", line), 0, 0));
442
490
  }
443
491
  box.addChild(new piTui.Spacer(1));
444
- box.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("dim", "Type a message to start coding, or use /help for commands."), 0, 0));
492
+ box.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("dim", "Type a message to start coding, or use /help for commands."), 0, 0));
445
493
  this.options.onComplete({
446
494
  modePack: this.selectedModePack,
447
495
  omPack: this.selectedOmPack,
@@ -456,8 +504,8 @@ var OnboardingInlineComponent = class extends piTui.Container {
456
504
  collapseStep(summary) {
457
505
  if (!this.stepBox) return;
458
506
  this.stepBox.clear();
459
- this.stepBox.setBgFn((text) => chunk7K5VFY2N_cjs.theme.bg("toolSuccessBg", text));
460
- this.stepBox.addChild(new piTui.Text(`${chunk7K5VFY2N_cjs.fg("success", "\u2713")} ${chunk7K5VFY2N_cjs.fg("text", summary)}`, 0, 0));
507
+ this.stepBox.setBgFn((text) => chunkK4WJUBEC_cjs.theme.bg("toolSuccessBg", text));
508
+ this.stepBox.addChild(new piTui.Text(`${chunkK4WJUBEC_cjs.theme.fg("success", "\u2713")} ${chunkK4WJUBEC_cjs.theme.fg("text", summary)}`, 0, 0));
461
509
  this.selectList = void 0;
462
510
  }
463
511
  // ---------------------------------------------------------------------------
@@ -471,22 +519,178 @@ var OnboardingInlineComponent = class extends piTui.Container {
471
519
  }
472
520
  }
473
521
  };
522
+ var AskQuestionInlineComponent = class extends piTui.Container {
523
+ contentBox;
524
+ selectList;
525
+ input;
526
+ onSubmit;
527
+ onCancel;
528
+ formatResult;
529
+ isNegativeAnswer;
530
+ answered = false;
531
+ questionText;
532
+ _focused = false;
533
+ get focused() {
534
+ return this._focused;
535
+ }
536
+ set focused(value) {
537
+ this._focused = value;
538
+ if (!this.answered && this.input) {
539
+ this.input.focused = value;
540
+ }
541
+ }
542
+ constructor(options, _ui) {
543
+ super();
544
+ this.onSubmit = options.onSubmit;
545
+ this.onCancel = options.onCancel;
546
+ this.formatResult = options.formatResult;
547
+ this.isNegativeAnswer = options.isNegativeAnswer;
548
+ this.questionText = options.question;
549
+ this.addChild(new piTui.Spacer(1));
550
+ this.contentBox = new piTui.Box(1, 1, (text) => chunkK4WJUBEC_cjs.theme.bg("toolPendingBg", text));
551
+ this.addChild(this.contentBox);
552
+ this.contentBox.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", "\u2753 Question")), 0, 0));
553
+ this.contentBox.addChild(new piTui.Spacer(1));
554
+ for (const line of options.question.split("\n")) {
555
+ this.contentBox.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("text", line), 0, 0));
556
+ }
557
+ this.contentBox.addChild(new piTui.Spacer(1));
558
+ if (options.options && options.options.length > 0) {
559
+ this.buildSelectMode(options.options);
560
+ } else {
561
+ this.buildInputMode();
562
+ }
563
+ }
564
+ buildSelectMode(opts) {
565
+ const items = opts.map((opt) => ({
566
+ value: opt.label,
567
+ label: opt.description ? ` ${opt.label} ${chunkK4WJUBEC_cjs.theme.fg("dim", opt.description)}` : ` ${opt.label}`
568
+ }));
569
+ this.selectList = new piTui.SelectList(items, Math.min(items.length, 8), chunkK4WJUBEC_cjs.getSelectListTheme());
570
+ this.selectList.onSelect = (item) => {
571
+ this.handleAnswer(item.value);
572
+ };
573
+ this.selectList.onCancel = () => {
574
+ this.handleCancel();
575
+ };
576
+ this.contentBox.addChild(this.selectList);
577
+ this.contentBox.addChild(new piTui.Spacer(1));
578
+ this.contentBox.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("dim", "\u2191\u2193 to navigate \xB7 Enter to select \xB7 Esc to skip"), 0, 0));
579
+ }
580
+ buildInputMode() {
581
+ this.input = new piTui.Input();
582
+ this.input.onSubmit = (value) => {
583
+ const trimmed = value.trim();
584
+ if (trimmed) {
585
+ this.handleAnswer(trimmed);
586
+ }
587
+ };
588
+ this.contentBox.addChild(this.input);
589
+ this.contentBox.addChild(new piTui.Spacer(1));
590
+ this.contentBox.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("dim", "Enter to submit \xB7 Esc to skip"), 0, 0));
591
+ }
592
+ handleAnswer(answer) {
593
+ if (this.answered) return;
594
+ this.answered = true;
595
+ const isNegative = this.isNegativeAnswer?.(answer) ?? false;
596
+ this.contentBox.clear();
597
+ this.contentBox.setBgFn((text) => chunkK4WJUBEC_cjs.theme.bg(isNegative ? "toolErrorBg" : "toolSuccessBg", text));
598
+ const resultText = this.formatResult ? this.formatResult(answer) : `${this.questionText} \u2192 ${answer}`;
599
+ const icon = isNegative ? chunkK4WJUBEC_cjs.theme.fg("error", "\u2717") : chunkK4WJUBEC_cjs.theme.fg("success", "\u2713");
600
+ this.contentBox.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("text", `${icon} ${resultText}`), 0, 0));
601
+ this.onSubmit(answer);
602
+ }
603
+ handleCancel() {
604
+ if (this.answered) return;
605
+ this.answered = true;
606
+ this.contentBox.clear();
607
+ this.contentBox.setBgFn((text) => chunkK4WJUBEC_cjs.theme.bg("toolErrorBg", text));
608
+ this.contentBox.addChild(
609
+ new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("dim", `${chunkK4WJUBEC_cjs.theme.fg("error", "\u2717")} ${this.questionText} (cancelled)`), 0, 0)
610
+ );
611
+ this.onCancel();
612
+ }
613
+ handleInput(data) {
614
+ if (this.answered) return;
615
+ if (this.selectList) {
616
+ this.selectList.handleInput(data);
617
+ } else if (this.input) {
618
+ const kb = piTui.getEditorKeybindings();
619
+ if (kb.matches(data, "selectCancel")) {
620
+ this.handleCancel();
621
+ return;
622
+ }
623
+ this.input.handleInput(data);
624
+ }
625
+ }
626
+ };
627
+
628
+ // src/tui/claude-max-warning.ts
629
+ function showClaudeMaxOAuthWarning(state, mode) {
630
+ const options = mode === "login" ? [
631
+ { label: "Continue", description: "Proceed with Anthropic OAuth" },
632
+ { label: "Cancel", description: "Go back" }
633
+ ] : [
634
+ { label: "Continue", description: "Keep Anthropic OAuth credentials" },
635
+ { label: "Remove OAuth", description: "Log out from Anthropic" }
636
+ ];
637
+ return new Promise((resolve2) => {
638
+ const questionComponent = new AskQuestionInlineComponent(
639
+ {
640
+ question: CLAUDE_MAX_OAUTH_WARNING_MESSAGE,
641
+ options,
642
+ formatResult: (answer) => `Claude Max OAuth warning \u2192 ${answer}`,
643
+ isNegativeAnswer: (answer) => answer !== "Continue",
644
+ onSubmit: (answer) => {
645
+ state.activeInlineQuestion = void 0;
646
+ if (answer === "Continue") {
647
+ resolve2("continue");
648
+ } else if (answer === "Cancel") {
649
+ resolve2("cancel");
650
+ } else {
651
+ resolve2("remove");
652
+ }
653
+ },
654
+ onCancel: () => {
655
+ state.activeInlineQuestion = void 0;
656
+ resolve2("cancel");
657
+ }
658
+ },
659
+ state.ui
660
+ );
661
+ state.activeInlineQuestion = questionComponent;
662
+ state.chatContainer.addChild(questionComponent);
663
+ state.chatContainer.addChild(new piTui.Spacer(1));
664
+ state.ui.requestRender();
665
+ state.chatContainer.invalidate();
666
+ });
667
+ }
474
668
  async function processSlashCommand(command, args, workingDir) {
475
- let result = command.template;
476
- result = replaceArguments(result, args);
669
+ const { result: withArgs, shouldAppendRawArgs } = replaceArguments(command.template, args);
670
+ let result = withArgs;
477
671
  result = await replaceShellOutput(result, workingDir);
478
672
  result = await replaceFileReferences(result, workingDir);
673
+ if (shouldAppendRawArgs) {
674
+ result = result.trimEnd() + `
675
+
676
+ ARGUMENTS: ${args.join(" ")}`;
677
+ }
479
678
  return result;
480
679
  }
481
680
  function replaceArguments(template, args) {
482
681
  let result = template;
682
+ const hasArgumentsVar = /\$ARGUMENTS/.test(template);
683
+ const hasPositionalVar = /\$[1-9]\d*/.test(template);
483
684
  result = result.replace(/\$ARGUMENTS/g, args.join(" "));
484
685
  args.forEach((arg, index) => {
485
686
  const pattern = new RegExp(`\\$${index + 1}`, "g");
486
687
  result = result.replace(pattern, arg);
487
688
  });
488
- result = result.replace(/\$\d+/g, "");
489
- return result;
689
+ result = result.replace(/\$[1-9]\d*/g, "");
690
+ return {
691
+ result,
692
+ shouldAppendRawArgs: !hasArgumentsVar && !hasPositionalVar && args.length > 0
693
+ };
490
694
  }
491
695
  async function replaceShellOutput(template, workingDir) {
492
696
  const shellPattern = /!`([^`]+)`/g;
@@ -551,7 +755,8 @@ function getCommands(modes) {
551
755
  { key: "/mcp", description: "Show/reload MCP connections" },
552
756
  { key: "/login", description: "Login with OAuth provider" },
553
757
  { key: "/logout", description: "Logout from OAuth provider" },
554
- { key: "/setup", description: "Run the setup wizard" }
758
+ { key: "/setup", description: "Run the setup wizard" },
759
+ { key: "/theme", description: "Switch color theme (auto/dark/light)" }
555
760
  ];
556
761
  if (modes > 1) {
557
762
  cmds.push({ key: "/mode", description: "Switch or list modes" });
@@ -631,22 +836,129 @@ function handleYoloCommand(ctx) {
631
836
  ctx.harness.setState({ yolo: !current });
632
837
  ctx.showInfo(!current ? "YOLO mode ON \u2014 tools auto-approved" : "YOLO mode OFF \u2014 tools require approval");
633
838
  }
839
+ var BASE_THINKING_LEVELS = [
840
+ { id: "off", label: "Off", providerValue: "none", description: "Reasoning disabled" },
841
+ { id: "low", label: "Low", providerValue: "low", description: "Light reasoning" },
842
+ { id: "medium", label: "Medium", providerValue: "medium", description: "Balanced reasoning" },
843
+ { id: "high", label: "High", providerValue: "high", description: "Deep reasoning" },
844
+ { id: "xhigh", label: "Very High", providerValue: "xhigh", description: "Maximum reasoning depth" }
845
+ ];
846
+ function isOpenAIModel(modelId) {
847
+ return modelId.startsWith("openai/");
848
+ }
849
+ function getThinkingLevelsForModel(modelId) {
850
+ if (!isOpenAIModel(modelId)) {
851
+ return [...BASE_THINKING_LEVELS];
852
+ }
853
+ return BASE_THINKING_LEVELS.map((level) => ({
854
+ ...level,
855
+ label: level.providerValue
856
+ }));
857
+ }
858
+ var THINKING_LEVELS = getThinkingLevelsForModel("");
859
+ function getThinkingLevelForModel(modelId, levelId) {
860
+ return getThinkingLevelsForModel(modelId).find((level) => level.id === levelId) ?? getThinkingLevelsForModel(modelId)[0];
861
+ }
634
862
 
635
863
  // src/tui/commands/think.ts
636
- async function handleThinkCommand(ctx) {
864
+ function supportsThinking(modelId) {
865
+ return modelId.startsWith("openai/");
866
+ }
867
+ function getThinkingStatusLine(modelId, levelId) {
868
+ const level = getThinkingLevelForModel(modelId, levelId);
869
+ return `Thinking: ${level.label}`;
870
+ }
871
+ function getModelNote(ctx) {
872
+ const modelId = ctx.state.harness.getCurrentModelId() ?? "";
873
+ if (!modelId) return "No model selected.";
874
+ if (!supportsThinking(modelId)) {
875
+ return `Warning: current model (${modelId}) may not support reasoning effort. Setting will be saved but may not take effect.`;
876
+ }
877
+ return null;
878
+ }
879
+ async function handleThinkCommand(ctx, args = []) {
637
880
  const currentLevel = ctx.harness.getState()?.thinkingLevel ?? "off";
638
- const levels = [
639
- { label: "Off", id: "off" },
640
- { label: "Minimal", id: "minimal" },
641
- { label: "Low", id: "low" },
642
- { label: "Medium", id: "medium" },
643
- { label: "High", id: "high" }
644
- ];
645
- const currentIdx = levels.findIndex((l) => l.id === currentLevel);
646
- const nextIdx = (currentIdx + 1) % levels.length;
647
- const next = levels[nextIdx];
648
- await ctx.harness.setState({ thinkingLevel: next.id });
649
- ctx.showInfo(`Thinking: ${next.label}`);
881
+ const modelId = ctx.state.harness.getCurrentModelId() ?? "";
882
+ const thinkingLevels = getThinkingLevelsForModel(modelId);
883
+ const arg = args[0]?.toLowerCase();
884
+ if (arg === "status") {
885
+ ctx.showInfo(getThinkingStatusLine(modelId, currentLevel));
886
+ return;
887
+ }
888
+ if (arg) {
889
+ const selected = thinkingLevels.find((l) => l.id === arg);
890
+ if (!selected) {
891
+ ctx.showInfo(
892
+ `Invalid thinking level: ${arg}. Use one of: ${THINKING_LEVELS.map((l) => l.id).join(", ")} or 'status'.`
893
+ );
894
+ return;
895
+ }
896
+ const note = getModelNote(ctx);
897
+ await ctx.harness.setState({ thinkingLevel: selected.id });
898
+ ctx.showInfo(getThinkingStatusLine(modelId, selected.id) + (note ? ` (${note})` : ""));
899
+ return;
900
+ }
901
+ const items = thinkingLevels.map((l) => ({
902
+ value: l.id,
903
+ label: ` ${l.label} ${chunkK4WJUBEC_cjs.theme.fg("dim", l.description)}${l.id === currentLevel ? chunkK4WJUBEC_cjs.theme.fg("dim", " (current)") : ""}`
904
+ }));
905
+ const modelNote = getModelNote(ctx);
906
+ return new Promise((resolve2) => {
907
+ const container = new piTui.Box(1, 1);
908
+ container.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", "Thinking Level")), 0, 0));
909
+ container.addChild(new piTui.Spacer(1));
910
+ if (modelNote) {
911
+ container.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("warning", modelNote), 0, 0));
912
+ container.addChild(new piTui.Spacer(1));
913
+ }
914
+ const selectList = new piTui.SelectList(items, items.length, chunkK4WJUBEC_cjs.getSelectListTheme());
915
+ selectList.onSelect = async (item) => {
916
+ ctx.state.activeInlineQuestion = void 0;
917
+ try {
918
+ await ctx.harness.setState({ thinkingLevel: item.value });
919
+ const selectedLabel = getThinkingLevelForModel(modelId, item.value).label;
920
+ collapseResult(
921
+ `Thinking \u2192 ${chunkK4WJUBEC_cjs.theme.bold(item.value === currentLevel ? `${selectedLabel} (unchanged)` : selectedLabel)}`
922
+ );
923
+ } catch {
924
+ collapseResult("cancelled");
925
+ } finally {
926
+ ctx.state.ui.requestRender();
927
+ resolve2();
928
+ }
929
+ };
930
+ selectList.onCancel = () => {
931
+ ctx.state.activeInlineQuestion = void 0;
932
+ collapseResult("cancelled");
933
+ ctx.state.ui.requestRender();
934
+ resolve2();
935
+ };
936
+ container.addChild(selectList);
937
+ container.addChild(new piTui.Spacer(1));
938
+ container.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("dim", "\u2191\u2193 navigate \xB7 Enter select \xB7 Esc cancel"), 0, 0));
939
+ const currentIdx = thinkingLevels.findIndex((l) => l.id === currentLevel);
940
+ if (currentIdx > 0) selectList.setSelectedIndex(currentIdx);
941
+ const collapseResult = (result) => {
942
+ container.clear();
943
+ if (result === "cancelled") {
944
+ container.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("dim", `${chunkK4WJUBEC_cjs.theme.fg("error", "\u2717")} Thinking level (cancelled)`), 0, 0));
945
+ } else {
946
+ container.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("text", `${chunkK4WJUBEC_cjs.theme.fg("success", "\u2713")} ${result}`), 0, 0));
947
+ }
948
+ };
949
+ const inputShim = {
950
+ handleInput: (data) => {
951
+ if (piTui.isKeyRelease(data)) return;
952
+ selectList.handleInput(data);
953
+ }
954
+ };
955
+ ctx.state.activeInlineQuestion = inputShim;
956
+ ctx.state.chatContainer.addChild(new piTui.Spacer(1));
957
+ ctx.state.chatContainer.addChild(container);
958
+ ctx.state.chatContainer.addChild(new piTui.Spacer(1));
959
+ ctx.state.ui.requestRender();
960
+ ctx.state.chatContainer.invalidate();
961
+ });
650
962
  }
651
963
 
652
964
  // src/tui/commands/permissions.ts
@@ -880,7 +1192,15 @@ ${modeList}`);
880
1192
 
881
1193
  // src/tui/commands/skills.ts
882
1194
  async function handleSkillsCommand(ctx) {
883
- const workspace = ctx.getResolvedWorkspace();
1195
+ let workspace = ctx.getResolvedWorkspace();
1196
+ if (!workspace && ctx.harness.hasWorkspace()) {
1197
+ try {
1198
+ workspace = await ctx.harness.resolveWorkspace();
1199
+ } catch (error) {
1200
+ ctx.showError(`Failed to resolve workspace: ${error instanceof Error ? error.message : String(error)}`);
1201
+ return;
1202
+ }
1203
+ }
884
1204
  if (!workspace?.skills) {
885
1205
  ctx.showInfo(
886
1206
  "No skills configured.\n\nAdd skills to any of these locations:\n .mastracode/skills/ (project-local)\n .claude/skills/ (project-local)\n ~/.mastracode/skills/ (global)\n ~/.claude/skills/ (global)\n\nEach skill is a folder with a SKILL.md file.\nInstall skills: npx add-skill <github-url>"
@@ -959,12 +1279,13 @@ async function handleResourceCommand(ctx, args) {
959
1279
  state.ui.requestRender();
960
1280
  ctx.showInfo(sub === "reset" ? `Resource ID reset to: ${defaultId}` : `Switched to resource: ${newId}`);
961
1281
  }
962
- var addedColor = chalk10__default.default.hex("#5cb85c");
963
- var hunkHeaderColor = chalk10__default.default.hex("#61afef");
964
- var fileHeaderColor = chalk10__default.default.bold.hex("#c678dd");
965
- var removedColor = chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.red);
966
- var metaColor = chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.mainGray);
967
1282
  function colorizeDiffLine(line) {
1283
+ const t = chunkK4WJUBEC_cjs.theme.getTheme();
1284
+ const addedColor = chalk10__default.default.hex(t.success);
1285
+ const hunkHeaderColor = chalk10__default.default.hex(t.toolBorderPending);
1286
+ const fileHeaderColor = chalk10__default.default.bold.hex(t.accent);
1287
+ const removedColor = chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.red);
1288
+ const metaColor = chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.mainGray);
968
1289
  if (line.startsWith("+++") || line.startsWith("---")) {
969
1290
  return fileHeaderColor(line);
970
1291
  }
@@ -983,7 +1304,7 @@ function colorizeDiffLine(line) {
983
1304
  if (line.startsWith("index ") || line.startsWith("new file") || line.startsWith("deleted file") || line.startsWith("similarity") || line.startsWith("rename")) {
984
1305
  return metaColor(line);
985
1306
  }
986
- const statMatch = line.match(/^(.+\|.+?)(\++)([-]*)$/);
1307
+ const statMatch = line.match(/^(.+\|.+?)(\++)([- ]*)$/);
987
1308
  if (statMatch) {
988
1309
  return statMatch[1] + addedColor(statMatch[2]) + removedColor(statMatch[3]);
989
1310
  }
@@ -996,7 +1317,9 @@ var DiffOutputComponent = class extends piTui.Container {
996
1317
  constructor(command, diffOutput) {
997
1318
  super();
998
1319
  this.addChild(new piTui.Spacer(1));
999
- this.addChild(new piTui.Text(`${chunk7K5VFY2N_cjs.fg("success", "\u2713")} ${chunk7K5VFY2N_cjs.bold(chunk7K5VFY2N_cjs.fg("muted", "$"))} ${chunk7K5VFY2N_cjs.fg("text", command)}`, 1, 0));
1320
+ this.addChild(
1321
+ new piTui.Text(`${chunkK4WJUBEC_cjs.theme.fg("success", "\u2713")} ${chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("muted", "$"))} ${chunkK4WJUBEC_cjs.theme.fg("text", command)}`, 1, 0)
1322
+ );
1000
1323
  const output = diffOutput.trimEnd();
1001
1324
  if (output) {
1002
1325
  const lines = output.split("\n");
@@ -1071,117 +1394,12 @@ async function handleDiffCommand(ctx, filePath) {
1071
1394
  opCounts.set(op, (opCounts.get(op) || 0) + 1);
1072
1395
  }
1073
1396
  const ops = Array.from(opCounts.entries()).map(([op, count]) => count > 1 ? `${op}\xD7${count}` : op).join(", ");
1074
- lines.push(` ${chunk7K5VFY2N_cjs.fg("path", fp)} ${chunk7K5VFY2N_cjs.fg("muted", `(${ops})`)}`);
1397
+ lines.push(` ${chunkK4WJUBEC_cjs.theme.fg("path", fp)} ${chunkK4WJUBEC_cjs.theme.fg("muted", `(${ops})`)}`);
1075
1398
  }
1076
1399
  lines.push("");
1077
- lines.push(chunk7K5VFY2N_cjs.fg("muted", "Use /diff <path> to see the git diff for a specific file."));
1400
+ lines.push(chunkK4WJUBEC_cjs.theme.fg("muted", "Use /diff <path> to see the git diff for a specific file."));
1078
1401
  ctx.showInfo(lines.join("\n"));
1079
1402
  }
1080
- var AskQuestionInlineComponent = class extends piTui.Container {
1081
- contentBox;
1082
- selectList;
1083
- input;
1084
- onSubmit;
1085
- onCancel;
1086
- formatResult;
1087
- isNegativeAnswer;
1088
- answered = false;
1089
- questionText;
1090
- _focused = false;
1091
- get focused() {
1092
- return this._focused;
1093
- }
1094
- set focused(value) {
1095
- this._focused = value;
1096
- if (!this.answered && this.input) {
1097
- this.input.focused = value;
1098
- }
1099
- }
1100
- constructor(options, _ui) {
1101
- super();
1102
- this.onSubmit = options.onSubmit;
1103
- this.onCancel = options.onCancel;
1104
- this.formatResult = options.formatResult;
1105
- this.isNegativeAnswer = options.isNegativeAnswer;
1106
- this.questionText = options.question;
1107
- this.addChild(new piTui.Spacer(1));
1108
- this.contentBox = new piTui.Box(1, 1, (text) => chunk7K5VFY2N_cjs.theme.bg("toolPendingBg", text));
1109
- this.addChild(this.contentBox);
1110
- this.contentBox.addChild(new piTui.Text(chunk7K5VFY2N_cjs.theme.bold(chunk7K5VFY2N_cjs.theme.fg("accent", "\u2753 Question")), 0, 0));
1111
- this.contentBox.addChild(new piTui.Spacer(1));
1112
- for (const line of options.question.split("\n")) {
1113
- this.contentBox.addChild(new piTui.Text(chunk7K5VFY2N_cjs.theme.fg("text", line), 0, 0));
1114
- }
1115
- this.contentBox.addChild(new piTui.Spacer(1));
1116
- if (options.options && options.options.length > 0) {
1117
- this.buildSelectMode(options.options);
1118
- } else {
1119
- this.buildInputMode();
1120
- }
1121
- }
1122
- buildSelectMode(opts) {
1123
- const items = opts.map((opt) => ({
1124
- value: opt.label,
1125
- label: opt.description ? ` ${opt.label} ${chunk7K5VFY2N_cjs.theme.fg("dim", opt.description)}` : ` ${opt.label}`
1126
- }));
1127
- this.selectList = new piTui.SelectList(items, Math.min(items.length, 8), chunk7K5VFY2N_cjs.getSelectListTheme());
1128
- this.selectList.onSelect = (item) => {
1129
- this.handleAnswer(item.value);
1130
- };
1131
- this.selectList.onCancel = () => {
1132
- this.handleCancel();
1133
- };
1134
- this.contentBox.addChild(this.selectList);
1135
- this.contentBox.addChild(new piTui.Spacer(1));
1136
- this.contentBox.addChild(new piTui.Text(chunk7K5VFY2N_cjs.theme.fg("dim", "\u2191\u2193 to navigate \xB7 Enter to select \xB7 Esc to skip"), 0, 0));
1137
- }
1138
- buildInputMode() {
1139
- this.input = new piTui.Input();
1140
- this.input.onSubmit = (value) => {
1141
- const trimmed = value.trim();
1142
- if (trimmed) {
1143
- this.handleAnswer(trimmed);
1144
- }
1145
- };
1146
- this.contentBox.addChild(this.input);
1147
- this.contentBox.addChild(new piTui.Spacer(1));
1148
- this.contentBox.addChild(new piTui.Text(chunk7K5VFY2N_cjs.theme.fg("dim", "Enter to submit \xB7 Esc to skip"), 0, 0));
1149
- }
1150
- handleAnswer(answer) {
1151
- if (this.answered) return;
1152
- this.answered = true;
1153
- const isNegative = this.isNegativeAnswer?.(answer) ?? false;
1154
- this.contentBox.clear();
1155
- this.contentBox.setBgFn((text) => chunk7K5VFY2N_cjs.theme.bg(isNegative ? "toolErrorBg" : "toolSuccessBg", text));
1156
- const resultText = this.formatResult ? this.formatResult(answer) : `${this.questionText} \u2192 ${answer}`;
1157
- const icon = isNegative ? chunk7K5VFY2N_cjs.theme.fg("error", "\u2717") : chunk7K5VFY2N_cjs.theme.fg("success", "\u2713");
1158
- this.contentBox.addChild(new piTui.Text(chunk7K5VFY2N_cjs.theme.fg("text", `${icon} ${resultText}`), 0, 0));
1159
- this.onSubmit(answer);
1160
- }
1161
- handleCancel() {
1162
- if (this.answered) return;
1163
- this.answered = true;
1164
- this.contentBox.clear();
1165
- this.contentBox.setBgFn((text) => chunk7K5VFY2N_cjs.theme.bg("toolErrorBg", text));
1166
- this.contentBox.addChild(
1167
- new piTui.Text(chunk7K5VFY2N_cjs.theme.fg("dim", `${chunk7K5VFY2N_cjs.theme.fg("error", "\u2717")} ${this.questionText} (cancelled)`), 0, 0)
1168
- );
1169
- this.onCancel();
1170
- }
1171
- handleInput(data) {
1172
- if (this.answered) return;
1173
- if (this.selectList) {
1174
- this.selectList.handleInput(data);
1175
- } else if (this.input) {
1176
- const kb = piTui.getEditorKeybindings();
1177
- if (kb.matches(data, "selectCancel")) {
1178
- this.handleCancel();
1179
- return;
1180
- }
1181
- this.input.handleInput(data);
1182
- }
1183
- }
1184
- };
1185
1403
  var ThreadSelectorComponent = class extends piTui.Box {
1186
1404
  searchInput;
1187
1405
  listContainer;
@@ -1205,7 +1423,7 @@ var ThreadSelectorComponent = class extends piTui.Box {
1205
1423
  this.searchInput.focused = value;
1206
1424
  }
1207
1425
  constructor(options) {
1208
- super(2, 1, (text) => chunk7K5VFY2N_cjs.bg("overlayBg", text));
1426
+ super(2, 1, (text) => chunkK4WJUBEC_cjs.theme.bg("overlayBg", text));
1209
1427
  this.tui = options.tui;
1210
1428
  this.currentResourceId = options.currentResourceId;
1211
1429
  this.allThreads = this.sortThreads(options.threads, options.currentThreadId);
@@ -1232,9 +1450,9 @@ var ThreadSelectorComponent = class extends piTui.Box {
1232
1450
  this.tui.requestRender();
1233
1451
  }
1234
1452
  buildUI() {
1235
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.bold(chunk7K5VFY2N_cjs.fg("accent", "Select Thread")), 0, 0));
1453
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", "Select Thread")), 0, 0));
1236
1454
  this.addChild(new piTui.Spacer(1));
1237
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("muted", "Type to search \u2022 \u2191\u2193 navigate \u2022 Enter select \u2022 Esc cancel"), 0, 0));
1455
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("muted", "Type to search \u2022 \u2191\u2193 navigate \u2022 Enter select \u2022 Esc cancel"), 0, 0));
1238
1456
  this.addChild(new piTui.Spacer(1));
1239
1457
  this.searchInput = new piTui.Input();
1240
1458
  this.searchInput.onSubmit = () => {
@@ -1297,33 +1515,33 @@ var ThreadSelectorComponent = class extends piTui.Box {
1297
1515
  if (!thread) continue;
1298
1516
  const isSelected = i === this.selectedIndex;
1299
1517
  const isCurrent = thread.id === this.currentThreadId;
1300
- const checkmark = isCurrent ? chunk7K5VFY2N_cjs.fg("success", " \u2713") : "";
1518
+ const checkmark = isCurrent ? chunkK4WJUBEC_cjs.theme.fg("success", " \u2713") : "";
1301
1519
  const shortId = thread.id.slice(-6);
1302
1520
  const threadPath = thread.metadata?.projectPath;
1303
- const pathTag = threadPath ? chunk7K5VFY2N_cjs.fg("dim", ` [${threadPath.split("/").pop()}]`) : "";
1521
+ const pathTag = threadPath ? chunkK4WJUBEC_cjs.theme.fg("dim", ` [${threadPath.split("/").pop()}]`) : "";
1304
1522
  const displayId = `${thread.resourceId}/${shortId}`;
1305
- const timeAgo = chunk7K5VFY2N_cjs.fg("muted", ` (${this.formatTimeAgo(thread.updatedAt)})`);
1523
+ const timeAgo = chunkK4WJUBEC_cjs.theme.fg("muted", ` (${this.formatTimeAgo(thread.updatedAt)})`);
1306
1524
  const hasCustomTitle = thread.title && thread.title !== "New Thread";
1307
1525
  let line = "";
1308
1526
  if (isSelected) {
1309
- line = chunk7K5VFY2N_cjs.fg("accent", `\u2192 ${displayId}`) + pathTag + timeAgo + checkmark;
1527
+ line = chunkK4WJUBEC_cjs.theme.fg("accent", `\u2192 ${displayId}`) + pathTag + timeAgo + checkmark;
1310
1528
  } else {
1311
1529
  line = ` ${displayId}` + pathTag + timeAgo + checkmark;
1312
1530
  }
1313
1531
  this.listContainer.addChild(new piTui.Text(line, 0, 0));
1314
1532
  const preview = this.messagePreviews.get(thread.id);
1315
1533
  if (preview) {
1316
- this.listContainer.addChild(new piTui.Text(` ${chunk7K5VFY2N_cjs.fg("muted", `"${preview}"`)}`, 0, 0));
1534
+ this.listContainer.addChild(new piTui.Text(` ${chunkK4WJUBEC_cjs.theme.fg("muted", `"${preview}"`)}`, 0, 0));
1317
1535
  } else if (hasCustomTitle) {
1318
- this.listContainer.addChild(new piTui.Text(` ${chunk7K5VFY2N_cjs.fg("muted", `"${thread.title}"`)}`, 0, 0));
1536
+ this.listContainer.addChild(new piTui.Text(` ${chunkK4WJUBEC_cjs.theme.fg("muted", `"${thread.title}"`)}`, 0, 0));
1319
1537
  }
1320
1538
  }
1321
1539
  if (startIndex > 0 || endIndex < this.filteredThreads.length) {
1322
- const scrollInfo = chunk7K5VFY2N_cjs.fg("muted", `(${this.selectedIndex + 1}/${this.filteredThreads.length})`);
1540
+ const scrollInfo = chunkK4WJUBEC_cjs.theme.fg("muted", `(${this.selectedIndex + 1}/${this.filteredThreads.length})`);
1323
1541
  this.listContainer.addChild(new piTui.Text(scrollInfo, 0, 0));
1324
1542
  }
1325
1543
  if (this.filteredThreads.length === 0) {
1326
- this.listContainer.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("muted", "No matching threads"), 0, 0));
1544
+ this.listContainer.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("muted", "No matching threads"), 0, 0));
1327
1545
  }
1328
1546
  }
1329
1547
  handleInput(keyData) {
@@ -1424,7 +1642,7 @@ async function handleThreadsCommand(ctx) {
1424
1642
  try {
1425
1643
  await state.harness.switchThread({ threadId: thread.id });
1426
1644
  } catch (error) {
1427
- if (error instanceof chunk7K5VFY2N_cjs.ThreadLockError) {
1645
+ if (error instanceof chunkK4WJUBEC_cjs.ThreadLockError) {
1428
1646
  showThreadLockPrompt(ctx, thread.title || thread.id, error.ownerPid);
1429
1647
  } else {
1430
1648
  ctx.showError(`Failed to switch thread: ${error instanceof Error ? error.message : String(error)}`);
@@ -1474,7 +1692,7 @@ async function handleThreadTagDirCommand(ctx) {
1474
1692
  const questionComponent = new AskQuestionInlineComponent(
1475
1693
  {
1476
1694
  question: `Tag this thread with directory "${dirName}"?
1477
- ${chunk7K5VFY2N_cjs.fg("dim", projectPath)}`,
1695
+ ${chunkK4WJUBEC_cjs.theme.fg("dim", projectPath)}`,
1478
1696
  options: [{ label: "Yes" }, { label: "No" }],
1479
1697
  formatResult: (answer) => answer === "Yes" ? `Tagged thread with: ${dirName}` : `Thread not tagged`,
1480
1698
  onSubmit: async (answer) => {
@@ -1644,7 +1862,7 @@ var ModelSelectorComponent = class extends piTui.Box {
1644
1862
  this.searchInput.focused = value;
1645
1863
  }
1646
1864
  constructor(options) {
1647
- super(2, 1, (text) => chunk7K5VFY2N_cjs.bg("overlayBg", text));
1865
+ super(2, 1, (text) => chunkK4WJUBEC_cjs.theme.bg("overlayBg", text));
1648
1866
  this.tui = options.tui;
1649
1867
  this.title = options.title ?? "Select Model";
1650
1868
  this.titleColor = options.titleColor;
@@ -1656,10 +1874,10 @@ var ModelSelectorComponent = class extends piTui.Box {
1656
1874
  this.buildUI();
1657
1875
  }
1658
1876
  buildUI() {
1659
- const titleText = this.titleColor ? chalk10__default.default.bgHex(this.titleColor).white.bold(` ${this.title} `) : chunk7K5VFY2N_cjs.bold(chunk7K5VFY2N_cjs.fg("accent", this.title));
1877
+ const titleText = this.titleColor ? chalk10__default.default.bgHex(this.titleColor).white.bold(` ${this.title} `) : chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", this.title));
1660
1878
  this.addChild(new piTui.Text(titleText, 0, 0));
1661
1879
  this.addChild(new piTui.Spacer(1));
1662
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("muted", "Type to search \u2022 \u2191\u2193 navigate \u2022 Enter select \u2022 Esc cancel"), 0, 0));
1880
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("muted", "Type to search \u2022 \u2191\u2193 navigate \u2022 Enter select \u2022 Esc cancel"), 0, 0));
1663
1881
  this.addChild(new piTui.Spacer(1));
1664
1882
  this.searchInput = new piTui.Input();
1665
1883
  this.searchInput.onSubmit = () => {
@@ -1722,7 +1940,7 @@ var ModelSelectorComponent = class extends piTui.Box {
1722
1940
  if (this.hasCustomItem && i === 0) {
1723
1941
  const query = this.searchInput.getValue().trim();
1724
1942
  const isSelected2 = this.selectedIndex === 0;
1725
- const line2 = isSelected2 ? chunk7K5VFY2N_cjs.fg("accent", "\u2192 ") + chunk7K5VFY2N_cjs.bold(chunk7K5VFY2N_cjs.fg("accent", `Use: ${query}`)) : " " + chunk7K5VFY2N_cjs.fg("muted", `Use: ${query}`);
1943
+ const line2 = isSelected2 ? chunkK4WJUBEC_cjs.theme.fg("accent", "\u2192 ") + chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", `Use: ${query}`)) : " " + chunkK4WJUBEC_cjs.theme.fg("muted", `Use: ${query}`);
1726
1944
  this.listContainer.addChild(new piTui.Text(line2, 0, 0));
1727
1945
  continue;
1728
1946
  }
@@ -1731,23 +1949,23 @@ var ModelSelectorComponent = class extends piTui.Box {
1731
1949
  if (!item) continue;
1732
1950
  const isSelected = i === this.selectedIndex;
1733
1951
  const isCurrent = item.id === this.currentModelId;
1734
- const checkmark = isCurrent ? chunk7K5VFY2N_cjs.fg("success", " \u2713") : "";
1735
- const noKeyIndicator = !item.hasApiKey ? chunk7K5VFY2N_cjs.fg("error", " \u2717") + chunk7K5VFY2N_cjs.fg("muted", item.apiKeyEnvVar ? ` (${item.apiKeyEnvVar})` : " (no key)") : "";
1952
+ const checkmark = isCurrent ? chunkK4WJUBEC_cjs.theme.fg("success", " \u2713") : "";
1953
+ const noKeyIndicator = !item.hasApiKey ? chunkK4WJUBEC_cjs.theme.fg("error", " \u2717") + chunkK4WJUBEC_cjs.theme.fg("muted", item.apiKeyEnvVar ? ` (${item.apiKeyEnvVar})` : " (no key)") : "";
1736
1954
  let line = "";
1737
1955
  if (isSelected) {
1738
- line = chunk7K5VFY2N_cjs.fg("accent", "\u2192 " + item.id) + checkmark + noKeyIndicator;
1956
+ line = chunkK4WJUBEC_cjs.theme.fg("accent", "\u2192 " + item.id) + checkmark + noKeyIndicator;
1739
1957
  } else {
1740
- const modelText = item.hasApiKey ? item.id : chunk7K5VFY2N_cjs.fg("muted", item.id);
1958
+ const modelText = item.hasApiKey ? item.id : chunkK4WJUBEC_cjs.theme.fg("muted", item.id);
1741
1959
  line = " " + modelText + checkmark + noKeyIndicator;
1742
1960
  }
1743
1961
  this.listContainer.addChild(new piTui.Text(line, 0, 0));
1744
1962
  }
1745
1963
  if (startIndex > 0 || endIndex < totalItems) {
1746
- const scrollInfo = chunk7K5VFY2N_cjs.fg("muted", `(${this.selectedIndex + 1}/${totalItems})`);
1964
+ const scrollInfo = chunkK4WJUBEC_cjs.theme.fg("muted", `(${this.selectedIndex + 1}/${totalItems})`);
1747
1965
  this.listContainer.addChild(new piTui.Text(scrollInfo, 0, 0));
1748
1966
  }
1749
1967
  if (totalItems === 0) {
1750
- this.listContainer.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("muted", "No matching models"), 0, 0));
1968
+ this.listContainer.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("muted", "No matching models"), 0, 0));
1751
1969
  }
1752
1970
  }
1753
1971
  handleInput(keyData) {
@@ -1808,10 +2026,10 @@ async function showModelListForScope(ctx, scope, modeId, modeName) {
1808
2026
  try {
1809
2027
  await ctx.state.harness.switchModel({ modelId: model.id, scope, modeId });
1810
2028
  if (scope === "global") {
1811
- const settings = chunk7K5VFY2N_cjs.loadSettings();
2029
+ const settings = chunkK4WJUBEC_cjs.loadSettings();
1812
2030
  settings.models.activeModelPackId = null;
1813
2031
  settings.models.modeDefaults[modeId] = model.id;
1814
- chunk7K5VFY2N_cjs.saveSettings(settings);
2032
+ chunkK4WJUBEC_cjs.saveSettings(settings);
1815
2033
  }
1816
2034
  ctx.showInfo(`Model set for ${scopeLabel}: ${model.id}`);
1817
2035
  } catch (err) {
@@ -1932,7 +2150,9 @@ async function handleModelsCommand(ctx) {
1932
2150
  }
1933
2151
  var GRADIENT_WIDTH = 30;
1934
2152
  var BASE_COLOR = [124, 58, 237];
1935
- var MIN_BRIGHTNESS = 0.45;
2153
+ function getMinBrightness() {
2154
+ return chunkK4WJUBEC_cjs.getThemeMode() === "dark" ? 0.45 : 0.55;
2155
+ }
1936
2156
  function hexToRgb(hex) {
1937
2157
  const h = hex.replace("#", "");
1938
2158
  return [parseInt(h.slice(0, 2), 16), parseInt(h.slice(2, 4), 16), parseInt(h.slice(4, 6), 16)];
@@ -1952,7 +2172,8 @@ function applyGradientSweep(text, offset, color, fadeProgress = 0) {
1952
2172
  distance = 100 - distance;
1953
2173
  }
1954
2174
  const normalizedDistance = Math.min(distance / (GRADIENT_WIDTH / 2), 1);
1955
- const animBrightness = MIN_BRIGHTNESS + (1 - MIN_BRIGHTNESS) * (1 - normalizedDistance);
2175
+ const minBrightness = getMinBrightness();
2176
+ const animBrightness = minBrightness + (1 - minBrightness) * (1 - normalizedDistance);
1956
2177
  const brightness = animBrightness + (IDLE_BRIGHTNESS - animBrightness) * fadeProgress;
1957
2178
  const r = Math.floor(baseColor[0] * brightness);
1958
2179
  const g = Math.floor(baseColor[1] * brightness);
@@ -2089,18 +2310,18 @@ var OMProgressComponent = class extends piTui.Container {
2089
2310
  if (this.state.thresholdPercent > 0) {
2090
2311
  const percent = Math.round(this.state.thresholdPercent);
2091
2312
  const bar = this.renderProgressBar(percent, 10);
2092
- this.statusText.setText(chunk7K5VFY2N_cjs.fg("muted", `OM ${bar} ${percent}%`));
2313
+ this.statusText.setText(chunkK4WJUBEC_cjs.theme.fg("muted", `OM ${bar} ${percent}%`));
2093
2314
  } else {
2094
2315
  this.statusText.setText("");
2095
2316
  }
2096
2317
  } else if (this.state.status === "observing") {
2097
2318
  const elapsed = this.state.startTime ? Math.round((Date.now() - this.state.startTime) / 1e3) : 0;
2098
2319
  const spinner = this.getSpinner();
2099
- this.statusText.setText(chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.orange)(`${spinner} Observing... ${elapsed}s`));
2320
+ this.statusText.setText(chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.orange)(`${spinner} Observing... ${elapsed}s`));
2100
2321
  } else if (this.state.status === "reflecting") {
2101
2322
  const elapsed = this.state.startTime ? Math.round((Date.now() - this.state.startTime) / 1e3) : 0;
2102
2323
  const spinner = this.getSpinner();
2103
- this.statusText.setText(chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.pink)(`${spinner} Reflecting... ${elapsed}s`));
2324
+ this.statusText.setText(chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.pink)(`${spinner} Reflecting... ${elapsed}s`));
2104
2325
  }
2105
2326
  }
2106
2327
  renderProgressBar(percent, width) {
@@ -2108,11 +2329,11 @@ var OMProgressComponent = class extends piTui.Container {
2108
2329
  const empty = width - filled;
2109
2330
  const bar = "\u2501".repeat(filled) + "\u2500".repeat(empty);
2110
2331
  if (percent >= 90) {
2111
- return chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.red)(bar);
2332
+ return chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.red)(bar);
2112
2333
  } else if (percent >= 70) {
2113
- return chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.orange)(bar);
2334
+ return chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.orange)(bar);
2114
2335
  } else {
2115
- return chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.darkGray)(bar);
2336
+ return chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.darkGray)(bar);
2116
2337
  }
2117
2338
  }
2118
2339
  spinnerFrame = 0;
@@ -2138,27 +2359,27 @@ function formatTokensThreshold(n) {
2138
2359
  return (s.endsWith(".0") ? s.slice(0, -2) : s) + "k";
2139
2360
  }
2140
2361
  function colorByPercent(text, percent) {
2141
- if (percent >= 90) return chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.red)(text);
2142
- if (percent >= 70) return chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.orange)(text);
2143
- return chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.darkGray)(text);
2362
+ if (percent >= 90) return chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.red)(text);
2363
+ if (percent >= 70) return chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.orange)(text);
2364
+ return chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.darkGray)(text);
2144
2365
  }
2145
2366
  function formatObservationStatus(state, compact, labelStyler) {
2146
2367
  const percent = Math.round(state.thresholdPercent);
2147
2368
  const pct = colorByPercent(`${percent}%`, percent);
2148
- const defaultStyler = (s) => chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.specialGray)(s);
2369
+ const defaultStyler = (s) => chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.specialGray)(s);
2149
2370
  const styleLabel = labelStyler ?? defaultStyler;
2150
2371
  if (compact === "percentOnly") {
2151
2372
  return styleLabel("msg ") + pct;
2152
2373
  }
2153
2374
  const label = compact === "full" ? "messages" : "msg";
2154
2375
  const fraction = `${formatTokensValue(state.pendingTokens)}/${formatTokensThreshold(state.threshold)}`;
2155
- const buffered = compact !== "noBuffer" && state.buffered.observations.projectedMessageRemoval > 0 ? chalk10__default.default.hex("#555")(` \u2193${formatTokensThreshold(state.buffered.observations.projectedMessageRemoval)}`) : "";
2376
+ const buffered = compact !== "noBuffer" && state.buffered.observations.projectedMessageRemoval > 0 ? chunkK4WJUBEC_cjs.theme.fg("muted", ` \u2193${formatTokensThreshold(state.buffered.observations.projectedMessageRemoval)}`) : "";
2156
2377
  return styleLabel(`${label} `) + colorByPercent(fraction, percent) + buffered;
2157
2378
  }
2158
2379
  function formatReflectionStatus(state, compact, labelStyler) {
2159
2380
  const percent = Math.round(state.reflectionThresholdPercent);
2160
2381
  const pct = colorByPercent(`${percent}%`, percent);
2161
- const defaultStyler = (s) => chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.specialGray)(s);
2382
+ const defaultStyler = (s) => chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.specialGray)(s);
2162
2383
  const styleLabel = labelStyler ?? defaultStyler;
2163
2384
  const label = styleLabel(compact === "full" ? "memory" : "mem") + " ";
2164
2385
  if (compact === "percentOnly") {
@@ -2166,7 +2387,7 @@ function formatReflectionStatus(state, compact, labelStyler) {
2166
2387
  }
2167
2388
  const fraction = `${formatTokensValue(state.observationTokens)}/${formatTokensThreshold(state.reflectionThreshold)}`;
2168
2389
  const savings = state.buffered.reflection.inputObservationTokens - state.buffered.reflection.observationTokens;
2169
- const buffered = compact !== "noBuffer" && state.buffered.reflection.status === "complete" ? chalk10__default.default.hex("#555")(` \u2193${formatTokensThreshold(savings)}`) : "";
2390
+ const buffered = compact !== "noBuffer" && state.buffered.reflection.status === "complete" ? chunkK4WJUBEC_cjs.theme.fg("muted", ` \u2193${formatTokensThreshold(savings)}`) : "";
2170
2391
  return label + colorByPercent(fraction, percent) + buffered;
2171
2392
  }
2172
2393
  function formatOMStatus(state) {
@@ -2174,8 +2395,18 @@ function formatOMStatus(state) {
2174
2395
  }
2175
2396
 
2176
2397
  // src/tui/status-line.ts
2177
- var OBSERVER_COLOR = chunk7K5VFY2N_cjs.mastra.orange;
2178
- var REFLECTOR_COLOR = chunk7K5VFY2N_cjs.mastra.pink;
2398
+ var OBSERVER_COLOR = chunkK4WJUBEC_cjs.mastra.orange;
2399
+ var REFLECTOR_COLOR = chunkK4WJUBEC_cjs.mastra.pink;
2400
+ function lighten(r, g, b, factor) {
2401
+ return [Math.floor(r + (255 - r) * factor), Math.floor(g + (255 - g) * factor), Math.floor(b + (255 - b) * factor)];
2402
+ }
2403
+ function adjustBadgeColor(r, g, b, modeColor) {
2404
+ if (chunkK4WJUBEC_cjs.getThemeMode() !== "light") return [r, g, b];
2405
+ if (modeColor === chunkK4WJUBEC_cjs.mastra.purple || modeColor === chunkK4WJUBEC_cjs.mastra.blue) {
2406
+ return lighten(r, g, b, 0.25);
2407
+ }
2408
+ return [r, g, b];
2409
+ }
2179
2410
  function updateStatusLine(state) {
2180
2411
  if (!state.statusLine) return;
2181
2412
  const termWidth = (process.stdout.columns || 80) - 1;
@@ -2206,25 +2437,26 @@ function updateStatusLine(state) {
2206
2437
  badgeBrightness = animBrightness + (0.9 - animBrightness) * fade;
2207
2438
  }
2208
2439
  }
2209
- const [mr, mg, mb] = [
2440
+ const [mr, mg, mb] = adjustBadgeColor(
2210
2441
  Math.floor(mcr * badgeBrightness),
2211
2442
  Math.floor(mcg * badgeBrightness),
2212
- Math.floor(mcb * badgeBrightness)
2213
- ];
2214
- modeBadge = chalk10__default.default.bgRgb(mr, mg, mb).hex(chunk7K5VFY2N_cjs.mastra.bg).bold(` ${badgeName.toLowerCase()} `);
2443
+ Math.floor(mcb * badgeBrightness),
2444
+ modeColor
2445
+ );
2446
+ modeBadge = chalk10__default.default.bgRgb(mr, mg, mb).hex("#000000").bold(` ${badgeName.toLowerCase()} `);
2215
2447
  modeBadgeWidth = badgeName.length + 2;
2216
2448
  } else if (badgeName) {
2217
- modeBadge = chunk7K5VFY2N_cjs.fg("dim", badgeName) + " ";
2449
+ modeBadge = chunkK4WJUBEC_cjs.theme.fg("dim", badgeName) + " ";
2218
2450
  modeBadgeWidth = badgeName.length + 1;
2219
2451
  }
2220
2452
  if (mainModeColor) {
2221
- const [br, bg2, bb] = [
2453
+ const [br, bg, bb] = [
2222
2454
  parseInt(mainModeColor.slice(1, 3), 16),
2223
2455
  parseInt(mainModeColor.slice(3, 5), 16),
2224
2456
  parseInt(mainModeColor.slice(5, 7), 16)
2225
2457
  ];
2226
2458
  const dim = 0.35;
2227
- state.editor.borderColor = (text) => chalk10__default.default.rgb(Math.floor(br * dim), Math.floor(bg2 * dim), Math.floor(bb * dim))(text);
2459
+ state.editor.borderColor = (text) => chalk10__default.default.rgb(Math.floor(br * dim), Math.floor(bg * dim), Math.floor(bb * dim))(text);
2228
2460
  }
2229
2461
  const fullModelId = showOMMode ? isObserving ? state.harness.getObserverModelId() : state.harness.getReflectorModelId() : state.harness.getFullModelId();
2230
2462
  const shortModelId = fullModelId.includes("/") ? fullModelId.slice(fullModelId.indexOf("/") + 1) : fullModelId;
@@ -2234,16 +2466,17 @@ function updateStatusLine(state) {
2234
2466
  if (homedir2 && displayPath.startsWith(homedir2)) {
2235
2467
  displayPath = "~" + displayPath.slice(homedir2.length);
2236
2468
  }
2237
- if (state.projectInfo.gitBranch) {
2238
- displayPath = `${displayPath} (${state.projectInfo.gitBranch})`;
2239
- }
2469
+ const branch = state.projectInfo.gitBranch;
2470
+ const dirFull = branch ? `${displayPath} (${branch})` : displayPath;
2471
+ const dirBranchOnly = branch || null;
2472
+ const dirBranchShort = branch && branch.length > 24 ? branch.slice(0, 12) + ".." + branch.slice(-8) : dirBranchOnly;
2240
2473
  const isYolo = state.harness.getState().yolo === true;
2241
2474
  const styleModelId = (id) => {
2242
2475
  if (!state.modelAuthStatus.hasAuth) {
2243
2476
  const envVar = state.modelAuthStatus.apiKeyEnvVar;
2244
- return chunk7K5VFY2N_cjs.fg("dim", id) + chunk7K5VFY2N_cjs.fg("error", " \u2717") + chunk7K5VFY2N_cjs.fg("muted", envVar ? ` (${envVar})` : " (no key)");
2477
+ return chunkK4WJUBEC_cjs.theme.fg("dim", id) + chunkK4WJUBEC_cjs.theme.fg("error", " \u2717") + chunkK4WJUBEC_cjs.theme.fg("muted", envVar ? ` (${envVar})` : " (no key)");
2245
2478
  }
2246
- const tintBg = modeColor ? chunk7K5VFY2N_cjs.tintHex(modeColor, 0.15) : void 0;
2479
+ const tintBg = modeColor ? chunkK4WJUBEC_cjs.tintHex(modeColor, 0.15) : void 0;
2247
2480
  const padded = ` ${id} `;
2248
2481
  if (state.gradientAnimator?.isRunning() && modeColor) {
2249
2482
  const fade = state.gradientAnimator.getFadeProgress();
@@ -2259,16 +2492,17 @@ function updateStatusLine(state) {
2259
2492
  }
2260
2493
  }
2261
2494
  if (modeColor) {
2262
- const [r, g, b] = [
2495
+ const [r, g, b] = adjustBadgeColor(
2263
2496
  parseInt(modeColor.slice(1, 3), 16),
2264
2497
  parseInt(modeColor.slice(3, 5), 16),
2265
- parseInt(modeColor.slice(5, 7), 16)
2266
- ];
2498
+ parseInt(modeColor.slice(5, 7), 16),
2499
+ modeColor
2500
+ );
2267
2501
  const dim = 0.8;
2268
2502
  const fgStyled = chalk10__default.default.rgb(Math.floor(r * dim), Math.floor(g * dim), Math.floor(b * dim)).bold(padded);
2269
2503
  return tintBg ? chalk10__default.default.bgHex(tintBg)(fgStyled) : fgStyled;
2270
2504
  }
2271
- return chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.specialGray).bold(id);
2505
+ return chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.specialGray).bold(id);
2272
2506
  };
2273
2507
  let shortModeBadge = "";
2274
2508
  let shortModeBadgeWidth = 0;
@@ -2288,22 +2522,23 @@ function updateStatusLine(state) {
2288
2522
  sBadgeBrightness = animBrightness + (0.9 - animBrightness) * fade;
2289
2523
  }
2290
2524
  }
2291
- const [sr, sg, sb] = [
2525
+ const [sr, sg, sb] = adjustBadgeColor(
2292
2526
  Math.floor(mcr * sBadgeBrightness),
2293
2527
  Math.floor(mcg * sBadgeBrightness),
2294
- Math.floor(mcb * sBadgeBrightness)
2295
- ];
2296
- shortModeBadge = chalk10__default.default.bgRgb(sr, sg, sb).hex(chunk7K5VFY2N_cjs.mastra.bg).bold(` ${shortName} `);
2528
+ Math.floor(mcb * sBadgeBrightness),
2529
+ modeColor
2530
+ );
2531
+ shortModeBadge = chalk10__default.default.bgRgb(sr, sg, sb).hex("#000000").bold(` ${shortName} `);
2297
2532
  shortModeBadgeWidth = shortName.length + 2;
2298
2533
  } else if (badgeName) {
2299
2534
  const shortName = badgeName.toLowerCase().charAt(0);
2300
- shortModeBadge = chunk7K5VFY2N_cjs.fg("dim", shortName) + " ";
2535
+ shortModeBadge = chunkK4WJUBEC_cjs.theme.fg("dim", shortName) + " ";
2301
2536
  shortModeBadgeWidth = shortName.length + 1;
2302
2537
  }
2303
2538
  const buildLine = (opts) => {
2304
2539
  const parts = [];
2305
2540
  if (isYolo && modeColor) {
2306
- const yBox = chalk10__default.default.bgHex(chunk7K5VFY2N_cjs.tintHex(modeColor, 0.25)).hex(chunk7K5VFY2N_cjs.tintHex(modeColor, 0.9)).bold(" \u2692 ");
2541
+ const yBox = chalk10__default.default.bgHex(chunkK4WJUBEC_cjs.tintHex(modeColor, 0.25)).hex(chunkK4WJUBEC_cjs.tintHex(modeColor, 0.9)).bold(" \u2692 ");
2307
2542
  parts.push({
2308
2543
  plain: ` ${opts.modelId} \u2692 `,
2309
2544
  styled: styleModelId(opts.modelId) + yBox
@@ -2338,16 +2573,18 @@ function updateStatusLine(state) {
2338
2573
  if (ref) {
2339
2574
  parts.push({ plain: ref, styled: ref });
2340
2575
  }
2341
- if (opts.showDir) {
2576
+ const dirText = opts.dir !== void 0 ? opts.dir : opts.showDir ? dirFull : null;
2577
+ if (dirText) {
2342
2578
  parts.push({
2343
- plain: displayPath,
2344
- styled: chunk7K5VFY2N_cjs.fg("dim", displayPath)
2579
+ plain: dirText,
2580
+ styled: chunkK4WJUBEC_cjs.theme.fg("dim", dirText)
2345
2581
  });
2346
2582
  }
2347
2583
  const totalPlain = useBadgeWidth + parts.reduce((sum, p, i) => sum + piTui.visibleWidth(p.plain) + (i > 0 ? SEP.length : 0), 0);
2348
2584
  if (totalPlain > termWidth) return null;
2349
2585
  let styledLine;
2350
- if (opts.showDir && parts.length >= 3) {
2586
+ const hasDir = !!dirText;
2587
+ if (hasDir && parts.length >= 3) {
2351
2588
  const leftPart = parts[0];
2352
2589
  const centerParts = parts.slice(1, -1);
2353
2590
  const dirPart = parts[parts.length - 1];
@@ -2359,7 +2596,7 @@ function updateStatusLine(state) {
2359
2596
  const gapLeft = Math.floor(freeSpace / 2);
2360
2597
  const gapRight = freeSpace - gapLeft;
2361
2598
  styledLine = useBadge + leftPart.styled + " ".repeat(Math.max(gapLeft, 1)) + centerParts.map((p) => p.styled).join(SEP) + " ".repeat(Math.max(gapRight, 1)) + dirPart.styled;
2362
- } else if (opts.showDir && parts.length === 2) {
2599
+ } else if (hasDir && parts.length === 2) {
2363
2600
  const mainStr = useBadge + parts[0].styled;
2364
2601
  const dirPart = parts[parts.length - 1];
2365
2602
  const gap = termWidth - totalPlain;
@@ -2370,23 +2607,25 @@ function updateStatusLine(state) {
2370
2607
  return { plain: "", styled: styledLine };
2371
2608
  };
2372
2609
  const result = (
2373
- // 1. Full badge + full model + long labels + fractions + buffer + dir
2374
- buildLine({ modelId: fullModelId, memCompact: "full", showDir: true }) ?? // 2. Drop directory
2375
- buildLine({ modelId: fullModelId, memCompact: "full", showDir: false }) ?? // 3. Drop provider + "claude-" prefix, keep full labels + fractions + buffer
2376
- buildLine({ modelId: tinyModelId, memCompact: "full", showDir: false }) ?? // 4. Short labels (msg/mem) + fractions + buffer
2377
- buildLine({ modelId: tinyModelId, showDir: false }) ?? // 5. Short badge + short labels + fractions + buffer
2378
- buildLine({ modelId: tinyModelId, showDir: false, badge: "short" }) ?? // 6. Short badge + fractions (drop buffer indicator)
2610
+ // 1. Full badge + full model + long labels + fractions + buffer + full dir
2611
+ buildLine({ modelId: fullModelId, memCompact: "full", showDir: false, dir: dirFull }) ?? // 2. Full badge + full model + branch only (drop path)
2612
+ buildLine({ modelId: fullModelId, memCompact: "full", showDir: false, dir: dirBranchOnly }) ?? // 3. Full badge + full model + abbreviated branch
2613
+ buildLine({ modelId: fullModelId, memCompact: "full", showDir: false, dir: dirBranchShort }) ?? // 4. Drop directory entirely
2614
+ buildLine({ modelId: fullModelId, memCompact: "full", showDir: false }) ?? // 5. Drop provider + "claude-" prefix, keep full labels + fractions + buffer
2615
+ buildLine({ modelId: tinyModelId, memCompact: "full", showDir: false }) ?? // 6. Short labels (msg/mem) + fractions + buffer
2616
+ buildLine({ modelId: tinyModelId, showDir: false }) ?? // 7. Short badge + short labels + fractions + buffer
2617
+ buildLine({ modelId: tinyModelId, showDir: false, badge: "short" }) ?? // 8. Short badge + fractions (drop buffer indicator)
2379
2618
  buildLine({
2380
2619
  modelId: tinyModelId,
2381
2620
  memCompact: "noBuffer",
2382
2621
  showDir: false,
2383
2622
  badge: "short"
2384
- }) ?? // 7. Full badge + percent only
2623
+ }) ?? // 9. Full badge + percent only
2385
2624
  buildLine({
2386
2625
  modelId: tinyModelId,
2387
2626
  memCompact: "percentOnly",
2388
2627
  showDir: false
2389
- }) ?? // 8. Short badge + percent only
2628
+ }) ?? // 10. Short badge + percent only
2390
2629
  buildLine({
2391
2630
  modelId: tinyModelId,
2392
2631
  memCompact: "percentOnly",
@@ -2395,7 +2634,7 @@ function updateStatusLine(state) {
2395
2634
  })
2396
2635
  );
2397
2636
  state.statusLine.setText(
2398
- result?.styled ?? shortModeBadge + styleModelId(tinyModelId) + (isYolo && modeColor ? chalk10__default.default.bgHex(chunk7K5VFY2N_cjs.tintHex(modeColor, 0.25)).hex(chunk7K5VFY2N_cjs.tintHex(modeColor, 0.9)).bold(" \u2692 ") : "")
2637
+ result?.styled ?? shortModeBadge + styleModelId(tinyModelId) + (isYolo && modeColor ? chalk10__default.default.bgHex(chunkK4WJUBEC_cjs.tintHex(modeColor, 0.25)).hex(chunkK4WJUBEC_cjs.tintHex(modeColor, 0.9)).bold(" \u2692 ") : "")
2399
2638
  );
2400
2639
  if (state.memoryStatusLine) {
2401
2640
  state.memoryStatusLine.setText("");
@@ -2433,9 +2672,9 @@ async function selectModel(ctx, title, modeColor) {
2433
2672
  }
2434
2673
  async function runCustomFlow(ctx) {
2435
2674
  const modes = [
2436
- { id: "plan", label: "plan", color: chunk7K5VFY2N_cjs.mastra.blue },
2437
- { id: "build", label: "build", color: chunk7K5VFY2N_cjs.mastra.purple },
2438
- { id: "fast", label: "fast", color: chunk7K5VFY2N_cjs.mastra.green }
2675
+ { id: "plan", label: "plan", color: chunkK4WJUBEC_cjs.mastra.blue },
2676
+ { id: "build", label: "build", color: chunkK4WJUBEC_cjs.mastra.purple },
2677
+ { id: "fast", label: "fast", color: chunkK4WJUBEC_cjs.mastra.green }
2439
2678
  ];
2440
2679
  const models = { build: "", plan: "", fast: "" };
2441
2680
  for (const mode of modes) {
@@ -2472,7 +2711,7 @@ function applyPack(ctx, pack) {
2472
2711
  harness.setSubagentModelId({ modelId: saModelId, agentType });
2473
2712
  }
2474
2713
  }
2475
- const s = chunk7K5VFY2N_cjs.loadSettings();
2714
+ const s = chunkK4WJUBEC_cjs.loadSettings();
2476
2715
  const modeDefaults = {};
2477
2716
  for (const mode of modes) {
2478
2717
  const modelId = pack.models[mode.id];
@@ -2496,17 +2735,22 @@ function applyPack(ctx, pack) {
2496
2735
  s.models.modeDefaults = {};
2497
2736
  }
2498
2737
  s.models.subagentModels = {};
2499
- chunk7K5VFY2N_cjs.saveSettings(s);
2738
+ chunkK4WJUBEC_cjs.saveSettings(s);
2739
+ const hasOpenAI = Object.values(pack.models).some((m) => m.startsWith("openai/"));
2740
+ const currentThinking = harness.getState()?.thinkingLevel ?? "off";
2741
+ if (hasOpenAI && currentThinking === "off") {
2742
+ harness.setState({ thinkingLevel: "low" });
2743
+ }
2500
2744
  updateStatusLine(ctx.state);
2501
2745
  }
2502
2746
  function getPackDetail(pack) {
2503
2747
  if (pack.id === "custom") {
2504
- return chunk7K5VFY2N_cjs.fg("dim", " You'll pick a model for each mode.");
2748
+ return chunkK4WJUBEC_cjs.theme.fg("dim", " You'll pick a model for each mode.");
2505
2749
  }
2506
2750
  return [
2507
- ` ${chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.blue)("plan")} \u2192 ${chunk7K5VFY2N_cjs.fg("text", pack.models.plan)}`,
2508
- ` ${chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.purple)("build")} \u2192 ${chunk7K5VFY2N_cjs.fg("text", pack.models.build)}`,
2509
- ` ${chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.green)("fast")} \u2192 ${chunk7K5VFY2N_cjs.fg("text", pack.models.fast)}`
2751
+ ` ${chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.blue)("plan")} \u2192 ${chunkK4WJUBEC_cjs.theme.fg("text", pack.models.plan)}`,
2752
+ ` ${chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.purple)("build")} \u2192 ${chunkK4WJUBEC_cjs.theme.fg("text", pack.models.build)}`,
2753
+ ` ${chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.green)("fast")} \u2192 ${chunkK4WJUBEC_cjs.theme.fg("text", pack.models.fast)}`
2510
2754
  ].join("\n");
2511
2755
  }
2512
2756
  async function handleModelsPackCommand(ctx) {
@@ -2525,8 +2769,8 @@ async function handleModelsPackCommand(ctx) {
2525
2769
  google: hasEnv("google") ? "apikey" : false,
2526
2770
  deepseek: hasEnv("deepseek") ? "apikey" : false
2527
2771
  };
2528
- const settings = chunk7K5VFY2N_cjs.loadSettings();
2529
- const packs = chunk7K5VFY2N_cjs.getAvailableModePacks(access, settings.customModelPacks);
2772
+ const settings = chunkK4WJUBEC_cjs.loadSettings();
2773
+ const packs = chunkK4WJUBEC_cjs.getAvailableModePacks(access, settings.customModelPacks);
2530
2774
  if (packs.length === 0) {
2531
2775
  ctx.showInfo("No model packs available. Run /setup to configure.");
2532
2776
  return;
@@ -2534,13 +2778,13 @@ async function handleModelsPackCommand(ctx) {
2534
2778
  const currentPackId = settings.models.activeModelPackId;
2535
2779
  const items = packs.map((p) => ({
2536
2780
  value: p.id,
2537
- label: ` ${p.name} ${chunk7K5VFY2N_cjs.fg("dim", p.description)}${p.id === currentPackId ? chunk7K5VFY2N_cjs.fg("dim", " (current)") : ""}`
2781
+ label: ` ${p.name} ${chunkK4WJUBEC_cjs.theme.fg("dim", p.description)}${p.id === currentPackId ? chunkK4WJUBEC_cjs.theme.fg("dim", " (current)") : ""}`
2538
2782
  }));
2539
2783
  return new Promise((resolve2) => {
2540
2784
  const container = new piTui.Box(1, 1);
2541
- container.addChild(new piTui.Text(chunk7K5VFY2N_cjs.bold(chunk7K5VFY2N_cjs.fg("accent", "Switch model pack")), 0, 0));
2785
+ container.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", "Switch model pack")), 0, 0));
2542
2786
  container.addChild(new piTui.Spacer(1));
2543
- const selectList = new piTui.SelectList(items, items.length, chunk7K5VFY2N_cjs.getSelectListTheme());
2787
+ const selectList = new piTui.SelectList(items, items.length, chunkK4WJUBEC_cjs.getSelectListTheme());
2544
2788
  const detailText = new piTui.Text("", 0, 0);
2545
2789
  const updateDetail = (packId) => {
2546
2790
  const pack = packs.find((p) => p.id === packId);
@@ -2561,14 +2805,14 @@ async function handleModelsPackCommand(ctx) {
2561
2805
  const customPack = await runCustomFlow(ctx);
2562
2806
  if (customPack) {
2563
2807
  applyPack(ctx, customPack);
2564
- collapseResult(`Model pack \u2192 ${chunk7K5VFY2N_cjs.bold("Custom")}`);
2808
+ collapseResult(`Model pack \u2192 ${chunkK4WJUBEC_cjs.theme.bold("Custom")}`);
2565
2809
  ctx.showInfo("Switched to Custom pack");
2566
2810
  } else {
2567
2811
  collapseResult("cancelled");
2568
2812
  }
2569
2813
  } else {
2570
2814
  applyPack(ctx, pack);
2571
- collapseResult(`Model pack \u2192 ${chunk7K5VFY2N_cjs.bold(pack.name)}`);
2815
+ collapseResult(`Model pack \u2192 ${chunkK4WJUBEC_cjs.theme.bold(pack.name)}`);
2572
2816
  ctx.showInfo(`Switched to ${pack.name} pack`);
2573
2817
  }
2574
2818
  resolve2();
@@ -2585,7 +2829,7 @@ async function handleModelsPackCommand(ctx) {
2585
2829
  container.addChild(new piTui.Spacer(1));
2586
2830
  container.addChild(detailText);
2587
2831
  container.addChild(new piTui.Spacer(1));
2588
- container.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("dim", "\u2191\u2193 navigate \xB7 Enter select \xB7 Esc cancel"), 0, 0));
2832
+ container.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("dim", "\u2191\u2193 navigate \xB7 Enter select \xB7 Esc cancel"), 0, 0));
2589
2833
  const currentIdx = packs.findIndex((p) => p.id === currentPackId);
2590
2834
  const initialIdx = currentIdx >= 0 ? currentIdx : 0;
2591
2835
  if (initialIdx > 0) selectList.setSelectedIndex(initialIdx);
@@ -2595,9 +2839,9 @@ async function handleModelsPackCommand(ctx) {
2595
2839
  const collapseResult = (result) => {
2596
2840
  container.clear();
2597
2841
  if (result === "cancelled") {
2598
- container.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("dim", `${chunk7K5VFY2N_cjs.fg("error", "\u2717")} Model pack (cancelled)`), 0, 0));
2842
+ container.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("dim", `${chunkK4WJUBEC_cjs.theme.fg("error", "\u2717")} Model pack (cancelled)`), 0, 0));
2599
2843
  } else if (result) {
2600
- container.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("text", `${chunk7K5VFY2N_cjs.fg("success", "\u2713")} ${result}`), 0, 0));
2844
+ container.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("text", `${chunkK4WJUBEC_cjs.theme.fg("success", "\u2713")} ${result}`), 0, 0));
2601
2845
  }
2602
2846
  };
2603
2847
  ctx.state.chatContainer.addChild(new piTui.Spacer(1));
@@ -2626,9 +2870,9 @@ async function showSubagentModelListForScope(ctx, scope, agentType, agentTypeLab
2626
2870
  try {
2627
2871
  await ctx.state.harness.setSubagentModelId({ modelId: model.id, agentType });
2628
2872
  if (scope === "global") {
2629
- const settings = chunk7K5VFY2N_cjs.loadSettings();
2873
+ const settings = chunkK4WJUBEC_cjs.loadSettings();
2630
2874
  settings.models.subagentModels[agentType] = model.id;
2631
- chunk7K5VFY2N_cjs.saveSettings(settings);
2875
+ chunkK4WJUBEC_cjs.saveSettings(settings);
2632
2876
  }
2633
2877
  ctx.showInfo(`Subagent model set for ${scopeLabel}: ${model.id}`);
2634
2878
  } catch (err) {
@@ -2783,18 +3027,18 @@ var ThresholdSubmenu = class extends piTui.Container {
2783
3027
  super();
2784
3028
  this.onDone = onDone;
2785
3029
  this.onBack = onBack;
2786
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.bold(chunk7K5VFY2N_cjs.fg("accent", title)), 0, 0));
3030
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", title)), 0, 0));
2787
3031
  this.addChild(new piTui.Spacer(1));
2788
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("muted", " _k tokens (type a number, e.g. 30 for 30k):"), 0, 0));
3032
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("muted", " _k tokens (type a number, e.g. 30 for 30k):"), 0, 0));
2789
3033
  this.input = new piTui.Input();
2790
3034
  this.addChild(this.input);
2791
3035
  this.addChild(new piTui.Spacer(1));
2792
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("muted", " Or pick a preset:"), 0, 0));
3036
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("muted", " Or pick a preset:"), 0, 0));
2793
3037
  const items = presets.map((p) => ({
2794
3038
  value: String(p),
2795
3039
  label: ` ${formatTokens(p)} tokens`
2796
3040
  }));
2797
- this.selectList = new piTui.SelectList(items, Math.min(items.length, 8), chunk7K5VFY2N_cjs.getSelectListTheme());
3041
+ this.selectList = new piTui.SelectList(items, Math.min(items.length, 8), chunkK4WJUBEC_cjs.getSelectListTheme());
2798
3042
  const currentIndex = presets.indexOf(currentValue);
2799
3043
  if (currentIndex !== -1) {
2800
3044
  this.selectList.setSelectedIndex(currentIndex);
@@ -2805,7 +3049,7 @@ var ThresholdSubmenu = class extends piTui.Container {
2805
3049
  this.selectList.onCancel = onBack;
2806
3050
  this.addChild(this.selectList);
2807
3051
  this.addChild(new piTui.Spacer(1));
2808
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("dim", " Enter to confirm \xB7 \u2193 for presets \xB7 Esc to go back"), 0, 0));
3052
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("dim", " Enter to confirm \xB7 \u2193 for presets \xB7 Esc to go back"), 0, 0));
2809
3053
  }
2810
3054
  handleInput(data) {
2811
3055
  if (this.inInputMode) {
@@ -2848,9 +3092,9 @@ var ModelSelectSubmenu = class extends piTui.Container {
2848
3092
  this.onSelect = onSelect;
2849
3093
  this.onCancel = onCancel;
2850
3094
  this.tui = tui;
2851
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.bold(chunk7K5VFY2N_cjs.fg("accent", title)), 0, 0));
3095
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", title)), 0, 0));
2852
3096
  this.addChild(new piTui.Spacer(1));
2853
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("muted", "Type to search \xB7 \u2191\u2193 navigate \xB7 Enter select \xB7 Esc back"), 0, 0));
3097
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("muted", "Type to search \xB7 \u2191\u2193 navigate \xB7 Enter select \xB7 Esc back"), 0, 0));
2854
3098
  this.addChild(new piTui.Spacer(1));
2855
3099
  this.searchInput = new piTui.Input();
2856
3100
  this.addChild(this.searchInput);
@@ -2878,15 +3122,15 @@ var ModelSelectSubmenu = class extends piTui.Container {
2878
3122
  const item = this.filteredModels[i];
2879
3123
  const isSelected = i === this.selectedIndex;
2880
3124
  const isCurrent = item.id === this.currentModelId;
2881
- const checkmark = isCurrent ? chunk7K5VFY2N_cjs.fg("success", " \u2713") : "";
2882
- const line = isSelected ? chunk7K5VFY2N_cjs.fg("accent", `\u2192 ${item.label}`) + checkmark : ` ${item.label}` + checkmark;
3125
+ const checkmark = isCurrent ? chunkK4WJUBEC_cjs.theme.fg("success", " \u2713") : "";
3126
+ const line = isSelected ? chunkK4WJUBEC_cjs.theme.fg("accent", `\u2192 ${item.label}`) + checkmark : ` ${item.label}` + checkmark;
2883
3127
  this.listContainer.addChild(new piTui.Text(line, 0, 0));
2884
3128
  }
2885
3129
  if (startIndex > 0 || endIndex < total) {
2886
- this.listContainer.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("muted", `(${this.selectedIndex + 1}/${total})`), 0, 0));
3130
+ this.listContainer.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("muted", `(${this.selectedIndex + 1}/${total})`), 0, 0));
2887
3131
  }
2888
3132
  if (total === 0) {
2889
- this.listContainer.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("muted", "No matching models"), 0, 0));
3133
+ this.listContainer.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("muted", "No matching models"), 0, 0));
2890
3134
  }
2891
3135
  }
2892
3136
  handleInput(data) {
@@ -2925,8 +3169,8 @@ var OMSettingsComponent = class extends piTui.Box {
2925
3169
  this._focused = value;
2926
3170
  }
2927
3171
  constructor(config, callbacks, models, tui) {
2928
- super(2, 1, (text) => chunk7K5VFY2N_cjs.bg("overlayBg", text));
2929
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.bold(chunk7K5VFY2N_cjs.fg("accent", "Observational Memory Settings")), 0, 0));
3172
+ super(2, 1, (text) => chunkK4WJUBEC_cjs.theme.bg("overlayBg", text));
3173
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", "Observational Memory Settings")), 0, 0));
2930
3174
  this.addChild(new piTui.Spacer(1));
2931
3175
  const items = [
2932
3176
  {
@@ -3003,7 +3247,7 @@ var OMSettingsComponent = class extends piTui.Box {
3003
3247
  this.settingsList = new piTui.SettingsList(
3004
3248
  items,
3005
3249
  10,
3006
- chunk7K5VFY2N_cjs.getSettingsListTheme(),
3250
+ chunkK4WJUBEC_cjs.getSettingsListTheme(),
3007
3251
  (_id, _newValue) => {
3008
3252
  },
3009
3253
  callbacks.onClose
@@ -3070,7 +3314,7 @@ async function handleOMCommand(ctx) {
3070
3314
  }
3071
3315
  var SelectSubmenu = class extends piTui.SelectList {
3072
3316
  constructor(items, currentValue, onSelect, onBack) {
3073
- super(items, Math.min(items.length, 8), chunk7K5VFY2N_cjs.getSelectListTheme());
3317
+ super(items, Math.min(items.length, 8), chunkK4WJUBEC_cjs.getSelectListTheme());
3074
3318
  const currentIndex = items.findIndex((i) => i.value === currentValue);
3075
3319
  if (currentIndex !== -1) {
3076
3320
  this.setSelectedIndex(currentIndex);
@@ -3108,7 +3352,7 @@ var StorageBackendSubmenu = class extends piTui.Container {
3108
3352
  description: "Remote PostgreSQL (requires connection string)"
3109
3353
  }
3110
3354
  ];
3111
- this.selectList = new piTui.SelectList(items, items.length, chunk7K5VFY2N_cjs.getSelectListTheme());
3355
+ this.selectList = new piTui.SelectList(items, items.length, chunkK4WJUBEC_cjs.getSelectListTheme());
3112
3356
  const currentIndex = items.findIndex((i) => i.value === currentBackend);
3113
3357
  if (currentIndex !== -1) this.selectList.setSelectedIndex(currentIndex);
3114
3358
  this.selectList.onSelect = (item) => {
@@ -3122,15 +3366,15 @@ var StorageBackendSubmenu = class extends piTui.Container {
3122
3366
  this.phase = "connection";
3123
3367
  this.clear();
3124
3368
  if (this.pendingBackend === "pg") {
3125
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.bold(chunk7K5VFY2N_cjs.fg("accent", "PostgreSQL Connection")), 0, 0));
3369
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", "PostgreSQL Connection")), 0, 0));
3126
3370
  this.addChild(new piTui.Spacer(1));
3127
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("muted", "Enter a connection string:"), 0, 0));
3128
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("dim", "e.g. postgresql://user:pass@localhost:5432/mydb"), 0, 0));
3371
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("muted", "Enter a connection string:"), 0, 0));
3372
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("dim", "e.g. postgresql://user:pass@localhost:5432/mydb"), 0, 0));
3129
3373
  } else {
3130
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.bold(chunk7K5VFY2N_cjs.fg("accent", "LibSQL Connection")), 0, 0));
3374
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", "LibSQL Connection")), 0, 0));
3131
3375
  this.addChild(new piTui.Spacer(1));
3132
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("muted", "Enter a URL or leave empty for default local file:"), 0, 0));
3133
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("dim", "e.g. libsql://your-db.turso.io"), 0, 0));
3376
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("muted", "Enter a URL or leave empty for default local file:"), 0, 0));
3377
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("dim", "e.g. libsql://your-db.turso.io"), 0, 0));
3134
3378
  }
3135
3379
  this.addChild(new piTui.Spacer(1));
3136
3380
  this.input = new piTui.Input();
@@ -3140,7 +3384,7 @@ var StorageBackendSubmenu = class extends piTui.Container {
3140
3384
  }
3141
3385
  this.addChild(this.input);
3142
3386
  this.addChild(new piTui.Spacer(1));
3143
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("dim", "Enter to save \xB7 Esc to go back"), 0, 0));
3387
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("dim", "Enter to save \xB7 Esc to go back"), 0, 0));
3144
3388
  }
3145
3389
  handleInput(data) {
3146
3390
  if (this.phase === "select") {
@@ -3180,8 +3424,8 @@ var SettingsComponent = class extends piTui.Box {
3180
3424
  this._focused = value;
3181
3425
  }
3182
3426
  constructor(config, callbacks) {
3183
- super(2, 1, (text) => chunk7K5VFY2N_cjs.bg("overlayBg", text));
3184
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.bold(chunk7K5VFY2N_cjs.fg("accent", "Settings")), 0, 0));
3427
+ super(2, 1, (text) => chunkK4WJUBEC_cjs.theme.bg("overlayBg", text));
3428
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", "Settings")), 0, 0));
3185
3429
  this.addChild(new piTui.Spacer(1));
3186
3430
  const notificationModes = [
3187
3431
  { value: "off", label: "Off", desc: "No notifications" },
@@ -3189,13 +3433,11 @@ var SettingsComponent = class extends piTui.Box {
3189
3433
  { value: "system", label: "System", desc: "Native OS notification" },
3190
3434
  { value: "both", label: "Both", desc: "Bell + system notification" }
3191
3435
  ];
3192
- const thinkingLevels = [
3193
- { value: "off", label: "Off", desc: "No extended thinking" },
3194
- { value: "minimal", label: "Minimal", desc: "~1k budget tokens" },
3195
- { value: "low", label: "Low", desc: "~4k budget tokens" },
3196
- { value: "medium", label: "Medium", desc: "~10k budget tokens" },
3197
- { value: "high", label: "High", desc: "~32k budget tokens" }
3198
- ];
3436
+ const thinkingLevels = getThinkingLevelsForModel(config.currentModelId).map((level) => ({
3437
+ value: level.id,
3438
+ label: level.label,
3439
+ desc: level.description
3440
+ }));
3199
3441
  const getNotifLabel = (mode) => notificationModes.find((m) => m.value === mode)?.label ?? mode;
3200
3442
  const getThinkingLabel = (level) => thinkingLevels.find((l) => l.value === level)?.label ?? level;
3201
3443
  const items = [
@@ -3249,7 +3491,7 @@ var SettingsComponent = class extends piTui.Box {
3249
3491
  {
3250
3492
  id: "thinking",
3251
3493
  label: "Thinking level",
3252
- description: "Extended thinking budget for Anthropic models (currently disabled)",
3494
+ description: "Reasoning depth level",
3253
3495
  currentValue: getThinkingLabel(config.thinkingLevel),
3254
3496
  submenu: (_currentValue, done) => new SelectSubmenu(
3255
3497
  thinkingLevels.map((l) => ({
@@ -3319,7 +3561,7 @@ var SettingsComponent = class extends piTui.Box {
3319
3561
  this.settingsList = new piTui.SettingsList(
3320
3562
  items,
3321
3563
  10,
3322
- chunk7K5VFY2N_cjs.getSettingsListTheme(),
3564
+ chunkK4WJUBEC_cjs.getSettingsListTheme(),
3323
3565
  (_id, _newValue) => {
3324
3566
  },
3325
3567
  callbacks.onClose
@@ -3334,11 +3576,12 @@ var SettingsComponent = class extends piTui.Box {
3334
3576
  // src/tui/commands/settings.ts
3335
3577
  async function handleSettingsCommand(ctx) {
3336
3578
  const state = ctx.state.harness.getState();
3337
- const globalSettings = chunk7K5VFY2N_cjs.loadSettings();
3579
+ const globalSettings = chunkK4WJUBEC_cjs.loadSettings();
3338
3580
  const config = {
3339
3581
  notifications: state?.notifications ?? "off",
3340
3582
  yolo: state?.yolo === true,
3341
3583
  thinkingLevel: state?.thinkingLevel ?? "off",
3584
+ currentModelId: ctx.state.harness.getCurrentModelId() ?? "",
3342
3585
  escapeAsCancel: ctx.state.editor.escapeEnabled,
3343
3586
  storageBackend: globalSettings.storage.backend,
3344
3587
  pgConnectionString: globalSettings.storage.pg?.connectionString ?? "",
@@ -3362,14 +3605,14 @@ async function handleSettingsCommand(ctx) {
3362
3605
  await ctx.state.harness.setThreadSetting({ key: "escapeAsCancel", value: enabled });
3363
3606
  },
3364
3607
  onStorageBackendChange: (backend, connectionUrl) => {
3365
- const current = chunk7K5VFY2N_cjs.loadSettings();
3608
+ const current = chunkK4WJUBEC_cjs.loadSettings();
3366
3609
  current.storage.backend = backend;
3367
3610
  if (backend === "pg" && connectionUrl !== void 0) {
3368
3611
  current.storage.pg = { ...current.storage.pg, connectionString: connectionUrl };
3369
3612
  } else if (backend === "libsql") {
3370
3613
  current.storage.libsql = { ...current.storage.libsql, url: connectionUrl || void 0 };
3371
3614
  }
3372
- chunk7K5VFY2N_cjs.saveSettings(current);
3615
+ chunkK4WJUBEC_cjs.saveSettings(current);
3373
3616
  ctx.state.ui.hideOverlay();
3374
3617
  ctx.stop();
3375
3618
  const label = backend === "pg" ? "PostgreSQL" : "LibSQL";
@@ -3393,12 +3636,12 @@ Storage backend changed to ${label}. Restarting is required.
3393
3636
  }
3394
3637
  var LoginDialogComponent = class extends piTui.Box {
3395
3638
  constructor(tui, providerId, onComplete) {
3396
- super(2, 1, (text) => chunk7K5VFY2N_cjs.bg("overlayBg", text));
3639
+ super(2, 1, (text) => chunkK4WJUBEC_cjs.theme.bg("overlayBg", text));
3397
3640
  this.onComplete = onComplete;
3398
3641
  this.tui = tui;
3399
- const providerInfo = chunkC6XKRHRK_cjs.getOAuthProviders().find((p) => p.id === providerId);
3642
+ const providerInfo = chunkS5ZLN7DR_cjs.getOAuthProviders().find((p) => p.id === providerId);
3400
3643
  const providerName = providerInfo?.name || providerId;
3401
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("warning", `Login to ${providerName}`)));
3644
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("warning", `Login to ${providerName}`)));
3402
3645
  this.addChild(new piTui.Spacer(1));
3403
3646
  this.contentContainer = new piTui.Container();
3404
3647
  this.addChild(this.contentContainer);
@@ -3449,13 +3692,13 @@ var LoginDialogComponent = class extends piTui.Box {
3449
3692
  */
3450
3693
  showAuth(url, instructions) {
3451
3694
  this.contentContainer.clear();
3452
- this.contentContainer.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("accent", url)));
3695
+ this.contentContainer.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("accent", url)));
3453
3696
  const clickHint = process.platform === "darwin" ? "Cmd+click to open" : "Ctrl+click to open";
3454
3697
  const hyperlink = `\x1B]8;;${url}\x07${clickHint}\x1B]8;;\x07`;
3455
- this.contentContainer.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("muted", hyperlink)));
3698
+ this.contentContainer.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("muted", hyperlink)));
3456
3699
  if (instructions) {
3457
3700
  this.contentContainer.addChild(new piTui.Spacer(1));
3458
- this.contentContainer.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("warning", instructions)));
3701
+ this.contentContainer.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("warning", instructions)));
3459
3702
  }
3460
3703
  const openCmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
3461
3704
  child_process.exec(`${openCmd} "${url}"`);
@@ -3466,12 +3709,12 @@ var LoginDialogComponent = class extends piTui.Box {
3466
3709
  */
3467
3710
  showPrompt(message, placeholder) {
3468
3711
  this.contentContainer.addChild(new piTui.Spacer(1));
3469
- this.contentContainer.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("text", message)));
3712
+ this.contentContainer.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("text", message)));
3470
3713
  if (placeholder) {
3471
- this.contentContainer.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("muted", `e.g., ${placeholder}`)));
3714
+ this.contentContainer.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("muted", `e.g., ${placeholder}`)));
3472
3715
  }
3473
3716
  this.contentContainer.addChild(this.input);
3474
- this.contentContainer.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("muted", "(Escape to cancel, Enter to submit)")));
3717
+ this.contentContainer.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("muted", "(Escape to cancel, Enter to submit)")));
3475
3718
  this.input.setValue("");
3476
3719
  this.tui.requestRender();
3477
3720
  return new Promise((resolve2, reject) => {
@@ -3483,7 +3726,7 @@ var LoginDialogComponent = class extends piTui.Box {
3483
3726
  * Show progress message
3484
3727
  */
3485
3728
  showProgress(message) {
3486
- this.contentContainer.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("muted", message)));
3729
+ this.contentContainer.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("muted", message)));
3487
3730
  this.tui.requestRender();
3488
3731
  }
3489
3732
  handleInput(data) {
@@ -3498,12 +3741,21 @@ var LoginDialogComponent = class extends piTui.Box {
3498
3741
 
3499
3742
  // src/tui/commands/login.ts
3500
3743
  async function performLogin(ctx, providerId) {
3501
- const provider = chunkC6XKRHRK_cjs.getOAuthProviders().find((p) => p.id === providerId);
3744
+ const provider = chunkS5ZLN7DR_cjs.getOAuthProviders().find((p) => p.id === providerId);
3502
3745
  const providerName = provider?.name || providerId;
3503
3746
  if (!ctx.authStorage) {
3504
3747
  ctx.showError("Auth storage not configured");
3505
3748
  return;
3506
3749
  }
3750
+ if (providerId === ANTHROPIC_OAUTH_PROVIDER_ID) {
3751
+ const warningResult = await showClaudeMaxOAuthWarning(ctx.state, "login");
3752
+ if (warningResult !== "continue") {
3753
+ return;
3754
+ }
3755
+ const settings = chunkK4WJUBEC_cjs.loadSettings();
3756
+ settings.onboarding.claudeMaxOAuthWarningAcknowledgedAt = (/* @__PURE__ */ new Date()).toISOString();
3757
+ chunkK4WJUBEC_cjs.saveSettings(settings);
3758
+ }
3507
3759
  return new Promise((resolve2) => {
3508
3760
  const dialog = new LoginDialogComponent(ctx.state.ui, providerId, (success, message) => {
3509
3761
  ctx.state.ui.hideOverlay();
@@ -3533,7 +3785,7 @@ async function performLogin(ctx, providerId) {
3533
3785
  signal: dialog.signal
3534
3786
  }).then(async () => {
3535
3787
  ctx.state.ui.hideOverlay();
3536
- const defaultModel = chunkC6XKRHRK_cjs.PROVIDER_DEFAULT_MODELS[providerId];
3788
+ const defaultModel = chunkS5ZLN7DR_cjs.PROVIDER_DEFAULT_MODELS[providerId];
3537
3789
  if (defaultModel) {
3538
3790
  await ctx.state.harness.switchModel({ modelId: defaultModel });
3539
3791
  ctx.showInfo(`Logged in to ${providerName} - switched to ${defaultModel}`);
@@ -3551,7 +3803,7 @@ async function performLogin(ctx, providerId) {
3551
3803
  });
3552
3804
  }
3553
3805
  async function handleLoginCommand(ctx, mode) {
3554
- const allProviders = chunkC6XKRHRK_cjs.getOAuthProviders();
3806
+ const allProviders = chunkS5ZLN7DR_cjs.getOAuthProviders();
3555
3807
  const loggedInIds = allProviders.filter((p) => ctx.authStorage?.isLoggedIn(p.id)).map((p) => p.id);
3556
3808
  if (mode === "logout") {
3557
3809
  if (loggedInIds.length === 0) {
@@ -3665,8 +3917,123 @@ Pay special attention to: ${focusArea}
3665
3917
  async function handleSetupCommand(ctx) {
3666
3918
  await ctx.showOnboarding();
3667
3919
  }
3920
+
3921
+ // src/tui/detect-theme.ts
3922
+ function queryTerminalBackground(timeoutMs = 200) {
3923
+ return new Promise((resolve2) => {
3924
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
3925
+ resolve2(null);
3926
+ return;
3927
+ }
3928
+ let settled = false;
3929
+ let buffer = "";
3930
+ let wasRaw;
3931
+ let wasResumed = false;
3932
+ let timer;
3933
+ const cleanup = () => {
3934
+ if (settled) return;
3935
+ settled = true;
3936
+ if (timer) {
3937
+ clearTimeout(timer);
3938
+ timer = void 0;
3939
+ }
3940
+ process.stdin.removeListener("data", onData);
3941
+ try {
3942
+ if (process.stdin.isTTY) {
3943
+ process.stdin.setRawMode(wasRaw);
3944
+ }
3945
+ } catch {
3946
+ }
3947
+ if (wasResumed) {
3948
+ process.stdin.pause();
3949
+ }
3950
+ };
3951
+ const onData = (data) => {
3952
+ buffer += data.toString();
3953
+ const match = buffer.match(/\x1b\]11;rgb:([0-9a-fA-F]+)\/([0-9a-fA-F]+)\/([0-9a-fA-F]+)/);
3954
+ if (match) {
3955
+ cleanup();
3956
+ const rHex = match[1];
3957
+ const gHex = match[2];
3958
+ const bHex = match[3];
3959
+ const normalize = (hex) => {
3960
+ const val = parseInt(hex, 16);
3961
+ return hex.length <= 2 ? val / 255 : val / 65535;
3962
+ };
3963
+ const r = normalize(rHex);
3964
+ const g = normalize(gHex);
3965
+ const b = normalize(bHex);
3966
+ const linearize = (c) => c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
3967
+ const luma = 0.2126 * linearize(r) + 0.7152 * linearize(g) + 0.0722 * linearize(b);
3968
+ resolve2(luma >= 0.5 ? "light" : "dark");
3969
+ return;
3970
+ }
3971
+ };
3972
+ timer = setTimeout(() => {
3973
+ cleanup();
3974
+ resolve2(null);
3975
+ }, timeoutMs);
3976
+ if (timer.unref) timer.unref();
3977
+ try {
3978
+ wasRaw = process.stdin.isRaw ?? false;
3979
+ process.stdin.setRawMode(true);
3980
+ if (process.stdin.isPaused()) {
3981
+ process.stdin.resume();
3982
+ wasResumed = true;
3983
+ }
3984
+ process.stdin.on("data", onData);
3985
+ process.stdout.write("\x1B]11;?\x07");
3986
+ } catch {
3987
+ cleanup();
3988
+ resolve2(null);
3989
+ }
3990
+ });
3991
+ }
3992
+ function detectFromColorFgBg() {
3993
+ const colorFgBg = process.env.COLORFGBG;
3994
+ if (!colorFgBg) return null;
3995
+ const parts = colorFgBg.split(";");
3996
+ const bgPart = parts[parts.length - 1];
3997
+ if (bgPart === void 0) return null;
3998
+ const bgIndex = parseInt(bgPart, 10);
3999
+ if (isNaN(bgIndex)) return null;
4000
+ return bgIndex >= 7 ? "light" : "dark";
4001
+ }
4002
+ async function detectTerminalTheme() {
4003
+ const envTheme = process.env.MASTRA_THEME?.toLowerCase();
4004
+ if (envTheme === "light") return "light";
4005
+ if (envTheme === "dark") return "dark";
4006
+ const oscResult = await queryTerminalBackground(200);
4007
+ if (oscResult) return oscResult;
4008
+ const fgbgResult = detectFromColorFgBg();
4009
+ if (fgbgResult) return fgbgResult;
4010
+ return "dark";
4011
+ }
4012
+
4013
+ // src/tui/commands/theme.ts
4014
+ async function handleThemeCommand(ctx, args) {
4015
+ const arg = args[0]?.toLowerCase();
4016
+ if (!arg) {
4017
+ const mode = chunkK4WJUBEC_cjs.getThemeMode();
4018
+ const settings2 = chunkK4WJUBEC_cjs.loadSettings();
4019
+ const pref = settings2.preferences.theme ?? "auto";
4020
+ ctx.showInfo(`Theme: ${mode} (preference: ${pref})`);
4021
+ return;
4022
+ }
4023
+ if (arg !== "auto" && arg !== "dark" && arg !== "light") {
4024
+ ctx.showError("Usage: /theme [auto|dark|light]");
4025
+ return;
4026
+ }
4027
+ const settings = chunkK4WJUBEC_cjs.loadSettings();
4028
+ settings.preferences.theme = arg;
4029
+ chunkK4WJUBEC_cjs.saveSettings(settings);
4030
+ const resolved = arg === "auto" ? await detectTerminalTheme() : arg;
4031
+ chunkK4WJUBEC_cjs.applyThemeMode(resolved);
4032
+ ctx.showInfo(`Theme set to ${arg}${arg === "auto" ? ` (detected: ${resolved})` : ""}`);
4033
+ ctx.state.ui.requestRender();
4034
+ }
3668
4035
  var MAX_COLLAPSED_LINES = 3;
3669
- var BORDER_COLOR = chunk7K5VFY2N_cjs.mastra.purple;
4036
+ var BORDER_COLOR = chunkK4WJUBEC_cjs.mastra.purple;
3670
4037
  var SlashCommandComponent = class extends piTui.Container {
3671
4038
  commandName;
3672
4039
  contentLines;
@@ -3688,7 +4055,7 @@ var SlashCommandComponent = class extends piTui.Container {
3688
4055
  const border = (char) => chalk10__default.default.bold.hex(BORDER_COLOR)(char);
3689
4056
  const termWidth = process.stdout.columns || 80;
3690
4057
  const maxLineWidth = termWidth - 6;
3691
- const heading = chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.specialGray)(`/${this.commandName}`);
4058
+ const heading = chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.specialGray)(`/${this.commandName}`);
3692
4059
  this.addChild(new piTui.Text(`${border("\u250C\u2500\u2500")} ${heading}`, 0, 0));
3693
4060
  if (this.contentLines.length === 0) {
3694
4061
  this.addChild(new piTui.Text(`${border("\u2514\u2500\u2500")}`, 0, 0));
@@ -3712,11 +4079,11 @@ var SlashCommandComponent = class extends piTui.Container {
3712
4079
  const truncated = !this.expanded && wrappedLines.length > MAX_COLLAPSED_LINES + 1;
3713
4080
  const displayLines = truncated ? wrappedLines.slice(0, MAX_COLLAPSED_LINES) : wrappedLines;
3714
4081
  const contentText = displayLines.map(
3715
- (line) => `${border("\u2502")} ${chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.mainGray)(line.length > maxLineWidth ? line.slice(0, maxLineWidth - 1) + "\u2026" : line)}`
4082
+ (line) => `${border("\u2502")} ${chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.mainGray)(line.length > maxLineWidth ? line.slice(0, maxLineWidth - 1) + "\u2026" : line)}`
3716
4083
  ).join("\n");
3717
4084
  this.addChild(new piTui.Text(contentText, 0, 0));
3718
4085
  if (truncated) {
3719
- const moreText = chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.darkGray)(
4086
+ const moreText = chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.darkGray)(
3720
4087
  `... ${wrappedLines.length - MAX_COLLAPSED_LINES} more lines (ctrl+e to expand)`
3721
4088
  );
3722
4089
  this.addChild(new piTui.Text(`${border("\u2502")} ${moreText}`, 0, 0));
@@ -3892,12 +4259,12 @@ function reasonToMessage(reason) {
3892
4259
  // src/tui/display.ts
3893
4260
  function showError(state, message) {
3894
4261
  state.chatContainer.addChild(new piTui.Spacer(1));
3895
- state.chatContainer.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("error", `Error: ${message}`), 1, 0));
4262
+ state.chatContainer.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("error", `Error: ${message}`), 1, 0));
3896
4263
  state.ui.requestRender();
3897
4264
  }
3898
4265
  function showInfo(state, message) {
3899
4266
  state.chatContainer.addChild(new piTui.Spacer(1));
3900
- state.chatContainer.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("muted", message), 1, 0));
4267
+ state.chatContainer.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("muted", message), 1, 0));
3901
4268
  state.ui.requestRender();
3902
4269
  }
3903
4270
  function showFormattedError(state, event) {
@@ -3907,9 +4274,9 @@ function showFormattedError(state, event) {
3907
4274
  const errorMessage = error.message || String(error);
3908
4275
  const isValidationError = errorMessage.toLowerCase().includes("validation failed") || errorMessage.toLowerCase().includes("required parameter") || errorMessage.includes("Required");
3909
4276
  if (isValidationError) {
3910
- state.chatContainer.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("error", "Tool validation error - see details above"), 1, 0));
4277
+ state.chatContainer.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("error", "Tool validation error - see details above"), 1, 0));
3911
4278
  state.chatContainer.addChild(
3912
- new piTui.Text(chunk7K5VFY2N_cjs.fg("muted", " Check the tool execution box for specific parameter requirements"), 1, 0)
4279
+ new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("muted", " Check the tool execution box for specific parameter requirements"), 1, 0)
3913
4280
  );
3914
4281
  } else {
3915
4282
  let errorText = `Error: ${parsed.message}`;
@@ -3917,12 +4284,12 @@ function showFormattedError(state, event) {
3917
4284
  const retryDelay = "retryDelay" in event ? event.retryDelay : parsed.retryDelay;
3918
4285
  if (retryable && retryDelay) {
3919
4286
  const seconds = Math.ceil(retryDelay / 1e3);
3920
- errorText += chunk7K5VFY2N_cjs.fg("muted", ` (retry in ${seconds}s)`);
4287
+ errorText += chunkK4WJUBEC_cjs.theme.fg("muted", ` (retry in ${seconds}s)`);
3921
4288
  }
3922
- state.chatContainer.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("error", errorText), 1, 0));
4289
+ state.chatContainer.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("error", errorText), 1, 0));
3923
4290
  const hint = getErrorHint(parsed.type);
3924
4291
  if (hint) {
3925
- state.chatContainer.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("muted", ` Hint: ${hint}`), 1, 0));
4292
+ state.chatContainer.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("muted", ` Hint: ${hint}`), 1, 0));
3926
4293
  }
3927
4294
  }
3928
4295
  state.ui.requestRender();
@@ -3997,7 +4364,7 @@ async function dispatchSlashCommand(input, state, buildCtx) {
3997
4364
  await handleOMCommand(buildCtx());
3998
4365
  return true;
3999
4366
  case "think":
4000
- await handleThinkCommand(buildCtx());
4367
+ await handleThinkCommand(buildCtx(), args);
4001
4368
  return true;
4002
4369
  case "permissions":
4003
4370
  await handlePermissionsCommand(buildCtx(), args);
@@ -4044,6 +4411,9 @@ async function dispatchSlashCommand(input, state, buildCtx) {
4044
4411
  case "setup":
4045
4412
  await handleSetupCommand(buildCtx());
4046
4413
  return true;
4414
+ case "theme":
4415
+ await handleThemeCommand(buildCtx(), args);
4416
+ return true;
4047
4417
  default: {
4048
4418
  const customCommand = state.customSlashCommands.find((cmd) => cmd.name === command);
4049
4419
  if (customCommand) {
@@ -4076,6 +4446,10 @@ ${processedContent.trim()}
4076
4446
  }
4077
4447
  function handleAgentStart(ctx) {
4078
4448
  const { state } = ctx;
4449
+ const freshBranch = chunkS5ZLN7DR_cjs.getCurrentGitBranch(state.projectInfo.rootPath);
4450
+ if (freshBranch) {
4451
+ state.projectInfo.gitBranch = freshBranch;
4452
+ }
4079
4453
  if (!state.gradientAnimator) {
4080
4454
  state.gradientAnimator = new GradientAnimator(() => {
4081
4455
  ctx.updateStatusLine();
@@ -4088,6 +4462,10 @@ function handleAgentEnd(ctx) {
4088
4462
  if (state.gradientAnimator) {
4089
4463
  state.gradientAnimator.fadeOut();
4090
4464
  }
4465
+ const freshBranch = chunkS5ZLN7DR_cjs.getCurrentGitBranch(state.projectInfo.rootPath);
4466
+ if (freshBranch) {
4467
+ state.projectInfo.gitBranch = freshBranch;
4468
+ }
4091
4469
  if (state.streamingComponent) {
4092
4470
  state.streamingComponent = void 0;
4093
4471
  state.streamingMessage = void 0;
@@ -4115,7 +4493,7 @@ function handleAgentAborted(ctx) {
4115
4493
  state.streamingMessage = void 0;
4116
4494
  } else if (state.userInitiatedAbort) {
4117
4495
  state.chatContainer.addChild(new piTui.Spacer(1));
4118
- state.chatContainer.addChild(new piTui.Text(chunk7K5VFY2N_cjs.theme.fg("error", "Interrupted"), 1, 0));
4496
+ state.chatContainer.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("error", "Interrupted"), 1, 0));
4119
4497
  }
4120
4498
  state.userInitiatedAbort = false;
4121
4499
  state.followUpComponents = [];
@@ -4154,7 +4532,7 @@ var AssistantMessageComponent = class extends piTui.Container {
4154
4532
  markdownTheme;
4155
4533
  lastMessage;
4156
4534
  _id;
4157
- constructor(message, hideThinkingBlock = false, markdownTheme = chunk7K5VFY2N_cjs.getMarkdownTheme()) {
4535
+ constructor(message, hideThinkingBlock = false, markdownTheme = chunkK4WJUBEC_cjs.getMarkdownTheme()) {
4158
4536
  super();
4159
4537
  this._id = ++_compId;
4160
4538
  this.hideThinkingBlock = hideThinkingBlock;
@@ -4196,14 +4574,14 @@ var AssistantMessageComponent = class extends piTui.Container {
4196
4574
  } else if (content.type === "thinking" && content.thinking.trim()) {
4197
4575
  const hasTextAfter = message.content.slice(i + 1).some((c) => c.type === "text" && c.text.trim());
4198
4576
  if (this.hideThinkingBlock) {
4199
- this.contentContainer.addChild(new piTui.Text(chunk7K5VFY2N_cjs.theme.italic(chunk7K5VFY2N_cjs.theme.fg("thinkingText", "Thinking...")), 1, 0));
4577
+ this.contentContainer.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.italic(chunkK4WJUBEC_cjs.theme.fg("thinkingText", "Thinking...")), 1, 0));
4200
4578
  if (hasTextAfter) {
4201
4579
  this.contentContainer.addChild(new piTui.Spacer(1));
4202
4580
  }
4203
4581
  } else {
4204
4582
  this.contentContainer.addChild(
4205
4583
  new piTui.Markdown(content.thinking.trim(), 1, 0, this.markdownTheme, {
4206
- color: (text) => chunk7K5VFY2N_cjs.theme.fg("thinkingText", text),
4584
+ color: (text) => chunkK4WJUBEC_cjs.theme.fg("thinkingText", text),
4207
4585
  italic: true
4208
4586
  })
4209
4587
  );
@@ -4214,11 +4592,11 @@ var AssistantMessageComponent = class extends piTui.Container {
4214
4592
  if (message.stopReason === "aborted") {
4215
4593
  const abortMessage = message.errorMessage || "Interrupted";
4216
4594
  this.contentContainer.addChild(new piTui.Spacer(1));
4217
- this.contentContainer.addChild(new piTui.Text(chunk7K5VFY2N_cjs.theme.fg("error", abortMessage), 1, 0));
4595
+ this.contentContainer.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("error", abortMessage), 1, 0));
4218
4596
  } else if (message.stopReason === "error") {
4219
4597
  const errorMsg = message.errorMessage || "Unknown error";
4220
4598
  this.contentContainer.addChild(new piTui.Spacer(1));
4221
- this.contentContainer.addChild(new piTui.Text(chunk7K5VFY2N_cjs.theme.fg("error", `Error: ${errorMsg}`), 1, 0));
4599
+ this.contentContainer.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("error", `Error: ${errorMsg}`), 1, 0));
4222
4600
  }
4223
4601
  }
4224
4602
  };
@@ -4261,7 +4639,7 @@ var CollapsibleComponent = class extends piTui.Container {
4261
4639
  }
4262
4640
  updateDisplay() {
4263
4641
  this.clear();
4264
- const lineCount = this.options.showLineCount && this.content.length > 0 ? chunk7K5VFY2N_cjs.theme.fg("muted", ` (${this.content.length} lines)`) : "";
4642
+ const lineCount = this.options.showLineCount && this.content.length > 0 ? chunkK4WJUBEC_cjs.theme.fg("muted", ` (${this.content.length} lines)`) : "";
4265
4643
  const headerText = typeof this.header === "string" ? `${this.header}${lineCount}` : this.header;
4266
4644
  if (typeof headerText === "string") {
4267
4645
  this.addChild(new piTui.Text(headerText, 0, 0));
@@ -4269,7 +4647,7 @@ var CollapsibleComponent = class extends piTui.Container {
4269
4647
  this.addChild(headerText);
4270
4648
  }
4271
4649
  if (!this.expanded && this.summary) {
4272
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.theme.fg("muted", this.summary), 0, 0));
4650
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("muted", this.summary), 0, 0));
4273
4651
  return;
4274
4652
  }
4275
4653
  if (this.content.length === 0) return;
@@ -4285,7 +4663,7 @@ var CollapsibleComponent = class extends piTui.Container {
4285
4663
  if (hasMore) {
4286
4664
  const remaining = this.content.length - linesToShow;
4287
4665
  const action = this.expanded ? "collapse" : "expand";
4288
- const hint = chunk7K5VFY2N_cjs.theme.fg("muted", `... ${remaining} more lines (Ctrl+E to ${action} all)`);
4666
+ const hint = chunkK4WJUBEC_cjs.theme.fg("muted", `... ${remaining} more lines (Ctrl+E to ${action} all)`);
4289
4667
  this.addChild(new piTui.Text(hint, 0, 0));
4290
4668
  }
4291
4669
  }
@@ -4342,11 +4720,11 @@ function formatStackTrace(stack) {
4342
4720
  if (line.match(/^\s*at\s+/)) {
4343
4721
  return line.replace(
4344
4722
  /(\s+at\s+)([^(]+)(\s*\()([^)]+)(\))/,
4345
- (match, at, fn, open, loc, close) => `${chunk7K5VFY2N_cjs.fg("muted", at)}${chunk7K5VFY2N_cjs.fg("function", fn)}${chunk7K5VFY2N_cjs.fg("muted", open)}${chunk7K5VFY2N_cjs.fg("path", loc)}${chunk7K5VFY2N_cjs.fg("muted", close)}`
4723
+ (match, at, fn, open, loc, close) => `${chunkK4WJUBEC_cjs.theme.fg("muted", at)}${chunkK4WJUBEC_cjs.theme.fg("function", fn)}${chunkK4WJUBEC_cjs.theme.fg("muted", open)}${chunkK4WJUBEC_cjs.theme.fg("path", loc)}${chunkK4WJUBEC_cjs.theme.fg("muted", close)}`
4346
4724
  );
4347
4725
  }
4348
4726
  if (!line.trim() || line.includes("node_modules")) {
4349
- return chunk7K5VFY2N_cjs.fg("muted", line);
4727
+ return chunkK4WJUBEC_cjs.theme.fg("muted", line);
4350
4728
  }
4351
4729
  return line;
4352
4730
  });
@@ -4377,23 +4755,23 @@ var ErrorDisplayComponent = class extends piTui.Container {
4377
4755
  }
4378
4756
  build() {
4379
4757
  const info = parseErrorInfo(this.error);
4380
- const borderTop = new piTui.Text(chunk7K5VFY2N_cjs.fg("error", "\u250C\u2500 Error \u2500" + "\u2500".repeat(50) + "\u2510"), 0, 0);
4758
+ const borderTop = new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("error", "\u250C\u2500 Error \u2500" + "\u2500".repeat(50) + "\u2510"), 0, 0);
4381
4759
  this.addChild(borderTop);
4382
4760
  const errorContainer = new piTui.Container();
4383
- const errorBg = (text) => chunk7K5VFY2N_cjs.bg("errorBg", text);
4761
+ const errorBg = (text) => chunkK4WJUBEC_cjs.theme.bg("errorBg", text);
4384
4762
  if (info.name && info.name !== "Error") {
4385
4763
  const typeLine = new piTui.Container();
4386
4764
  typeLine.addChild(new piTui.Text("\u2502 ", 0, 0));
4387
- typeLine.addChild(new piTui.Text(errorBg(` ${chunk7K5VFY2N_cjs.bold(chunk7K5VFY2N_cjs.fg("error", info.name))} `), 0, 0));
4765
+ typeLine.addChild(new piTui.Text(errorBg(` ${chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("error", info.name))} `), 0, 0));
4388
4766
  errorContainer.addChild(typeLine);
4389
4767
  }
4390
4768
  const msgLine = new piTui.Container();
4391
4769
  msgLine.addChild(new piTui.Text("\u2502 ", 0, 0));
4392
- msgLine.addChild(new piTui.Text(chunk7K5VFY2N_cjs.bold(info.message), 0, 0));
4770
+ msgLine.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.bold(info.message), 0, 0));
4393
4771
  errorContainer.addChild(msgLine);
4394
4772
  if (info.file && info.line) {
4395
4773
  const location = `${info.file}:${info.line}${info.column ? `:${info.column}` : ""}`;
4396
- errorContainer.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("muted", ` at ${location}`), 0, 0));
4774
+ errorContainer.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("muted", ` at ${location}`), 0, 0));
4397
4775
  }
4398
4776
  this.addChild(errorContainer);
4399
4777
  if (this.options.showContext && info.context) {
@@ -4404,26 +4782,26 @@ var ErrorDisplayComponent = class extends piTui.Container {
4404
4782
  this.addChild(new piTui.Spacer(1));
4405
4783
  this.addChild(new CollapsibleStackTrace(info.stack, { expanded: this.options.expanded }, this.ui));
4406
4784
  }
4407
- const borderBottom = new piTui.Text(chunk7K5VFY2N_cjs.fg("error", "\u2514" + "\u2500".repeat(60) + "\u2518"), 0, 0);
4785
+ const borderBottom = new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("error", "\u2514" + "\u2500".repeat(60) + "\u2518"), 0, 0);
4408
4786
  this.addChild(borderBottom);
4409
4787
  }
4410
4788
  createCodeContext(context, errorLine) {
4411
4789
  const container = new piTui.Container();
4412
4790
  const codeBlock = new piTui.Container();
4413
- codeBlock.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("muted", "Code context:"), 0, 0));
4791
+ codeBlock.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("muted", "Code context:"), 0, 0));
4414
4792
  if (context.before) {
4415
4793
  context.before.forEach((line, i) => {
4416
4794
  const lineNum = errorLine ? errorLine - context.before.length + i : i + 1;
4417
- codeBlock.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("muted", `${lineNum.toString().padStart(4)} \u2502 ${line}`), 0, 0));
4795
+ codeBlock.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("muted", `${lineNum.toString().padStart(4)} \u2502 ${line}`), 0, 0));
4418
4796
  });
4419
4797
  }
4420
4798
  if (context.line && errorLine) {
4421
- codeBlock.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("error", `${errorLine.toString().padStart(4)} \u2502 ${context.line}`), 0, 0));
4799
+ codeBlock.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("error", `${errorLine.toString().padStart(4)} \u2502 ${context.line}`), 0, 0));
4422
4800
  }
4423
4801
  if (context.after) {
4424
4802
  context.after.forEach((line, i) => {
4425
4803
  const lineNum = errorLine ? errorLine + i + 1 : i + 1;
4426
- codeBlock.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("muted", `${lineNum.toString().padStart(4)} \u2502 ${line}`), 0, 0));
4804
+ codeBlock.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("muted", `${lineNum.toString().padStart(4)} \u2502 ${line}`), 0, 0));
4427
4805
  });
4428
4806
  }
4429
4807
  container.addChild(codeBlock);
@@ -4482,7 +4860,7 @@ function formatArgs(args) {
4482
4860
  for (const [key, value] of Object.entries(obj)) {
4483
4861
  let valueStr;
4484
4862
  if (value === null || value === void 0) {
4485
- valueStr = chunk7K5VFY2N_cjs.theme.fg("muted", "undefined");
4863
+ valueStr = chunkK4WJUBEC_cjs.theme.fg("muted", "undefined");
4486
4864
  } else if (typeof value === "string") {
4487
4865
  valueStr = value.length > 50 ? `"${value.slice(0, 47)}..."` : `"${value}"`;
4488
4866
  } else if (typeof value === "object") {
@@ -4493,7 +4871,7 @@ function formatArgs(args) {
4493
4871
  } else {
4494
4872
  valueStr = String(value);
4495
4873
  }
4496
- lines.push(` ${chunk7K5VFY2N_cjs.theme.fg("accent", key)}: ${valueStr}`);
4874
+ lines.push(` ${chunkK4WJUBEC_cjs.theme.fg("accent", key)}: ${valueStr}`);
4497
4875
  }
4498
4876
  return lines;
4499
4877
  }
@@ -4503,7 +4881,7 @@ var ToolValidationErrorComponent = class extends piTui.Container {
4503
4881
  const { toolName, errors, args } = options;
4504
4882
  this.addChild(
4505
4883
  new piTui.Text(
4506
- `${chunk7K5VFY2N_cjs.theme.fg("error", "\u2717 Tool validation failed: ")}${chunk7K5VFY2N_cjs.theme.bold(chunk7K5VFY2N_cjs.theme.fg("toolTitle", toolName))}`,
4884
+ `${chunkK4WJUBEC_cjs.theme.fg("error", "\u2717 Tool validation failed: ")}${chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("toolTitle", toolName))}`,
4507
4885
  0,
4508
4886
  0
4509
4887
  )
@@ -4514,24 +4892,24 @@ var ToolValidationErrorComponent = class extends piTui.Container {
4514
4892
  this.addChild(new piTui.Text("", 0, 0));
4515
4893
  }
4516
4894
  if (error.field !== "unknown") {
4517
- this.addChild(new piTui.Text(`${chunk7K5VFY2N_cjs.theme.fg("muted", " Parameter: ")}${chunk7K5VFY2N_cjs.theme.fg("accent", error.field)}`, 0, 0));
4895
+ this.addChild(new piTui.Text(`${chunkK4WJUBEC_cjs.theme.fg("muted", " Parameter: ")}${chunkK4WJUBEC_cjs.theme.fg("accent", error.field)}`, 0, 0));
4518
4896
  }
4519
- this.addChild(new piTui.Text(`${chunk7K5VFY2N_cjs.theme.fg("muted", " Issue: ")}${chunk7K5VFY2N_cjs.theme.fg("error", error.message)}`, 0, 0));
4897
+ this.addChild(new piTui.Text(`${chunkK4WJUBEC_cjs.theme.fg("muted", " Issue: ")}${chunkK4WJUBEC_cjs.theme.fg("error", error.message)}`, 0, 0));
4520
4898
  if (error.expected || error.received) {
4521
4899
  let detail = "";
4522
4900
  if (error.expected) {
4523
- detail += `${chunk7K5VFY2N_cjs.theme.fg("muted", " Expected: ")}${chunk7K5VFY2N_cjs.theme.fg("success", error.expected)}`;
4524
- if (error.received) detail += chunk7K5VFY2N_cjs.theme.fg("muted", ", ");
4901
+ detail += `${chunkK4WJUBEC_cjs.theme.fg("muted", " Expected: ")}${chunkK4WJUBEC_cjs.theme.fg("success", error.expected)}`;
4902
+ if (error.received) detail += chunkK4WJUBEC_cjs.theme.fg("muted", ", ");
4525
4903
  }
4526
4904
  if (error.received) {
4527
- detail += `${chunk7K5VFY2N_cjs.theme.fg("muted", "Received: ")}${chunk7K5VFY2N_cjs.theme.fg("error", error.received)}`;
4905
+ detail += `${chunkK4WJUBEC_cjs.theme.fg("muted", "Received: ")}${chunkK4WJUBEC_cjs.theme.fg("error", error.received)}`;
4528
4906
  }
4529
4907
  this.addChild(new piTui.Text(detail, 0, 0));
4530
4908
  }
4531
4909
  });
4532
4910
  if (args && Object.keys(args).length > 0) {
4533
4911
  this.addChild(new piTui.Text("", 0, 0));
4534
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.theme.fg("muted", "Provided arguments:"), 0, 0));
4912
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("muted", "Provided arguments:"), 0, 0));
4535
4913
  const argsLines = formatArgs(args);
4536
4914
  argsLines.forEach((line) => {
4537
4915
  this.addChild(new piTui.Text(line, 0, 0));
@@ -4540,7 +4918,7 @@ var ToolValidationErrorComponent = class extends piTui.Container {
4540
4918
  const suggestions = this.generateSuggestions(toolName, errors);
4541
4919
  if (suggestions.length > 0) {
4542
4920
  this.addChild(new piTui.Text("", 0, 0));
4543
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.theme.bold(chunk7K5VFY2N_cjs.theme.fg("accent", "Suggestions:")), 0, 0));
4921
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", "Suggestions:")), 0, 0));
4544
4922
  suggestions.forEach((suggestion) => {
4545
4923
  this.addChild(new piTui.Text(` \u2022 ${suggestion}`, 0, 0));
4546
4924
  });
@@ -4648,7 +5026,7 @@ var ToolExecutionComponentEnhanced = class extends piTui.Container {
4648
5026
  };
4649
5027
  this.expanded = !this.options.collapsedByDefault;
4650
5028
  this.addChild(new piTui.Spacer(1));
4651
- this.contentBox = new piTui.Box(1, 1, (text) => chunk7K5VFY2N_cjs.theme.bg("toolPendingBg", text));
5029
+ this.contentBox = new piTui.Box(1, 1, (text) => chunkK4WJUBEC_cjs.theme.bg("toolPendingBg", text));
4652
5030
  this.addChild(this.contentBox);
4653
5031
  this.rebuild();
4654
5032
  }
@@ -4700,7 +5078,7 @@ var ToolExecutionComponentEnhanced = class extends piTui.Container {
4700
5078
  return;
4701
5079
  }
4702
5080
  const bgColor = this.isPartial ? "toolPendingBg" : this.result?.isError ? "toolErrorBg" : "toolSuccessBg";
4703
- this.contentBox.setBgFn((text) => chunk7K5VFY2N_cjs.theme.bg(bgColor, text));
5081
+ this.contentBox.setBgFn((text) => chunkK4WJUBEC_cjs.theme.bg(bgColor, text));
4704
5082
  }
4705
5083
  /**
4706
5084
  * Full clear-and-rebuild. Called when:
@@ -4748,16 +5126,16 @@ var ToolExecutionComponentEnhanced = class extends piTui.Container {
4748
5126
  const startLine = viewRange?.[0] ?? argsObj?.offset ?? 1;
4749
5127
  if (!this.result || this.isPartial) {
4750
5128
  const path6 = argsObj?.path ? shortenPath(String(argsObj.path)) : "...";
4751
- const rangeDisplay2 = viewRange ? chunk7K5VFY2N_cjs.theme.fg("muted", `:${viewRange[0]},${viewRange[1]}`) : "";
5129
+ const rangeDisplay2 = viewRange ? chunkK4WJUBEC_cjs.theme.fg("muted", `:${viewRange[0]},${viewRange[1]}`) : "";
4752
5130
  const status2 = this.getStatusIndicator();
4753
- const pathDisplay2 = fullPath ? fileLink(chunk7K5VFY2N_cjs.theme.fg("accent", path6), fullPath, startLine) : chunk7K5VFY2N_cjs.theme.fg("accent", path6);
4754
- const headerText = `${chunk7K5VFY2N_cjs.theme.bold(chunk7K5VFY2N_cjs.theme.fg("toolTitle", "view"))} ${pathDisplay2}${rangeDisplay2}${status2}`;
5131
+ const pathDisplay2 = fullPath ? fileLink(chunkK4WJUBEC_cjs.theme.fg("accent", path6), fullPath, startLine) : chunkK4WJUBEC_cjs.theme.fg("accent", path6);
5132
+ const headerText = `${chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("toolTitle", "view"))} ${pathDisplay2}${rangeDisplay2}${status2}`;
4755
5133
  this.contentBox.addChild(new piTui.Text(headerText, 0, 0));
4756
5134
  return;
4757
5135
  }
4758
- const border = (char) => chunk7K5VFY2N_cjs.theme.bold(chunk7K5VFY2N_cjs.theme.fg("accent", char));
5136
+ const border = (char) => chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", char));
4759
5137
  const status = this.getStatusIndicator();
4760
- const rangeDisplay = viewRange ? chunk7K5VFY2N_cjs.theme.fg("muted", `:${viewRange[0]},${viewRange[1]}`) : "";
5138
+ const rangeDisplay = viewRange ? chunkK4WJUBEC_cjs.theme.fg("muted", `:${viewRange[0]},${viewRange[1]}`) : "";
4761
5139
  const termWidth = process.stdout.columns || 80;
4762
5140
  const fixedParts = "\u2514\u2500\u2500 view " + (rangeDisplay ? `:XXX,XXX` : "") + " \u2713";
4763
5141
  const availableForPath = termWidth - fixedParts.length - 6;
@@ -4765,8 +5143,8 @@ var ToolExecutionComponentEnhanced = class extends piTui.Container {
4765
5143
  if (path5.length > availableForPath && availableForPath > 10) {
4766
5144
  path5 = "\u2026" + path5.slice(-(availableForPath - 1));
4767
5145
  }
4768
- const pathDisplay = fullPath ? fileLink(chunk7K5VFY2N_cjs.theme.fg("accent", path5), fullPath, startLine) : chunk7K5VFY2N_cjs.theme.fg("accent", path5);
4769
- const footerText = `${chunk7K5VFY2N_cjs.theme.bold(chunk7K5VFY2N_cjs.theme.fg("toolTitle", "view"))} ${pathDisplay}${rangeDisplay}${status}`;
5146
+ const pathDisplay = fullPath ? fileLink(chunkK4WJUBEC_cjs.theme.fg("accent", path5), fullPath, startLine) : chunkK4WJUBEC_cjs.theme.fg("accent", path5);
5147
+ const footerText = `${chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("toolTitle", "view"))} ${pathDisplay}${rangeDisplay}${status}`;
4770
5148
  this.contentBox.addChild(new piTui.Text("", 0, 0));
4771
5149
  this.contentBox.addChild(new piTui.Text(border("\u250C\u2500\u2500"), 0, 0));
4772
5150
  const output = this.getFormattedOutput();
@@ -4789,7 +5167,7 @@ var ToolExecutionComponentEnhanced = class extends piTui.Container {
4789
5167
  if (hasMore) {
4790
5168
  const remaining = totalLines - collapsedLines;
4791
5169
  this.contentBox.addChild(
4792
- new piTui.Text(border("\u2502") + " " + chunk7K5VFY2N_cjs.theme.fg("muted", `... ${remaining} more lines (ctrl+e to expand)`), 0, 0)
5170
+ new piTui.Text(border("\u2502") + " " + chunkK4WJUBEC_cjs.theme.fg("muted", `... ${remaining} more lines (ctrl+e to expand)`), 0, 0)
4793
5171
  );
4794
5172
  }
4795
5173
  }
@@ -4807,12 +5185,12 @@ var ToolExecutionComponentEnhanced = class extends piTui.Container {
4807
5185
  if (tailMatch) {
4808
5186
  maxStreamLines = Math.abs(parseInt(tailMatch[1], 10));
4809
5187
  }
4810
- const timeoutSuffix = timeout ? chunk7K5VFY2N_cjs.theme.fg("muted", ` (timeout ${timeout}s)`) : "";
4811
- const cwdSuffix = cwd ? chunk7K5VFY2N_cjs.theme.fg("muted", ` in ${cwd}`) : "";
5188
+ const timeoutSuffix = timeout ? chunkK4WJUBEC_cjs.theme.fg("muted", ` (timeout ${timeout}s)`) : "";
5189
+ const cwdSuffix = cwd ? chunkK4WJUBEC_cjs.theme.fg("muted", ` in ${cwd}`) : "";
4812
5190
  const timeSuffix = this.isPartial ? timeoutSuffix : this.getDurationSuffix();
4813
5191
  const renderBorderedShell = (status2, outputLines) => {
4814
- const border = (char) => chunk7K5VFY2N_cjs.theme.bold(chunk7K5VFY2N_cjs.theme.fg("accent", char));
4815
- const footerText = `${chunk7K5VFY2N_cjs.theme.bold(chunk7K5VFY2N_cjs.theme.fg("toolTitle", "$"))} ${chunk7K5VFY2N_cjs.theme.fg("accent", command)}${cwdSuffix}${timeSuffix}${status2}`;
5192
+ const border = (char) => chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", char));
5193
+ const footerText = `${chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("toolTitle", "$"))} ${chunkK4WJUBEC_cjs.theme.fg("accent", command)}${cwdSuffix}${timeSuffix}${status2}`;
4816
5194
  this.contentBox.addChild(new piTui.Text(border("\u250C\u2500\u2500"), 0, 0));
4817
5195
  const termWidth = process.stdout.columns || 80;
4818
5196
  const maxLineWidth = termWidth - 6;
@@ -4855,7 +5233,7 @@ var ToolExecutionComponentEnhanced = class extends piTui.Container {
4855
5233
  return lines;
4856
5234
  };
4857
5235
  if (this.result.isError) {
4858
- const status2 = chunk7K5VFY2N_cjs.theme.fg("error", " \u2717");
5236
+ const status2 = chunkK4WJUBEC_cjs.theme.fg("error", " \u2717");
4859
5237
  const output2 = this.streamingOutput.trim() || this.getFormattedOutput();
4860
5238
  renderBorderedShell(status2, prepareOutputLines(output2));
4861
5239
  return;
@@ -4865,12 +5243,12 @@ var ToolExecutionComponentEnhanced = class extends piTui.Container {
4865
5243
  /Error:|TypeError:|SyntaxError:|ReferenceError:|command not found|fatal:|error:/i
4866
5244
  );
4867
5245
  if (looksLikeError) {
4868
- const status2 = chunk7K5VFY2N_cjs.theme.fg("error", " \u2717");
5246
+ const status2 = chunkK4WJUBEC_cjs.theme.fg("error", " \u2717");
4869
5247
  const output2 = this.streamingOutput.trim() || this.getFormattedOutput();
4870
5248
  renderBorderedShell(status2, prepareOutputLines(output2));
4871
5249
  return;
4872
5250
  }
4873
- const status = chunk7K5VFY2N_cjs.theme.fg("success", " \u2713");
5251
+ const status = chunkK4WJUBEC_cjs.theme.fg("success", " \u2713");
4874
5252
  const output = this.streamingOutput.trim() || this.getFormattedOutput();
4875
5253
  renderBorderedShell(status, prepareOutputLines(output));
4876
5254
  }
@@ -4882,12 +5260,12 @@ var ToolExecutionComponentEnhanced = class extends piTui.Container {
4882
5260
  if (!this.result || this.isPartial) {
4883
5261
  const path6 = argsObj?.path ? shortenPath(String(argsObj.path)) : "...";
4884
5262
  const status2 = this.getStatusIndicator();
4885
- const pathDisplay2 = fullPath ? fileLink(chunk7K5VFY2N_cjs.theme.fg("accent", path6), fullPath, startLineNum) : chunk7K5VFY2N_cjs.theme.fg("accent", path6);
5263
+ const pathDisplay2 = fullPath ? fileLink(chunkK4WJUBEC_cjs.theme.fg("accent", path6), fullPath, startLineNum) : chunkK4WJUBEC_cjs.theme.fg("accent", path6);
4886
5264
  if (argsObj?.old_str && argsObj?.new_str) {
4887
- const border2 = (char) => chunk7K5VFY2N_cjs.theme.bold(chunk7K5VFY2N_cjs.theme.fg("accent", char));
5265
+ const border2 = (char) => chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", char));
4888
5266
  const termWidth2 = process.stdout.columns || 80;
4889
5267
  const maxLineWidth = termWidth2 - 6;
4890
- const footerText2 = `${chunk7K5VFY2N_cjs.theme.bold(chunk7K5VFY2N_cjs.theme.fg("toolTitle", "edit"))} ${pathDisplay2}${chunk7K5VFY2N_cjs.theme.fg("muted", startLine)}${status2}`;
5268
+ const footerText2 = `${chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("toolTitle", "edit"))} ${pathDisplay2}${chunkK4WJUBEC_cjs.theme.fg("muted", startLine)}${status2}`;
4891
5269
  this.contentBox.addChild(new piTui.Text("", 0, 0));
4892
5270
  this.contentBox.addChild(new piTui.Text(border2("\u250C\u2500\u2500"), 0, 0));
4893
5271
  const oldStr = String(argsObj.old_str);
@@ -4904,7 +5282,7 @@ var ToolExecutionComponentEnhanced = class extends piTui.Container {
4904
5282
  }
4905
5283
  if (skippedAbove > 0) {
4906
5284
  this.contentBox.addChild(
4907
- new piTui.Text(border2("\u2502") + " " + chunk7K5VFY2N_cjs.theme.fg("muted", `... ${skippedAbove} lines above (ctrl+e to expand)`), 0, 0)
5285
+ new piTui.Text(border2("\u2502") + " " + chunkK4WJUBEC_cjs.theme.fg("muted", `... ${skippedAbove} lines above (ctrl+e to expand)`), 0, 0)
4908
5286
  );
4909
5287
  }
4910
5288
  const borderedLines = linesToShow.map((line) => {
@@ -4915,11 +5293,11 @@ var ToolExecutionComponentEnhanced = class extends piTui.Container {
4915
5293
  this.contentBox.addChild(new piTui.Text(`${border2("\u2514\u2500\u2500")} ${footerText2}`, 0, 0));
4916
5294
  return;
4917
5295
  }
4918
- const headerText = `${chunk7K5VFY2N_cjs.theme.bold(chunk7K5VFY2N_cjs.theme.fg("toolTitle", "edit"))} ${pathDisplay2}${chunk7K5VFY2N_cjs.theme.fg("muted", startLine)}${status2}`;
5296
+ const headerText = `${chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("toolTitle", "edit"))} ${pathDisplay2}${chunkK4WJUBEC_cjs.theme.fg("muted", startLine)}${status2}`;
4919
5297
  this.contentBox.addChild(new piTui.Text(headerText, 0, 0));
4920
5298
  return;
4921
5299
  }
4922
- const border = (char) => chunk7K5VFY2N_cjs.theme.bold(chunk7K5VFY2N_cjs.theme.fg("accent", char));
5300
+ const border = (char) => chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", char));
4923
5301
  const status = this.getStatusIndicator();
4924
5302
  const termWidth = process.stdout.columns || 80;
4925
5303
  const fixedParts = "\u2514\u2500\u2500 edit " + startLine + " \u2713";
@@ -4928,8 +5306,8 @@ var ToolExecutionComponentEnhanced = class extends piTui.Container {
4928
5306
  if (path5.length > availableForPath && availableForPath > 10) {
4929
5307
  path5 = "\u2026" + path5.slice(-(availableForPath - 1));
4930
5308
  }
4931
- const pathDisplay = fullPath ? fileLink(chunk7K5VFY2N_cjs.theme.fg("accent", path5), fullPath, startLineNum) : chunk7K5VFY2N_cjs.theme.fg("accent", path5);
4932
- const footerText = `${chunk7K5VFY2N_cjs.theme.bold(chunk7K5VFY2N_cjs.theme.fg("toolTitle", "edit"))} ${pathDisplay}${chunk7K5VFY2N_cjs.theme.fg("muted", startLine)}${status}`;
5309
+ const pathDisplay = fullPath ? fileLink(chunkK4WJUBEC_cjs.theme.fg("accent", path5), fullPath, startLineNum) : chunkK4WJUBEC_cjs.theme.fg("accent", path5);
5310
+ const footerText = `${chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("toolTitle", "edit"))} ${pathDisplay}${chunkK4WJUBEC_cjs.theme.fg("muted", startLine)}${status}`;
4933
5311
  this.contentBox.addChild(new piTui.Text("", 0, 0));
4934
5312
  this.contentBox.addChild(new piTui.Text(border("\u250C\u2500\u2500"), 0, 0));
4935
5313
  if (argsObj?.old_str && argsObj?.new_str && !this.result.isError) {
@@ -4950,7 +5328,7 @@ var ToolExecutionComponentEnhanced = class extends piTui.Container {
4950
5328
  const maxLineWidth = termWidth - 6;
4951
5329
  if (skippedBefore > 0) {
4952
5330
  this.contentBox.addChild(
4953
- new piTui.Text(border("\u2502") + " " + chunk7K5VFY2N_cjs.theme.fg("muted", `... ${skippedBefore} lines above`), 0, 0)
5331
+ new piTui.Text(border("\u2502") + " " + chunkK4WJUBEC_cjs.theme.fg("muted", `... ${skippedBefore} lines above`), 0, 0)
4954
5332
  );
4955
5333
  }
4956
5334
  const borderedLines = linesToShow.map((line) => {
@@ -4962,7 +5340,7 @@ var ToolExecutionComponentEnhanced = class extends piTui.Container {
4962
5340
  const remaining = totalLines - (skippedBefore + linesToShow.length);
4963
5341
  if (remaining > 0) {
4964
5342
  this.contentBox.addChild(
4965
- new piTui.Text(border("\u2502") + " " + chunk7K5VFY2N_cjs.theme.fg("muted", `... ${remaining} more lines (ctrl+e to expand)`), 0, 0)
5343
+ new piTui.Text(border("\u2502") + " " + chunkK4WJUBEC_cjs.theme.fg("muted", `... ${remaining} more lines (ctrl+e to expand)`), 0, 0)
4966
5344
  );
4967
5345
  }
4968
5346
  }
@@ -4972,7 +5350,7 @@ var ToolExecutionComponentEnhanced = class extends piTui.Container {
4972
5350
  const maxLineWidth = termWidth - 6;
4973
5351
  const lines = output.split("\n").map((line) => {
4974
5352
  const truncated = truncateAnsi(line, maxLineWidth);
4975
- return border("\u2502") + " " + chunk7K5VFY2N_cjs.theme.fg("error", truncated);
5353
+ return border("\u2502") + " " + chunkK4WJUBEC_cjs.theme.fg("error", truncated);
4976
5354
  });
4977
5355
  this.contentBox.addChild(new piTui.Text(lines.join("\n"), 0, 0));
4978
5356
  }
@@ -4985,17 +5363,18 @@ var ToolExecutionComponentEnhanced = class extends piTui.Container {
4985
5363
  const maxDiags = shouldCollapse ? COLLAPSED_DIAG_LINES : diagnostics.entries.length;
4986
5364
  const entriesToShow = diagnostics.entries.slice(0, maxDiags);
4987
5365
  for (const diag of entriesToShow) {
4988
- const color = diag.severity === "error" ? "#e06c75" : diag.severity === "warning" ? "#f59e0b" : "#71717a";
5366
+ const t = chunkK4WJUBEC_cjs.theme.getTheme();
5367
+ const color = diag.severity === "error" ? t.error : diag.severity === "warning" ? t.warning : t.muted;
4989
5368
  const icon = diag.severity === "error" ? "\u2717" : diag.severity === "warning" ? "\u26A0" : "\u2139";
4990
5369
  const location = diag.location ? chalk10__default.default.hex(color)(diag.location) + " " : "";
4991
- const line = ` ${chalk10__default.default.hex(color)(icon)} ${location}${chalk10__default.default.hex("#a1a1aa")(diag.message)}`;
5370
+ const line = ` ${chalk10__default.default.hex(color)(icon)} ${location}${chunkK4WJUBEC_cjs.theme.fg("thinkingText", diag.message)}`;
4992
5371
  this.contentBox.addChild(new piTui.Text(line, 0, 0));
4993
5372
  }
4994
5373
  if (shouldCollapse) {
4995
5374
  const remaining = diagnostics.entries.length - COLLAPSED_DIAG_LINES;
4996
5375
  this.contentBox.addChild(
4997
5376
  new piTui.Text(
4998
- chalk10__default.default.hex("#71717a")(` ... ${remaining} more diagnostic${remaining > 1 ? "s" : ""} (ctrl+e to expand)`),
5377
+ chunkK4WJUBEC_cjs.theme.fg("muted", ` ... ${remaining} more diagnostic${remaining > 1 ? "s" : ""} (ctrl+e to expand)`),
4999
5378
  0,
5000
5379
  0
5001
5380
  )
@@ -5042,22 +5421,22 @@ var ToolExecutionComponentEnhanced = class extends piTui.Container {
5042
5421
  const newLines = newStr.split("\n");
5043
5422
  const lines = [];
5044
5423
  let firstChangeIndex = -1;
5045
- const removedColor2 = chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.red);
5046
- const addedColor2 = chalk10__default.default.hex("#5cb85c");
5424
+ const removedColor = chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.red);
5425
+ const addedColor = chalk10__default.default.hex(chunkK4WJUBEC_cjs.theme.getTheme().success);
5047
5426
  const maxLines = Math.max(oldLines.length, newLines.length);
5048
5427
  for (let i = 0; i < maxLines; i++) {
5049
5428
  if (i >= oldLines.length) {
5050
5429
  if (firstChangeIndex === -1) firstChangeIndex = lines.length;
5051
- lines.push(addedColor2(newLines[i]));
5430
+ lines.push(addedColor(newLines[i]));
5052
5431
  } else if (i >= newLines.length) {
5053
5432
  if (firstChangeIndex === -1) firstChangeIndex = lines.length;
5054
- lines.push(removedColor2(oldLines[i]));
5433
+ lines.push(removedColor(oldLines[i]));
5055
5434
  } else if (oldLines[i] !== newLines[i]) {
5056
5435
  if (firstChangeIndex === -1) firstChangeIndex = lines.length;
5057
- lines.push(removedColor2(oldLines[i]));
5058
- lines.push(addedColor2(newLines[i]));
5436
+ lines.push(removedColor(oldLines[i]));
5437
+ lines.push(addedColor(newLines[i]));
5059
5438
  } else {
5060
- lines.push(chunk7K5VFY2N_cjs.theme.fg("muted", oldLines[i]));
5439
+ lines.push(chunkK4WJUBEC_cjs.theme.fg("muted", oldLines[i]));
5061
5440
  }
5062
5441
  }
5063
5442
  return {
@@ -5073,12 +5452,12 @@ var ToolExecutionComponentEnhanced = class extends piTui.Container {
5073
5452
  if (!content) {
5074
5453
  const path7 = argsObj?.path ? shortenPath(String(argsObj.path)) : "...";
5075
5454
  const status3 = this.getStatusIndicator();
5076
- const pathDisplay3 = fullPath ? fileLink(chunk7K5VFY2N_cjs.theme.fg("accent", path7), fullPath) : chunk7K5VFY2N_cjs.theme.fg("accent", path7);
5077
- const headerText = `${chunk7K5VFY2N_cjs.theme.bold(chunk7K5VFY2N_cjs.theme.fg("toolTitle", "write"))} ${pathDisplay3}${status3}`;
5455
+ const pathDisplay3 = fullPath ? fileLink(chunkK4WJUBEC_cjs.theme.fg("accent", path7), fullPath) : chunkK4WJUBEC_cjs.theme.fg("accent", path7);
5456
+ const headerText = `${chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("toolTitle", "write"))} ${pathDisplay3}${status3}`;
5078
5457
  this.contentBox.addChild(new piTui.Text(headerText, 0, 0));
5079
5458
  return;
5080
5459
  }
5081
- const border2 = (char) => chunk7K5VFY2N_cjs.theme.bold(chunk7K5VFY2N_cjs.theme.fg("accent", char));
5460
+ const border2 = (char) => chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", char));
5082
5461
  const status2 = this.getStatusIndicator();
5083
5462
  const termWidth2 = process.stdout.columns || 80;
5084
5463
  const maxLineWidth2 = termWidth2 - 6;
@@ -5088,8 +5467,8 @@ var ToolExecutionComponentEnhanced = class extends piTui.Container {
5088
5467
  if (path6.length > availableForPath2 && availableForPath2 > 10) {
5089
5468
  path6 = "\u2026" + path6.slice(-(availableForPath2 - 1));
5090
5469
  }
5091
- const pathDisplay2 = fullPath ? fileLink(chunk7K5VFY2N_cjs.theme.fg("accent", path6), fullPath) : chunk7K5VFY2N_cjs.theme.fg("accent", path6);
5092
- const footerText2 = `${chunk7K5VFY2N_cjs.theme.bold(chunk7K5VFY2N_cjs.theme.fg("toolTitle", "write"))} ${pathDisplay2}${status2}`;
5470
+ const pathDisplay2 = fullPath ? fileLink(chunkK4WJUBEC_cjs.theme.fg("accent", path6), fullPath) : chunkK4WJUBEC_cjs.theme.fg("accent", path6);
5471
+ const footerText2 = `${chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("toolTitle", "write"))} ${pathDisplay2}${status2}`;
5093
5472
  this.contentBox.addChild(new piTui.Text("", 0, 0));
5094
5473
  this.contentBox.addChild(new piTui.Text(border2("\u250C\u2500\u2500"), 0, 0));
5095
5474
  const highlighted = highlightCode(content, fullPath);
@@ -5104,7 +5483,7 @@ var ToolExecutionComponentEnhanced = class extends piTui.Container {
5104
5483
  }
5105
5484
  if (skippedAbove > 0) {
5106
5485
  this.contentBox.addChild(
5107
- new piTui.Text(border2("\u2502") + " " + chunk7K5VFY2N_cjs.theme.fg("muted", `... ${skippedAbove} lines above (ctrl+e to expand)`), 0, 0)
5486
+ new piTui.Text(border2("\u2502") + " " + chunkK4WJUBEC_cjs.theme.fg("muted", `... ${skippedAbove} lines above (ctrl+e to expand)`), 0, 0)
5108
5487
  );
5109
5488
  }
5110
5489
  const borderedLines = lines.map((line) => {
@@ -5115,7 +5494,7 @@ var ToolExecutionComponentEnhanced = class extends piTui.Container {
5115
5494
  this.contentBox.addChild(new piTui.Text(`${border2("\u2514\u2500\u2500")} ${footerText2}`, 0, 0));
5116
5495
  return;
5117
5496
  }
5118
- const border = (char) => chunk7K5VFY2N_cjs.theme.bold(chunk7K5VFY2N_cjs.theme.fg("accent", char));
5497
+ const border = (char) => chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", char));
5119
5498
  const status = this.getStatusIndicator();
5120
5499
  const termWidth = process.stdout.columns || 80;
5121
5500
  const maxLineWidth = termWidth - 6;
@@ -5125,8 +5504,8 @@ var ToolExecutionComponentEnhanced = class extends piTui.Container {
5125
5504
  if (path5.length > availableForPath && availableForPath > 10) {
5126
5505
  path5 = "\u2026" + path5.slice(-(availableForPath - 1));
5127
5506
  }
5128
- const pathDisplay = fullPath ? fileLink(chunk7K5VFY2N_cjs.theme.fg("accent", path5), fullPath) : chunk7K5VFY2N_cjs.theme.fg("accent", path5);
5129
- const footerText = `${chunk7K5VFY2N_cjs.theme.bold(chunk7K5VFY2N_cjs.theme.fg("toolTitle", "write"))} ${pathDisplay}${status}`;
5507
+ const pathDisplay = fullPath ? fileLink(chunkK4WJUBEC_cjs.theme.fg("accent", path5), fullPath) : chunkK4WJUBEC_cjs.theme.fg("accent", path5);
5508
+ const footerText = `${chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("toolTitle", "write"))} ${pathDisplay}${status}`;
5130
5509
  this.contentBox.addChild(new piTui.Text("", 0, 0));
5131
5510
  this.contentBox.addChild(new piTui.Text(border("\u250C\u2500\u2500"), 0, 0));
5132
5511
  if (this.result.isError) {
@@ -5134,7 +5513,7 @@ var ToolExecutionComponentEnhanced = class extends piTui.Container {
5134
5513
  if (output) {
5135
5514
  const lines = output.split("\n").map((line) => {
5136
5515
  const truncated = truncateAnsi(line, maxLineWidth);
5137
- return border("\u2502") + " " + chunk7K5VFY2N_cjs.theme.fg("error", truncated);
5516
+ return border("\u2502") + " " + chunkK4WJUBEC_cjs.theme.fg("error", truncated);
5138
5517
  });
5139
5518
  this.contentBox.addChild(new piTui.Text(lines.join("\n"), 0, 0));
5140
5519
  }
@@ -5151,7 +5530,7 @@ var ToolExecutionComponentEnhanced = class extends piTui.Container {
5151
5530
  }
5152
5531
  if (skippedAbove > 0) {
5153
5532
  this.contentBox.addChild(
5154
- new piTui.Text(border("\u2502") + " " + chunk7K5VFY2N_cjs.theme.fg("muted", `... ${skippedAbove} lines above (ctrl+e to expand)`), 0, 0)
5533
+ new piTui.Text(border("\u2502") + " " + chunkK4WJUBEC_cjs.theme.fg("muted", `... ${skippedAbove} lines above (ctrl+e to expand)`), 0, 0)
5155
5534
  );
5156
5535
  }
5157
5536
  const borderedLines = lines.map((line) => {
@@ -5167,11 +5546,11 @@ var ToolExecutionComponentEnhanced = class extends piTui.Container {
5167
5546
  const fullPath = argsObj?.path ? String(argsObj.path) : "";
5168
5547
  const path5 = argsObj?.path ? shortenPath(String(argsObj.path)) : "/";
5169
5548
  const pattern = argsObj?.pattern ? String(argsObj.pattern) : "";
5170
- const patternDisplay = pattern ? " " + chunk7K5VFY2N_cjs.theme.fg("muted", pattern) : "";
5549
+ const patternDisplay = pattern ? " " + chunkK4WJUBEC_cjs.theme.fg("muted", pattern) : "";
5171
5550
  if (!this.result || this.isPartial) {
5172
5551
  const status = this.getStatusIndicator();
5173
- const pathDisplay = fullPath ? fileLink(chunk7K5VFY2N_cjs.theme.fg("accent", path5), fullPath) : chunk7K5VFY2N_cjs.theme.fg("accent", path5);
5174
- const header = `${chunk7K5VFY2N_cjs.theme.bold(chunk7K5VFY2N_cjs.theme.fg("toolTitle", "list"))} ${pathDisplay}${patternDisplay}${status}`;
5552
+ const pathDisplay = fullPath ? fileLink(chunkK4WJUBEC_cjs.theme.fg("accent", path5), fullPath) : chunkK4WJUBEC_cjs.theme.fg("accent", path5);
5553
+ const header = `${chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("toolTitle", "list"))} ${pathDisplay}${patternDisplay}${status}`;
5175
5554
  this.contentBox.addChild(new piTui.Text(header, 0, 0));
5176
5555
  return;
5177
5556
  }
@@ -5182,7 +5561,7 @@ var ToolExecutionComponentEnhanced = class extends piTui.Container {
5182
5561
  const listStatus = this.getStatusIndicator();
5183
5562
  this.collapsible = new CollapsibleComponent(
5184
5563
  {
5185
- header: `${chunk7K5VFY2N_cjs.theme.bold(chunk7K5VFY2N_cjs.theme.fg("toolTitle", "list"))} ${chunk7K5VFY2N_cjs.theme.fg("accent", path5)}${patternDisplay}${listStatus}`,
5564
+ header: `${chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("toolTitle", "list"))} ${chunkK4WJUBEC_cjs.theme.fg("accent", path5)}${patternDisplay}${listStatus}`,
5186
5565
  summary: `${fileCount} items`,
5187
5566
  expanded: this.expanded,
5188
5567
  collapsedLines: 15,
@@ -5200,13 +5579,13 @@ var ToolExecutionComponentEnhanced = class extends piTui.Container {
5200
5579
  const tasks = argsObj?.tasks;
5201
5580
  const status = this.getStatusIndicator();
5202
5581
  const count = tasks?.length ?? 0;
5203
- const countSuffix = count > 0 ? chunk7K5VFY2N_cjs.theme.fg("muted", ` (${count} tasks)`) : "";
5204
- const header = `${chunk7K5VFY2N_cjs.theme.bold(chunk7K5VFY2N_cjs.theme.fg("toolTitle", "task_write"))}${countSuffix}${status}`;
5582
+ const countSuffix = count > 0 ? chunkK4WJUBEC_cjs.theme.fg("muted", ` (${count} tasks)`) : "";
5583
+ const header = `${chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("toolTitle", "task_write"))}${countSuffix}${status}`;
5205
5584
  this.contentBox.addChild(new piTui.Text(header, 0, 0));
5206
5585
  if (!this.isPartial && this.result?.isError) {
5207
5586
  const output = this.getFormattedOutput();
5208
5587
  if (output) {
5209
- this.contentBox.addChild(new piTui.Text(chunk7K5VFY2N_cjs.theme.fg("error", output), 0, 0));
5588
+ this.contentBox.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("error", output), 0, 0));
5210
5589
  }
5211
5590
  }
5212
5591
  }
@@ -5217,10 +5596,10 @@ var ToolExecutionComponentEnhanced = class extends piTui.Container {
5217
5596
  const argsObj = this.args;
5218
5597
  const keys = Object.keys(argsObj);
5219
5598
  if (keys.length > 0) {
5220
- argsSummary = chunk7K5VFY2N_cjs.theme.fg("muted", ` (${keys.length} args)`);
5599
+ argsSummary = chunkK4WJUBEC_cjs.theme.fg("muted", ` (${keys.length} args)`);
5221
5600
  }
5222
5601
  }
5223
- const header = `${chunk7K5VFY2N_cjs.theme.bold(chunk7K5VFY2N_cjs.theme.fg("toolTitle", this.toolName))}${argsSummary}${status}`;
5602
+ const header = `${chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("toolTitle", this.toolName))}${argsSummary}${status}`;
5224
5603
  if (!this.result || this.isPartial) {
5225
5604
  this.contentBox.addChild(new piTui.Text(header, 0, 0));
5226
5605
  const preview = this.formatArgsPreview();
@@ -5266,7 +5645,7 @@ var ToolExecutionComponentEnhanced = class extends piTui.Container {
5266
5645
  const key = keys[i];
5267
5646
  if (lines.length >= maxLines) {
5268
5647
  const remaining = keys.length - i;
5269
- lines.push(chunk7K5VFY2N_cjs.theme.fg("muted", ` ... ${remaining} more`));
5648
+ lines.push(chunkK4WJUBEC_cjs.theme.fg("muted", ` ... ${remaining} more`));
5270
5649
  break;
5271
5650
  }
5272
5651
  const raw = argsObj[key];
@@ -5274,7 +5653,7 @@ var ToolExecutionComponentEnhanced = class extends piTui.Container {
5274
5653
  if (typeof raw === "string") {
5275
5654
  const strLines = raw.split("\n");
5276
5655
  if (strLines.length > 1) {
5277
- val = strLines[0].slice(0, maxValueLen) + chunk7K5VFY2N_cjs.theme.fg("muted", ` (${strLines.length} lines)`);
5656
+ val = strLines[0].slice(0, maxValueLen) + chunkK4WJUBEC_cjs.theme.fg("muted", ` (${strLines.length} lines)`);
5278
5657
  } else {
5279
5658
  val = raw.length > maxValueLen ? raw.slice(0, maxValueLen) + "\u2026" : raw;
5280
5659
  }
@@ -5289,19 +5668,19 @@ var ToolExecutionComponentEnhanced = class extends piTui.Container {
5289
5668
  } else {
5290
5669
  val = String(raw);
5291
5670
  }
5292
- const line = truncateAnsi(` ${chunk7K5VFY2N_cjs.theme.fg("muted", key + "=")}${val}`, maxLineWidth);
5671
+ const line = truncateAnsi(` ${chunkK4WJUBEC_cjs.theme.fg("muted", key + "=")}${val}`, maxLineWidth);
5293
5672
  lines.push(line);
5294
5673
  }
5295
5674
  return lines;
5296
5675
  }
5297
5676
  getStatusIndicator() {
5298
- return this.isPartial ? chunk7K5VFY2N_cjs.theme.fg("muted", " \u22EF") : this.result?.isError ? chunk7K5VFY2N_cjs.theme.fg("error", " \u2717") : chunk7K5VFY2N_cjs.theme.fg("success", " \u2713");
5677
+ return this.isPartial ? chunkK4WJUBEC_cjs.theme.fg("muted", " \u22EF") : this.result?.isError ? chunkK4WJUBEC_cjs.theme.fg("error", " \u2717") : chunkK4WJUBEC_cjs.theme.fg("success", " \u2713");
5299
5678
  }
5300
5679
  getDurationSuffix() {
5301
5680
  if (this.isPartial) return "";
5302
5681
  const ms = Date.now() - this.startTime;
5303
- if (ms < 1e3) return chunk7K5VFY2N_cjs.theme.fg("muted", ` ${ms}ms`);
5304
- return chunk7K5VFY2N_cjs.theme.fg("muted", ` ${(ms / 1e3).toFixed(1)}s`);
5682
+ if (ms < 1e3) return chunkK4WJUBEC_cjs.theme.fg("muted", ` ${ms}ms`);
5683
+ return chunkK4WJUBEC_cjs.theme.fg("muted", ` ${(ms / 1e3).toFixed(1)}s`);
5305
5684
  }
5306
5685
  getFormattedOutput() {
5307
5686
  if (!this.result) return "";
@@ -5506,7 +5885,7 @@ function handleMessageStart(ctx, message) {
5506
5885
  state.lastAskUserComponent = void 0;
5507
5886
  state.lastSubmitPlanComponent = void 0;
5508
5887
  if (!state.streamingComponent) {
5509
- state.streamingComponent = new AssistantMessageComponent(void 0, state.hideThinkingBlock, chunk7K5VFY2N_cjs.getMarkdownTheme());
5888
+ state.streamingComponent = new AssistantMessageComponent(void 0, state.hideThinkingBlock, chunkK4WJUBEC_cjs.getMarkdownTheme());
5510
5889
  ctx.addChildBeforeFollowUps(state.streamingComponent);
5511
5890
  state.streamingMessage = message;
5512
5891
  const trailingParts = getTrailingContentParts(message);
@@ -5535,7 +5914,7 @@ function handleMessageUpdate(ctx, message) {
5535
5914
  state.streamingComponent = new AssistantMessageComponent(
5536
5915
  void 0,
5537
5916
  state.hideThinkingBlock,
5538
- chunk7K5VFY2N_cjs.getMarkdownTheme()
5917
+ chunkK4WJUBEC_cjs.getMarkdownTheme()
5539
5918
  );
5540
5919
  ctx.addChildBeforeFollowUps(state.streamingComponent);
5541
5920
  continue;
@@ -5556,7 +5935,7 @@ function handleMessageUpdate(ctx, message) {
5556
5935
  state.streamingComponent = new AssistantMessageComponent(
5557
5936
  void 0,
5558
5937
  state.hideThinkingBlock,
5559
- chunk7K5VFY2N_cjs.getMarkdownTheme()
5938
+ chunkK4WJUBEC_cjs.getMarkdownTheme()
5560
5939
  );
5561
5940
  ctx.addChildBeforeFollowUps(state.streamingComponent);
5562
5941
  } else {
@@ -5630,7 +6009,7 @@ function formatMarker(data) {
5630
6009
  switch (data.type) {
5631
6010
  case "om_observation_start": {
5632
6011
  const tokens = data.tokensToObserve > 0 ? ` ~${formatTokens2(data.tokensToObserve)} tokens` : "";
5633
- return chunk7K5VFY2N_cjs.fg("muted", ` \u{1F9E0} ${label} in progress${tokens}...`);
6012
+ return chunkK4WJUBEC_cjs.theme.fg("muted", ` \u{1F9E0} ${label} in progress${tokens}...`);
5634
6013
  }
5635
6014
  case "om_observation_end": {
5636
6015
  const observed = formatTokens2(data.tokensObserved);
@@ -5638,36 +6017,36 @@ function formatMarker(data) {
5638
6017
  const ratio = data.tokensObserved > 0 && data.observationTokens > 0 ? `${Math.round(data.tokensObserved / data.observationTokens)}x` : "";
5639
6018
  const duration = (data.durationMs / 1e3).toFixed(1);
5640
6019
  const ratioStr = ratio ? ` (${ratio} compression)` : "";
5641
- return chunk7K5VFY2N_cjs.fg("success", ` \u{1F9E0} Observed: ${observed} \u2192 ${compressed} tokens${ratioStr} in ${duration}s \u2713`);
6020
+ return chunkK4WJUBEC_cjs.theme.fg("success", ` \u{1F9E0} Observed: ${observed} \u2192 ${compressed} tokens${ratioStr} in ${duration}s \u2713`);
5642
6021
  }
5643
6022
  case "om_observation_failed": {
5644
6023
  const tokens = data.tokensAttempted ? ` (${formatTokens2(data.tokensAttempted)} tokens)` : "";
5645
- return chunk7K5VFY2N_cjs.fg("error", ` \u2717 ${label} failed${tokens}: ${data.error}`);
6024
+ return chunkK4WJUBEC_cjs.theme.fg("error", ` \u2717 ${label} failed${tokens}: ${data.error}`);
5646
6025
  }
5647
6026
  case "om_buffering_start": {
5648
6027
  const tokens = data.tokensToBuffer > 0 ? ` ~${formatTokens2(data.tokensToBuffer)} tokens` : "";
5649
- return chunk7K5VFY2N_cjs.fg("muted", ` \u27F3 Buffering ${label.toLowerCase()}${tokens}...`);
6028
+ return chunkK4WJUBEC_cjs.theme.fg("muted", ` \u27F3 Buffering ${label.toLowerCase()}${tokens}...`);
5650
6029
  }
5651
6030
  case "om_buffering_end": {
5652
6031
  const input = formatTokens2(data.tokensBuffered);
5653
6032
  const outputTokens = data.operationType === "observation" && data.observations ? Math.round(data.observations.length / 4) : data.bufferedTokens;
5654
6033
  const output = formatTokens2(outputTokens);
5655
6034
  const ratio = data.tokensBuffered > 0 && outputTokens > 0 ? ` (${Math.round(data.tokensBuffered / outputTokens)}x)` : "";
5656
- return chunk7K5VFY2N_cjs.fg("success", ` \u2713 Buffered ${label.toLowerCase()}: ${input} \u2192 ${output} tokens${ratio}`);
6035
+ return chunkK4WJUBEC_cjs.theme.fg("success", ` \u2713 Buffered ${label.toLowerCase()}: ${input} \u2192 ${output} tokens${ratio}`);
5657
6036
  }
5658
6037
  case "om_buffering_failed": {
5659
- return chunk7K5VFY2N_cjs.fg("error", ` \u2717 Buffering ${label.toLowerCase()} failed: ${data.error}`);
6038
+ return chunkK4WJUBEC_cjs.theme.fg("error", ` \u2717 Buffering ${label.toLowerCase()} failed: ${data.error}`);
5660
6039
  }
5661
6040
  case "om_activation": {
5662
6041
  const kind = data.operationType === "reflection" ? "reflection" : "observations";
5663
6042
  const msgTokens = formatTokens2(data.tokensActivated);
5664
6043
  const obsTokens = formatTokens2(data.observationTokens);
5665
- return chunk7K5VFY2N_cjs.fg("success", ` \u2713 Activated ${kind}: -${msgTokens} msg tokens, +${obsTokens} obs tokens`);
6044
+ return chunkK4WJUBEC_cjs.theme.fg("success", ` \u2713 Activated ${kind}: -${msgTokens} msg tokens, +${obsTokens} obs tokens`);
5666
6045
  }
5667
6046
  }
5668
6047
  }
5669
- var OBSERVER_COLOR2 = "#f59e0b";
5670
- var REFLECTOR_COLOR2 = "#ef4444";
6048
+ var OBSERVER_COLOR2 = chunkK4WJUBEC_cjs.mastra.orange;
6049
+ var REFLECTOR_COLOR2 = chunkK4WJUBEC_cjs.mastra.red;
5671
6050
  var COLLAPSED_LINES = 10;
5672
6051
  function formatTokens3(tokens) {
5673
6052
  if (tokens === 0) return "0";
@@ -5783,22 +6162,22 @@ var OMOutputComponent = class extends piTui.Container {
5783
6162
  truncated = hiddenGroups > 0;
5784
6163
  if (truncated) {
5785
6164
  for (const line of headLines) {
5786
- borderedLines.push(border("\u2502") + " " + chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.specialGray)(line));
6165
+ borderedLines.push(border("\u2502") + " " + chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.specialGray)(line));
5787
6166
  }
5788
6167
  borderedLines.push(
5789
- border("\u2502") + " " + chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.mainGray)(`... ${originalLineCount} lines total (ctrl+e to expand)`)
6168
+ border("\u2502") + " " + chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.mainGray)(`... ${originalLineCount} lines total (ctrl+e to expand)`)
5790
6169
  );
5791
6170
  for (const line of tailLines) {
5792
- borderedLines.push(border("\u2502") + " " + chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.specialGray)(line));
6171
+ borderedLines.push(border("\u2502") + " " + chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.specialGray)(line));
5793
6172
  }
5794
6173
  } else {
5795
6174
  for (const line of wrappedLines) {
5796
- borderedLines.push(border("\u2502") + " " + chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.specialGray)(line));
6175
+ borderedLines.push(border("\u2502") + " " + chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.specialGray)(line));
5797
6176
  }
5798
6177
  }
5799
6178
  } else {
5800
6179
  for (const line of wrappedLines) {
5801
- borderedLines.push(border("\u2502") + " " + chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.specialGray)(line));
6180
+ borderedLines.push(border("\u2502") + " " + chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.specialGray)(line));
5802
6181
  }
5803
6182
  }
5804
6183
  const displayOutput = borderedLines.join("\n");
@@ -5806,11 +6185,11 @@ var OMOutputComponent = class extends piTui.Container {
5806
6185
  this.addChild(new piTui.Text(displayOutput, 0, 0));
5807
6186
  }
5808
6187
  if (this.data.currentTask && (this.expanded || !truncated)) {
5809
- const taskLine = border("\u2502") + " " + chalk10__default.default.hex(color).bold("Current task: ") + chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.specialGray)(this.data.currentTask);
6188
+ const taskLine = border("\u2502") + " " + chalk10__default.default.hex(color).bold("Current task: ") + chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.specialGray)(this.data.currentTask);
5810
6189
  this.addChild(new piTui.Text(truncateAnsi2(taskLine, termWidth - 2), 0, 0));
5811
6190
  }
5812
6191
  if (this.data.suggestedResponse && (this.expanded || !truncated)) {
5813
- const sugLine = border("\u2502") + " " + chalk10__default.default.hex(color).bold("Suggested response: ") + chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.specialGray)(this.data.suggestedResponse);
6192
+ const sugLine = border("\u2502") + " " + chalk10__default.default.hex(color).bold("Suggested response: ") + chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.specialGray)(this.data.suggestedResponse);
5814
6193
  this.addChild(new piTui.Text(truncateAnsi2(sugLine, termWidth - 2), 0, 0));
5815
6194
  }
5816
6195
  this.addChild(new piTui.Text(`${border("\u2514\u2500\u2500")} ${footerText}`, 0, 0));
@@ -5824,14 +6203,14 @@ var OMOutputComponent = class extends piTui.Container {
5824
6203
  const ratio = (this.data.tokensObserved ?? 0) > 0 && (this.data.compressedTokens ?? this.data.observationTokens ?? 0) > 0 ? `${Math.round((this.data.tokensObserved ?? 0) / (this.data.compressedTokens ?? this.data.observationTokens ?? 1))}x` : "";
5825
6204
  const durationStr = this.data.durationMs ? ` in ${(this.data.durationMs / 1e3).toFixed(1)}s` : "";
5826
6205
  const ratioStr = ratio ? ` (${ratio} compression)` : "";
5827
- return `${emoji} ${chalk10__default.default.hex(color)(`Reflected: ${observed} \u2192 ${compressed} tokens${ratioStr}${durationStr}`)} ${chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.green)("\u2713")}`;
6206
+ return `${emoji} ${chalk10__default.default.hex(color)(`Reflected: ${observed} \u2192 ${compressed} tokens${ratioStr}${durationStr}`)} ${chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.green)("\u2713")}`;
5828
6207
  } else {
5829
6208
  const observed = formatTokens3(this.data.tokensObserved ?? 0);
5830
6209
  const compressed = formatTokens3(this.data.observationTokens ?? 0);
5831
6210
  const ratio = (this.data.tokensObserved ?? 0) > 0 && (this.data.observationTokens ?? 0) > 0 ? `${Math.round((this.data.tokensObserved ?? 0) / (this.data.observationTokens ?? 1))}x` : "";
5832
6211
  const durationStr = this.data.durationMs ? ` in ${(this.data.durationMs / 1e3).toFixed(1)}s` : "";
5833
6212
  const ratioStr = ratio ? ` (${ratio} compression)` : "";
5834
- return `${emoji} ${chalk10__default.default.hex(color)(`Observed: ${observed} \u2192 ${compressed} tokens${ratioStr}${durationStr}`)} ${chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.green)("\u2713")}`;
6213
+ return `${emoji} ${chalk10__default.default.hex(color)(`Observed: ${observed} \u2192 ${compressed} tokens${ratioStr}${durationStr}`)} ${chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.green)("\u2713")}`;
5835
6214
  }
5836
6215
  }
5837
6216
  };
@@ -5992,13 +6371,13 @@ var AskQuestionDialogComponent = class extends piTui.Box {
5992
6371
  if (this.input) this.input.focused = value;
5993
6372
  }
5994
6373
  constructor(options) {
5995
- super(2, 1, (text) => chunk7K5VFY2N_cjs.bg("overlayBg", text));
6374
+ super(2, 1, (text) => chunkK4WJUBEC_cjs.theme.bg("overlayBg", text));
5996
6375
  this.onSubmit = options.onSubmit;
5997
6376
  this.onCancel = options.onCancel;
5998
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.bold(chunk7K5VFY2N_cjs.fg("accent", "Question")), 0, 0));
6377
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", "Question")), 0, 0));
5999
6378
  this.addChild(new piTui.Spacer(1));
6000
6379
  for (const line of options.question.split("\n")) {
6001
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("text", line), 0, 0));
6380
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("text", line), 0, 0));
6002
6381
  }
6003
6382
  this.addChild(new piTui.Spacer(1));
6004
6383
  if (options.options && options.options.length > 0) {
@@ -6010,16 +6389,16 @@ var AskQuestionDialogComponent = class extends piTui.Box {
6010
6389
  buildSelectMode(opts) {
6011
6390
  const items = opts.map((opt) => ({
6012
6391
  value: opt.label,
6013
- label: opt.description ? ` ${opt.label} ${chunk7K5VFY2N_cjs.fg("dim", opt.description)}` : ` ${opt.label}`
6392
+ label: opt.description ? ` ${opt.label} ${chunkK4WJUBEC_cjs.theme.fg("dim", opt.description)}` : ` ${opt.label}`
6014
6393
  }));
6015
- this.selectList = new piTui.SelectList(items, Math.min(items.length, 8), chunk7K5VFY2N_cjs.getSelectListTheme());
6394
+ this.selectList = new piTui.SelectList(items, Math.min(items.length, 8), chunkK4WJUBEC_cjs.getSelectListTheme());
6016
6395
  this.selectList.onSelect = (item) => {
6017
6396
  this.onSubmit(item.value);
6018
6397
  };
6019
6398
  this.selectList.onCancel = this.onCancel;
6020
6399
  this.addChild(this.selectList);
6021
6400
  this.addChild(new piTui.Spacer(1));
6022
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("dim", " \u2191\u2193 to navigate \xB7 Enter to select \xB7 Esc to skip"), 0, 0));
6401
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("dim", " \u2191\u2193 to navigate \xB7 Enter to select \xB7 Esc to skip"), 0, 0));
6023
6402
  }
6024
6403
  buildInputMode() {
6025
6404
  this.input = new piTui.Input();
@@ -6031,7 +6410,7 @@ var AskQuestionDialogComponent = class extends piTui.Box {
6031
6410
  };
6032
6411
  this.addChild(this.input);
6033
6412
  this.addChild(new piTui.Spacer(1));
6034
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("dim", " Enter to submit \xB7 Esc to skip"), 0, 0));
6413
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("dim", " Enter to submit \xB7 Esc to skip"), 0, 0));
6035
6414
  }
6036
6415
  handleInput(data) {
6037
6416
  if (this.selectList) {
@@ -6073,28 +6452,28 @@ var PlanApprovalInlineComponent = class extends piTui.Container {
6073
6452
  this.planTitle = options.title;
6074
6453
  this.planContent = options.plan;
6075
6454
  this.addChild(new piTui.Spacer(1));
6076
- this.contentBox = new piTui.Box(1, 1, (text) => chunk7K5VFY2N_cjs.theme.bg("toolPendingBg", text));
6455
+ this.contentBox = new piTui.Box(1, 1, (text) => chunkK4WJUBEC_cjs.theme.bg("toolPendingBg", text));
6077
6456
  this.addChild(this.contentBox);
6078
- this.contentBox.addChild(new piTui.Text(chunk7K5VFY2N_cjs.theme.bold(chunk7K5VFY2N_cjs.theme.fg("accent", `Plan: ${options.title}`)), 0, 0));
6457
+ this.contentBox.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", `Plan: ${options.title}`)), 0, 0));
6079
6458
  this.contentBox.addChild(new piTui.Spacer(1));
6080
- const md = new piTui.Markdown(options.plan, 1, 0, chunk7K5VFY2N_cjs.getMarkdownTheme());
6459
+ const md = new piTui.Markdown(options.plan, 1, 0, chunkK4WJUBEC_cjs.getMarkdownTheme());
6081
6460
  this.contentBox.addChild(md);
6082
6461
  this.contentBox.addChild(new piTui.Spacer(1));
6083
6462
  const items = [
6084
6463
  {
6085
6464
  value: "approve",
6086
- label: ` ${chunk7K5VFY2N_cjs.theme.fg("success", "Approve")} ${chunk7K5VFY2N_cjs.theme.fg("dim", "\u2014 switch to Build mode and implement")}`
6465
+ label: ` ${chunkK4WJUBEC_cjs.theme.fg("success", "Approve")} ${chunkK4WJUBEC_cjs.theme.fg("dim", "\u2014 switch to Build mode and implement")}`
6087
6466
  },
6088
6467
  {
6089
6468
  value: "reject",
6090
- label: ` ${chunk7K5VFY2N_cjs.theme.fg("error", "Reject")} ${chunk7K5VFY2N_cjs.theme.fg("dim", "\u2014 stay in Plan mode")}`
6469
+ label: ` ${chunkK4WJUBEC_cjs.theme.fg("error", "Reject")} ${chunkK4WJUBEC_cjs.theme.fg("dim", "\u2014 stay in Plan mode")}`
6091
6470
  },
6092
6471
  {
6093
6472
  value: "edit",
6094
- label: ` ${chunk7K5VFY2N_cjs.theme.fg("warning", "Request changes")} ${chunk7K5VFY2N_cjs.theme.fg("dim", "\u2014 provide feedback")}`
6473
+ label: ` ${chunkK4WJUBEC_cjs.theme.fg("warning", "Request changes")} ${chunkK4WJUBEC_cjs.theme.fg("dim", "\u2014 provide feedback")}`
6095
6474
  }
6096
6475
  ];
6097
- this.selectList = new piTui.SelectList(items, items.length, chunk7K5VFY2N_cjs.getSelectListTheme());
6476
+ this.selectList = new piTui.SelectList(items, items.length, chunkK4WJUBEC_cjs.getSelectListTheme());
6098
6477
  this.selectList.onSelect = (item) => {
6099
6478
  this.handleSelection(item.value);
6100
6479
  };
@@ -6103,7 +6482,7 @@ var PlanApprovalInlineComponent = class extends piTui.Container {
6103
6482
  };
6104
6483
  this.contentBox.addChild(this.selectList);
6105
6484
  this.contentBox.addChild(new piTui.Spacer(1));
6106
- this.contentBox.addChild(new piTui.Text(chunk7K5VFY2N_cjs.theme.fg("dim", "Up/Down navigate Enter select Esc reject"), 0, 0));
6485
+ this.contentBox.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("dim", "Up/Down navigate Enter select Esc reject"), 0, 0));
6107
6486
  }
6108
6487
  handleSelection(value) {
6109
6488
  if (this.resolved) return;
@@ -6135,7 +6514,7 @@ var PlanApprovalInlineComponent = class extends piTui.Container {
6135
6514
  this.mode = "feedback";
6136
6515
  this.selectList = void 0;
6137
6516
  this.contentBox.clear();
6138
- this.contentBox.addChild(new piTui.Text(chunk7K5VFY2N_cjs.theme.fg("accent", "Provide feedback for revision:"), 0, 0));
6517
+ this.contentBox.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("accent", "Provide feedback for revision:"), 0, 0));
6139
6518
  this.contentBox.addChild(new piTui.Spacer(1));
6140
6519
  this.feedbackInput = new piTui.Input();
6141
6520
  this.feedbackInput.focused = this._focused;
@@ -6149,23 +6528,23 @@ var PlanApprovalInlineComponent = class extends piTui.Container {
6149
6528
  this.contentBox.addChild(this.feedbackInput);
6150
6529
  this.contentBox.addChild(new piTui.Spacer(1));
6151
6530
  this.contentBox.addChild(
6152
- new piTui.Text(chunk7K5VFY2N_cjs.theme.fg("dim", "Enter to submit feedback Esc to reject without feedback"), 0, 0)
6531
+ new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("dim", "Enter to submit feedback Esc to reject without feedback"), 0, 0)
6153
6532
  );
6154
6533
  }
6155
6534
  showResult(status, isApproved) {
6156
6535
  this.contentBox.clear();
6157
6536
  const bgColor = isApproved ? "toolSuccessBg" : "toolErrorBg";
6158
- this.contentBox.setBgFn((text) => chunk7K5VFY2N_cjs.theme.bg(bgColor, text));
6159
- const icon = isApproved ? chunk7K5VFY2N_cjs.theme.fg("success", "\u2713") : chunk7K5VFY2N_cjs.theme.fg("error", "\u2717");
6537
+ this.contentBox.setBgFn((text) => chunkK4WJUBEC_cjs.theme.bg(bgColor, text));
6538
+ const icon = isApproved ? chunkK4WJUBEC_cjs.theme.fg("success", "\u2713") : chunkK4WJUBEC_cjs.theme.fg("error", "\u2717");
6160
6539
  this.contentBox.addChild(
6161
6540
  new piTui.Text(
6162
- `${icon} ${chunk7K5VFY2N_cjs.theme.bold(chunk7K5VFY2N_cjs.theme.fg("accent", `Plan: ${this.planTitle}`))} ${chunk7K5VFY2N_cjs.theme.fg("dim", `\u2014 ${status}`)}`,
6541
+ `${icon} ${chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", `Plan: ${this.planTitle}`))} ${chunkK4WJUBEC_cjs.theme.fg("dim", `\u2014 ${status}`)}`,
6163
6542
  0,
6164
6543
  0
6165
6544
  )
6166
6545
  );
6167
6546
  this.contentBox.addChild(new piTui.Spacer(1));
6168
- const md = new piTui.Markdown(this.planContent, 1, 0, chunk7K5VFY2N_cjs.getMarkdownTheme());
6547
+ const md = new piTui.Markdown(this.planContent, 1, 0, chunkK4WJUBEC_cjs.getMarkdownTheme());
6169
6548
  this.contentBox.addChild(md);
6170
6549
  }
6171
6550
  handleInput(data) {
@@ -6187,19 +6566,19 @@ var PlanResultComponent = class extends piTui.Container {
6187
6566
  super();
6188
6567
  this.addChild(new piTui.Spacer(1));
6189
6568
  const bgColor = options.isApproved ? "toolSuccessBg" : "toolErrorBg";
6190
- const contentBox = new piTui.Box(1, 1, (text) => chunk7K5VFY2N_cjs.theme.bg(bgColor, text));
6569
+ const contentBox = new piTui.Box(1, 1, (text) => chunkK4WJUBEC_cjs.theme.bg(bgColor, text));
6191
6570
  this.addChild(contentBox);
6192
- const icon = options.isApproved ? chunk7K5VFY2N_cjs.theme.fg("success", "\u2713") : chunk7K5VFY2N_cjs.theme.fg("error", "\u2717");
6571
+ const icon = options.isApproved ? chunkK4WJUBEC_cjs.theme.fg("success", "\u2713") : chunkK4WJUBEC_cjs.theme.fg("error", "\u2717");
6193
6572
  const status = options.isApproved ? "Approved" : options.feedback ? `Rejected \u2014 ${options.feedback}` : "Rejected";
6194
6573
  contentBox.addChild(
6195
6574
  new piTui.Text(
6196
- `${icon} ${chunk7K5VFY2N_cjs.theme.bold(chunk7K5VFY2N_cjs.theme.fg("accent", `Plan: ${options.title}`))} ${chunk7K5VFY2N_cjs.theme.fg("dim", `\u2014 ${status}`)}`,
6575
+ `${icon} ${chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", `Plan: ${options.title}`))} ${chunkK4WJUBEC_cjs.theme.fg("dim", `\u2014 ${status}`)}`,
6197
6576
  0,
6198
6577
  0
6199
6578
  )
6200
6579
  );
6201
6580
  contentBox.addChild(new piTui.Spacer(1));
6202
- const md = new piTui.Markdown(options.plan, 1, 0, chunk7K5VFY2N_cjs.getMarkdownTheme());
6581
+ const md = new piTui.Markdown(options.plan, 1, 0, chunkK4WJUBEC_cjs.getMarkdownTheme());
6203
6582
  contentBox.addChild(md);
6204
6583
  }
6205
6584
  };
@@ -6281,7 +6660,7 @@ async function handleSandboxAccessRequest(ctx, questionId, requestedPath, reason
6281
6660
  const questionComponent = new AskQuestionInlineComponent(
6282
6661
  {
6283
6662
  question: `Grant sandbox access to "${requestedPath}"?
6284
- ${chunk7K5VFY2N_cjs.fg("dim", `Reason: ${reason}`)}`,
6663
+ ${chunkK4WJUBEC_cjs.theme.fg("dim", `Reason: ${reason}`)}`,
6285
6664
  options: [
6286
6665
  { label: "Yes", description: "Allow access to this directory" },
6287
6666
  { label: "No", description: "Deny access" }
@@ -6453,7 +6832,7 @@ var SubagentExecutionComponent = class extends piTui.Container {
6453
6832
  rebuild() {
6454
6833
  this.clear();
6455
6834
  this.addChild(new piTui.Spacer(1));
6456
- const border = (char) => chunk7K5VFY2N_cjs.theme.bold(chunk7K5VFY2N_cjs.theme.fg("accent", char));
6835
+ const border = (char) => chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", char));
6457
6836
  const termWidth = process.stdout.columns || 80;
6458
6837
  const maxLineWidth = termWidth - 6;
6459
6838
  this.addChild(new piTui.Text(border("\u250C\u2500\u2500"), 0, 0));
@@ -6479,11 +6858,11 @@ var SubagentExecutionComponent = class extends piTui.Container {
6479
6858
  const taskContent = displayTaskLines.map((line) => `${border("\u2502")} ${line}`).join("\n");
6480
6859
  this.addChild(new piTui.Text(taskContent, 0, 0));
6481
6860
  if (taskTruncated) {
6482
- const moreText = chunk7K5VFY2N_cjs.theme.fg("muted", `... ${wrappedTaskLines.length - maxTaskLines} more lines (ctrl+e to expand)`);
6861
+ const moreText = chunkK4WJUBEC_cjs.theme.fg("muted", `... ${wrappedTaskLines.length - maxTaskLines} more lines (ctrl+e to expand)`);
6483
6862
  this.addChild(new piTui.Text(`${border("\u2502")} ${moreText}`, 0, 0));
6484
6863
  }
6485
6864
  if (this.toolCalls.length > 0) {
6486
- this.addChild(new piTui.Text(`${border("\u2502")} ${chunk7K5VFY2N_cjs.theme.fg("muted", "\u2500\u2500\u2500")}`, 0, 0));
6865
+ this.addChild(new piTui.Text(`${border("\u2502")} ${chunkK4WJUBEC_cjs.theme.fg("muted", "\u2500\u2500\u2500")}`, 0, 0));
6487
6866
  const activityLines = this.toolCalls.map((tc) => formatToolCallLine(tc));
6488
6867
  const cap = this.done ? COLLAPSED_LINES2 : MAX_ACTIVITY_LINES;
6489
6868
  let displayLines = activityLines;
@@ -6498,48 +6877,48 @@ var SubagentExecutionComponent = class extends piTui.Container {
6498
6877
  }
6499
6878
  }
6500
6879
  if (!this.done && hiddenCount > 0) {
6501
- const hiddenText = chunk7K5VFY2N_cjs.theme.fg("muted", ` ... ${hiddenCount} more above`);
6880
+ const hiddenText = chunkK4WJUBEC_cjs.theme.fg("muted", ` ... ${hiddenCount} more above`);
6502
6881
  this.addChild(new piTui.Text(`${border("\u2502")} ${hiddenText}`, 0, 0));
6503
6882
  }
6504
6883
  const activityContent = displayLines.map((line) => `${border("\u2502")} ${line}`).join("\n");
6505
6884
  this.addChild(new piTui.Text(activityContent, 0, 0));
6506
6885
  if (this.done && hiddenCount > 0) {
6507
- const moreText = chunk7K5VFY2N_cjs.theme.fg("muted", `... ${hiddenCount} more (ctrl+e to expand)`);
6886
+ const moreText = chunkK4WJUBEC_cjs.theme.fg("muted", `... ${hiddenCount} more (ctrl+e to expand)`);
6508
6887
  this.addChild(new piTui.Text(`${border("\u2502")} ${moreText}`, 0, 0));
6509
6888
  }
6510
6889
  }
6511
6890
  const showResult = this.done && this.finalResult && (this.expanded || this.toolCalls.length === 0);
6512
6891
  if (showResult) {
6513
- this.addChild(new piTui.Text(`${border("\u2502")} ${chunk7K5VFY2N_cjs.theme.fg("muted", "\u2500\u2500\u2500")}`, 0, 0));
6892
+ this.addChild(new piTui.Text(`${border("\u2502")} ${chunkK4WJUBEC_cjs.theme.fg("muted", "\u2500\u2500\u2500")}`, 0, 0));
6514
6893
  const resultLines = this.finalResult.split("\n");
6515
6894
  const maxResultLines = this.expanded ? resultLines.length : 10;
6516
6895
  const truncated = !this.expanded && resultLines.length > maxResultLines + 1;
6517
6896
  const displayLines = truncated ? resultLines.slice(-maxResultLines) : resultLines;
6518
6897
  if (truncated) {
6519
- const hiddenLine = `${border("\u2502")} ${chunk7K5VFY2N_cjs.theme.fg("muted", ` ... ${resultLines.length - maxResultLines} more lines (ctrl+e to expand)`)}`;
6898
+ const hiddenLine = `${border("\u2502")} ${chunkK4WJUBEC_cjs.theme.fg("muted", ` ... ${resultLines.length - maxResultLines} more lines (ctrl+e to expand)`)}`;
6520
6899
  this.addChild(new piTui.Text(hiddenLine, 0, 0));
6521
6900
  }
6522
6901
  const resultContent = displayLines.map((line) => {
6523
6902
  const truncatedLine = line.length > maxLineWidth ? line.slice(0, maxLineWidth - 1) + "\u2026" : line;
6524
- return `${border("\u2502")} ${chunk7K5VFY2N_cjs.theme.fg("muted", truncatedLine)}`;
6903
+ return `${border("\u2502")} ${chunkK4WJUBEC_cjs.theme.fg("muted", truncatedLine)}`;
6525
6904
  }).join("\n");
6526
6905
  if (resultContent.trim()) {
6527
6906
  this.addChild(new piTui.Text(resultContent, 0, 0));
6528
6907
  }
6529
6908
  }
6530
- const typeLabel = chunk7K5VFY2N_cjs.theme.bold(chunk7K5VFY2N_cjs.theme.fg("accent", this.agentType));
6531
- const modelLabel = this.modelId ? chunk7K5VFY2N_cjs.theme.fg("muted", ` ${this.modelId}`) : "";
6532
- const statusIcon = this.done ? this.isError ? chunk7K5VFY2N_cjs.theme.fg("error", " \u2717") : chunk7K5VFY2N_cjs.theme.fg("success", " \u2713") : chunk7K5VFY2N_cjs.theme.fg("muted", " \u22EF");
6533
- const durationStr = this.done ? chunk7K5VFY2N_cjs.theme.fg("muted", ` ${formatDuration(this.durationMs)}`) : "";
6534
- const footerText = `${chunk7K5VFY2N_cjs.theme.bold(chunk7K5VFY2N_cjs.theme.fg("toolTitle", "subagent"))} ${typeLabel}${modelLabel}${durationStr}${statusIcon}`;
6909
+ const typeLabel = chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", this.agentType));
6910
+ const modelLabel = this.modelId ? chunkK4WJUBEC_cjs.theme.fg("muted", ` ${this.modelId}`) : "";
6911
+ const statusIcon = this.done ? this.isError ? chunkK4WJUBEC_cjs.theme.fg("error", " \u2717") : chunkK4WJUBEC_cjs.theme.fg("success", " \u2713") : chunkK4WJUBEC_cjs.theme.fg("muted", " \u22EF");
6912
+ const durationStr = this.done ? chunkK4WJUBEC_cjs.theme.fg("muted", ` ${formatDuration(this.durationMs)}`) : "";
6913
+ const footerText = `${chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("toolTitle", "subagent"))} ${typeLabel}${modelLabel}${durationStr}${statusIcon}`;
6535
6914
  this.addChild(new piTui.Text(`${border("\u2514\u2500\u2500")} ${footerText}`, 0, 0));
6536
6915
  this.invalidate();
6537
6916
  this.ui.requestRender();
6538
6917
  }
6539
6918
  };
6540
6919
  function formatToolCallLine(tc, _maxWidth) {
6541
- const icon = tc.done ? tc.isError ? chunk7K5VFY2N_cjs.theme.fg("error", "\u2717") : chunk7K5VFY2N_cjs.theme.fg("success", "\u2713") : chunk7K5VFY2N_cjs.theme.fg("muted", "\u22EF");
6542
- const name = chunk7K5VFY2N_cjs.theme.fg("toolTitle", tc.name);
6920
+ const icon = tc.done ? tc.isError ? chunkK4WJUBEC_cjs.theme.fg("error", "\u2717") : chunkK4WJUBEC_cjs.theme.fg("success", "\u2713") : chunkK4WJUBEC_cjs.theme.fg("muted", "\u22EF");
6921
+ const name = chunkK4WJUBEC_cjs.theme.fg("toolTitle", tc.name);
6543
6922
  const argsSummary = summarizeArgs(tc.args);
6544
6923
  return `${icon} ${name} ${argsSummary}`;
6545
6924
  }
@@ -6559,16 +6938,16 @@ function summarizeArgs(args) {
6559
6938
  const content = t.content || t.activeForm || "task";
6560
6939
  return `${icon} ${content}`;
6561
6940
  });
6562
- return chunk7K5VFY2N_cjs.theme.fg("muted", taskSummaries.join(", "));
6941
+ return chunkK4WJUBEC_cjs.theme.fg("muted", taskSummaries.join(", "));
6563
6942
  }
6564
6943
  for (const [_key, val] of Object.entries(obj)) {
6565
6944
  if (typeof val === "string") {
6566
6945
  const short = val.length > 40 ? val.slice(0, 40) + "\u2026" : val;
6567
- parts.push(chunk7K5VFY2N_cjs.theme.fg("muted", short));
6946
+ parts.push(chunkK4WJUBEC_cjs.theme.fg("muted", short));
6568
6947
  } else if (Array.isArray(val)) {
6569
- parts.push(chunk7K5VFY2N_cjs.theme.fg("muted", `${val.length} items`));
6948
+ parts.push(chunkK4WJUBEC_cjs.theme.fg("muted", `${val.length} items`));
6570
6949
  } else if (typeof val === "object" && val !== null) {
6571
- parts.push(chunk7K5VFY2N_cjs.theme.fg("muted", "{...}"));
6950
+ parts.push(chunkK4WJUBEC_cjs.theme.fg("muted", "{...}"));
6572
6951
  }
6573
6952
  }
6574
6953
  return parts.join(" ");
@@ -6629,7 +7008,7 @@ var ToolApprovalDialogComponent = class extends piTui.Box {
6629
7008
  this._focused = value;
6630
7009
  }
6631
7010
  constructor(options) {
6632
- super(2, 1, (text) => chunk7K5VFY2N_cjs.bg("overlayBg", text));
7011
+ super(2, 1, (text) => chunkK4WJUBEC_cjs.theme.bg("overlayBg", text));
6633
7012
  this.toolName = options.toolName;
6634
7013
  this.args = options.args;
6635
7014
  this.categoryLabel = options.categoryLabel;
@@ -6637,28 +7016,28 @@ var ToolApprovalDialogComponent = class extends piTui.Box {
6637
7016
  this.buildUI();
6638
7017
  }
6639
7018
  buildUI() {
6640
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("warning", "\u26A0 Tool Approval Required"), 0, 0));
7019
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("warning", "\u26A0 Tool Approval Required"), 0, 0));
6641
7020
  this.addChild(new piTui.Spacer(1));
6642
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("accent", `Tool: `) + chunk7K5VFY2N_cjs.fg("text", this.toolName), 0, 0));
7021
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("accent", `Tool: `) + chunkK4WJUBEC_cjs.theme.fg("text", this.toolName), 0, 0));
6643
7022
  if (this.categoryLabel) {
6644
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("accent", `Category: `) + chunk7K5VFY2N_cjs.fg("text", this.categoryLabel), 0, 0));
7023
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("accent", `Category: `) + chunkK4WJUBEC_cjs.theme.fg("text", this.categoryLabel), 0, 0));
6645
7024
  }
6646
7025
  this.addChild(new piTui.Spacer(1));
6647
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("muted", "Arguments:"), 0, 0));
7026
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("muted", "Arguments:"), 0, 0));
6648
7027
  const argsText = this.formatArgs(this.args);
6649
7028
  for (const line of argsText.split("\n").slice(0, 10)) {
6650
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("text", " " + line), 0, 0));
7029
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("text", " " + line), 0, 0));
6651
7030
  }
6652
7031
  if (argsText.split("\n").length > 10) {
6653
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("muted", " ... (truncated)"), 0, 0));
7032
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("muted", " ... (truncated)"), 0, 0));
6654
7033
  }
6655
7034
  this.addChild(new piTui.Spacer(1));
6656
7035
  const categoryHint = this.categoryLabel ? `lways allow ${this.categoryLabel.toLowerCase()}` : "lways allow category";
6657
- const dim = chalk10__default.default.hex("#555");
6658
- const key = chalk10__default.default.white.bold;
7036
+ const dimColor = chalk10__default.default.hex(chunkK4WJUBEC_cjs.theme.getTheme().dim);
7037
+ const key = chalk10__default.default.hex(chunkK4WJUBEC_cjs.theme.getTheme().text).bold;
6659
7038
  this.addChild(
6660
7039
  new piTui.Text(
6661
- chunk7K5VFY2N_cjs.fg("accent", "Allow? ") + key("y") + dim("es ") + key("n") + dim("o ") + key("a") + dim(categoryHint + " ") + key("Y") + dim("olo"),
7040
+ chunkK4WJUBEC_cjs.theme.fg("accent", "Allow? ") + key("y") + dimColor("es ") + key("n") + dimColor("o ") + key("a") + dimColor(categoryHint + " ") + key("Y") + dimColor("olo"),
6662
7041
  0,
6663
7042
  0
6664
7043
  )
@@ -6793,7 +7172,7 @@ function handleToolStart(ctx, toolCallId, toolName, args) {
6793
7172
  ctx.addChildBeforeFollowUps(component2);
6794
7173
  state.pendingTools.set(toolCallId, component2);
6795
7174
  state.allToolComponents.push(component2);
6796
- state.streamingComponent = new AssistantMessageComponent(void 0, state.hideThinkingBlock, chunk7K5VFY2N_cjs.getMarkdownTheme());
7175
+ state.streamingComponent = new AssistantMessageComponent(void 0, state.hideThinkingBlock, chunkK4WJUBEC_cjs.getMarkdownTheme());
6797
7176
  ctx.addChildBeforeFollowUps(state.streamingComponent);
6798
7177
  state.ui.requestRender();
6799
7178
  }
@@ -6834,7 +7213,7 @@ function handleToolInputStart(ctx, toolCallId, toolName) {
6834
7213
  }
6835
7214
  if (toolName === "task_write") {
6836
7215
  state.taskWriteInsertIndex = state.chatContainer.children.length;
6837
- state.streamingComponent = new AssistantMessageComponent(void 0, state.hideThinkingBlock, chunk7K5VFY2N_cjs.getMarkdownTheme());
7216
+ state.streamingComponent = new AssistantMessageComponent(void 0, state.hideThinkingBlock, chunkK4WJUBEC_cjs.getMarkdownTheme());
6838
7217
  ctx.addChildBeforeFollowUps(state.streamingComponent);
6839
7218
  state.ui.requestRender();
6840
7219
  } else if (toolName !== "subagent") {
@@ -6849,7 +7228,7 @@ function handleToolInputStart(ctx, toolCallId, toolName) {
6849
7228
  ctx.addChildBeforeFollowUps(component);
6850
7229
  state.pendingTools.set(toolCallId, component);
6851
7230
  state.allToolComponents.push(component);
6852
- state.streamingComponent = new AssistantMessageComponent(void 0, state.hideThinkingBlock, chunk7K5VFY2N_cjs.getMarkdownTheme());
7231
+ state.streamingComponent = new AssistantMessageComponent(void 0, state.hideThinkingBlock, chunkK4WJUBEC_cjs.getMarkdownTheme());
6853
7232
  ctx.addChildBeforeFollowUps(state.streamingComponent);
6854
7233
  state.ui.requestRender();
6855
7234
  }
@@ -6976,6 +7355,10 @@ async function dispatchEvent(event, ectx, state) {
6976
7355
  ectx.showInfo(`Switched to thread: ${event.threadId}`);
6977
7356
  await ectx.renderExistingMessages();
6978
7357
  await state.harness.loadOMProgress();
7358
+ const freshBranch = chunkS5ZLN7DR_cjs.getCurrentGitBranch(state.projectInfo.rootPath);
7359
+ if (freshBranch) {
7360
+ state.projectInfo.gitBranch = freshBranch;
7361
+ }
6979
7362
  const threadState = state.harness.getState();
6980
7363
  if (state.taskProgress) {
6981
7364
  state.taskProgress.updateTasks(threadState.tasks ?? []);
@@ -7116,25 +7499,25 @@ async function dispatchEvent(event, ectx, state) {
7116
7499
  var SystemReminderComponent = class extends piTui.Container {
7117
7500
  constructor(options) {
7118
7501
  super();
7119
- const title = chunk7K5VFY2N_cjs.theme.fg("warning", "\u26A1 System Notice");
7502
+ const title = chunkK4WJUBEC_cjs.theme.fg("warning", "\u26A1 System Notice");
7120
7503
  const content = `${title}
7121
7504
  ${options.message.trim()}`;
7122
7505
  this.addChild(
7123
- new piTui.Markdown(content, 1, 1, chunk7K5VFY2N_cjs.getMarkdownTheme(), {
7124
- bgColor: (text) => chunk7K5VFY2N_cjs.theme.bg("systemReminderBg", text),
7125
- color: (text) => chunk7K5VFY2N_cjs.theme.fg("muted", text)
7506
+ new piTui.Markdown(content, 1, 1, chunkK4WJUBEC_cjs.getMarkdownTheme(), {
7507
+ bgColor: (text) => chunkK4WJUBEC_cjs.theme.bg("systemReminderBg", text),
7508
+ color: (text) => chunkK4WJUBEC_cjs.theme.fg("muted", text)
7126
7509
  })
7127
7510
  );
7128
7511
  }
7129
7512
  };
7130
7513
  var UserMessageComponent = class extends piTui.Container {
7131
- constructor(text, markdownTheme = chunk7K5VFY2N_cjs.getMarkdownTheme()) {
7514
+ constructor(text, markdownTheme = chunkK4WJUBEC_cjs.getMarkdownTheme()) {
7132
7515
  super();
7133
7516
  this.addChild(new piTui.Spacer(1));
7134
7517
  this.addChild(
7135
7518
  new piTui.Markdown(text, 1, 1, markdownTheme, {
7136
- bgColor: (text2) => chunk7K5VFY2N_cjs.theme.bg("userMessageBg", text2),
7137
- color: (text2) => chunk7K5VFY2N_cjs.theme.fg("userMessageText", text2)
7519
+ bgColor: (text2) => chunkK4WJUBEC_cjs.theme.bg("userMessageBg", text2),
7520
+ color: (text2) => chunkK4WJUBEC_cjs.theme.fg("userMessageText", text2)
7138
7521
  })
7139
7522
  );
7140
7523
  }
@@ -7142,7 +7525,7 @@ var UserMessageComponent = class extends piTui.Container {
7142
7525
 
7143
7526
  // src/tui/render-messages.ts
7144
7527
  function renderCompletedTasksInline(state, tasks, insertIndex = -1, collapsed = false) {
7145
- const headerText = chunk7K5VFY2N_cjs.bold(chunk7K5VFY2N_cjs.fg("accent", "Tasks")) + chunk7K5VFY2N_cjs.fg("dim", ` [${tasks.length}/${tasks.length} completed]`);
7528
+ const headerText = chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", "Tasks")) + chunkK4WJUBEC_cjs.theme.fg("dim", ` [${tasks.length}/${tasks.length} completed]`);
7146
7529
  const container = new piTui.Container();
7147
7530
  container.addChild(new piTui.Spacer(1));
7148
7531
  container.addChild(new piTui.Text(headerText, 0, 0));
@@ -7151,13 +7534,17 @@ function renderCompletedTasksInline(state, tasks, insertIndex = -1, collapsed =
7151
7534
  const visible = shouldCollapse ? tasks.slice(0, MAX_VISIBLE) : tasks;
7152
7535
  const remaining = shouldCollapse ? tasks.length - MAX_VISIBLE : 0;
7153
7536
  for (const task of visible) {
7154
- const icon = chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.green)("\u2713");
7155
- const text = chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.green)(task.content);
7537
+ const icon = chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.green)("\u2713");
7538
+ const text = chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.green)(task.content);
7156
7539
  container.addChild(new piTui.Text(` ${icon} ${text}`, 0, 0));
7157
7540
  }
7158
7541
  if (remaining > 0) {
7159
7542
  container.addChild(
7160
- new piTui.Text(chunk7K5VFY2N_cjs.fg("dim", ` ... ${remaining} more completed task${remaining > 1 ? "s" : ""} (ctrl+e to expand)`), 0, 0)
7543
+ new piTui.Text(
7544
+ chunkK4WJUBEC_cjs.theme.fg("dim", ` ... ${remaining} more completed task${remaining > 1 ? "s" : ""} (ctrl+e to expand)`),
7545
+ 0,
7546
+ 0
7547
+ )
7161
7548
  );
7162
7549
  }
7163
7550
  if (insertIndex >= 0) {
@@ -7172,10 +7559,10 @@ function renderClearedTasksInline(state, clearedTasks, insertIndex = -1) {
7172
7559
  container.addChild(new piTui.Spacer(1));
7173
7560
  const count = clearedTasks.length;
7174
7561
  const label = count === 1 ? "Task" : "Tasks";
7175
- container.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("accent", `${label} cleared`), 0, 0));
7562
+ container.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("accent", `${label} cleared`), 0, 0));
7176
7563
  for (const task of clearedTasks) {
7177
- const icon = task.status === "completed" ? chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.green)("\u2713") : chalk10__default.default.hex(chunk7K5VFY2N_cjs.mastra.darkGray)("\u25CB");
7178
- const text = chalk10__default.default.dim.strikethrough(task.content);
7564
+ const icon = task.status === "completed" ? chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.green)("\u2713") : chalk10__default.default.hex(chunkK4WJUBEC_cjs.mastra.darkGray)("\u25CB");
7565
+ const text = chalk10__default.default.hex(chunkK4WJUBEC_cjs.theme.getTheme().dim).strikethrough(task.content);
7179
7566
  container.addChild(new piTui.Text(` ${icon} ${text}`, 0, 0));
7180
7567
  }
7181
7568
  if (insertIndex >= 0) {
@@ -7243,7 +7630,7 @@ async function renderExistingMessages(state) {
7243
7630
  const textComponent = new AssistantMessageComponent(
7244
7631
  textMessage,
7245
7632
  state.hideThinkingBlock,
7246
- chunk7K5VFY2N_cjs.getMarkdownTheme()
7633
+ chunkK4WJUBEC_cjs.getMarkdownTheme()
7247
7634
  );
7248
7635
  state.chatContainer.addChild(textComponent);
7249
7636
  accumulatedContent = [];
@@ -7253,7 +7640,7 @@ async function renderExistingMessages(state) {
7253
7640
  const subArgs = content.args;
7254
7641
  const rawResult = toolResult?.type === "tool_result" ? formatToolResult(toolResult.result) : void 0;
7255
7642
  const isErr = toolResult?.type === "tool_result" && toolResult.isError;
7256
- const meta = rawResult ? chunk7K5VFY2N_cjs.parseSubagentMeta(rawResult) : null;
7643
+ const meta = rawResult ? chunkK4WJUBEC_cjs.parseSubagentMeta(rawResult) : null;
7257
7644
  const resultText = meta?.text ?? rawResult;
7258
7645
  const modelId = meta?.modelId ?? subArgs?.modelId;
7259
7646
  const durationMs = meta?.durationMs ?? 0;
@@ -7353,7 +7740,7 @@ async function renderExistingMessages(state) {
7353
7740
  const textComponent = new AssistantMessageComponent(
7354
7741
  textMessage,
7355
7742
  state.hideThinkingBlock,
7356
- chunk7K5VFY2N_cjs.getMarkdownTheme()
7743
+ chunkK4WJUBEC_cjs.getMarkdownTheme()
7357
7744
  );
7358
7745
  state.chatContainer.addChild(textComponent);
7359
7746
  accumulatedContent = [];
@@ -7381,7 +7768,7 @@ async function renderExistingMessages(state) {
7381
7768
  ...message,
7382
7769
  content: accumulatedContent
7383
7770
  };
7384
- const textComponent = new AssistantMessageComponent(textMessage, state.hideThinkingBlock, chunk7K5VFY2N_cjs.getMarkdownTheme());
7771
+ const textComponent = new AssistantMessageComponent(textMessage, state.hideThinkingBlock, chunkK4WJUBEC_cjs.getMarkdownTheme());
7385
7772
  state.chatContainer.addChild(textComponent);
7386
7773
  }
7387
7774
  }
@@ -7537,15 +7924,15 @@ function colorLine(line) {
7537
7924
  function renderBanner(version, appName) {
7538
7925
  const name = appName;
7539
7926
  if (name !== "Mastra Code") {
7540
- return chunk7K5VFY2N_cjs.fg("accent", "\u25C6") + " " + chunk7K5VFY2N_cjs.bold(chunk7K5VFY2N_cjs.fg("accent", name)) + chunk7K5VFY2N_cjs.fg("dim", ` v${version}`);
7927
+ return chunkK4WJUBEC_cjs.theme.fg("accent", "\u25C6") + " " + chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", name)) + chunkK4WJUBEC_cjs.theme.fg("dim", ` v${version}`);
7541
7928
  }
7542
7929
  const cols = process.stdout.columns || 80;
7543
7930
  if (cols < 30) {
7544
- return chunk7K5VFY2N_cjs.fg("accent", "\u25C6") + " " + chunk7K5VFY2N_cjs.bold(chunk7K5VFY2N_cjs.fg("accent", "Mastra Code")) + chunk7K5VFY2N_cjs.fg("dim", ` v${version}`);
7931
+ return chunkK4WJUBEC_cjs.theme.fg("accent", "\u25C6") + " " + chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", "Mastra Code")) + chunkK4WJUBEC_cjs.theme.fg("dim", ` v${version}`);
7545
7932
  }
7546
7933
  const art = cols >= 50 ? FULL_ART : SHORT_ART;
7547
7934
  const coloredLines = art.map((line) => colorLine(line));
7548
- coloredLines.push(chunk7K5VFY2N_cjs.fg("dim", `v${version}`));
7935
+ coloredLines.push(chunkK4WJUBEC_cjs.theme.fg("dim", `v${version}`));
7549
7936
  return coloredLines.join("\n");
7550
7937
  }
7551
7938
  var TaskProgressComponent = class extends piTui.Container {
@@ -7572,7 +7959,7 @@ var TaskProgressComponent = class extends piTui.Container {
7572
7959
  const completed = this.tasks.filter((t) => t.status === "completed").length;
7573
7960
  const total = this.tasks.length;
7574
7961
  if (completed === total) return;
7575
- const headerText = " " + chunk7K5VFY2N_cjs.bold(chunk7K5VFY2N_cjs.fg("accent", "Tasks")) + chunk7K5VFY2N_cjs.fg("dim", ` [${completed}/${total} completed]`);
7962
+ const headerText = " " + chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("accent", "Tasks")) + chunkK4WJUBEC_cjs.theme.fg("dim", ` [${completed}/${total} completed]`);
7576
7963
  this.addChild(new piTui.Spacer(1));
7577
7964
  this.addChild(new piTui.Text(headerText, 0, 0));
7578
7965
  for (const task of this.tasks) {
@@ -7583,18 +7970,18 @@ var TaskProgressComponent = class extends piTui.Container {
7583
7970
  const indent = " ";
7584
7971
  switch (task.status) {
7585
7972
  case "completed": {
7586
- const icon = chalk10__default.default.green("\u2713");
7587
- const text = chalk10__default.default.green.strikethrough(task.content);
7973
+ const icon = chunkK4WJUBEC_cjs.theme.fg("success", "\u2713");
7974
+ const text = chalk10__default.default.hex(chunkK4WJUBEC_cjs.theme.getTheme().success).strikethrough(task.content);
7588
7975
  return `${indent}${icon} ${text}`;
7589
7976
  }
7590
7977
  case "in_progress": {
7591
- const icon = chalk10__default.default.yellow("\u25B6");
7592
- const text = chalk10__default.default.yellow.bold(task.activeForm);
7978
+ const icon = chunkK4WJUBEC_cjs.theme.fg("warning", "\u25B6");
7979
+ const text = chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("warning", task.activeForm));
7593
7980
  return `${indent}${icon} ${text}`;
7594
7981
  }
7595
7982
  case "pending": {
7596
- const icon = chalk10__default.default.dim("\u25CB");
7597
- const text = chalk10__default.default.dim(task.content);
7983
+ const icon = chunkK4WJUBEC_cjs.theme.fg("dim", "\u25CB");
7984
+ const text = chunkK4WJUBEC_cjs.theme.fg("dim", task.content);
7598
7985
  return `${indent}${icon} ${text}`;
7599
7986
  }
7600
7987
  }
@@ -7701,14 +8088,14 @@ function buildLayout(state, refreshModelAuthStatus) {
7701
8088
  `Resource ID: ${state.projectInfo.resourceId}`,
7702
8089
  state.projectInfo.gitBranch ? `Branch: ${state.projectInfo.gitBranch}` : null,
7703
8090
  state.projectInfo.isWorktree ? `Worktree of: ${state.projectInfo.mainRepoPath}` : null,
7704
- `User: ${chunkC6XKRHRK_cjs.getUserId(state.projectInfo.rootPath)}`
7705
- ].filter(Boolean).map((line) => chunk7K5VFY2N_cjs.fg("muted", line)).join("\n");
7706
- const sep = chunk7K5VFY2N_cjs.fg("dim", " \xB7 ");
8091
+ `User: ${chunkS5ZLN7DR_cjs.getUserId(state.projectInfo.rootPath)}`
8092
+ ].filter(Boolean).map((line) => chunkK4WJUBEC_cjs.theme.fg("muted", line)).join("\n");
8093
+ const sep = chunkK4WJUBEC_cjs.theme.fg("dim", " \xB7 ");
7707
8094
  const hintParts = [];
7708
8095
  if (state.harness.listModes().length > 1) {
7709
- hintParts.push(`${chunk7K5VFY2N_cjs.fg("accent", "\u21E7+Tab")} ${chunk7K5VFY2N_cjs.fg("muted", "cycle modes")}`);
8096
+ hintParts.push(`${chunkK4WJUBEC_cjs.theme.fg("accent", "\u21E7+Tab")} ${chunkK4WJUBEC_cjs.theme.fg("muted", "cycle modes")}`);
7710
8097
  }
7711
- hintParts.push(`${chunk7K5VFY2N_cjs.fg("accent", "/help")} ${chunk7K5VFY2N_cjs.fg("muted", "info & shortcuts")}`);
8098
+ hintParts.push(`${chunkK4WJUBEC_cjs.theme.fg("accent", "/help")} ${chunkK4WJUBEC_cjs.theme.fg("muted", "info & shortcuts")}`);
7712
8099
  const instructions = ` ${hintParts.join(sep)}`;
7713
8100
  state.ui.addChild(new piTui.Spacer(1));
7714
8101
  state.ui.addChild(new piTui.Text(banner, 1, 0));
@@ -7730,6 +8117,17 @@ function buildLayout(state, refreshModelAuthStatus) {
7730
8117
  refreshModelAuthStatus();
7731
8118
  state.ui.setFocus(state.editor);
7732
8119
  }
8120
+ function detectFdPath() {
8121
+ const whichCmd = process.platform === "win32" ? "where" : "which";
8122
+ for (const bin of ["fd", "fdfind"]) {
8123
+ try {
8124
+ const resolved = child_process.execFileSync(whichCmd, [bin], { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }).trim().split(/\r?\n/)[0];
8125
+ if (resolved) return resolved;
8126
+ } catch {
8127
+ }
8128
+ }
8129
+ return null;
8130
+ }
7733
8131
  function setupAutocomplete(state) {
7734
8132
  const slashCommands = [
7735
8133
  { name: "new", description: "Start a new thread" },
@@ -7738,7 +8136,7 @@ function setupAutocomplete(state) {
7738
8136
  { name: "models:pack", description: "Switch model pack" },
7739
8137
  { name: "subagents", description: "Configure subagent model defaults" },
7740
8138
  { name: "om", description: "Configure Observational Memory models" },
7741
- { name: "think", description: "Set thinking level (Anthropic)" },
8139
+ { name: "think", description: "Set thinking (off|low|medium|high|xhigh|status)" },
7742
8140
  { name: "login", description: "Login with OAuth provider" },
7743
8141
  { name: "skills", description: "List available skills" },
7744
8142
  { name: "cost", description: "Show token usage and estimated costs" },
@@ -7773,6 +8171,7 @@ function setupAutocomplete(state) {
7773
8171
  },
7774
8172
  { name: "review", description: "Review a GitHub pull request" },
7775
8173
  { name: "setup", description: "Re-run the setup wizard" },
8174
+ { name: "theme", description: "Switch color theme (auto/dark/light)" },
7776
8175
  { name: "exit", description: "Exit the TUI" },
7777
8176
  { name: "help", description: "Show available commands" }
7778
8177
  ];
@@ -7786,7 +8185,8 @@ function setupAutocomplete(state) {
7786
8185
  description: customCmd.description || `Custom: ${customCmd.name}`
7787
8186
  });
7788
8187
  }
7789
- state.autocompleteProvider = new piTui.CombinedAutocompleteProvider(slashCommands, process.cwd());
8188
+ const fdPath = detectFdPath();
8189
+ state.autocompleteProvider = new piTui.CombinedAutocompleteProvider(slashCommands, process.cwd(), fdPath);
7790
8190
  state.editor.setAutocompleteProvider(state.autocompleteProvider);
7791
8191
  }
7792
8192
  async function loadCustomSlashCommands(state) {
@@ -7860,7 +8260,7 @@ async function promptForThreadSelection(state) {
7860
8260
  await state.harness.setThreadSetting({ key: "projectPath", value: currentPath });
7861
8261
  }
7862
8262
  } catch (error) {
7863
- if (error instanceof chunk7K5VFY2N_cjs.ThreadLockError) {
8263
+ if (error instanceof chunkK4WJUBEC_cjs.ThreadLockError) {
7864
8264
  state.pendingNewThread = true;
7865
8265
  state.pendingLockConflict = {
7866
8266
  threadTitle: mostRecent.title || mostRecent.id,
@@ -7888,16 +8288,22 @@ var ShellOutputComponent = class extends piTui.Container {
7888
8288
  this.addChild(new piTui.Spacer(1));
7889
8289
  const statusIcon = exitCode === 0 ? "\u2713" : "\u2717";
7890
8290
  const statusColor = exitCode === 0 ? "success" : "error";
7891
- this.addChild(new piTui.Text(`${chunk7K5VFY2N_cjs.fg(statusColor, statusIcon)} ${chunk7K5VFY2N_cjs.bold(chunk7K5VFY2N_cjs.fg("muted", "$"))} ${chunk7K5VFY2N_cjs.fg("text", command)}`, 1, 0));
8291
+ this.addChild(
8292
+ new piTui.Text(
8293
+ `${chunkK4WJUBEC_cjs.theme.fg(statusColor, statusIcon)} ${chunkK4WJUBEC_cjs.theme.bold(chunkK4WJUBEC_cjs.theme.fg("muted", "$"))} ${chunkK4WJUBEC_cjs.theme.fg("text", command)}`,
8294
+ 1,
8295
+ 0
8296
+ )
8297
+ );
7892
8298
  const output = (stdout + (stderr ? (stdout ? "\n" : "") + stderr : "")).trimEnd();
7893
8299
  if (output) {
7894
8300
  const lines = output.split("\n");
7895
8301
  for (const line of lines) {
7896
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("toolOutput", ` ${line}`), 0, 0));
8302
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("toolOutput", ` ${line}`), 0, 0));
7897
8303
  }
7898
8304
  }
7899
8305
  if (exitCode !== 0) {
7900
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("error", ` Exit code: ${exitCode}`), 0, 0));
8306
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("error", ` Exit code: ${exitCode}`), 0, 0));
7901
8307
  }
7902
8308
  }
7903
8309
  };
@@ -8166,7 +8572,7 @@ function createTUIState(options) {
8166
8572
  const chatContainer = new piTui.Container();
8167
8573
  const editorContainer = new piTui.Container();
8168
8574
  const footer = new piTui.Container();
8169
- const editor = new CustomEditor(ui, chunk7K5VFY2N_cjs.getEditorTheme());
8575
+ const editor = new CustomEditor(ui, chunkK4WJUBEC_cjs.getEditorTheme());
8170
8576
  return {
8171
8577
  // Core dependencies
8172
8578
  harness: options.harness,
@@ -8202,7 +8608,7 @@ function createTUIState(options) {
8202
8608
  pendingSlashCommands: [],
8203
8609
  pendingApprovalDismiss: null,
8204
8610
  // Status line
8205
- projectInfo: chunkC6XKRHRK_cjs.detectProject(process.cwd()),
8611
+ projectInfo: chunkS5ZLN7DR_cjs.detectProject(process.cwd()),
8206
8612
  modelAuthStatus: { hasAuth: true },
8207
8613
  // Input
8208
8614
  customSlashCommands: [],
@@ -8286,6 +8692,10 @@ var MastraTUI = class _MastraTUI {
8286
8692
  showInfo(this.state, "No model selected. Use /models to select a model, or /login to authenticate.");
8287
8693
  continue;
8288
8694
  }
8695
+ const allowed = await this.runUserPromptHook(userInput);
8696
+ if (!allowed) {
8697
+ continue;
8698
+ }
8289
8699
  const images = this.state.pendingImages.length > 0 ? [...this.state.pendingImages] : void 0;
8290
8700
  this.state.pendingImages = [];
8291
8701
  addUserMessage(this.state, {
@@ -8360,6 +8770,7 @@ var MastraTUI = class _MastraTUI {
8360
8770
  updateTerminalTitle(this.state);
8361
8771
  await renderExistingMessages(this.state);
8362
8772
  await renderExistingTasks(this.state);
8773
+ await this.checkClaudeMaxOAuthWarning();
8363
8774
  if (this.state.pendingLockConflict) {
8364
8775
  this.showThreadLockPrompt(this.state.pendingLockConflict.threadTitle, this.state.pendingLockConflict.ownerPid);
8365
8776
  this.state.pendingLockConflict = null;
@@ -8384,6 +8795,44 @@ var MastraTUI = class _MastraTUI {
8384
8795
  }
8385
8796
  async handleEvent(event) {
8386
8797
  await dispatchEvent(event, this.getEventContext(), this.state);
8798
+ if (event.type === "agent_end") {
8799
+ const stopReason = event.reason === "aborted" ? "aborted" : event.reason === "error" ? "error" : "complete";
8800
+ await this.runStopHook(stopReason);
8801
+ }
8802
+ }
8803
+ showHookWarnings(event, warnings) {
8804
+ for (const warning of warnings) {
8805
+ showInfo(this.state, `[${event}] ${warning}`);
8806
+ }
8807
+ }
8808
+ async runStopHook(stopReason) {
8809
+ const hookMgr = this.state.hookManager;
8810
+ if (!hookMgr) return;
8811
+ try {
8812
+ const result = await hookMgr.runStop(void 0, stopReason);
8813
+ this.showHookWarnings("Stop", result.warnings);
8814
+ if (!result.allowed && result.blockReason) {
8815
+ showError(this.state, `Stop hook blocked: ${result.blockReason}`);
8816
+ }
8817
+ } catch (error) {
8818
+ showError(this.state, `Stop hook failed: ${error instanceof Error ? error.message : String(error)}`);
8819
+ }
8820
+ }
8821
+ async runUserPromptHook(userInput) {
8822
+ const hookMgr = this.state.hookManager;
8823
+ if (!hookMgr) return true;
8824
+ try {
8825
+ const result = await hookMgr.runUserPromptSubmit(userInput);
8826
+ this.showHookWarnings("UserPromptSubmit", result.warnings);
8827
+ if (!result.allowed) {
8828
+ showError(this.state, result.blockReason || "Blocked by UserPromptSubmit hook");
8829
+ return false;
8830
+ }
8831
+ return true;
8832
+ } catch (error) {
8833
+ showError(this.state, `UserPromptSubmit hook failed: ${error instanceof Error ? error.message : String(error)}`);
8834
+ return false;
8835
+ }
8387
8836
  }
8388
8837
  // ===========================================================================
8389
8838
  /**
@@ -8452,6 +8901,26 @@ var MastraTUI = class _MastraTUI {
8452
8901
  this.state.ui.requestRender();
8453
8902
  this.state.chatContainer.invalidate();
8454
8903
  }
8904
+ /**
8905
+ * One-time startup check: if the user has Anthropic OAuth credentials and
8906
+ * hasn't yet acknowledged the Claude Max ToS warning, show it now.
8907
+ */
8908
+ async checkClaudeMaxOAuthWarning() {
8909
+ const authStorage = this.state.authStorage;
8910
+ if (!authStorage || !authStorage.isLoggedIn(ANTHROPIC_OAUTH_PROVIDER_ID)) return;
8911
+ const settings = chunkK4WJUBEC_cjs.loadSettings();
8912
+ if (settings.onboarding.claudeMaxOAuthWarningAcknowledgedAt) return;
8913
+ const result = await showClaudeMaxOAuthWarning(this.state, "startup");
8914
+ if (result === "continue") {
8915
+ settings.onboarding.claudeMaxOAuthWarningAcknowledgedAt = (/* @__PURE__ */ new Date()).toISOString();
8916
+ chunkK4WJUBEC_cjs.saveSettings(settings);
8917
+ } else if (result === "remove") {
8918
+ authStorage.logout(ANTHROPIC_OAUTH_PROVIDER_ID);
8919
+ settings.onboarding.claudeMaxOAuthWarningAcknowledgedAt = (/* @__PURE__ */ new Date()).toISOString();
8920
+ chunkK4WJUBEC_cjs.saveSettings(settings);
8921
+ await this.refreshModelAuthStatus();
8922
+ }
8923
+ }
8455
8924
  /**
8456
8925
  * Get the workspace, preferring harness-owned workspace over the direct option.
8457
8926
  */
@@ -8510,7 +8979,7 @@ var MastraTUI = class _MastraTUI {
8510
8979
  // Login (used by onboarding)
8511
8980
  // ===========================================================================
8512
8981
  async performLogin(providerId) {
8513
- const provider = chunkC6XKRHRK_cjs.getOAuthProviders().find((p) => p.id === providerId);
8982
+ const provider = chunkS5ZLN7DR_cjs.getOAuthProviders().find((p) => p.id === providerId);
8514
8983
  const providerName = provider?.name || providerId;
8515
8984
  if (!this.state.authStorage) {
8516
8985
  showError(this.state, "Auth storage not configured");
@@ -8545,7 +9014,7 @@ var MastraTUI = class _MastraTUI {
8545
9014
  signal: dialog.signal
8546
9015
  }).then(async () => {
8547
9016
  this.state.ui.hideOverlay();
8548
- const { PROVIDER_DEFAULT_MODELS: PROVIDER_DEFAULT_MODELS2 } = await import('./storage-JFFX7LJJ.cjs');
9017
+ const { PROVIDER_DEFAULT_MODELS: PROVIDER_DEFAULT_MODELS2 } = await import('./storage-PO4VN5NF.cjs');
8549
9018
  const defaultModel = PROVIDER_DEFAULT_MODELS2[providerId];
8550
9019
  if (defaultModel) {
8551
9020
  await this.state.harness.switchModel({ modelId: defaultModel });
@@ -8567,7 +9036,7 @@ var MastraTUI = class _MastraTUI {
8567
9036
  // Onboarding
8568
9037
  // ===========================================================================
8569
9038
  async showOnboarding() {
8570
- const allProviders = chunkC6XKRHRK_cjs.getOAuthProviders();
9039
+ const allProviders = chunkS5ZLN7DR_cjs.getOAuthProviders();
8571
9040
  const authProviders = allProviders.map((p) => ({
8572
9041
  label: p.name,
8573
9042
  value: p.id,
@@ -8590,9 +9059,10 @@ var MastraTUI = class _MastraTUI {
8590
9059
  };
8591
9060
  };
8592
9061
  const access = await buildAccess();
8593
- const savedSettings = chunk7K5VFY2N_cjs.loadSettings();
8594
- const modePacks = chunk7K5VFY2N_cjs.getAvailableModePacks(access, savedSettings.customModelPacks);
8595
- const omPacks = chunk7K5VFY2N_cjs.getAvailableOmPacks(access);
9062
+ const hasProviderAccess = Object.values(access).some(Boolean);
9063
+ const savedSettings = chunkK4WJUBEC_cjs.loadSettings();
9064
+ const modePacks = chunkK4WJUBEC_cjs.getAvailableModePacks(access, savedSettings.customModelPacks);
9065
+ const omPacks = chunkK4WJUBEC_cjs.getAvailableOmPacks(access);
8596
9066
  let prevModePackId = savedSettings.onboarding.modePackId;
8597
9067
  if (prevModePackId === "custom" && savedSettings.models.activeModelPackId?.startsWith("custom:")) {
8598
9068
  prevModePackId = savedSettings.models.activeModelPackId;
@@ -8608,6 +9078,7 @@ var MastraTUI = class _MastraTUI {
8608
9078
  authProviders,
8609
9079
  modePacks,
8610
9080
  omPacks,
9081
+ hasProviderAccess,
8611
9082
  previous,
8612
9083
  onComplete: async (result) => {
8613
9084
  this.state.activeOnboarding = void 0;
@@ -8616,20 +9087,32 @@ var MastraTUI = class _MastraTUI {
8616
9087
  },
8617
9088
  onCancel: () => {
8618
9089
  this.state.activeOnboarding = void 0;
8619
- const settings = chunk7K5VFY2N_cjs.loadSettings();
9090
+ const settings = chunkK4WJUBEC_cjs.loadSettings();
8620
9091
  if (!settings.onboarding.completedAt) {
8621
9092
  settings.onboarding.skippedAt = (/* @__PURE__ */ new Date()).toISOString();
8622
- settings.onboarding.version = chunk7K5VFY2N_cjs.ONBOARDING_VERSION;
8623
- chunk7K5VFY2N_cjs.saveSettings(settings);
9093
+ settings.onboarding.version = chunkK4WJUBEC_cjs.ONBOARDING_VERSION;
9094
+ chunkK4WJUBEC_cjs.saveSettings(settings);
8624
9095
  }
8625
9096
  resolve2();
8626
9097
  },
8627
9098
  onLogin: (providerId, done) => {
9099
+ if (providerId === ANTHROPIC_OAUTH_PROVIDER_ID) {
9100
+ const s = chunkK4WJUBEC_cjs.loadSettings();
9101
+ s.onboarding.claudeMaxOAuthWarningAcknowledgedAt = (/* @__PURE__ */ new Date()).toISOString();
9102
+ chunkK4WJUBEC_cjs.saveSettings(s);
9103
+ }
8628
9104
  this.performLogin(providerId).then(async () => {
8629
- const updatedAccess = await buildAccess();
8630
- component.updateModePacks(chunk7K5VFY2N_cjs.getAvailableModePacks(updatedAccess, savedSettings.customModelPacks));
8631
- component.updateOmPacks(chunk7K5VFY2N_cjs.getAvailableOmPacks(updatedAccess));
8632
- done();
9105
+ try {
9106
+ const updatedAccess = await buildAccess();
9107
+ const updatedHasAccess = Object.values(updatedAccess).some(Boolean);
9108
+ component.updateModePacks(chunkK4WJUBEC_cjs.getAvailableModePacks(updatedAccess, savedSettings.customModelPacks));
9109
+ component.updateOmPacks(chunkK4WJUBEC_cjs.getAvailableOmPacks(updatedAccess));
9110
+ component.updateHasProviderAccess(updatedHasAccess);
9111
+ } catch (err) {
9112
+ console.error("Failed to refresh provider access after login:", err);
9113
+ } finally {
9114
+ done();
9115
+ }
8633
9116
  });
8634
9117
  },
8635
9118
  onSelectModel: async (title, modeColor) => {
@@ -8697,10 +9180,10 @@ var MastraTUI = class _MastraTUI {
8697
9180
  const omPack = result.omPack;
8698
9181
  harness.setState({ observerModelId: omPack.modelId, reflectorModelId: omPack.modelId });
8699
9182
  harness.setState({ yolo: result.yolo });
8700
- const settings = chunk7K5VFY2N_cjs.loadSettings();
9183
+ const settings = chunkK4WJUBEC_cjs.loadSettings();
8701
9184
  settings.onboarding.completedAt = (/* @__PURE__ */ new Date()).toISOString();
8702
9185
  settings.onboarding.skippedAt = null;
8703
- settings.onboarding.version = chunk7K5VFY2N_cjs.ONBOARDING_VERSION;
9186
+ settings.onboarding.version = chunkK4WJUBEC_cjs.ONBOARDING_VERSION;
8704
9187
  settings.onboarding.modePackId = modePack.id;
8705
9188
  settings.onboarding.omPackId = omPack.id;
8706
9189
  const modeDefaults = {};
@@ -8729,15 +9212,15 @@ var MastraTUI = class _MastraTUI {
8729
9212
  settings.models.omModelOverride = omPack.id === "custom" ? omPack.modelId : null;
8730
9213
  settings.preferences.yolo = result.yolo;
8731
9214
  settings.models.subagentModels = {};
8732
- chunk7K5VFY2N_cjs.saveSettings(settings);
9215
+ chunkK4WJUBEC_cjs.saveSettings(settings);
8733
9216
  updateStatusLine(this.state);
8734
9217
  await this.refreshModelAuthStatus();
8735
9218
  }
8736
9219
  shouldShowOnboarding() {
8737
- const settings = chunk7K5VFY2N_cjs.loadSettings();
9220
+ const settings = chunkK4WJUBEC_cjs.loadSettings();
8738
9221
  const ob = settings.onboarding;
8739
9222
  if (ob.completedAt || ob.skippedAt) {
8740
- return ob.version < chunk7K5VFY2N_cjs.ONBOARDING_VERSION;
9223
+ return ob.version < chunkK4WJUBEC_cjs.ONBOARDING_VERSION;
8741
9224
  }
8742
9225
  return true;
8743
9226
  }
@@ -8751,19 +9234,19 @@ var LoginSelectorComponent = class extends piTui.Box {
8751
9234
  onSelectCallback;
8752
9235
  onCancelCallback;
8753
9236
  constructor(mode, authSource, onSelect, onCancel) {
8754
- super(2, 1, (text) => chunk7K5VFY2N_cjs.bg("overlayBg", text));
9237
+ super(2, 1, (text) => chunkK4WJUBEC_cjs.theme.bg("overlayBg", text));
8755
9238
  this.mode = mode;
8756
9239
  this.authSource = authSource;
8757
9240
  this.onSelectCallback = onSelect;
8758
9241
  this.onCancelCallback = onCancel;
8759
9242
  this.loadProviders();
8760
9243
  const title = mode === "login" ? "Select provider to login:" : "Select provider to logout:";
8761
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("text", title)));
9244
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("text", title)));
8762
9245
  this.addChild(new piTui.Spacer(1));
8763
9246
  this.listContainer = new piTui.Container();
8764
9247
  this.addChild(this.listContainer);
8765
9248
  this.addChild(new piTui.Spacer(1));
8766
- this.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("muted", "Press Enter to select, Escape to cancel")));
9249
+ this.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("muted", "Press Enter to select, Escape to cancel")));
8767
9250
  this.updateList();
8768
9251
  }
8769
9252
  loadProviders() {
@@ -8776,10 +9259,10 @@ var LoginSelectorComponent = class extends piTui.Box {
8776
9259
  if (!provider) continue;
8777
9260
  const isSelected = i === this.selectedIndex;
8778
9261
  const isLoggedIn = this.authSource.isLoggedIn(provider.id);
8779
- const statusIndicator = isLoggedIn ? chunk7K5VFY2N_cjs.fg("success", " \u2713 logged in") : "";
9262
+ const statusIndicator = isLoggedIn ? chunkK4WJUBEC_cjs.theme.fg("success", " \u2713 logged in") : "";
8780
9263
  let line = "";
8781
9264
  if (isSelected) {
8782
- line = chunk7K5VFY2N_cjs.fg("accent", "\u2192 " + provider.name) + statusIndicator;
9265
+ line = chunkK4WJUBEC_cjs.theme.fg("accent", "\u2192 " + provider.name) + statusIndicator;
8783
9266
  } else {
8784
9267
  line = " " + provider.name + statusIndicator;
8785
9268
  }
@@ -8787,7 +9270,7 @@ var LoginSelectorComponent = class extends piTui.Box {
8787
9270
  }
8788
9271
  if (this.allProviders.length === 0) {
8789
9272
  const message = this.mode === "login" ? "No OAuth providers available" : "No OAuth providers logged in. Use /login first.";
8790
- this.listContainer.addChild(new piTui.Text(chunk7K5VFY2N_cjs.fg("muted", message)));
9273
+ this.listContainer.addChild(new piTui.Text(chunkK4WJUBEC_cjs.theme.fg("muted", message)));
8791
9274
  }
8792
9275
  }
8793
9276
  handleInput(keyData) {
@@ -8818,6 +9301,7 @@ exports.OMProgressComponent = OMProgressComponent;
8818
9301
  exports.ToolExecutionComponentEnhanced = ToolExecutionComponentEnhanced;
8819
9302
  exports.UserMessageComponent = UserMessageComponent;
8820
9303
  exports.createTUIState = createTUIState;
9304
+ exports.detectTerminalTheme = detectTerminalTheme;
8821
9305
  exports.formatOMStatus = formatOMStatus;
8822
- //# sourceMappingURL=chunk-7TFV3VBB.cjs.map
8823
- //# sourceMappingURL=chunk-7TFV3VBB.cjs.map
9306
+ //# sourceMappingURL=chunk-C4X3C2DL.cjs.map
9307
+ //# sourceMappingURL=chunk-C4X3C2DL.cjs.map