@yoooclaw/phone-notifications 1.7.0 → 1.7.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/index.js +49 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3648,7 +3648,7 @@ var require_websocket_server = __commonJS({
|
|
|
3648
3648
|
|
|
3649
3649
|
// src/index.ts
|
|
3650
3650
|
import { readFileSync as readFileSync14 } from "fs";
|
|
3651
|
-
import { basename as basename2, dirname as
|
|
3651
|
+
import { basename as basename2, dirname as dirname6 } from "path";
|
|
3652
3652
|
|
|
3653
3653
|
// src/light/protocol.ts
|
|
3654
3654
|
var MAX_LIGHT_SEGMENTS = 12;
|
|
@@ -3794,11 +3794,11 @@ import { randomUUID } from "crypto";
|
|
|
3794
3794
|
|
|
3795
3795
|
// src/env.ts
|
|
3796
3796
|
import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, writeFileSync } from "fs";
|
|
3797
|
-
import { dirname } from "path";
|
|
3797
|
+
import { dirname as dirname2 } from "path";
|
|
3798
3798
|
|
|
3799
3799
|
// src/host.ts
|
|
3800
3800
|
import { existsSync, readFileSync } from "fs";
|
|
3801
|
-
import { join } from "path";
|
|
3801
|
+
import { dirname, join } from "path";
|
|
3802
3802
|
function trimToUndefined(value) {
|
|
3803
3803
|
if (typeof value !== "string") {
|
|
3804
3804
|
return void 0;
|
|
@@ -3809,6 +3809,18 @@ function trimToUndefined(value) {
|
|
|
3809
3809
|
function homeDir() {
|
|
3810
3810
|
return process.env.HOME || process.env.USERPROFILE || "/tmp";
|
|
3811
3811
|
}
|
|
3812
|
+
function expandUserPath(value) {
|
|
3813
|
+
if (!value) {
|
|
3814
|
+
return void 0;
|
|
3815
|
+
}
|
|
3816
|
+
if (value === "~") {
|
|
3817
|
+
return homeDir();
|
|
3818
|
+
}
|
|
3819
|
+
if (value.startsWith("~/")) {
|
|
3820
|
+
return join(homeDir(), value.slice(2));
|
|
3821
|
+
}
|
|
3822
|
+
return value;
|
|
3823
|
+
}
|
|
3812
3824
|
function candidateMetaPaths() {
|
|
3813
3825
|
const home = homeDir();
|
|
3814
3826
|
return [
|
|
@@ -3824,8 +3836,8 @@ function loadQClawMeta() {
|
|
|
3824
3836
|
try {
|
|
3825
3837
|
const parsed = JSON.parse(readFileSync(metaPath, "utf-8"));
|
|
3826
3838
|
return {
|
|
3827
|
-
stateDir: trimToUndefined(parsed?.stateDir),
|
|
3828
|
-
configPath: trimToUndefined(parsed?.configPath)
|
|
3839
|
+
stateDir: expandUserPath(trimToUndefined(parsed?.stateDir)),
|
|
3840
|
+
configPath: expandUserPath(trimToUndefined(parsed?.configPath))
|
|
3829
3841
|
};
|
|
3830
3842
|
} catch {
|
|
3831
3843
|
}
|
|
@@ -3833,21 +3845,42 @@ function loadQClawMeta() {
|
|
|
3833
3845
|
return void 0;
|
|
3834
3846
|
}
|
|
3835
3847
|
function resolveStateDirFromEnv() {
|
|
3836
|
-
return
|
|
3848
|
+
return expandUserPath(
|
|
3849
|
+
trimToUndefined(process.env.OPENCLAW_STATE_DIR) ?? trimToUndefined(process.env.QCLAW_STATE_DIR) ?? trimToUndefined(process.env.OPENCLAW_ROOT) ?? trimToUndefined(process.env.OPENCLAW_HOME) ?? trimToUndefined(process.env.QCLAW_HOME)
|
|
3850
|
+
);
|
|
3851
|
+
}
|
|
3852
|
+
function resolveConfigPathFromEnv() {
|
|
3853
|
+
return expandUserPath(
|
|
3854
|
+
trimToUndefined(process.env.OPENCLAW_CONFIG_PATH) ?? trimToUndefined(process.env.QCLAW_CONFIG_PATH)
|
|
3855
|
+
);
|
|
3856
|
+
}
|
|
3857
|
+
function hasOpenClawMarkers() {
|
|
3858
|
+
const baseDir = join(homeDir(), ".openclaw");
|
|
3859
|
+
return [
|
|
3860
|
+
join(baseDir, "openclaw.json"),
|
|
3861
|
+
join(baseDir, "credentials.json"),
|
|
3862
|
+
join(baseDir, "extensions")
|
|
3863
|
+
].some((candidate) => existsSync(candidate));
|
|
3837
3864
|
}
|
|
3838
3865
|
function resolveStateDir() {
|
|
3839
3866
|
const envDir = resolveStateDirFromEnv();
|
|
3840
3867
|
if (envDir) {
|
|
3841
3868
|
return envDir;
|
|
3842
3869
|
}
|
|
3870
|
+
if (hasOpenClawMarkers()) {
|
|
3871
|
+
return join(homeDir(), ".openclaw");
|
|
3872
|
+
}
|
|
3843
3873
|
const meta = loadQClawMeta();
|
|
3844
3874
|
if (meta?.stateDir) {
|
|
3845
3875
|
return meta.stateDir;
|
|
3846
3876
|
}
|
|
3877
|
+
if (meta?.configPath) {
|
|
3878
|
+
return dirname(meta.configPath);
|
|
3879
|
+
}
|
|
3847
3880
|
return join(homeDir(), ".openclaw");
|
|
3848
3881
|
}
|
|
3849
3882
|
function resolveConfigPath(stateDir = resolveStateDir()) {
|
|
3850
|
-
const envConfigPath =
|
|
3883
|
+
const envConfigPath = resolveConfigPathFromEnv();
|
|
3851
3884
|
if (envConfigPath) {
|
|
3852
3885
|
return envConfigPath;
|
|
3853
3886
|
}
|
|
@@ -3893,7 +3926,7 @@ function saveEnvName(env) {
|
|
|
3893
3926
|
throw new Error(`\u65E0\u6548\u7684\u73AF\u5883\u540D\u79F0: ${env}\uFF0C\u53EF\u9009\u503C: ${[...VALID_ENVS].join(", ")}`);
|
|
3894
3927
|
}
|
|
3895
3928
|
const filePath = envFilePath();
|
|
3896
|
-
mkdirSync(
|
|
3929
|
+
mkdirSync(dirname2(filePath), { recursive: true, mode: 448 });
|
|
3897
3930
|
writeFileSync(filePath, JSON.stringify({ env }, null, 2), {
|
|
3898
3931
|
encoding: "utf-8",
|
|
3899
3932
|
mode: 384
|
|
@@ -3964,7 +3997,7 @@ import {
|
|
|
3964
3997
|
writeFileSync as writeFileSync2,
|
|
3965
3998
|
watch
|
|
3966
3999
|
} from "fs";
|
|
3967
|
-
import { dirname as
|
|
4000
|
+
import { dirname as dirname3, basename } from "path";
|
|
3968
4001
|
function credentialsPath() {
|
|
3969
4002
|
return resolveStateFile("credentials.json");
|
|
3970
4003
|
}
|
|
@@ -3979,7 +4012,7 @@ function readCredentials() {
|
|
|
3979
4012
|
}
|
|
3980
4013
|
function writeCredentials(creds) {
|
|
3981
4014
|
const path2 = credentialsPath();
|
|
3982
|
-
mkdirSync2(
|
|
4015
|
+
mkdirSync2(dirname3(path2), { recursive: true, mode: 448 });
|
|
3983
4016
|
writeFileSync2(path2, JSON.stringify(creds, null, 2), {
|
|
3984
4017
|
encoding: "utf-8",
|
|
3985
4018
|
mode: 384
|
|
@@ -4000,7 +4033,7 @@ function requireApiKey() {
|
|
|
4000
4033
|
}
|
|
4001
4034
|
function watchCredentials(onChange) {
|
|
4002
4035
|
const path2 = credentialsPath();
|
|
4003
|
-
const dir =
|
|
4036
|
+
const dir = dirname3(path2);
|
|
4004
4037
|
const filename = basename(path2);
|
|
4005
4038
|
let debounceTimer = null;
|
|
4006
4039
|
const delayMs = 200;
|
|
@@ -5447,11 +5480,11 @@ import {
|
|
|
5447
5480
|
unlinkSync,
|
|
5448
5481
|
writeFileSync as writeFileSync9
|
|
5449
5482
|
} from "fs";
|
|
5450
|
-
import { dirname as
|
|
5483
|
+
import { dirname as dirname5, join as join10 } from "path";
|
|
5451
5484
|
|
|
5452
5485
|
// src/tunnel/relay-client.ts
|
|
5453
5486
|
import { writeFileSync as writeFileSync8, mkdirSync as mkdirSync6 } from "fs";
|
|
5454
|
-
import { dirname as
|
|
5487
|
+
import { dirname as dirname4 } from "path";
|
|
5455
5488
|
|
|
5456
5489
|
// node_modules/.pnpm/ws@8.19.0/node_modules/ws/wrapper.mjs
|
|
5457
5490
|
var import_stream = __toESM(require_stream(), 1);
|
|
@@ -5483,7 +5516,7 @@ var RelayClient = class {
|
|
|
5483
5516
|
lastDisconnectReason
|
|
5484
5517
|
};
|
|
5485
5518
|
try {
|
|
5486
|
-
mkdirSync6(
|
|
5519
|
+
mkdirSync6(dirname4(this.opts.statusFilePath), { recursive: true });
|
|
5487
5520
|
writeFileSync8(this.opts.statusFilePath, JSON.stringify(info, null, 2));
|
|
5488
5521
|
} catch {
|
|
5489
5522
|
}
|
|
@@ -6360,7 +6393,7 @@ function createTunnelService(opts) {
|
|
|
6360
6393
|
}
|
|
6361
6394
|
}
|
|
6362
6395
|
function acquireLock(filePath) {
|
|
6363
|
-
mkdirSync7(
|
|
6396
|
+
mkdirSync7(dirname5(filePath), { recursive: true });
|
|
6364
6397
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
6365
6398
|
try {
|
|
6366
6399
|
const fd = openSync(filePath, "wx", 384);
|
|
@@ -6826,7 +6859,7 @@ var index_default = {
|
|
|
6826
6859
|
if (openclawDir) return openclawDir;
|
|
6827
6860
|
if (!workspaceDir) return void 0;
|
|
6828
6861
|
if (basename2(workspaceDir) !== "workspace") return void 0;
|
|
6829
|
-
return
|
|
6862
|
+
return dirname6(workspaceDir);
|
|
6830
6863
|
};
|
|
6831
6864
|
api.registerCli(
|
|
6832
6865
|
(ctx) => {
|