aegiscode 7.0.2 → 7.0.3

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "aegiscode",
3
3
  "productName": "AEGIS Code",
4
- "version": "7.0.2",
4
+ "version": "7.0.3",
5
5
  "description": "aegiscode — the command-line version of AEGIS Desktop. The shared tool surface in your shell, over the same thin transport and tool registry as the MCP plugin and the desktop app. Ships transport + UI only; no brain.",
6
6
  "author": {
7
7
  "name": "AEGIS Code",
package/src/app.js CHANGED
@@ -1663,6 +1663,30 @@ function createApp(options = {}) {
1663
1663
  /** Non-interactive: one prompt, plain output, exit code. */
1664
1664
  async function runOnce(prompt, { json = false } = {}) {
1665
1665
  adoptLegacyKeyOnce();
1666
+ // Same self-service a fresh `aegiscode -p ...` deserves as a fresh
1667
+ // interactive session (runInteractive) or a fresh `/ask` (runPrompt):
1668
+ // this path used to skip straight to the "no key" refusal below, so
1669
+ // every headless/scripted first run (CI, docker, a README one-liner)
1670
+ // left an installed-but-never-registered machine with no account row
1671
+ // and no welcome trial, instead of the free device key auto-provision
1672
+ // was built to hand it.
1673
+ //
1674
+ // Not the shared `ensureApiKey()` helper: it reports through `emit()`,
1675
+ // which writes to `out` — the same stream `--json` puts its one machine-
1676
+ // readable line on. A notice ahead of that line would break every script
1677
+ // piping `-p ... --json` into a JSON parser, so this path's own notice
1678
+ // always goes to `err` regardless of `json`.
1679
+ if (!client.apiKey && !provisionAttempted) {
1680
+ provisionAttempted = true;
1681
+ const result = await autoProvisionApiKey(client, credentials);
1682
+ if (result.key) {
1683
+ err.write(
1684
+ `aegiscode: no AEGIS key was configured — auto-provisioned a free account` +
1685
+ (result.ok ? ` (saved to ${credentials.credentialsPath()})` : ' (could not save it — reconfigure with /key)') +
1686
+ `. Fund it at ${client.promptUrl('topup', 'device_autoprovision')} or run /byok to use your own key.\n`
1687
+ );
1688
+ }
1689
+ }
1666
1690
  if (!client.apiKey) {
1667
1691
  err.write(`aegiscode: no AEGIS account key. ${credentials.HOW_TO_SET}, or set $${credentials.KEY_ENV}.\n`);
1668
1692
  return 2;
package/src/chatflow.js CHANGED
@@ -2170,14 +2170,25 @@ async function runSession(host) {
2170
2170
  }
2171
2171
  return;
2172
2172
  }
2173
- if (key.name === KEY.UP) {
2174
- overlay.sel = Math.max(0, (overlay.sel || 0) - 1);
2175
- render();
2176
- return;
2177
- }
2178
- if (key.name === KEY.DOWN) {
2173
+ if (key.name === KEY.UP || key.name === KEY.DOWN) {
2174
+ // The model picker pins on a plain arrow too, not just the shift chord:
2175
+ // shift+arrow depends on the terminal sending CSI modifier 2, which not
2176
+ // every terminal/multiplexer does, and a user on one that doesn't gets a
2177
+ // picker that only ever points, never pins, with no way to tell why.
2178
+ // Plain arrow already moves the highlight everywhere else, so routing it
2179
+ // through the same apply path shift uses makes "it changes the model"
2180
+ // true regardless of what the terminal does with the shift modifier.
2181
+ const step = key.name === KEY.UP ? -1 : 1;
2179
2182
  const max = Math.max(0, overlayRowCount() - 1);
2180
- overlay.sel = Math.min(max, (overlay.sel || 0) + 1);
2183
+ overlay.sel = Math.min(max, Math.max(0, (overlay.sel || 0) + step));
2184
+ if (type === 'model') {
2185
+ const chosen = (overlay.items || [])[overlay.sel || 0];
2186
+ overlay = null;
2187
+ render();
2188
+ await applyModelRow(chosen);
2189
+ render();
2190
+ return;
2191
+ }
2181
2192
  render();
2182
2193
  return;
2183
2194
  }
@@ -2189,6 +2200,24 @@ async function runSession(host) {
2189
2200
  return;
2190
2201
  }
2191
2202
  if (type === 'model') {
2203
+ // Shift+W / Shift+S arrive as the plain chars 'W'/'S' — unlike a bare
2204
+ // Shift press, shift+letter is a real, universally-sent terminal
2205
+ // signal (the terminal just sends the uppercase letter), so this is
2206
+ // the one "shift + something" chord that works everywhere arrow keys
2207
+ // might not (e.g. over some remote links/multiplexers that eat CSI
2208
+ // arrow sequences but pass plain chars through fine). Routes through
2209
+ // the same move-and-pin step the arrow keys use.
2210
+ if (key.ch === 'W' || key.ch === 'S') {
2211
+ const step = key.ch === 'W' ? -1 : 1;
2212
+ const max = Math.max(0, overlayRowCount() - 1);
2213
+ overlay.sel = Math.min(max, Math.max(0, (overlay.sel || 0) + step));
2214
+ const chosen = (overlay.items || [])[overlay.sel || 0];
2215
+ overlay = null;
2216
+ render();
2217
+ await applyModelRow(chosen);
2218
+ render();
2219
+ return;
2220
+ }
2192
2221
  const idx = parseInt(key.ch, 10);
2193
2222
  const items = overlay.items || [];
2194
2223
  if (Number.isFinite(idx) && idx >= 1 && idx <= items.length) {
package/src/overlays.js CHANGED
@@ -214,12 +214,12 @@ function renderModelPicker(models, sel = 0, width = 80, height = 24, current = n
214
214
  }
215
215
  if (end < count) lines.push([span('', ' '), span(C.gray, `↓ ${count - end} more below`)]);
216
216
  lines.push(blank(width));
217
- // The shift chord is advertised only because it is handled now (chatflow's
218
- // handleOverlayKey): shift+↑/↓ moves the highlight and pins that row in one
219
- // keystroke, and shift+enter commits the row the highlight is on. The
220
- // reference picker asked for a separate Enter every time and this hint said
221
- // nothing about a way around it.
222
- lines.push([span('', ' '), span(C.gray, `↑↓ navigate ${GLYPH.bullet} shift+↑↓ pins as it moves ${GLYPH.bullet} enter pins ${GLYPH.bullet} esc cancels`)]);
217
+ // Plain ↑/↓ pins as it moves (chatflow's handleOverlayKey), the same apply
218
+ // path shift+↑/↓ and enter use — shift is no longer required because not
219
+ // every terminal sends the shift+arrow chord. shift+w/shift+s is the same
220
+ // move-and-pin step again, spelled as plain chars ('W'/'S') for links or
221
+ // multiplexers that eat CSI arrow sequences but pass letters through fine.
222
+ lines.push([span('', ' '), span(C.gray, `↑↓ or shift+w/s pins as it moves ${GLYPH.bullet} enter pins ${GLYPH.bullet} esc cancels`)]);
223
223
  return fit(lines, width);
224
224
  }
225
225