@signetai/connector-base 0.199.2 → 0.199.4
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 -19
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -32,7 +32,7 @@ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports,
|
|
|
32
32
|
|
|
33
33
|
// src/index.ts
|
|
34
34
|
import { randomBytes } from "node:crypto";
|
|
35
|
-
import { existsSync, readFileSync, renameSync, statSync as statSync2, unlinkSync as unlinkSync2, writeFileSync } from "node:fs";
|
|
35
|
+
import { existsSync, readFileSync, renameSync as renameSync2, statSync as statSync2, unlinkSync as unlinkSync2, writeFileSync } from "node:fs";
|
|
36
36
|
import { homedir } from "node:os";
|
|
37
37
|
import { dirname as dirname5, isAbsolute, join as join3, relative, sep } from "node:path";
|
|
38
38
|
|
|
@@ -43,7 +43,18 @@ import { fileURLToPath } from "node:url";
|
|
|
43
43
|
import { createHash } from "node:crypto";
|
|
44
44
|
import { homedir as homedir2 } from "os";
|
|
45
45
|
import { join as join2 } from "path";
|
|
46
|
-
import {
|
|
46
|
+
import {
|
|
47
|
+
closeSync,
|
|
48
|
+
existsSync as existsSync4,
|
|
49
|
+
fsyncSync,
|
|
50
|
+
mkdirSync as mkdirSync2,
|
|
51
|
+
openSync,
|
|
52
|
+
readFileSync as readFileSync3,
|
|
53
|
+
renameSync,
|
|
54
|
+
rmSync,
|
|
55
|
+
statSync,
|
|
56
|
+
writeSync
|
|
57
|
+
} from "node:fs";
|
|
47
58
|
import { homedir as homedir3 } from "node:os";
|
|
48
59
|
import { dirname as dirname2, join as join5, resolve } from "node:path";
|
|
49
60
|
import { createRequire as createRequire2 } from "node:module";
|
|
@@ -12495,8 +12506,7 @@ function isRecord4(value) {
|
|
|
12495
12506
|
function getWorkspaceConfigPath(env = process.env, home = homedir3()) {
|
|
12496
12507
|
return join5(readConfigHome(env, home), "signet", "workspace.json");
|
|
12497
12508
|
}
|
|
12498
|
-
function readConfiguredWorkspacePath(env = process.env, home = homedir3(),
|
|
12499
|
-
const strict = options.strict ?? false;
|
|
12509
|
+
function readConfiguredWorkspacePath(env = process.env, home = homedir3(), _options = {}) {
|
|
12500
12510
|
const configPath = getWorkspaceConfigPath(env, home);
|
|
12501
12511
|
if (!existsSync4(configPath))
|
|
12502
12512
|
return null;
|
|
@@ -12504,33 +12514,25 @@ function readConfiguredWorkspacePath(env = process.env, home = homedir3(), optio
|
|
|
12504
12514
|
try {
|
|
12505
12515
|
raw = JSON.parse(readFileSync3(configPath, "utf-8"));
|
|
12506
12516
|
} catch (err) {
|
|
12507
|
-
|
|
12508
|
-
|
|
12509
|
-
throw new Error(`Invalid Signet workspace config at ${configPath}: ${detail}`);
|
|
12510
|
-
}
|
|
12511
|
-
return null;
|
|
12517
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
12518
|
+
throw new Error(`Invalid Signet workspace config at ${configPath}: ${detail}`);
|
|
12512
12519
|
}
|
|
12513
12520
|
if (!isRecord4(raw) || !("workspace" in raw)) {
|
|
12514
|
-
|
|
12515
|
-
throw new Error(`Invalid Signet workspace config at ${configPath}: missing workspace`);
|
|
12516
|
-
return null;
|
|
12521
|
+
throw new Error(`Invalid Signet workspace config at ${configPath}: missing workspace`);
|
|
12517
12522
|
}
|
|
12518
12523
|
const workspace = raw.workspace;
|
|
12519
12524
|
if (typeof workspace !== "string" || workspace.trim().length === 0) {
|
|
12520
|
-
|
|
12521
|
-
throw new Error(`Invalid Signet workspace config at ${configPath}: workspace must be a non-empty string`);
|
|
12522
|
-
return null;
|
|
12525
|
+
throw new Error(`Invalid Signet workspace config at ${configPath}: workspace must be a non-empty string`);
|
|
12523
12526
|
}
|
|
12524
12527
|
return normalizeWorkspacePath(workspace, home);
|
|
12525
12528
|
}
|
|
12526
12529
|
function resolveWorkspacePath(options = {}) {
|
|
12527
12530
|
const env = options.env ?? process.env;
|
|
12528
12531
|
const home = options.home ?? homedir3();
|
|
12529
|
-
const strict = options.strict ?? false;
|
|
12530
12532
|
const requireExistingEnvPath = options.requireExistingEnvPath ?? false;
|
|
12531
12533
|
const configPath = getWorkspaceConfigPath(env, home);
|
|
12532
12534
|
const envPath = resolveEnvWorkspace(env, home, requireExistingEnvPath);
|
|
12533
|
-
const configValue = readConfiguredWorkspacePath(env, home
|
|
12535
|
+
const configValue = readConfiguredWorkspacePath(env, home);
|
|
12534
12536
|
if (envPath) {
|
|
12535
12537
|
return {
|
|
12536
12538
|
path: envPath,
|
|
@@ -12803,7 +12805,7 @@ class BaseConnector {
|
|
|
12803
12805
|
const tmp = join3(basePath, `.${randomBytes(6).toString("hex")}.tmp`);
|
|
12804
12806
|
try {
|
|
12805
12807
|
writeFileSync(tmp, cleaned, "utf-8");
|
|
12806
|
-
|
|
12808
|
+
renameSync2(tmp, agentsPath);
|
|
12807
12809
|
} catch (err) {
|
|
12808
12810
|
try {
|
|
12809
12811
|
unlinkSync2(tmp);
|
|
@@ -12867,7 +12869,7 @@ function atomicWriteText(path, content, mode) {
|
|
|
12867
12869
|
}
|
|
12868
12870
|
try {
|
|
12869
12871
|
writeFileSync(tmp, content, { encoding: "utf-8", mode: writeMode });
|
|
12870
|
-
|
|
12872
|
+
renameSync2(tmp, path);
|
|
12871
12873
|
} catch (err) {
|
|
12872
12874
|
try {
|
|
12873
12875
|
unlinkSync2(tmp);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signetai/connector-base",
|
|
3
|
-
"version": "0.199.
|
|
3
|
+
"version": "0.199.4",
|
|
4
4
|
"description": "Base class for Signet harness connectors",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"typecheck": "tsc --noEmit"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@signetai/core": "0.199.
|
|
29
|
+
"@signetai/core": "0.199.4",
|
|
30
30
|
"json5": "^2.2.3",
|
|
31
31
|
"jsonc-parser": "3.3.1"
|
|
32
32
|
},
|