codemaxxing 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -460,9 +460,12 @@ function App() {
460
460
  : "No MCP servers connected.");
461
461
  return;
462
462
  }
463
- // Commands below require an active LLM connection
464
- if (!agent) {
465
- addMsg("info", "⚠ No LLM connected. Use /login to authenticate with a provider, or start a local server.");
463
+ // Commands that work without an agent (needed for first-time setup)
464
+ // /models and /login are handled below and don't need an agent
465
+ const agentlessCommands = ["/models", "/model", "/login"];
466
+ const isAgentlessCmd = agentlessCommands.some(cmd => trimmed === cmd || trimmed.startsWith(cmd + " "));
467
+ if (!agent && !isAgentlessCmd) {
468
+ addMsg("info", "⚠ No LLM connected.\n Use /login to authenticate, then /models to pick a model.");
466
469
  return;
467
470
  }
468
471
  if (trimmed === "/reset") {
@@ -69,8 +69,21 @@ export async function connectToProvider(isRetry, ctx) {
69
69
  else {
70
70
  info.push("✗ No local LLM server found.");
71
71
  ctx.setConnectionInfo([...info]);
72
+ // Check if user has saved credentials — if so, auto-show model picker
73
+ const { getCredential } = await import("../utils/auth.js");
74
+ const hasAnyCreds = !!getCredential("anthropic") || !!getCredential("openai") ||
75
+ !!getCredential("openrouter") || !!getCredential("qwen") ||
76
+ !!getCredential("copilot");
77
+ if (hasAnyCreds) {
78
+ // User has auth'd before — skip wizard, go straight to /models picker
79
+ info.push("✔ Found saved credentials. Use /models to pick a model and start coding.");
80
+ ctx.setConnectionInfo([...info]);
81
+ ctx.setReady(true);
82
+ // The user will run /models, which now works without an agent
83
+ return;
84
+ }
85
+ // No creds found — show the setup wizard
72
86
  ctx.setReady(true);
73
- // Show the setup wizard on first run
74
87
  ctx.setWizardScreen("connection");
75
88
  ctx.setWizardIndex(0);
76
89
  return;
@@ -108,7 +108,10 @@ function handleLoginMethodPicker(inputChar, key, ctx) {
108
108
  ctx.setLoading(true);
109
109
  ctx.setSpinnerMsg("Waiting for Anthropic authorization...");
110
110
  loginAnthropicOAuth((msg) => ctx.addMsg("info", msg))
111
- .then((cred) => { ctx.addMsg("info", `✅ Anthropic authenticated! (${cred.label})`); ctx.setLoading(false); })
111
+ .then((cred) => {
112
+ ctx.addMsg("info", `✅ Anthropic authenticated! (${cred.label})\n Next: type /models to pick a model`);
113
+ ctx.setLoading(false);
114
+ })
112
115
  .catch((err) => {
113
116
  ctx.addMsg("error", `OAuth failed: ${err.message}\n Fallback: set your key via CLI: codemaxxing auth api-key anthropic <your-key>\n Or set ANTHROPIC_API_KEY env var and restart.\n Get key at: console.anthropic.com/settings/keys`);
114
117
  ctx.setLoading(false);
@@ -127,7 +130,7 @@ function handleLoginMethodPicker(inputChar, key, ctx) {
127
130
  ctx.setSpinnerMsg("Waiting for OpenAI authorization...");
128
131
  loginOpenAICodexOAuth((msg) => ctx.addMsg("info", msg))
129
132
  .then((cred) => {
130
- ctx.addMsg("info", `✅ OpenAI authenticated! (${cred.label})`);
133
+ ctx.addMsg("info", `✅ OpenAI authenticated! (${cred.label})\n Next: type /models to pick a model`);
131
134
  ctx.setLoading(false);
132
135
  })
133
136
  .catch((err) => {
@@ -150,7 +153,7 @@ function handleLoginMethodPicker(inputChar, key, ctx) {
150
153
  ctx.setLoading(true);
151
154
  ctx.setSpinnerMsg("Waiting for GitHub authorization...");
152
155
  copilotDeviceFlow((msg) => ctx.addMsg("info", msg))
153
- .then(() => { ctx.addMsg("info", `✅ GitHub Copilot authenticated!`); ctx.setLoading(false); })
156
+ .then(() => { ctx.addMsg("info", `✅ GitHub Copilot authenticated!\n Next: type /models to pick a model`); ctx.setLoading(false); })
154
157
  .catch((err) => { ctx.addMsg("error", `Copilot auth failed: ${err.message}`); ctx.setLoading(false); });
155
158
  }
156
159
  else if (method === "api-key") {
@@ -186,7 +189,7 @@ function handleLoginPicker(_inputChar, key, ctx) {
186
189
  ctx.setLoading(true);
187
190
  ctx.setSpinnerMsg("Waiting for authorization...");
188
191
  openRouterOAuth((msg) => ctx.addMsg("info", msg))
189
- .then(() => { ctx.addMsg("info", `✅ OpenRouter authenticated! Access to 200+ models.`); ctx.setLoading(false); })
192
+ .then(() => { ctx.addMsg("info", `✅ OpenRouter authenticated! Access to 200+ models.\n Next: type /models to pick a model`); ctx.setLoading(false); })
190
193
  .catch((err) => { ctx.addMsg("error", `OAuth failed: ${err.message}`); ctx.setLoading(false); });
191
194
  }
192
195
  else if (methods[0] === "device-flow") {
@@ -195,7 +198,7 @@ function handleLoginPicker(_inputChar, key, ctx) {
195
198
  ctx.setLoading(true);
196
199
  ctx.setSpinnerMsg("Waiting for GitHub authorization...");
197
200
  copilotDeviceFlow((msg) => ctx.addMsg("info", msg))
198
- .then(() => { ctx.addMsg("info", `✅ GitHub Copilot authenticated!`); ctx.setLoading(false); })
201
+ .then(() => { ctx.addMsg("info", `✅ GitHub Copilot authenticated!\n Next: type /models to pick a model`); ctx.setLoading(false); })
199
202
  .catch((err) => { ctx.addMsg("error", `Copilot auth failed: ${err.message}`); ctx.setLoading(false); });
200
203
  }
201
204
  else if (methods[0] === "api-key") {
@@ -415,6 +418,25 @@ function handleModelPicker(_inputChar, key, ctx) {
415
418
  ctx.addMsg("info", `✅ Switched to: ${selected.name}`);
416
419
  ctx.refreshConnectionBanner();
417
420
  }
421
+ else if (selected && !ctx.agent) {
422
+ // First-time: save model selection to config, then reconnect
423
+ ctx.addMsg("info", `Initializing with ${selected.name}...`);
424
+ // Save selected model to config so connectToProvider picks it up
425
+ import("../config.js").then(({ loadConfig, saveConfig }) => {
426
+ const config = loadConfig();
427
+ config.provider = {
428
+ baseUrl: selected.baseUrl,
429
+ apiKey: selected.apiKey,
430
+ model: selected.name,
431
+ type: selected.providerType === "anthropic" ? "anthropic" : "openai",
432
+ };
433
+ saveConfig(config);
434
+ // Now reconnect with the saved config
435
+ ctx.connectToProvider?.(false);
436
+ }).catch((err) => {
437
+ ctx.addMsg("error", `Failed to initialize: ${err.message}`);
438
+ });
439
+ }
418
440
  ctx.setModelPickerGroups(null);
419
441
  ctx.setProviderPicker(null);
420
442
  ctx.setSelectedProvider(null);
@@ -38,6 +38,7 @@ export async function chatWithResponsesAPI(options) {
38
38
  inputItems.push({
39
39
  type: "function_call",
40
40
  id: tc.id,
41
+ call_id: tc.id,
41
42
  name: tc.function?.name || tc.name || "",
42
43
  arguments: typeof tc.function?.arguments === "string"
43
44
  ? tc.function.arguments
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codemaxxing",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Open-source terminal coding agent. Connect any LLM. Max your code.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {