agent-sh 0.14.3 → 0.14.5

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.
@@ -192,11 +192,15 @@ export class AgentLoop {
192
192
  const modes = this.pullModes();
193
193
  const prev = this.activeMode;
194
194
  const fresh = modes.find((m) => m.model === prev.model && m.provider === prev.provider);
195
+ let identityChanged = false;
195
196
  if (fresh) {
196
197
  this.activeMode = fresh;
197
198
  if (fresh.providerConfig && fresh.providerConfig !== prev.providerConfig) {
198
199
  this.llmClient.reconfigure({ ...fresh.providerConfig, model: fresh.model });
199
200
  }
201
+ identityChanged = fresh.model !== prev.model
202
+ || fresh.provider !== prev.provider
203
+ || fresh.contextWindow !== prev.contextWindow;
200
204
  }
201
205
  else if (prev.provider) {
202
206
  // Ghost: keep prev active so mid-turn stream() doesn't switch models.
@@ -204,7 +208,8 @@ export class AgentLoop {
204
208
  message: `${prev.provider}:${prev.model} is not in the refreshed catalog — keeping it active until you /model to another.`,
205
209
  });
206
210
  }
207
- this.emitIdentity();
211
+ if (identityChanged)
212
+ this.emitIdentity();
208
213
  this.bus.emit("config:changed", {});
209
214
  });
210
215
  onPipe("config:get-models", () => {
@@ -320,6 +320,8 @@ export default function agentBackend(ctx) {
320
320
  bus.emit("agent:modes-changed", {});
321
321
  if (!ashActive)
322
322
  return;
323
+ if (buildModes().some((m) => m.model === llmClient.model))
324
+ return;
323
325
  const pendingProvider = getSettings().defaultProvider;
324
326
  if (!pendingProvider)
325
327
  return;
@@ -8,6 +8,7 @@ declare module "../core/event-bus.js" {
8
8
  "shell:command-done": {
9
9
  command: string;
10
10
  output: string;
11
+ outputRaw: string;
11
12
  cwd: string;
12
13
  exitCode: number | null;
13
14
  };
@@ -95,11 +95,12 @@ export class OutputParser {
95
95
  }
96
96
  if (this.lastCommand) {
97
97
  const raw = this.cleanOutput(this.currentOutputCapture);
98
- const output = stripAnsi(raw).trim();
99
- const cleaned = this.removeEchoedCommand(output, this.lastCommand);
98
+ const output = this.removeEchoedCommand(stripAnsi(raw).trim(), this.lastCommand);
99
+ const outputRaw = this.removeEchoedCommand(raw.trim(), this.lastCommand);
100
100
  this.bus.emit("shell:command-done", {
101
101
  command: this.lastCommand,
102
- output: cleaned,
102
+ output,
103
+ outputRaw,
103
104
  cwd: this.cwd,
104
105
  exitCode: null,
105
106
  });
@@ -128,7 +129,7 @@ export class OutputParser {
128
129
  }
129
130
  removeEchoedCommand(output, command) {
130
131
  const lines = output.split("\n");
131
- if (lines.length > 0 && lines[0].includes(command.slice(0, 20))) {
132
+ if (lines.length > 0 && stripAnsi(lines[0]).includes(command.slice(0, 20))) {
132
133
  return lines.slice(1).join("\n").trim();
133
134
  }
134
135
  return output;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-sh",
3
- "version": "0.14.3",
3
+ "version": "0.14.5",
4
4
  "description": "A shell-first terminal where AI is one keystroke away",
5
5
  "type": "module",
6
6
  "workspaces": [