moderado 0.4.8 → 0.4.18

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 (40) hide show
  1. package/README.md +51 -22
  2. package/dist/args.d.ts +1 -1
  3. package/dist/args.d.ts.map +1 -1
  4. package/dist/args.js +7 -0
  5. package/dist/args.js.map +1 -1
  6. package/dist/commands/chat.d.ts +4 -2
  7. package/dist/commands/chat.d.ts.map +1 -1
  8. package/dist/commands/chat.js +63 -39
  9. package/dist/commands/chat.js.map +1 -1
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +5 -1
  12. package/dist/index.js.map +1 -1
  13. package/dist/self_update.d.ts +53 -0
  14. package/dist/self_update.d.ts.map +1 -0
  15. package/dist/self_update.js +515 -0
  16. package/dist/self_update.js.map +1 -0
  17. package/dist/ui/model_selector.d.ts +1 -0
  18. package/dist/ui/model_selector.d.ts.map +1 -1
  19. package/dist/ui/model_selector.js +5 -5
  20. package/dist/ui/model_selector.js.map +1 -1
  21. package/dist/ui/popup.d.ts.map +1 -1
  22. package/dist/ui/popup.js +22 -2
  23. package/dist/ui/popup.js.map +1 -1
  24. package/dist/ui/provider_connect.d.ts +26 -2
  25. package/dist/ui/provider_connect.d.ts.map +1 -1
  26. package/dist/ui/provider_connect.js +157 -46
  27. package/dist/ui/provider_connect.js.map +1 -1
  28. package/dist/ui/welcome.d.ts +0 -2
  29. package/dist/ui/welcome.d.ts.map +1 -1
  30. package/dist/ui/welcome.js +2 -25
  31. package/dist/ui/welcome.js.map +1 -1
  32. package/dist/vendor/contracts/models.d.ts +4 -0
  33. package/dist/vendor/contracts/models.d.ts.map +1 -1
  34. package/dist/vendor/contracts/models.js +2 -0
  35. package/dist/vendor/contracts/models.js.map +1 -1
  36. package/dist/vendor/providers/presets.d.ts +1 -1
  37. package/dist/vendor/providers/presets.d.ts.map +1 -1
  38. package/dist/vendor/providers/presets.js +3 -5
  39. package/dist/vendor/providers/presets.js.map +1 -1
  40. package/package.json +2 -1
package/README.md CHANGED
@@ -88,18 +88,46 @@ npm install -g moderado
88
88
  moderado --help
89
89
  ```
90
90
 
91
- The latest published release is 0.4.8. Its `/login` command uses the Moderado
92
- Gateway for model routes and inference; `/connect` remains available for direct
93
- providers. The previous 0.3.10 release is self-contained and works without the
94
- Gateway. Both releases use the `moderado` command name.
95
-
96
- Install the latest release with `npm install -g moderado`. To stay on the
97
- self-contained 0.3.10 CLI, run `npm install -g moderado@0.3.10`.
98
-
99
- Any npm-compatible installer works (bun add -g moderado,
100
- pnpm add -g moderado, npx -y moderado@latest --help). Prebuilt binaries and the
101
- curl installer are documented in the root README. Windows installation options
102
- are npm and Scoop. See `docs/DISTRIBUTION.md` in the repository.
91
+ The latest published release is 0.4.10. Its `/connect` flow handles the
92
+ Gateway and direct providers; `/login` is no longer offered. The previous
93
+ 0.4.8 release uses `/login` for the Gateway. The earlier 0.3.10 release is
94
+ self-contained and works without the Gateway. All three use the `moderado`
95
+ command name.
96
+
97
+ Install the latest release with `npm install -g moderado`. To install a specific
98
+ version, run `npm install -g moderado@<version>`. Prebuilt binaries and the curl
99
+ installer are documented in the root README. Windows installation options are
100
+ npm and Scoop. See `docs/DISTRIBUTION.md` for package-manager details.
101
+
102
+ ### Update an existing installation
103
+
104
+ These commands are available starting with Moderado v0.4.18. The currently
105
+ published v0.4.10 release does not include them; install v0.4.18 or later with
106
+ the original installer before using these commands.
107
+
108
+ ```bash
109
+ moderado update # latest release within the installed major version
110
+ moderado upgrade # latest release, including a major version change
111
+ ```
112
+
113
+ Both commands update the current installation in place and report the installed
114
+ and target versions. If already current, the command reports that and exits
115
+ successfully. Restart Moderado after a successful update to use the new version.
116
+
117
+ Global npm installs and standalone binaries installed at the default
118
+ `~/.local/bin/moderado` path by the Moderado installer are updated in place.
119
+ The npm update preserves the existing global prefix and does not update other
120
+ global packages. Standalone installs made with a custom `--dir` path are not
121
+ recognized for in-place updates and require the original installer. Homebrew
122
+ and Scoop installations remain managed by their package managers: use
123
+ `brew upgrade moderado` or `scoop update moderado`. Other npm-compatible package
124
+ managers should be updated with the manager that installed Moderado.
125
+
126
+ If Moderado cannot safely identify or replace the installation, it exits with
127
+ an actionable error and leaves the current installation intact. Update it
128
+ manually with its original installer or package manager, for example
129
+ `npm install -g moderado` or the Homebrew/Scoop command above. An interrupted
130
+ update reports cancellation; run the command again when ready.
103
131
  To build from source instead:
104
132
 
105
133
  ```bash
@@ -116,15 +144,16 @@ Maintainers can install a verified release artifact directly with
116
144
 
117
145
  ### Connect to the Moderado Gateway
118
146
 
119
- Run `/login` in the TUI and choose the public Gateway for keyless inference.
147
+ In the current source build, run `/connect`, choose Moderado Gateway, and then
148
+ choose public access or sign in.
120
149
  Browser authorization or a Moderado Cloud `mrd_` API key is optional for account
121
150
  features. `/model` lists configured Gateway routes: `auto` follows Gateway
122
151
  routing, while selecting a route pins requests to it. Existing BYOK and local
123
152
  provider profiles remain independent.
124
153
 
125
- Use `/connect` to connect directly to OpenRouter, NVIDIA NIM, Agnes AI,
126
- OrcaRouter, Ollama, LM Studio, or a custom OpenAI-compatible provider. `/login`
127
- selects the Moderado Gateway; `/connect` selects a direct provider.
154
+ The same `/connect` menu offers OpenRouter, NVIDIA NIM, Agnes AI, OrcaRouter,
155
+ Ollama, LM Studio, and custom OpenAI-compatible providers. The published 0.4.8
156
+ release still uses `/login` for the Gateway.
128
157
 
129
158
  Cloud OAuth credentials last 30 days and have no refresh token; authorize again
130
159
  after expiry. On Windows, credentials are stored in Windows Credential Manager.
@@ -146,12 +175,12 @@ Run `moderado doctor` to inspect local setup without exposing secrets. Add
146
175
 
147
176
  Run `moderado` to open the TUI immediately. A fresh installation does not require
148
177
  an API key or a preselected model. The welcome card shows **No model connected —
149
- use `/login`** until you add one.
178
+ use `/connect`** until you add one.
150
179
 
151
- Use `/login` for the public Moderado Gateway and `/model` to browse configured routes.
152
- Cloud `auto` follows the Gateway's configured pool; choosing a route in `/model`
153
- pins it for subsequent requests. Existing direct BYOK and local profiles remain
154
- available separately.
180
+ Use `/connect` to choose the Gateway or another provider. The Gateway offers a
181
+ route picker after connection; `/model` can change the route later. Cloud `auto`
182
+ follows the Gateway's configured pool, while choosing a route pins subsequent
183
+ requests to it.
155
184
 
156
185
  ### Sessions and usage
157
186
 
@@ -230,7 +259,7 @@ Run `moderado doctor` to check the local Node runtime, workspace, Moderado home
230
259
 
231
260
  ## Windows credential storage
232
261
 
233
- On Windows, `/login` stores Moderado Cloud credentials in Windows Credential
262
+ On Windows, Gateway sign-in through `/connect` stores credentials in Windows Credential
234
263
  Manager and keeps only a credential reference in `~/.moderado/config.json`.
235
264
  Non-Windows platforms use the current memory-only credential store, so log in
236
265
  again for each new CLI process. Existing BYOK environment variables and saved
package/dist/args.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export interface CliParsedArgs {
2
- command?: 'models' | 'run' | 'doctor' | 'skills';
2
+ command?: 'models' | 'run' | 'doctor' | 'skills' | 'update' | 'upgrade';
3
3
  task?: string;
4
4
  skillAction?: 'on' | 'off';
5
5
  skillName?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACjD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,OAAO,C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O,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,YAAY,CAAC,IAAI,GAAE,MAAM,EAA0B,GAAG,aAAa,CAsFlF;AAED,wBAAgB,WAAW,IAAI,MAAM,CAoCpC"}
package/dist/args.js CHANGED
@@ -48,6 +48,9 @@ export function parseCliArgs(args = process.argv.slice(2)) {
48
48
  else if (first === 'models') {
49
49
  command = 'models';
50
50
  }
51
+ else if (first === 'update' || first === 'upgrade') {
52
+ command = first;
53
+ }
51
54
  else if (first === 'run') {
52
55
  command = 'run';
53
56
  task = positionals.slice(1).join(' ');
@@ -92,6 +95,8 @@ export function getHelpText() {
92
95
 
93
96
  USAGE:
94
97
  moderado models [options]
98
+ moderado update
99
+ moderado upgrade
95
100
  moderado run "<task>" [options]
96
101
  moderado "<task>" [options]
97
102
 
@@ -100,6 +105,8 @@ COMMANDS:
100
105
  run "<task>" Execute a bounded coding task in the workspace\n skills List built-in and user skills
101
106
  skills on|off NAME Enable or disable a user skill
102
107
  doctor Check local Moderado setup
108
+ update Update within the current major version
109
+ upgrade Upgrade across major versions
103
110
 
104
111
  OPTIONS:
105
112
  -w, --workspace <path> Target workspace directory (default: current directory)
package/dist/args.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"args.js","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AA4BtC,MAAM,UAAU,YAAY,CAAC,OAAiB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACjE,MAAM,aAAa,GAAG;QACpB,SAAS,EAAE,EAAE,IAAI,EAAE,QAAiB,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE;QAChE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAiB,EAAE,KAAK,EAAE,GAAG,EAAE;QA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CAAC,cAAc,CAAC,CAAC;QACnD,cAAc,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;QACzD,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QAC/C,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;QACrD,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;QACvC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;QACjC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;QACvC,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;QACjD,kBAAkB,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;QACjE,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;QACjC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;KACxC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCR,CAAC;AACF,CAAC"}
@@ -3,14 +3,15 @@ import { discoverMcpServers } from '@moderado/tools';
3
3
  import type { WebSearchProviderName, WebSearchToolOptions } from '@moderado/tools';
4
4
  import { ApprovalDecision, ApprovalRequest, ChatMessage, IToolRegistry, McpServerConfig, ToolResult } from '@moderado/contracts';
5
5
  import { CliParsedArgs } from '../args.js';
6
- import { ModeradoConfig } from '../config.js';
6
+ import { ModeradoConfig, ProviderConnection } from '../config.js';
7
7
  import { StoredSession } from '../sessions.js';
8
8
  import { selectConfirmPopup, selectListPopup } from '../ui/popup.js';
9
+ export declare function createConnectionProvider(connection: ProviderConnection): NvidiaAdapter;
9
10
  export declare function formatSessionExitSummary(session: StoredSession, modelId?: string): string;
10
11
  export declare function createAgentTask(request: string, mode: 'Plan' | 'Execute'): string;
11
12
  export declare function createReviewTask(changedFiles: string[]): string;
12
13
  export declare function createReviewToolRegistry(): IToolRegistry;
13
- export declare const STANDARD_SLASH_COMMANDS: readonly ["/connect", "/login", "/model", "/init", "/btw", "/mcp", "/session", "/queue", "/workflow", "/review", "/map", "/budget", "/skills", "/clear", "/help", "/exit", "/quit"];
14
+ export declare const STANDARD_SLASH_COMMANDS: readonly ["/connect", "/model", "/init", "/btw", "/mcp", "/session", "/queue", "/workflow", "/review", "/map", "/budget", "/skills", "/clear", "/help", "/exit", "/quit"];
14
15
  export declare function levenshteinDistance(a: string, b: string): number;
15
16
  export interface SlashCommandAdvice {
16
17
  isSlashCommand: boolean;
@@ -36,6 +37,7 @@ export declare function resolveTurnAssistantAnswer(result: {
36
37
  answer: string;
37
38
  isError: boolean;
38
39
  };
40
+ export declare function saveFailedTurnPrompt(history: ChatMessage[], prompt: string): ChatMessage[];
39
41
  export declare function isBareExitCommand(input: string): boolean;
40
42
  /** Resolve the required, explicit local destination for `/session share`. */
41
43
  export declare function resolveSessionSharePath(workspaceRoot: string, outputPath: string): string;
@@ -1 +1 @@
1
- {"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/commands/chat.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAkG,kBAAkB,EAA0D,MAAM,iBAAiB,CAAC;AAC7M,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,WAAW,EAAoB,aAAa,EAAE,eAAe,EAAyB,UAAU,EAAmB,MAAM,qBAAqB,CAAC;AAC3L,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAuD,cAAc,EAA+L,MAAM,c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EAAE,OAAO,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,EAC9F,QAAQ,EAAE,aAAa,GAAG,SAAS,EACnC,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,UAAU,EAAE,KAAK,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,EAC1E,MAAM,CAAC,EAAE,WAAW,EACpB,SAAS,CAAC,EAAE,WAAW,GACtB,OAAO,CAAC,IAAI,CAAC,CAoGf;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CA+9BnH"}
@@ -23,6 +23,9 @@ import { inspectGitWorkspace, readGitDiff } from '../vendor/tools/index.js';
23
23
  import { buildWorkspaceMap } from '../repo_map.js';
24
24
  import { evaluateTokenBudget, parseBudgetCommand } from '../budget.js';
25
25
  import { discoverSkills, formatSkillContext, formatSkillsList, getEnabledSkillNames, selectEnabledSkills, setSkillEnabled } from '../skills.js';
26
+ export function createConnectionProvider(connection) {
27
+ return new NvidiaAdapter({ apiKey: connection.apiKey, baseUrl: connection.baseUrl, providerId: connection.id, providerName: connection.displayName });
28
+ }
26
29
  export function formatSessionExitSummary(session, modelId) {
27
30
  const usage = session.usage;
28
31
  const tokens = usage.available
@@ -64,7 +67,6 @@ export function createReviewToolRegistry() {
64
67
  }
65
68
  export const STANDARD_SLASH_COMMANDS = [
66
69
  '/connect',
67
- '/login',
68
70
  '/model',
69
71
  '/init',
70
72
  '/btw',
@@ -170,7 +172,7 @@ export function formatTurnFailureAnswer(status, errorEvent, modelId, otherConnec
170
172
  const cleanDetail = rawDetail
171
173
  .replace(/^(?:NVIDIA NIM|OpenAI|OpenRouter|[a-zA-Z0-9_-]+)\s*(?:request failed|rate limit exceeded|service or model unavailable)?\s*(?:\([^)]*\))?\s*(?:during\s*streamChat)?:\s*/i, '')
172
174
  .trim();
173
- return `⚠️ **Model Error (${errorEvent?.code || 'ERR_INFERENCE_FAILED'}):**\n${cleanDetail || 'Model returned no response.'}\n\n👉 **Suggestion:** The model \`${modelId}\` encountered an error. Switch models with \`/model\`, connect directly with \`/connect\`, or reconnect to the Gateway with \`/login\`${altSuggestion}.`;
175
+ return `⚠️ **Model Error (${errorEvent?.code || 'ERR_INFERENCE_FAILED'}):**\n${cleanDetail || 'Model returned no response.'}\n\n👉 **Suggestion:** The model \`${modelId}\` encountered an error. Switch models with \`/model\` or choose a provider with \`/connect\`${altSuggestion}.`;
174
176
  }
175
177
  export function resolveTurnAssistantAnswer(result, previousHistoryLength, lastErrorEvent, streamedAnswer = '', currentModel = 'unknown', otherConnections = []) {
176
178
  if (result.status === 'cancelled') {
@@ -190,6 +192,11 @@ export function resolveTurnAssistantAnswer(result, previousHistoryLength, lastEr
190
192
  isError: false,
191
193
  };
192
194
  }
195
+ export function saveFailedTurnPrompt(history, prompt) {
196
+ if (!prompt.trim())
197
+ return history;
198
+ return [...history, { role: 'user', content: prompt }];
199
+ }
193
200
  export function isBareExitCommand(input) {
194
201
  return input.trim().toLowerCase() === 'exit';
195
202
  }
@@ -625,7 +632,7 @@ export async function executeBtwQuery(command, drawFrame, provider, currentModel
625
632
  if (!provider || !currentModel) {
626
633
  await drawFrame(renderBoxLines('By The Way (/btw)', [
627
634
  'No model or provider connected.',
628
- 'Use /login for the Gateway or /connect for a direct provider, then select a model with /model.',
635
+ 'Use /connect to choose a provider and model.',
629
636
  '',
630
637
  'Press Esc or Enter to return.',
631
638
  ], 72));
@@ -721,7 +728,7 @@ export async function handleChatSession(args, version, signal) {
721
728
  const activateConnection = (connection, explicitModel) => {
722
729
  activeConnection = connection;
723
730
  currentModel = explicitModel ?? connection.defaultModel ?? (connection.kind === 'nvidia-nim' ? 'auto' : undefined);
724
- provider = new NvidiaAdapter({ apiKey: connection.id === 'moderado-cloud' ? undefined : connection.apiKey, baseUrl: connection.baseUrl, providerId: connection.id, providerName: connection.displayName });
731
+ provider = createConnectionProvider(connection);
725
732
  };
726
733
  if (activeConnection)
727
734
  activateConnection(activeConnection, args.model);
@@ -796,7 +803,7 @@ export async function handleChatSession(args, version, signal) {
796
803
  }
797
804
  else {
798
805
  const turn = await promptInteractiveTurn({
799
- model: currentModel ?? 'No model connected — use /login or /connect', tokens: Math.round(sessionTokens), cost: costLabel(), workspace: canonicalWorkspace, version,
806
+ model: currentModel ?? 'No model connected — use /connect', tokens: Math.round(sessionTokens), cost: costLabel(), workspace: canonicalWorkspace, version,
800
807
  usageAvailable: activeSession.usage.available, usageEstimated: activeSession.usage.estimated, initialMode: activeMode, initialAutoApprove: activeAutoApprove, isFirstTurn: isFirst, signal, chatQuestion: lastQuestion || undefined, chatAnswer: lastAnswer || undefined, chatThoughtTime: lastThoughtTime, outputTokenRate: lastOutputTokenRate, tokenUsage: lastTokenUsage,
801
808
  queuedCommands: commandQueue.items,
802
809
  onExit: exitMessage,
@@ -833,24 +840,12 @@ export async function handleChatSession(args, version, signal) {
833
840
  }
834
841
  return selection.modelId;
835
842
  },
836
- onLogin: async (drawFrame) => {
837
- const connection = await loginModeradoCloudInteractive({
838
- signal,
839
- drawFrame,
840
- gatewayUrl: config.connections?.['moderado-cloud']?.baseUrl,
841
- });
842
- if (!connection)
843
- return currentModel;
844
- const runtimeConnection = requiresCredentialReference(connection) ? await storeConnectionCredential(connection, credentialStore) : connection;
845
- saveConnection(runtimeConnection);
846
- config = loadConfig();
847
- activateConnection(runtimeConnection);
848
- return currentModel ?? 'No model connected — use /login or /connect';
849
- },
850
843
  onConnect: async (drawFrame) => {
851
844
  const connection = await connectProviderInteractive({
852
845
  signal,
853
846
  drawFrame,
847
+ gatewayUrl: config.connections?.['moderado-cloud']?.baseUrl,
848
+ activeConnection,
854
849
  savedConnections: config.connections,
855
850
  connectProviders: config.connectProviders,
856
851
  resolveSavedConnection: (saved) => resolveConnectionCredential(saved, credentialStore),
@@ -1100,7 +1095,7 @@ export async function handleChatSession(args, version, signal) {
1100
1095
  lastTokenUsage = undefined;
1101
1096
  process.stdout.write('\x1b[H\x1b[J');
1102
1097
  process.stdout.write(renderFullWelcomeScreen({
1103
- model: currentModel ?? 'No model connected — use /login or /connect', tokens: Math.round(sessionTokens), cost: costLabel(),
1098
+ model: currentModel ?? 'No model connected — use /connect', tokens: Math.round(sessionTokens), cost: costLabel(),
1104
1099
  usageAvailable: activeSession.usage.available, usageEstimated: activeSession.usage.estimated, workspace: canonicalWorkspace, mode: activeMode,
1105
1100
  autoApprove: activeAutoApprove, chatQuestion: lastQuestion, chatAnswer: lastAnswer,
1106
1101
  chatThoughtTime: lastThoughtTime, queuedCommands: commandQueue.items,
@@ -1116,7 +1111,7 @@ export async function handleChatSession(args, version, signal) {
1116
1111
  lastTokenUsage = undefined;
1117
1112
  process.stdout.write('\x1b[H\x1b[J');
1118
1113
  process.stdout.write(renderFullWelcomeScreen({
1119
- model: currentModel ?? 'No model connected — use /login or /connect', tokens: Math.round(sessionTokens), cost: costLabel(),
1114
+ model: currentModel ?? 'No model connected — use /connect', tokens: Math.round(sessionTokens), cost: costLabel(),
1120
1115
  usageAvailable: activeSession.usage.available, usageEstimated: activeSession.usage.estimated, workspace: canonicalWorkspace, mode: activeMode,
1121
1116
  autoApprove: activeAutoApprove, chatQuestion: lastQuestion, chatAnswer: lastAnswer,
1122
1117
  chatThoughtTime: lastThoughtTime, queuedCommands: commandQueue.items,
@@ -1151,7 +1146,7 @@ export async function handleChatSession(args, version, signal) {
1151
1146
  }
1152
1147
  process.stdout.write('\x1b[H\x1b[J');
1153
1148
  process.stdout.write(renderFullWelcomeScreen({
1154
- model: currentModel ?? 'No model connected — use /login or /connect', tokens: Math.round(sessionTokens), cost: costLabel(),
1149
+ model: currentModel ?? 'No model connected — use /connect', tokens: Math.round(sessionTokens), cost: costLabel(),
1155
1150
  usageAvailable: activeSession.usage.available, usageEstimated: activeSession.usage.estimated, workspace: canonicalWorkspace, mode: activeMode,
1156
1151
  autoApprove: activeAutoApprove, chatQuestion: lastQuestion, chatAnswer: lastAnswer,
1157
1152
  chatThoughtTime: lastThoughtTime,
@@ -1190,7 +1185,7 @@ export async function handleChatSession(args, version, signal) {
1190
1185
  lastTokenUsage = undefined;
1191
1186
  process.stdout.write('\x1b[H\x1b[J');
1192
1187
  process.stdout.write(renderFullWelcomeScreen({
1193
- model: currentModel ?? 'No model connected — use /login or /connect', tokens: Math.round(sessionTokens), cost: costLabel(),
1188
+ model: currentModel ?? 'No model connected — use /connect', tokens: Math.round(sessionTokens), cost: costLabel(),
1194
1189
  usageAvailable: activeSession.usage.available, usageEstimated: activeSession.usage.estimated, workspace: canonicalWorkspace, mode: activeMode,
1195
1190
  autoApprove: activeAutoApprove, chatQuestion: lastQuestion, chatAnswer: lastAnswer,
1196
1191
  chatThoughtTime: lastThoughtTime,
@@ -1229,7 +1224,7 @@ export async function handleChatSession(args, version, signal) {
1229
1224
  lastOutputTokenRate = undefined;
1230
1225
  lastTokenUsage = undefined;
1231
1226
  process.stdout.write('\x1b[H\x1b[J');
1232
- process.stdout.write(renderFullWelcomeScreen({ model: currentModel ?? 'No model connected — use /login or /connect', tokens: Math.round(sessionTokens), cost: costLabel(), usageAvailable: activeSession.usage.available, usageEstimated: activeSession.usage.estimated, workspace: canonicalWorkspace, mode: activeMode, autoApprove: activeAutoApprove, chatQuestion: lastQuestion, chatAnswer: lastAnswer, chatThoughtTime: lastThoughtTime, queuedCommands: commandQueue.items }, process.stdout.rows));
1227
+ process.stdout.write(renderFullWelcomeScreen({ model: currentModel ?? 'No model connected — use /connect', tokens: Math.round(sessionTokens), cost: costLabel(), usageAvailable: activeSession.usage.available, usageEstimated: activeSession.usage.estimated, workspace: canonicalWorkspace, mode: activeMode, autoApprove: activeAutoApprove, chatQuestion: lastQuestion, chatAnswer: lastAnswer, chatThoughtTime: lastThoughtTime, queuedCommands: commandQueue.items }, process.stdout.rows));
1233
1228
  process.stdout.write(renderChatComposerCursor({ width: process.stdout.columns }, 0));
1234
1229
  continue;
1235
1230
  }
@@ -1239,8 +1234,7 @@ export async function handleChatSession(args, version, signal) {
1239
1234
  if (trimmed === '/help') {
1240
1235
  lastQuestion = trimmed;
1241
1236
  lastAnswer = 'Available slash commands:\n' +
1242
- ' /connect - Connect directly to an external or local provider\n' +
1243
- ' /login - Connect to the Moderado Gateway or log in to Moderado Cloud\n' +
1237
+ ' /connect - Choose a Gateway, hosted, or local provider\n' +
1244
1238
  ' /model - Switch active AI model\n' +
1245
1239
  ' /init - Scaffold AGENTS.md from workspace scan\n' +
1246
1240
  ' /mcp - Manage local MCP servers\n' +
@@ -1259,7 +1253,7 @@ export async function handleChatSession(args, version, signal) {
1259
1253
  lastTokenUsage = undefined;
1260
1254
  process.stdout.write('\x1b[H\x1b[J');
1261
1255
  process.stdout.write(renderFullWelcomeScreen({
1262
- model: currentModel ?? 'No model connected — use /login or /connect', tokens: Math.round(sessionTokens), cost: costLabel(),
1256
+ model: currentModel ?? 'No model connected — use /connect', tokens: Math.round(sessionTokens), cost: costLabel(),
1263
1257
  usageAvailable: activeSession.usage.available, usageEstimated: activeSession.usage.estimated, workspace: canonicalWorkspace, mode: activeMode,
1264
1258
  autoApprove: activeAutoApprove, chatQuestion: lastQuestion, chatAnswer: lastAnswer,
1265
1259
  chatThoughtTime: lastThoughtTime,
@@ -1292,7 +1286,7 @@ export async function handleChatSession(args, version, signal) {
1292
1286
  sessionStore.save(activeSession);
1293
1287
  process.stdout.write('\x1b[H\x1b[J');
1294
1288
  process.stdout.write(renderFullWelcomeScreen({
1295
- model: currentModel ?? 'No model connected — use /login or /connect', tokens: Math.round(sessionTokens), cost: costLabel(),
1289
+ model: currentModel ?? 'No model connected — use /connect', tokens: Math.round(sessionTokens), cost: costLabel(),
1296
1290
  usageAvailable: activeSession.usage.available, usageEstimated: activeSession.usage.estimated, workspace: canonicalWorkspace, mode: activeMode,
1297
1291
  autoApprove: activeAutoApprove, chatQuestion: lastQuestion, chatAnswer: lastAnswer,
1298
1292
  chatThoughtTime: lastThoughtTime,
@@ -1312,7 +1306,7 @@ export async function handleChatSession(args, version, signal) {
1312
1306
  sessionStore.save(activeSession);
1313
1307
  process.stdout.write('\x1b[H\x1b[J');
1314
1308
  process.stdout.write(renderFullWelcomeScreen({
1315
- model: currentModel ?? 'No model connected — use /login or /connect', tokens: Math.round(sessionTokens), cost: costLabel(),
1309
+ model: currentModel ?? 'No model connected — use /connect', tokens: Math.round(sessionTokens), cost: costLabel(),
1316
1310
  usageAvailable: activeSession.usage.available, usageEstimated: activeSession.usage.estimated, workspace: canonicalWorkspace, mode: activeMode,
1317
1311
  autoApprove: activeAutoApprove, chatQuestion: lastQuestion, chatAnswer: lastAnswer,
1318
1312
  chatThoughtTime: lastThoughtTime,
@@ -1368,13 +1362,26 @@ export async function handleChatSession(args, version, signal) {
1368
1362
  }
1369
1363
  }
1370
1364
  if (!provider) {
1371
- process.stdout.write('\nNo model is connected. Use /login for the Gateway or /connect for a direct provider.\n');
1372
- const connection = await loginModeradoCloudInteractive({
1365
+ process.stdout.write('\nNo model is connected. Use /connect to choose a provider.\n');
1366
+ const connection = await connectProviderInteractive({
1373
1367
  signal,
1368
+ drawFrame: (popupLines) => {
1369
+ process.stdout.write('\x1b[H\x1b[J');
1370
+ process.stdout.write(renderWelcomePopupLayer({
1371
+ model: currentModel ?? 'No model connected — use /connect',
1372
+ tokens: Math.round(sessionTokens), cost: costLabel(), workspace: canonicalWorkspace,
1373
+ mode: activeMode, autoApprove: activeAutoApprove,
1374
+ chatQuestion: lastQuestion, chatAnswer: lastAnswer,
1375
+ }, popupLines, process.stdout.columns, process.stdout.rows));
1376
+ },
1374
1377
  gatewayUrl: config.connections?.['moderado-cloud']?.baseUrl,
1378
+ activeConnection,
1379
+ savedConnections: config.connections,
1380
+ connectProviders: config.connectProviders,
1381
+ resolveSavedConnection: (saved) => resolveConnectionCredential(saved, credentialStore),
1375
1382
  });
1376
1383
  if (!connection) {
1377
- process.stdout.write('No provider connected. Use /login or /connect whenever you are ready.\n\n');
1384
+ process.stdout.write('No provider connected. Use /connect whenever you are ready.\n\n');
1378
1385
  continue;
1379
1386
  }
1380
1387
  const runtimeConnection = requiresCredentialReference(connection) ? await storeConnectionCredential(connection, credentialStore) : connection;
@@ -1416,7 +1423,7 @@ export async function handleChatSession(args, version, signal) {
1416
1423
  const displayAnswer = streamedAnswer || lastAnswer;
1417
1424
  process.stdout.write('\x1b[H\x1b[J');
1418
1425
  process.stdout.write(renderFullWelcomeScreen({
1419
- model: currentModel ?? 'No model connected — use /login or /connect',
1426
+ model: currentModel ?? 'No model connected — use /connect',
1420
1427
  tokens: Math.round(sessionTokens + (usageRecorded ? 0 : turnUsage?.usage.totalTokens ?? 0)),
1421
1428
  cost: costLabel(),
1422
1429
  usageAvailable: activeSession.usage.available, usageEstimated: activeSession.usage.estimated,
@@ -1594,10 +1601,13 @@ export async function handleChatSession(args, version, signal) {
1594
1601
  if (thinkingTimer)
1595
1602
  clearInterval(thinkingTimer);
1596
1603
  const cloudOAuth = isModeradoCloudOAuthConnection(activeConnection);
1597
- process.stdout.write(cloudOAuth
1598
- ? '\nModerado Cloud rejected this browser login. Sign in again to retry once.\n'
1599
- : `\nThe saved ${activeConnection.displayName} API key was rejected. Enter a replacement key to retry once.\n`);
1600
- const replacement = cloudOAuth
1604
+ const cloudWithoutKey = activeConnection.id === 'moderado-cloud' && !activeConnection.apiKey;
1605
+ process.stdout.write(cloudWithoutKey
1606
+ ? '\nThis free Gateway route requires a Moderado website API key. Sign in or enter a key to retry once.\n'
1607
+ : cloudOAuth
1608
+ ? '\nModerado Cloud rejected this browser login. Sign in again to retry once.\n'
1609
+ : `\nThe saved ${activeConnection.displayName} API key was rejected. Enter a replacement key to retry once.\n`);
1610
+ const replacement = cloudOAuth || cloudWithoutKey
1601
1611
  ? await loginModeradoCloudInteractive({ signal, gatewayUrl: activeConnection.baseUrl })
1602
1612
  : await replaceProviderKeyInteractive(activeConnection, { signal });
1603
1613
  if (!replacement)
@@ -1658,6 +1668,13 @@ export async function handleChatSession(args, version, signal) {
1658
1668
  streamedAnswer = lastAnswer;
1659
1669
  }
1660
1670
  else if (resolution.isError) {
1671
+ conversationHistory = saveFailedTurnPrompt(conversationHistory, effectivePrompt);
1672
+ activeSession.messages = conversationHistory;
1673
+ activeSession.providerId = activeConnection?.id;
1674
+ activeSession.providerName = activeConnection?.displayName;
1675
+ activeSession.modelId = result.selectedModel.id;
1676
+ activeSession.mode = activeMode;
1677
+ sessionStore.save(activeSession);
1661
1678
  streamedAnswer = lastAnswer;
1662
1679
  }
1663
1680
  else {
@@ -1691,16 +1708,23 @@ export async function handleChatSession(args, version, signal) {
1691
1708
  ? ` (other configured providers: ${otherConnections.join(', ')})`
1692
1709
  : '';
1693
1710
  lastQuestion = trimmed;
1711
+ conversationHistory = saveFailedTurnPrompt(conversationHistory, effectivePrompt);
1712
+ activeSession.messages = conversationHistory;
1713
+ activeSession.providerId = activeConnection?.id;
1714
+ activeSession.providerName = activeConnection?.displayName;
1715
+ activeSession.modelId = currentModel;
1716
+ activeSession.mode = activeMode;
1717
+ sessionStore.save(activeSession);
1694
1718
  const rawErr = err?.message || 'Inference error';
1695
1719
  const cleanErr = rawErr
1696
1720
  .replace(/^(?:NVIDIA NIM|OpenAI|OpenRouter|[a-zA-Z0-9_-]+)\s*(?:request failed|rate limit exceeded|service or model unavailable)?\s*(?:\([^)]*\))?\s*(?:during\s*streamChat)?:\s*/i, '')
1697
1721
  .trim();
1698
- lastAnswer = `⚠️ **Error:** ${cleanErr || rawErr}\n\n👉 **Suggestion:** Switch models with \`/model\`, connect directly with \`/connect\`, or reconnect to the Gateway with \`/login\`${altSuggestion}.`;
1722
+ lastAnswer = `⚠️ **Error:** ${cleanErr || rawErr}\n\n👉 **Suggestion:** Switch models with \`/model\` or choose a provider with \`/connect\`${altSuggestion}.`;
1699
1723
  lastThoughtTime = Math.max(0.001, (Date.now() - startedAt) / 1000);
1700
1724
  lastOutputTokenRate = undefined;
1701
1725
  process.stdout.write('\x1b[H\x1b[J');
1702
1726
  process.stdout.write(renderFullWelcomeScreen({
1703
- model: currentModel ?? 'No model connected — use /login or /connect',
1727
+ model: currentModel ?? 'No model connected — use /connect',
1704
1728
  tokens: Math.round(sessionTokens),
1705
1729
  cost: costLabel(),
1706
1730
  usageAvailable: activeSession.usage.available, usageEstimated: activeSession.usage.estimated,