sakuraai 0.0.9 → 0.0.10
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/index.js +25 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2461,7 +2461,7 @@ var init_pair = __esm({
|
|
|
2461
2461
|
import { Command } from "commander";
|
|
2462
2462
|
|
|
2463
2463
|
// src/version.ts
|
|
2464
|
-
var VERSION = "0.0.
|
|
2464
|
+
var VERSION = "0.0.10";
|
|
2465
2465
|
|
|
2466
2466
|
// src/index.ts
|
|
2467
2467
|
init_config();
|
|
@@ -2522,7 +2522,25 @@ function registerAuth(program) {
|
|
|
2522
2522
|
init_manager();
|
|
2523
2523
|
init_tailscale();
|
|
2524
2524
|
init_auth();
|
|
2525
|
+
init_config();
|
|
2525
2526
|
init_output();
|
|
2527
|
+
var sleep2 = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
2528
|
+
async function tunnelUrl(port2) {
|
|
2529
|
+
const ts = readTsnetState();
|
|
2530
|
+
if (ts?.tailscaleIp && ts.backendState === "Running") return `http://${ts.tailscaleIp}:${port2}`;
|
|
2531
|
+
return await discoverBaseUrl(port2).catch(() => null);
|
|
2532
|
+
}
|
|
2533
|
+
async function waitForTunnel(timeoutMs) {
|
|
2534
|
+
if (!getServerToken()) return false;
|
|
2535
|
+
const deadline = Date.now() + timeoutMs;
|
|
2536
|
+
while (Date.now() < deadline) {
|
|
2537
|
+
const cfg = loadConfig();
|
|
2538
|
+
const ts = readTsnetState();
|
|
2539
|
+
if (cfg.tailscale?.controlUrl && ts?.tailscaleIp && ts.backendState === "Running") return true;
|
|
2540
|
+
await sleep2(500);
|
|
2541
|
+
}
|
|
2542
|
+
return false;
|
|
2543
|
+
}
|
|
2526
2544
|
function registerRuntime(program, version) {
|
|
2527
2545
|
program.command("start").description("Run the Sakura runtime in this terminal (foreground)").option("--auth <token>", "sign in with a CLI token before starting").action(async (opts) => {
|
|
2528
2546
|
if (opts.auth) {
|
|
@@ -2539,9 +2557,11 @@ function registerRuntime(program, version) {
|
|
|
2539
2557
|
if (!isLoggedIn()) die("Not signed in. Run `sakuraai login` first.");
|
|
2540
2558
|
const info0 = start();
|
|
2541
2559
|
success(`Daemon running (pid ${info0.pid}) on ${info0.url}`);
|
|
2542
|
-
const
|
|
2543
|
-
if (
|
|
2544
|
-
|
|
2560
|
+
const ready = await waitForTunnel(2e4);
|
|
2561
|
+
if (ready) {
|
|
2562
|
+
info("Embedded Tailscale tunnel up \u2014 the phone can connect from any network, no Tailscale app needed.");
|
|
2563
|
+
} else if (getServerToken()) {
|
|
2564
|
+
warn("Tunnel not up yet \u2014 pairing over LAN for now. Re-run `sakuraai pair` in a moment for the private URL.");
|
|
2545
2565
|
}
|
|
2546
2566
|
const { showPairing: showPairing2 } = await Promise.resolve().then(() => (init_pair(), pair_exports));
|
|
2547
2567
|
await showPairing2();
|
|
@@ -2555,7 +2575,7 @@ function registerRuntime(program, version) {
|
|
|
2555
2575
|
});
|
|
2556
2576
|
d.command("status").description("Show runtime + connection status").option("--json", "output as JSON").action(async (opts) => {
|
|
2557
2577
|
const i = running();
|
|
2558
|
-
const tailnet = i ? await
|
|
2578
|
+
const tailnet = i ? await tunnelUrl(i.port) : null;
|
|
2559
2579
|
if (opts.json) return printJson({ running: !!i, daemon: i, tailnetBaseUrl: tailnet });
|
|
2560
2580
|
if (!i) return warn("Daemon is not running. Start it with `sakuraai daemon start`.");
|
|
2561
2581
|
success(`Daemon running (pid ${i.pid}) on ${i.url}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sakuraai",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "Sakura Agent CLI + local runtime for managing AI coding sessions (Claude Code, Codex, OpenCode) and reaching them privately from the Sakura mobile app over Tailscale",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|