@yanzc/claude-pro 0.10.0 → 0.12.0
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/README.md +66 -35
- package/package.json +1 -1
- package/src/agent.js +16 -6
- package/src/browser/session.js +32 -2
- package/src/commands.js +160 -11
- package/src/config.js +42 -10
- package/src/live.js +148 -0
- package/src/main.js +5 -3
- package/src/peers.js +64 -10
- package/src/providers.js +10 -1
- package/src/remote.js +90 -243
- package/src/runtime.js +36 -11
- package/src/selfcheck.js +3 -3
- package/src/session.js +116 -7
- package/src/supervisor.js +1 -1
- package/src/tools/bash.js +23 -20
- package/src/tools/browser.js +14 -8
- package/src/tools/code.js +18 -11
- package/src/tools/peers.js +6 -5
- package/src/tools/restart.js +1 -1
- package/src/ui/dialogs.js +23 -30
- package/src/ui/editor.js +65 -169
- package/src/ui/repl.js +470 -449
- package/src/ui/screen.js +47 -674
- package/src/updater.js +5 -4
- package/src/utils/shell.js +4 -5
- package/src/web/api.js +787 -0
- package/src/web/app.css +412 -0
- package/src/web/app.js +1850 -0
- package/src/web/data.js +424 -0
- package/src/web/host.js +334 -0
- package/src/web/login.html +66 -0
- package/src/web/page.html +41 -0
- package/src/web/remote-access.js +232 -0
- package/src/web/server.js +459 -0
package/src/updater.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Manual update support for `npm i -g claude-pro`: the interactive session checks npm and installs a release only
|
|
2
|
-
// when `/update` asks for it
|
|
2
|
+
// when `/update` or the web console's update button asks for it. Installation is serialized by a lock file and the session loads
|
|
3
3
|
// the new package with a restart (the conversation carries over). A git checkout (the development copy) is never
|
|
4
4
|
// touched.
|
|
5
5
|
|
|
@@ -100,19 +100,20 @@ function runNpm(args, { timeoutMs = 300_000 } = {}) {
|
|
|
100
100
|
|
|
101
101
|
// Look for a newer version on npm. Resolves with {status: 'dev'|'current'|'available'|'installed', version}:
|
|
102
102
|
// 'available' to be installed (installUpdate), 'installed' when it is on disk already (another session installed
|
|
103
|
-
// it: a restart loads it).
|
|
104
|
-
// /update is the only caller.)
|
|
103
|
+
// it: a restart loads it). Checking does not install anything.
|
|
105
104
|
export async function checkForUpdate() {
|
|
106
105
|
if (!installedByNpm()) return { status: 'dev' };
|
|
106
|
+
const disk = installedVersion();
|
|
107
|
+
if (isNewer(disk, VERSION)) return { status: 'installed', version: disk };
|
|
107
108
|
const latest = await latestVersion();
|
|
108
109
|
if (!isNewer(latest, VERSION)) return { status: 'current', version: latest };
|
|
109
|
-
if (!isNewer(latest, installedVersion())) return { status: 'installed', version: installedVersion() };
|
|
110
110
|
return { status: 'available', version: latest };
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
// Install `version` with npm. Resolves with {status: 'updated'|'installed'|'locked'|'failed', version, error}:
|
|
114
114
|
// 'locked' while another session of the machine is installing.
|
|
115
115
|
export async function installUpdate(version) {
|
|
116
|
+
if (!/^\d+\.\d+\.\d+$/.test(String(version))) return { status: 'failed', error: 'invalid npm version' };
|
|
116
117
|
if (!takeLock()) return { status: 'locked', version };
|
|
117
118
|
try {
|
|
118
119
|
if (!isNewer(version, installedVersion())) return { status: 'installed', version: installedVersion() };
|
package/src/utils/shell.js
CHANGED
|
@@ -279,7 +279,7 @@ export function hasRipgrep(config) { return ripgrepPath(config) !== null; }
|
|
|
279
279
|
|
|
280
280
|
// `stdin`: text to feed the command on standard input (hooks get their event JSON this way).
|
|
281
281
|
// Without it the command's stdin is closed, so nothing can hang waiting for input.
|
|
282
|
-
export function spawnShell(shell, command, { cwd, env,
|
|
282
|
+
export function spawnShell(shell, command, { cwd, env, stdin }) {
|
|
283
283
|
const withStdin = typeof stdin === 'string';
|
|
284
284
|
const stdio = [withStdin ? 'pipe' : 'ignore', 'pipe', 'pipe'];
|
|
285
285
|
const feed = (child) => {
|
|
@@ -291,20 +291,19 @@ export function spawnShell(shell, command, { cwd, env, cwdFile, stdin }) {
|
|
|
291
291
|
cwd, env, windowsHide: true, windowsVerbatimArguments: true, stdio,
|
|
292
292
|
}));
|
|
293
293
|
}
|
|
294
|
-
// The command is evaluated via an env var so no quoting is needed
|
|
295
|
-
//
|
|
294
|
+
// The command is evaluated via an env var so no quoting is needed. Each command starts in the session's
|
|
295
|
+
// directory: a `cd` lasts for that command only (the user's choice, 2026-11-21). On Windows the script first
|
|
296
296
|
// writes its own (MSYS) process id to a file, which is how killTree finds everything under it.
|
|
297
297
|
const pidFile = isWin ? path.join(os.tmpdir(), `claude-pro-pid-${process.pid}-${Date.now()}-${Math.random().toString(36).slice(2)}`) : null;
|
|
298
298
|
const script = [
|
|
299
299
|
...(pidFile ? ['if [ -n "$CLAUDE_PRO_PID_FILE" ]; then echo $$ > "$CLAUDE_PRO_PID_FILE"; fi'] : []),
|
|
300
300
|
`eval "$CLAUDE_PRO_COMMAND"${withStdin ? '' : ' < /dev/null'}`,
|
|
301
301
|
'__ccc_status=$?',
|
|
302
|
-
'if [ -n "$CLAUDE_PRO_CWD_FILE" ]; then { pwd -W 2>/dev/null || pwd -P; } > "$CLAUDE_PRO_CWD_FILE" 2>/dev/null; fi',
|
|
303
302
|
'exit $__ccc_status',
|
|
304
303
|
].join('\n');
|
|
305
304
|
const child = spawn(shell.path, ['-c', script], {
|
|
306
305
|
cwd,
|
|
307
|
-
env: { ...env, CLAUDE_PRO_COMMAND: command,
|
|
306
|
+
env: { ...env, CLAUDE_PRO_COMMAND: command, CLAUDE_PRO_PID_FILE: pidFile || '' },
|
|
308
307
|
windowsHide: true,
|
|
309
308
|
detached: !isWin,
|
|
310
309
|
stdio,
|