mtech-ai-local-runner 0.1.103 → 0.1.104
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 +6 -0
- package/dist/src/commands/claude-token.js +24 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## 0.1.104: the token prompt is hidden
|
|
2
|
+
|
|
3
|
+
`setup --claude-token` no longer prints the pasted token. If you used it on 0.1.103, revoke that token and store a
|
|
4
|
+
fresh one. Released in 0.1.104; its Local Fix receipt must be listed on the Gateway before a runner on it prepares a
|
|
5
|
+
Local Fix.
|
|
6
|
+
|
|
1
7
|
## 0.1.103: Claude logs in with the runner's own token
|
|
2
8
|
|
|
3
9
|
Run `npx mtech-ai-local-runner@latest setup --claude-token` once and paste the token from `claude setup-token`. Local
|
|
@@ -1,29 +1,33 @@
|
|
|
1
1
|
import { execFileSync } from "node:child_process";
|
|
2
|
-
import readline from "node:readline
|
|
2
|
+
import readline from "node:readline";
|
|
3
3
|
import { ClaudeRunnerTokenStore, normalizeClaudeRunnerToken } from "../safety/claude-runner-token.js";
|
|
4
4
|
export const CLAUDE_TOKEN_FLAG = "--claude-token";
|
|
5
5
|
export const CLAUDE_TOKEN_RESET_FLAG = "--claude-token-reset";
|
|
6
|
+
/** Reads pasted lines without ever writing them back: readline gets no output stream and runs as a non-terminal, and
|
|
7
|
+
* terminal echo is off while it reads. Lines are joined, so a wrapped paste is fine; an empty line ends the input. */
|
|
8
|
+
export async function readHiddenLines(input, output, prompt, setEcho = () => undefined) {
|
|
9
|
+
output.write(prompt);
|
|
10
|
+
setEcho(false);
|
|
11
|
+
const rl = readline.createInterface({ input, terminal: false });
|
|
12
|
+
try {
|
|
13
|
+
let value = "";
|
|
14
|
+
for await (const raw of rl) {
|
|
15
|
+
const line = raw.replace(/\s+/g, "");
|
|
16
|
+
if (line === "" && value !== "")
|
|
17
|
+
break;
|
|
18
|
+
value += line;
|
|
19
|
+
}
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
finally {
|
|
23
|
+
rl.close();
|
|
24
|
+
setEcho(true);
|
|
25
|
+
output.write("\n");
|
|
26
|
+
}
|
|
27
|
+
}
|
|
6
28
|
export const terminalHiddenReader = {
|
|
7
29
|
isInteractive: () => process.stdin.isTTY === true,
|
|
8
|
-
|
|
9
|
-
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
10
|
-
process.stdout.write(prompt);
|
|
11
|
-
execFileSync("/bin/stty", ["-echo"], { stdio: "inherit" });
|
|
12
|
-
try {
|
|
13
|
-
let value = "";
|
|
14
|
-
for (;;) {
|
|
15
|
-
const line = (await rl.question("")).replace(/\s+/g, "");
|
|
16
|
-
if (line === "" && value !== "")
|
|
17
|
-
return value;
|
|
18
|
-
value += line;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
finally {
|
|
22
|
-
execFileSync("/bin/stty", ["echo"], { stdio: "inherit" });
|
|
23
|
-
process.stdout.write("\n");
|
|
24
|
-
rl.close();
|
|
25
|
-
}
|
|
26
|
-
},
|
|
30
|
+
readHiddenLines: prompt => readHiddenLines(process.stdin, process.stdout, prompt, on => execFileSync("/bin/stty", [on ? "echo" : "-echo"], { stdio: "inherit" })),
|
|
27
31
|
};
|
|
28
32
|
export async function runClaudeTokenCommand(input) {
|
|
29
33
|
const store = input.store ?? new ClaudeRunnerTokenStore({ stateRoot: input.stateRoot });
|