@yanzc/claude-pro 0.7.1 → 0.7.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/src/oauth.js CHANGED
@@ -209,7 +209,7 @@ async function renew(config, { force }) {
209
209
  if (!oauth?.refreshToken) return { refreshed: false, reason: 'no refresh token' };
210
210
  if (!force && !needsRefresh(oauth)) return { refreshed: false, reason: 'still valid' };
211
211
  if (Number(oauth.refreshTokenExpiresAt) > 0 && Number(oauth.refreshTokenExpiresAt) <= timing.now()) {
212
- throw new Error(`The Claude Code login has expired and cannot be renewed: its refresh token ran out. ${SIGN_IN_AGAIN}`);
212
+ throw new Error(`The Claude subscription login has expired and cannot be renewed: its refresh token ran out. ${SIGN_IN_AGAIN}`);
213
213
  }
214
214
  const startedWith = oauth.accessToken;
215
215
  // somebody else renewed it while we were looking: take theirs
@@ -221,7 +221,7 @@ async function renew(config, { force }) {
221
221
  const now = readStoredLogin(file)?.oauth;
222
222
  // renewing early failed but the token still works: carry on with it (unless renewing was asked for)
223
223
  if (!force && now && !isExpired(now)) return { refreshed: false, reason: why, stillValid: true };
224
- throw new Error(force ? `The Claude Code login could not be renewed: ${why}` : `The Claude Code access token has expired and could not be renewed: ${why}`);
224
+ throw new Error(force ? `The Claude subscription login could not be renewed: ${why}` : `The Claude subscription access token has expired and could not be renewed: ${why}`);
225
225
  };
226
226
 
227
227
  let release;
@@ -251,7 +251,7 @@ async function renew(config, { force }) {
251
251
  // new one: look before giving up.
252
252
  if (res.status === 400 || res.status === 401 || res.status === 403) {
253
253
  if (renewedElsewhere()) return { refreshed: false, reason: 'renewed by another process' };
254
- throw new Error(`The Claude Code login can no longer be renewed (${describeFailure(res.data) || `HTTP ${res.status}`}). ${SIGN_IN_AGAIN}`);
254
+ throw new Error(`The Claude subscription login can no longer be renewed (${describeFailure(res.data) || `HTTP ${res.status}`}). ${SIGN_IN_AGAIN}`);
255
255
  }
256
256
  return failed(`the token server answered HTTP ${res.status}${describeFailure(res.data) ? ` (${describeFailure(res.data)})` : ''}`);
257
257
  } finally {
package/src/prompts.js CHANGED
@@ -50,10 +50,7 @@ export function mainSystemPrompt({ cwd, model, shellName, extra = '', autoMemory
50
50
  ? `\n\n# Memory\nProject and user instructions are shown below: the facts of this project (its environment, mechanisms, commands) and how the user wants to work in it. Where they differ from the defaults above, they win.\n\n${files}`
51
51
  : '';
52
52
 
53
- return `You are ${APP_NAME}, an interactive command line agent modelled on Claude Code. You help the user with software engineering tasks (solving bugs, adding functionality, refactoring, explaining code, running builds and tests) and with anything else they ask that you can do with your knowledge and the tools on this machine. Use the instructions below and the tools available to you to assist the user.
54
-
55
- IMPORTANT: Assist with authorized security testing, defensive security, CTF challenges, and educational contexts. Refuse requests for destructive techniques, DoS attacks, mass targeting, supply chain compromise, or detection evasion for malicious purposes. Dual-use security tools (C2 frameworks, credential testing, exploit development) require clear authorization context: pentesting engagements, CTF competitions, security research, or defensive use cases.
56
- Do not make up URLs. Give a URL only when it came from the user, a file or a tool result, or when you know it exists; when you are not sure of an address, look it up with WebSearch or say that you are not sure.
53
+ return `You are ${APP_NAME}, an interactive command line agent. You help the user with software engineering tasks (solving bugs, adding functionality, refactoring, explaining code, running builds and tests) and with anything else they ask that you can do with your knowledge and the tools on this machine. Use the instructions below and the tools available to you to assist the user.
57
54
 
58
55
  # Communication
59
56
  - Your output is shown in a terminal, rendered as GitHub-flavored markdown in a monospace font: keep it scannable.
package/src/ratelimit.js CHANGED
@@ -240,7 +240,7 @@ export function describePause(ev, now = Date.now()) {
240
240
  if (ev.waitingForLogin) {
241
241
  const until = ev.giveUpAt ? ` Giving up at ${formatClock(ev.giveUpAt, now)}.` : '';
242
242
  if (ev.renewError) return `The limit has reset, but the login could not be renewed: ${ev.renewError} Trying again every 5 minutes, and this continues by itself as soon as the login is valid.${until}`;
243
- return `The limit has reset, but the Claude Code login has expired and cannot be renewed from here. Waiting for it to be renewed: run claude once, and this continues by itself.${until}`;
243
+ return `The limit has reset, but the Claude subscription login has expired and cannot be renewed from here. Waiting for it to be renewed: run claude once, and this continues by itself.${until}`;
244
244
  }
245
245
  const label = capitalize(ev.label || 'rate limit');
246
246
  const left = humanDuration(Math.max(0, ev.resumeAt - now));
@@ -249,7 +249,7 @@ export function describePause(ev, now = Date.now()) {
249
249
  ? `${label} reached and the server gave no reset time. Checking again at ${formatClock(ev.resumeAt, now)} (in ${left}), and every few minutes after that, then continuing automatically.`
250
250
  : `${label} reached. Pausing until ${formatClock(ev.resumeAt, now)} (in ${left}), then continuing automatically.`;
251
251
  const warning = ev.loginExpiresAt && ev.loginExpiresAt < ev.resumeAt
252
- ? ` The Claude Code login expires at ${formatClock(ev.loginExpiresAt, now)}, before that, and it cannot be renewed from here. If no Claude Code session is running to renew it, run claude once after the reset: this continues by itself once the login is valid again.`
252
+ ? ` The Claude subscription login expires at ${formatClock(ev.loginExpiresAt, now)}, before that, and it cannot be renewed from here. If no claude command is running to renew it, run claude once after the reset: this continues by itself once the login is valid again.`
253
253
  : '';
254
254
  return text + warning;
255
255
  }
package/src/ui/repl.js CHANGED
@@ -269,10 +269,8 @@ export class App {
269
269
  const stdin = this.stdin;
270
270
  stdin.setRawMode(true);
271
271
  // Where the cursor is, before anything is drawn: the input box is kept on the last rows of the window from
272
- // there (see screen.js). CLAUDE_PRO_PIN_INPUT=0 (here or in the settings) leaves it right below the output.
273
- const pinOff = (v) => /^(0|false|no|off)$/i.test(v || '');
274
- if (pinOff(process.env.CLAUDE_PRO_PIN_INPUT)) this.screen.pin = false;
275
- else if (stdin.isTTY && this.stdout.isTTY && !this.headless) this.screen.pinFrom(await queryCursorRow(stdin, this.stdout));
272
+ // there (see screen.js).
273
+ if (stdin.isTTY && this.stdout.isTTY && !this.headless) this.screen.pinFrom(await queryCursorRow(stdin, this.stdout));
276
274
  stdin.setEncoding('utf8');
277
275
  this.stdout.write(ESC.bracketedPasteOn);
278
276
  this.watchCopies();
@@ -292,7 +290,6 @@ export class App {
292
290
  this.screen.schedule();
293
291
  };
294
292
  this.commands = buildCommands(this);
295
- if (pinOff(this.config.env.CLAUDE_PRO_PIN_INPUT)) { this.screen.pin = false; this.screen.pinned = null; }
296
293
  // What the session showed before a restart: scrolled back to in fullscreen, repainted after a resize otherwise.
297
294
  if (Array.isArray(this.flags.restart?.screenHistory)) this.screen.history = this.flags.restart.screenHistory.filter((l) => typeof l === 'string');
298
295
  if (this.fullscreenWanted()) this.screen.setFull(true);
@@ -468,7 +465,7 @@ export class App {
468
465
  id: this.flags.restart?.peerId,
469
466
  onMessage: (msg) => this.onPeerMessage(msg),
470
467
  getStatus: () => ({ busy: this.working() }),
471
- info: () => ({ kind: this.headless ? 'background' : 'terminal', remoteId: this.remote?.id || this.flags.remoteId || this.flags.restart?.remote?.id || null, conversationId: this.store.id }),
468
+ info: () => ({ kind: this.headless ? 'background' : 'terminal', remoteId: this.remote?.id || this.flags.remoteId || this.flags.restart?.remote?.id || null, conversationId: this.store.id, attached: this.vterm ? this.vterm.clients.size : 0 }),
472
469
  onControl: (body) => this.onControl(body),
473
470
  onAttach: this.headless ? (socket, size) => this.attachClient(socket, size) : null,
474
471
  }).start();
@@ -500,13 +497,24 @@ export class App {
500
497
  }
501
498
 
502
499
  // `claude-pro attach` (see attach.js) on this background session: the screen, drawn whole for it, and its keys.
503
- // From the client: one JSON object a line, {keys: base64} or {resize: [columns, rows]}.
500
+ // From the client: one JSON object a line, {keys: base64} or {resize: [columns, rows]}. A turn that runs goes on:
501
+ // the client gets the conversation as it is (scrolled back with the wheel, PgUp), the live part and what follows.
502
+ // The registry says how many are attached (the web page shows it, see background.js); one that goes away
503
+ // (detached, its window closed, its process killed) changes nothing else.
504
504
  attachClient(socket, { cols, rows } = {}) {
505
505
  const client = { write: (d) => { if (!socket.destroyed) socket.write(d); }, close: () => socket.end() };
506
506
  socket.on('error', () => { /* its close follows */ });
507
- socket.on('close', () => this.vterm.detach(client));
507
+ // An HTTP server's sockets stay half open when the other side closes (allowHalfOpen): without this, a client that
508
+ // went away (its window closed, its process killed) would count as attached until a write failed, a minute later.
509
+ socket.on('end', () => socket.destroy());
510
+ socket.on('close', () => {
511
+ this.vterm.detach(client);
512
+ this.peers?.update();
513
+ });
508
514
  this.vterm.attach(client, { cols, rows });
515
+ this.peers?.update();
509
516
  client.write(`${ATTACH_MODES}${ESC.bracketedPasteOn}`);
517
+ this.screen.title = ''; // its window gets the title too (sent again with the next draw)
510
518
  if (this.screen.full) this.screen.repaint();
511
519
  let buf = '';
512
520
  // (no setEncoding: an HTTP server's socket refuses it; the lines are ASCII anyway, JSON with base64)
@@ -975,7 +983,7 @@ export class App {
975
983
  if (w) {
976
984
  const label = w.label.charAt(0).toUpperCase() + w.label.slice(1);
977
985
  rateWait = {
978
- text: w.waitingForLogin ? 'Waiting for the Claude Code login to be renewed' : `${w.overloaded ? label : `${label} reached`}${w.polling ? ' · checking again' : ` · resumes at ${formatClock(w.resumeAt)}`}`,
986
+ text: w.waitingForLogin ? 'Waiting for the Claude subscription login to be renewed' : `${w.overloaded ? label : `${label} reached`}${w.polling ? ' · checking again' : ` · resumes at ${formatClock(w.resumeAt)}`}`,
979
987
  resumeIn: w.resumeAt - Date.now(),
980
988
  };
981
989
  }
@@ -1417,7 +1425,7 @@ export class App {
1417
1425
  const model = cfg.mainModel;
1418
1426
  const lines = [
1419
1427
  c.claude('╭' + '─'.repeat(w - 2) + '╮'),
1420
- row(`${c.claude('✻')} Welcome to ${c.bold(APP_NAME)}! ${c.dim(`v${VERSION} · a Claude Code style agent`)}`),
1428
+ row(`${c.claude('✻')} Welcome to ${c.bold(APP_NAME)}! ${c.dim(`v${VERSION} · a command line coding agent`)}`),
1421
1429
  row(''),
1422
1430
  row(c.dim(' /help for help, /status for your current setup')),
1423
1431
  row(''),
@@ -1465,13 +1473,13 @@ export class App {
1465
1473
  return mode === 'fullscreen' && this.stdout.isTTY !== false;
1466
1474
  }
1467
1475
 
1468
- // Fullscreen: the wheel scrolls the conversation (CLAUDE_PRO_SCROLL_SPEED rows a notch, 3 by default); a drag,
1476
+ // Fullscreen: the wheel scrolls the conversation (3 rows a notch); a drag,
1469
1477
  // a double or a triple click selects, and what is selected goes to the clipboard (see Screen.mouse).
1470
1478
  onMouse(m) {
1471
1479
  if (!this.screen.full || this.exiting) return;
1472
1480
  if (m.button & 64) {
1473
1481
  if (m.button & 128) return;
1474
- const speed = Math.max(1, Math.min(20, Number(this.config.env.CLAUDE_PRO_SCROLL_SPEED) || 3));
1482
+ const speed = 3;
1475
1483
  this.screen.scrollBy(m.button & 1 ? -speed : speed);
1476
1484
  return;
1477
1485
  }
@@ -2445,7 +2453,7 @@ export class App {
2445
2453
  const w = this.rateWait;
2446
2454
  const left = humanDuration(w.resumeAt - Date.now()); // the same wording as the notice above it
2447
2455
  const esc = c.dim(`(${this.controller?.signal.aborted ? 'cancelling…' : 'esc to cancel'})`);
2448
- if (w.waitingForLogin) return c.yellow(`${frame} Waiting for the Claude Code login to be renewed · checking again in ${left}`) + ' ' + esc;
2456
+ if (w.waitingForLogin) return c.yellow(`${frame} Waiting for the Claude subscription login to be renewed · checking again in ${left}`) + ' ' + esc;
2449
2457
  const label = w.label.charAt(0).toUpperCase() + w.label.slice(1);
2450
2458
  const when = w.polling ? `checking again in ${left}` : `resumes at ${formatClock(w.resumeAt)} (in ${left})`;
2451
2459
  return c.yellow(`${frame} ${w.overloaded ? label : `${label} reached`} · ${when}`) + ' ' + esc;