sakuraai 0.0.14 → 0.0.15
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 +21 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4651,6 +4651,7 @@ var init_server = __esm({
|
|
|
4651
4651
|
});
|
|
4652
4652
|
|
|
4653
4653
|
// src/daemon/tsnet.ts
|
|
4654
|
+
import crypto from "crypto";
|
|
4654
4655
|
import fs21 from "fs";
|
|
4655
4656
|
import path19 from "path";
|
|
4656
4657
|
import { fileURLToPath } from "url";
|
|
@@ -4683,15 +4684,30 @@ function startTsnet(port2) {
|
|
|
4683
4684
|
return;
|
|
4684
4685
|
}
|
|
4685
4686
|
stopping = false;
|
|
4687
|
+
resetStateIfKeyChanged(ts.authKey);
|
|
4686
4688
|
spawnSidecar(bin, ts.controlUrl, ts.authKey, ts.hostname || cfg.machineName, port2);
|
|
4687
4689
|
}
|
|
4690
|
+
function resetStateIfKeyChanged(authKey) {
|
|
4691
|
+
const hash = crypto.createHash("sha256").update(authKey).digest("hex");
|
|
4692
|
+
let prev = null;
|
|
4693
|
+
try {
|
|
4694
|
+
prev = fs21.readFileSync(KEY_MARK, "utf8").trim();
|
|
4695
|
+
} catch {
|
|
4696
|
+
}
|
|
4697
|
+
if (prev && prev !== hash) {
|
|
4698
|
+
log.info("tailnet key changed \u2014 re-registering this Mac on the new key");
|
|
4699
|
+
fs21.rmSync(STATE_DIR, { recursive: true, force: true });
|
|
4700
|
+
}
|
|
4701
|
+
fs21.mkdirSync(STATE_DIR, { recursive: true });
|
|
4702
|
+
fs21.writeFileSync(KEY_MARK, hash);
|
|
4703
|
+
}
|
|
4688
4704
|
function spawnSidecar(bin, controlUrl, authKey, hostname2, port2) {
|
|
4689
4705
|
const env = {
|
|
4690
4706
|
...process.env,
|
|
4691
4707
|
SAKURA_TS_CONTROL_URL: controlUrl,
|
|
4692
4708
|
SAKURA_TS_AUTH_KEY: authKey,
|
|
4693
4709
|
SAKURA_TS_HOSTNAME: hostname2,
|
|
4694
|
-
SAKURA_TS_STATE_DIR:
|
|
4710
|
+
SAKURA_TS_STATE_DIR: STATE_DIR,
|
|
4695
4711
|
SAKURA_TS_STATE_FILE: TSNET_PATH,
|
|
4696
4712
|
SAKURA_TS_PORT: String(port2)
|
|
4697
4713
|
};
|
|
@@ -4728,7 +4744,7 @@ function stopTsnet() {
|
|
|
4728
4744
|
} catch {
|
|
4729
4745
|
}
|
|
4730
4746
|
}
|
|
4731
|
-
var child, stopping, restartTimer;
|
|
4747
|
+
var child, stopping, restartTimer, STATE_DIR, KEY_MARK;
|
|
4732
4748
|
var init_tsnet = __esm({
|
|
4733
4749
|
"src/daemon/tsnet.ts"() {
|
|
4734
4750
|
"use strict";
|
|
@@ -4737,6 +4753,8 @@ var init_tsnet = __esm({
|
|
|
4737
4753
|
child = null;
|
|
4738
4754
|
stopping = false;
|
|
4739
4755
|
restartTimer = null;
|
|
4756
|
+
STATE_DIR = path19.join(SAKURA_DIR, "tsnet-state");
|
|
4757
|
+
KEY_MARK = path19.join(STATE_DIR, "joined-with");
|
|
4740
4758
|
}
|
|
4741
4759
|
});
|
|
4742
4760
|
|
|
@@ -4985,7 +5003,7 @@ var init_pair = __esm({
|
|
|
4985
5003
|
import { Command } from "commander";
|
|
4986
5004
|
|
|
4987
5005
|
// src/version.ts
|
|
4988
|
-
var VERSION = "0.0.
|
|
5006
|
+
var VERSION = "0.0.15";
|
|
4989
5007
|
|
|
4990
5008
|
// src/index.ts
|
|
4991
5009
|
init_config();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sakuraai",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"description": "Sakura Agent CLI + local runtime for managing AI coding sessions (Claude Code, Codex, OpenCode, ZCode, DeepSeek) and reaching them privately from the Sakura mobile app over Tailscale",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|