@notiamo/runner 0.1.0 → 0.1.1
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/cli.js +14 -10
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -30256,7 +30256,7 @@ async function runInit(deps) {
|
|
|
30256
30256
|
const env = deps.env ?? process.env;
|
|
30257
30257
|
const print = deps.print ?? ((s) => console.log(s));
|
|
30258
30258
|
const ask = async (q2, def) => (await deps.prompt(q2, { default: def })).trim() || def;
|
|
30259
|
-
const token = (await deps.prompt("Runner token (
|
|
30259
|
+
const token = (await deps.prompt("Runner token (made in Notiamo under Settings \u203A Agent runs \u203A Runners; nothing shows while you paste it): ", { hidden: true })).trim();
|
|
30260
30260
|
if (!token.startsWith("ntr_")) throw new Error("That is not a runner token: it starts with ntr_. Make one in Notiamo: Settings \u203A Agent runs \u203A Runners.");
|
|
30261
30261
|
const host = normalizeHost(await ask("Notiamo address: ", DEFAULT_HOST));
|
|
30262
30262
|
const hostname3 = deps.hostname ?? os2.hostname();
|
|
@@ -30264,6 +30264,12 @@ async function runInit(deps) {
|
|
|
30264
30264
|
const version2 = await deps.exec("claude", ["--version"], { env });
|
|
30265
30265
|
if (version2.code !== 0) throw new Error("Claude Code is not installed. Install it first: https://claude.com/claude-code");
|
|
30266
30266
|
const engineVersion = version2.stdout.trim().slice(0, 100) || "unknown";
|
|
30267
|
+
try {
|
|
30268
|
+
await new NotiamoApi({ host, token }, deps.fetch).hello({ version: VERSION, os: platform, engine: "claude", engineVersion });
|
|
30269
|
+
} catch (e) {
|
|
30270
|
+
if (e instanceof ApiError && e.status === 401) throw new Error("The runner token was not accepted.");
|
|
30271
|
+
throw new Error(`Notiamo at ${host} did not answer: ${e instanceof Error ? e.message : String(e)}`);
|
|
30272
|
+
}
|
|
30267
30273
|
const claudeEnv = { ...env, CLAUDE_CONFIG_DIR: p.claudeConfigDir };
|
|
30268
30274
|
if (!deps.skipLogin) {
|
|
30269
30275
|
print("Sign Claude Code in for the runner (its own sign-in, kept apart from yours):");
|
|
@@ -30271,12 +30277,6 @@ async function runInit(deps) {
|
|
|
30271
30277
|
}
|
|
30272
30278
|
const check2 = await deps.exec("claude", ["-p", "say ok"], { env: claudeEnv });
|
|
30273
30279
|
if (check2.code !== 0) throw new Error("Claude Code is not signed in for the runner.");
|
|
30274
|
-
try {
|
|
30275
|
-
await new NotiamoApi({ host, token }, deps.fetch).hello({ version: VERSION, os: platform, engine: "claude", engineVersion });
|
|
30276
|
-
} catch (e) {
|
|
30277
|
-
if (e instanceof ApiError && e.status === 401) throw new Error("The runner token was not accepted.");
|
|
30278
|
-
throw new Error(`Notiamo at ${host} did not answer: ${e instanceof Error ? e.message : String(e)}`);
|
|
30279
|
-
}
|
|
30280
30280
|
saveConfig({ host, token, name, dataDir: dir, engine: "claude" }, dir);
|
|
30281
30281
|
await installService({
|
|
30282
30282
|
platform,
|
|
@@ -62675,10 +62675,14 @@ async function prompt(q2, opts = {}) {
|
|
|
62675
62675
|
cb();
|
|
62676
62676
|
} });
|
|
62677
62677
|
const rl = createInterface({ input: process.stdin, output: output2, terminal: process.stdin.isTTY === true });
|
|
62678
|
+
const text = opts.default ? `${q2.replace(/:\s*$/, "")} [${opts.default}]: ` : q2;
|
|
62678
62679
|
try {
|
|
62679
|
-
|
|
62680
|
-
|
|
62681
|
-
|
|
62680
|
+
if (opts.hidden) {
|
|
62681
|
+
process.stdout.write(text);
|
|
62682
|
+
muted = true;
|
|
62683
|
+
return await rl.question("");
|
|
62684
|
+
}
|
|
62685
|
+
return await rl.question(text);
|
|
62682
62686
|
} finally {
|
|
62683
62687
|
if (muted) process.stdout.write("\n");
|
|
62684
62688
|
rl.close();
|