@signetai/connector-forge 0.154.6 → 0.154.7
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 +161 -88
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -6,29 +6,32 @@ import {
|
|
|
6
6
|
readFileSync as readFileSync2,
|
|
7
7
|
readdirSync,
|
|
8
8
|
readlinkSync,
|
|
9
|
-
rmSync,
|
|
9
|
+
rmSync as rmSync2,
|
|
10
10
|
unlinkSync as unlinkSync3,
|
|
11
|
-
writeFileSync as
|
|
11
|
+
writeFileSync as writeFileSync3
|
|
12
12
|
} from "node:fs";
|
|
13
|
-
import { homedir as
|
|
13
|
+
import { homedir as homedir5 } from "node:os";
|
|
14
14
|
import { isAbsolute, join as join6, relative, resolve as resolve2, sep } from "node:path";
|
|
15
15
|
|
|
16
16
|
// ../../../libs/connector-base/dist/index.js
|
|
17
17
|
import { randomBytes } from "node:crypto";
|
|
18
|
-
import { existsSync, readFileSync, renameSync, statSync, unlinkSync as unlinkSync2, writeFileSync } from "node:fs";
|
|
18
|
+
import { existsSync, readFileSync, renameSync, statSync as statSync2, unlinkSync as unlinkSync2, writeFileSync } from "node:fs";
|
|
19
19
|
import { homedir } from "node:os";
|
|
20
|
-
import { dirname as
|
|
20
|
+
import { dirname as dirname3, join as join3 } from "node:path";
|
|
21
21
|
import { createRequire } from "node:module";
|
|
22
22
|
import { dirname, join } from "node:path";
|
|
23
23
|
import { fileURLToPath } from "node:url";
|
|
24
24
|
import { homedir as homedir2 } from "os";
|
|
25
25
|
import { join as join2 } from "path";
|
|
26
|
+
import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync3, rmSync, statSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
27
|
+
import { homedir as homedir3 } from "node:os";
|
|
28
|
+
import { dirname as dirname2, join as join5, resolve } from "node:path";
|
|
26
29
|
import { createRequire as createRequire2 } from "node:module";
|
|
27
|
-
import { homedir as
|
|
28
|
-
import { basename, dirname as
|
|
29
|
-
import { homedir as
|
|
30
|
-
import { existsSync as
|
|
31
|
-
import { join as
|
|
30
|
+
import { homedir as homedir4, platform as platform2 } from "node:os";
|
|
31
|
+
import { basename, dirname as dirname4, resolve as resolve4 } from "node:path";
|
|
32
|
+
import { homedir as homedir8 } from "node:os";
|
|
33
|
+
import { existsSync as existsSync13, lstatSync, mkdirSync as mkdirSync9, readdirSync as readdirSync6, symlinkSync, unlinkSync } from "node:fs";
|
|
34
|
+
import { join as join13 } from "node:path";
|
|
32
35
|
var __create2 = Object.create;
|
|
33
36
|
var __getProtoOf2 = Object.getPrototypeOf;
|
|
34
37
|
var __defProp2 = Object.defineProperty;
|
|
@@ -10714,6 +10717,109 @@ function expandHome(p, home = homedir2()) {
|
|
|
10714
10717
|
}
|
|
10715
10718
|
var LOCAL_BINDS = new Set(["127.0.0.1", "localhost", "::1", "::ffff:127.0.0.1"]);
|
|
10716
10719
|
var import_yaml2 = __toESM2(require_dist(), 1);
|
|
10720
|
+
var WORKSPACE_ENV_KEYS = ["SIGNET_PATH", "SIGNET_WORKSPACE"];
|
|
10721
|
+
var DEFAULT_AGENTS_DIRNAME = ".agents";
|
|
10722
|
+
function normalizeWorkspacePath(pathValue, home = homedir3()) {
|
|
10723
|
+
return resolve(expandHome(pathValue.trim(), home));
|
|
10724
|
+
}
|
|
10725
|
+
function readTrimmedEnv(env, name) {
|
|
10726
|
+
const value = env[name];
|
|
10727
|
+
if (typeof value !== "string")
|
|
10728
|
+
return;
|
|
10729
|
+
const trimmed = value.trim();
|
|
10730
|
+
return trimmed.length > 0 ? trimmed : undefined;
|
|
10731
|
+
}
|
|
10732
|
+
function readConfigHome(env, home) {
|
|
10733
|
+
const raw = env.XDG_CONFIG_HOME;
|
|
10734
|
+
if (typeof raw !== "string")
|
|
10735
|
+
return join5(home, ".config");
|
|
10736
|
+
const trimmed = raw.trim();
|
|
10737
|
+
return trimmed.length > 0 ? normalizeWorkspacePath(trimmed, home) : join5(home, ".config");
|
|
10738
|
+
}
|
|
10739
|
+
function isExistingDirectory(path) {
|
|
10740
|
+
try {
|
|
10741
|
+
return statSync(path).isDirectory();
|
|
10742
|
+
} catch {
|
|
10743
|
+
return false;
|
|
10744
|
+
}
|
|
10745
|
+
}
|
|
10746
|
+
function isRecord4(value) {
|
|
10747
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
10748
|
+
}
|
|
10749
|
+
function getWorkspaceConfigPath(env = process.env, home = homedir3()) {
|
|
10750
|
+
return join5(readConfigHome(env, home), "signet", "workspace.json");
|
|
10751
|
+
}
|
|
10752
|
+
function readConfiguredWorkspacePath(env = process.env, home = homedir3(), options = {}) {
|
|
10753
|
+
const strict = options.strict ?? false;
|
|
10754
|
+
const configPath = getWorkspaceConfigPath(env, home);
|
|
10755
|
+
if (!existsSync4(configPath))
|
|
10756
|
+
return null;
|
|
10757
|
+
let raw;
|
|
10758
|
+
try {
|
|
10759
|
+
raw = JSON.parse(readFileSync3(configPath, "utf-8"));
|
|
10760
|
+
} catch (err) {
|
|
10761
|
+
if (strict) {
|
|
10762
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
10763
|
+
throw new Error(`Invalid Signet workspace config at ${configPath}: ${detail}`);
|
|
10764
|
+
}
|
|
10765
|
+
return null;
|
|
10766
|
+
}
|
|
10767
|
+
if (!isRecord4(raw) || !("workspace" in raw)) {
|
|
10768
|
+
if (strict)
|
|
10769
|
+
throw new Error(`Invalid Signet workspace config at ${configPath}: missing workspace`);
|
|
10770
|
+
return null;
|
|
10771
|
+
}
|
|
10772
|
+
const workspace = raw.workspace;
|
|
10773
|
+
if (typeof workspace !== "string" || workspace.trim().length === 0) {
|
|
10774
|
+
if (strict)
|
|
10775
|
+
throw new Error(`Invalid Signet workspace config at ${configPath}: workspace must be a non-empty string`);
|
|
10776
|
+
return null;
|
|
10777
|
+
}
|
|
10778
|
+
return normalizeWorkspacePath(workspace, home);
|
|
10779
|
+
}
|
|
10780
|
+
function resolveWorkspacePath(options = {}) {
|
|
10781
|
+
const env = options.env ?? process.env;
|
|
10782
|
+
const home = options.home ?? homedir3();
|
|
10783
|
+
const strict = options.strict ?? false;
|
|
10784
|
+
const requireExistingEnvPath = options.requireExistingEnvPath ?? false;
|
|
10785
|
+
const configPath = getWorkspaceConfigPath(env, home);
|
|
10786
|
+
const envPath = resolveEnvWorkspace(env, home, requireExistingEnvPath);
|
|
10787
|
+
const configValue = readConfiguredWorkspacePath(env, home, { strict: envPath ? false : strict });
|
|
10788
|
+
if (envPath) {
|
|
10789
|
+
return {
|
|
10790
|
+
path: envPath,
|
|
10791
|
+
source: "env",
|
|
10792
|
+
configPath,
|
|
10793
|
+
configuredPath: configValue
|
|
10794
|
+
};
|
|
10795
|
+
}
|
|
10796
|
+
if (configValue) {
|
|
10797
|
+
return {
|
|
10798
|
+
path: configValue,
|
|
10799
|
+
source: "config",
|
|
10800
|
+
configPath,
|
|
10801
|
+
configuredPath: configValue
|
|
10802
|
+
};
|
|
10803
|
+
}
|
|
10804
|
+
return {
|
|
10805
|
+
path: join5(home, DEFAULT_AGENTS_DIRNAME),
|
|
10806
|
+
source: "default",
|
|
10807
|
+
configPath,
|
|
10808
|
+
configuredPath: configValue
|
|
10809
|
+
};
|
|
10810
|
+
}
|
|
10811
|
+
function resolveEnvWorkspace(env, home, requireExisting) {
|
|
10812
|
+
for (const key of WORKSPACE_ENV_KEYS) {
|
|
10813
|
+
const raw = readTrimmedEnv(env, key);
|
|
10814
|
+
if (!raw)
|
|
10815
|
+
continue;
|
|
10816
|
+
const normalized = normalizeWorkspacePath(raw, home);
|
|
10817
|
+
if (!requireExisting || isExistingDirectory(normalized))
|
|
10818
|
+
return normalized;
|
|
10819
|
+
console.warn(`[signet] ${key}="${raw}" does not point to an existing workspace directory; using the default workspace resolution instead.`);
|
|
10820
|
+
}
|
|
10821
|
+
return null;
|
|
10822
|
+
}
|
|
10717
10823
|
var native = null;
|
|
10718
10824
|
try {
|
|
10719
10825
|
const esmRequire = createRequire2(import.meta.url);
|
|
@@ -10788,11 +10894,11 @@ var VALID_GITHUB_RESOURCE_TYPES = new Set(DEFAULT_GITHUB_RESOURCE_TYPES);
|
|
|
10788
10894
|
function defaultDiscordDesktopCachePath() {
|
|
10789
10895
|
switch (platform2()) {
|
|
10790
10896
|
case "darwin":
|
|
10791
|
-
return
|
|
10897
|
+
return resolve4(homedir4(), "Library", "Application Support", "discord");
|
|
10792
10898
|
case "win32":
|
|
10793
|
-
return
|
|
10899
|
+
return resolve4(process.env.APPDATA || resolve4(homedir4(), "AppData", "Roaming"), "discord");
|
|
10794
10900
|
default:
|
|
10795
|
-
return
|
|
10901
|
+
return resolve4(process.env.XDG_CONFIG_HOME || resolve4(homedir4(), ".config"), "discord");
|
|
10796
10902
|
}
|
|
10797
10903
|
}
|
|
10798
10904
|
var IDENTITY_FILES = {
|
|
@@ -10860,15 +10966,15 @@ function symlinkSkills(sourceDir, targetDir, options = {}) {
|
|
|
10860
10966
|
skipped: [],
|
|
10861
10967
|
errors: []
|
|
10862
10968
|
};
|
|
10863
|
-
if (!
|
|
10969
|
+
if (!existsSync13(sourceDir)) {
|
|
10864
10970
|
return result;
|
|
10865
10971
|
}
|
|
10866
|
-
const targetParent =
|
|
10867
|
-
if (!
|
|
10868
|
-
|
|
10972
|
+
const targetParent = join13(targetDir, "..");
|
|
10973
|
+
if (!existsSync13(targetParent)) {
|
|
10974
|
+
mkdirSync9(targetParent, { recursive: true });
|
|
10869
10975
|
}
|
|
10870
|
-
if (!
|
|
10871
|
-
|
|
10976
|
+
if (!existsSync13(targetDir)) {
|
|
10977
|
+
mkdirSync9(targetDir, { recursive: true });
|
|
10872
10978
|
}
|
|
10873
10979
|
let entries;
|
|
10874
10980
|
try {
|
|
@@ -10881,8 +10987,8 @@ function symlinkSkills(sourceDir, targetDir, options = {}) {
|
|
|
10881
10987
|
return result;
|
|
10882
10988
|
}
|
|
10883
10989
|
for (const entry of entries) {
|
|
10884
|
-
const srcPath =
|
|
10885
|
-
const destPath =
|
|
10990
|
+
const srcPath = join13(sourceDir, entry);
|
|
10991
|
+
const destPath = join13(targetDir, entry);
|
|
10886
10992
|
try {
|
|
10887
10993
|
const src = lstatSync(srcPath);
|
|
10888
10994
|
if (src.isSymbolicLink() || !src.isDirectory()) {
|
|
@@ -10923,7 +11029,7 @@ function symlinkSkills(sourceDir, targetDir, options = {}) {
|
|
|
10923
11029
|
}
|
|
10924
11030
|
return result;
|
|
10925
11031
|
}
|
|
10926
|
-
var home =
|
|
11032
|
+
var home = homedir8();
|
|
10927
11033
|
var SIGNET_BLOCK_START = "<!-- SIGNET:START -->";
|
|
10928
11034
|
var SIGNET_BLOCK_END = "<!-- SIGNET:END -->";
|
|
10929
11035
|
function stripSignetBlock(content) {
|
|
@@ -11080,7 +11186,7 @@ class BaseConnector {
|
|
|
11080
11186
|
generateHeader(sourcePath, targetName) {
|
|
11081
11187
|
const name = targetName || this.name;
|
|
11082
11188
|
const safe = (p) => p.replace(/[\n\r]/g, "");
|
|
11083
|
-
const root =
|
|
11189
|
+
const root = dirname3(sourcePath);
|
|
11084
11190
|
return `# Auto-generated from ${safe(sourcePath)}
|
|
11085
11191
|
# Source: ${safe(sourcePath)}
|
|
11086
11192
|
# Generated: ${new Date().toISOString()}
|
|
@@ -11117,11 +11223,11 @@ function isSignetGeneratedFile(raw) {
|
|
|
11117
11223
|
return lines.some((line, i) => /^#\s+AUTO-GENERATED\s+from\s+.*\s+by\s+Signet/i.test(line) || /^#\s+Auto-generated\s+from\s+/.test(line) && i + 1 < lines.length && /^#\s+Source:\s+/.test(lines[i + 1]));
|
|
11118
11224
|
}
|
|
11119
11225
|
function atomicWriteText(path, content, mode) {
|
|
11120
|
-
const tmp = join3(
|
|
11226
|
+
const tmp = join3(dirname3(path), `.${randomBytes(6).toString("hex")}.tmp`);
|
|
11121
11227
|
let writeMode = mode;
|
|
11122
11228
|
if (writeMode === undefined) {
|
|
11123
11229
|
try {
|
|
11124
|
-
writeMode =
|
|
11230
|
+
writeMode = statSync2(path).mode & 511;
|
|
11125
11231
|
} catch {}
|
|
11126
11232
|
}
|
|
11127
11233
|
try {
|
|
@@ -11160,41 +11266,8 @@ function readManagedTrimmedEnv(name) {
|
|
|
11160
11266
|
const trimmed = value.trim();
|
|
11161
11267
|
return trimmed.length > 0 ? trimmed : undefined;
|
|
11162
11268
|
}
|
|
11163
|
-
function isExistingDirectory(path) {
|
|
11164
|
-
try {
|
|
11165
|
-
return statSync(path).isDirectory();
|
|
11166
|
-
} catch {
|
|
11167
|
-
return false;
|
|
11168
|
-
}
|
|
11169
|
-
}
|
|
11170
11269
|
function resolveSignetWorkspacePath(home2 = homedir()) {
|
|
11171
|
-
|
|
11172
|
-
if (configured) {
|
|
11173
|
-
const resolved = resolve(expandHome(configured));
|
|
11174
|
-
if (isExistingDirectory(resolved))
|
|
11175
|
-
return resolved;
|
|
11176
|
-
console.warn(`[signet] SIGNET_PATH="${configured}" does not point to an existing workspace directory; using the default workspace resolution instead.`);
|
|
11177
|
-
}
|
|
11178
|
-
const defaultWorkspace = join3(home2, ".agents");
|
|
11179
|
-
const configHome = readManagedTrimmedEnv("XDG_CONFIG_HOME") ?? join3(home2, ".config");
|
|
11180
|
-
const workspaceConfigPath = join3(configHome, "signet", "workspace.json");
|
|
11181
|
-
if (!existsSync(workspaceConfigPath))
|
|
11182
|
-
return defaultWorkspace;
|
|
11183
|
-
let raw;
|
|
11184
|
-
try {
|
|
11185
|
-
raw = JSON.parse(readFileSync(workspaceConfigPath, "utf8"));
|
|
11186
|
-
} catch (err) {
|
|
11187
|
-
const detail = err instanceof Error ? err.message : String(err);
|
|
11188
|
-
throw new Error(`Invalid Signet workspace config at ${workspaceConfigPath}: ${detail}`);
|
|
11189
|
-
}
|
|
11190
|
-
if (typeof raw !== "object" || raw === null || !("workspace" in raw)) {
|
|
11191
|
-
throw new Error(`Invalid Signet workspace config at ${workspaceConfigPath}: missing workspace`);
|
|
11192
|
-
}
|
|
11193
|
-
const workspace = raw.workspace;
|
|
11194
|
-
if (typeof workspace !== "string" || workspace.trim().length === 0) {
|
|
11195
|
-
throw new Error(`Invalid Signet workspace config at ${workspaceConfigPath}: workspace must be a non-empty string`);
|
|
11196
|
-
}
|
|
11197
|
-
return resolve(expandHome(workspace.trim()));
|
|
11270
|
+
return resolveWorkspacePath({ home: home2, strict: true, requireExistingEnvPath: true }).path;
|
|
11198
11271
|
}
|
|
11199
11272
|
function resolveSignetApiKey() {
|
|
11200
11273
|
return readManagedTrimmedEnv("SIGNET_API_KEY") ?? readManagedTrimmedEnv("SIGNET_TOKEN");
|
|
@@ -11202,16 +11275,16 @@ function resolveSignetApiKey() {
|
|
|
11202
11275
|
|
|
11203
11276
|
// ../../../platform/core/dist/index.js
|
|
11204
11277
|
import { createRequire as createRequire3 } from "node:module";
|
|
11205
|
-
import { dirname as
|
|
11278
|
+
import { dirname as dirname5, join as join4 } from "node:path";
|
|
11206
11279
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
11207
11280
|
import { homedir as homedir22 } from "os";
|
|
11208
11281
|
import { join as join22 } from "path";
|
|
11209
11282
|
import { createRequire as createRequire22 } from "node:module";
|
|
11210
|
-
import { homedir as
|
|
11211
|
-
import { basename as basename2, dirname as
|
|
11212
|
-
import { existsSync as
|
|
11213
|
-
import { dirname as
|
|
11214
|
-
import { homedir as
|
|
11283
|
+
import { homedir as homedir42, platform as platform22 } from "node:os";
|
|
11284
|
+
import { basename as basename2, dirname as dirname42, resolve as resolve42 } from "node:path";
|
|
11285
|
+
import { existsSync as existsSync11, readFileSync as readFileSync9, readdirSync as readdirSync4, realpathSync, statSync as statSync5 } from "node:fs";
|
|
11286
|
+
import { dirname as dirname7, join as join11 } from "node:path";
|
|
11287
|
+
import { homedir as homedir82 } from "node:os";
|
|
11215
11288
|
var __create = Object.create;
|
|
11216
11289
|
var __getProtoOf = Object.getPrototypeOf;
|
|
11217
11290
|
var __defProp = Object.defineProperty;
|
|
@@ -21886,7 +21959,7 @@ var MIGRATIONS2 = [
|
|
|
21886
21959
|
];
|
|
21887
21960
|
var LATEST_SCHEMA_VERSION2 = MIGRATIONS2[MIGRATIONS2.length - 1]?.version ?? 0;
|
|
21888
21961
|
var __filename22 = fileURLToPath2(import.meta.url);
|
|
21889
|
-
var __dirname22 =
|
|
21962
|
+
var __dirname22 = dirname5(__filename22);
|
|
21890
21963
|
var import_yaml3 = __toESM(require_dist2(), 1);
|
|
21891
21964
|
function expandHome2(p, home2 = homedir22()) {
|
|
21892
21965
|
if (p === "~")
|
|
@@ -22050,11 +22123,11 @@ var VALID_GITHUB_RESOURCE_TYPES2 = new Set(DEFAULT_GITHUB_RESOURCE_TYPES2);
|
|
|
22050
22123
|
function defaultDiscordDesktopCachePath2() {
|
|
22051
22124
|
switch (platform22()) {
|
|
22052
22125
|
case "darwin":
|
|
22053
|
-
return
|
|
22126
|
+
return resolve42(homedir42(), "Library", "Application Support", "discord");
|
|
22054
22127
|
case "win32":
|
|
22055
|
-
return
|
|
22128
|
+
return resolve42(process.env.APPDATA || resolve42(homedir42(), "AppData", "Roaming"), "discord");
|
|
22056
22129
|
default:
|
|
22057
|
-
return
|
|
22130
|
+
return resolve42(process.env.XDG_CONFIG_HOME || resolve42(homedir42(), ".config"), "discord");
|
|
22058
22131
|
}
|
|
22059
22132
|
}
|
|
22060
22133
|
var IDENTITY_MODES = ["managed", "passthrough", "off"];
|
|
@@ -22119,7 +22192,7 @@ function hasValidIdentity(basePath) {
|
|
|
22119
22192
|
return true;
|
|
22120
22193
|
for (const key of REQUIRED_IDENTITY_KEYS2) {
|
|
22121
22194
|
const spec = IDENTITY_FILES2[key];
|
|
22122
|
-
if (!
|
|
22195
|
+
if (!existsSync11(join11(basePath, spec.path))) {
|
|
22123
22196
|
return false;
|
|
22124
22197
|
}
|
|
22125
22198
|
}
|
|
@@ -22145,16 +22218,16 @@ function resolveIdentityModeFromConfig(config) {
|
|
|
22145
22218
|
return "managed";
|
|
22146
22219
|
}
|
|
22147
22220
|
function loadIdentityMode(agentsDir) {
|
|
22148
|
-
const agentYaml =
|
|
22149
|
-
if (!
|
|
22221
|
+
const agentYaml = join11(agentsDir, "agent.yaml");
|
|
22222
|
+
if (!existsSync11(agentYaml))
|
|
22150
22223
|
return "managed";
|
|
22151
22224
|
try {
|
|
22152
|
-
return resolveIdentityModeFromConfig(parseSimpleYaml(
|
|
22225
|
+
return resolveIdentityModeFromConfig(parseSimpleYaml(readFileSync9(agentYaml, "utf-8")));
|
|
22153
22226
|
} catch {
|
|
22154
22227
|
return "managed";
|
|
22155
22228
|
}
|
|
22156
22229
|
}
|
|
22157
|
-
var home2 =
|
|
22230
|
+
var home2 = homedir82();
|
|
22158
22231
|
var SKIP_SUBTYPES2 = new Set([
|
|
22159
22232
|
"channel_join",
|
|
22160
22233
|
"channel_leave",
|
|
@@ -22277,7 +22350,7 @@ var SIGNET_FORGE_MARKER = "Managed by Signet (@signetai/connector-forge)";
|
|
|
22277
22350
|
function isJsonObject(value) {
|
|
22278
22351
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22279
22352
|
}
|
|
22280
|
-
function
|
|
22353
|
+
function readTrimmedEnv2(name) {
|
|
22281
22354
|
const value = process.env[name];
|
|
22282
22355
|
if (typeof value !== "string")
|
|
22283
22356
|
return;
|
|
@@ -22285,8 +22358,8 @@ function readTrimmedEnv(name) {
|
|
|
22285
22358
|
return trimmed.length > 0 ? trimmed : undefined;
|
|
22286
22359
|
}
|
|
22287
22360
|
function getHomeDir() {
|
|
22288
|
-
const home3 =
|
|
22289
|
-
return home3 ??
|
|
22361
|
+
const home3 = readTrimmedEnv2("HOME");
|
|
22362
|
+
return home3 ?? homedir5();
|
|
22290
22363
|
}
|
|
22291
22364
|
function readJsonObject(path) {
|
|
22292
22365
|
if (!existsSync2(path))
|
|
@@ -22306,9 +22379,9 @@ function readMcpServers(config) {
|
|
|
22306
22379
|
}
|
|
22307
22380
|
function signetRuntimeEnv(basePath) {
|
|
22308
22381
|
const env = { SIGNET_PATH: basePath };
|
|
22309
|
-
const daemonUrl =
|
|
22310
|
-
const apiKey =
|
|
22311
|
-
const agentId =
|
|
22382
|
+
const daemonUrl = readTrimmedEnv2("SIGNET_DAEMON_URL");
|
|
22383
|
+
const apiKey = readTrimmedEnv2("SIGNET_API_KEY") ?? readTrimmedEnv2("SIGNET_TOKEN");
|
|
22384
|
+
const agentId = readTrimmedEnv2("SIGNET_AGENT_ID");
|
|
22312
22385
|
if (daemonUrl)
|
|
22313
22386
|
env.SIGNET_DAEMON_URL = daemonUrl;
|
|
22314
22387
|
if (apiKey)
|
|
@@ -22318,7 +22391,7 @@ function signetRuntimeEnv(basePath) {
|
|
|
22318
22391
|
return env;
|
|
22319
22392
|
}
|
|
22320
22393
|
function resolveRemoteDaemonUrl() {
|
|
22321
|
-
return
|
|
22394
|
+
return readTrimmedEnv2("SIGNET_DAEMON_URL") ? resolveSignetDaemonUrl() : null;
|
|
22322
22395
|
}
|
|
22323
22396
|
function buildMcpServer(basePath) {
|
|
22324
22397
|
const remoteDaemonUrl = resolveRemoteDaemonUrl();
|
|
@@ -22345,7 +22418,7 @@ class ForgeConnector extends BaseConnector {
|
|
|
22345
22418
|
name = "ForgeCode";
|
|
22346
22419
|
harnessId = "forge";
|
|
22347
22420
|
getForgeHome() {
|
|
22348
|
-
const configured =
|
|
22421
|
+
const configured = readTrimmedEnv2("FORGE_CONFIG");
|
|
22349
22422
|
if (configured)
|
|
22350
22423
|
return resolve2(expandHome2(configured));
|
|
22351
22424
|
const legacyPath = join6(getHomeDir(), "forge");
|
|
@@ -22396,7 +22469,7 @@ class ForgeConnector extends BaseConnector {
|
|
|
22396
22469
|
try {
|
|
22397
22470
|
const raw = readFileSync2(staleAgentsPath, "utf-8");
|
|
22398
22471
|
if (isSignetGeneratedFile(raw) || raw.includes(SIGNET_FORGE_MARKER))
|
|
22399
|
-
|
|
22472
|
+
rmSync2(staleAgentsPath);
|
|
22400
22473
|
} catch {}
|
|
22401
22474
|
}
|
|
22402
22475
|
}
|
|
@@ -22432,7 +22505,7 @@ class ForgeConnector extends BaseConnector {
|
|
|
22432
22505
|
try {
|
|
22433
22506
|
const raw = readFileSync2(agentsPath, "utf-8");
|
|
22434
22507
|
if (isSignetGeneratedFile(raw) || raw.includes(SIGNET_FORGE_MARKER)) {
|
|
22435
|
-
|
|
22508
|
+
rmSync2(agentsPath, { force: true });
|
|
22436
22509
|
filesRemoved.push(agentsPath);
|
|
22437
22510
|
}
|
|
22438
22511
|
} catch {}
|
|
@@ -22452,7 +22525,7 @@ class ForgeConnector extends BaseConnector {
|
|
|
22452
22525
|
const patched = this.removeMcpServer(config);
|
|
22453
22526
|
if (patched) {
|
|
22454
22527
|
if (Object.keys(config).length === 0) {
|
|
22455
|
-
|
|
22528
|
+
rmSync2(this.getMcpConfigPath(), { force: true });
|
|
22456
22529
|
filesRemoved.push(this.getMcpConfigPath());
|
|
22457
22530
|
} else {
|
|
22458
22531
|
atomicWriteJson(this.getMcpConfigPath(), config);
|
|
@@ -22473,7 +22546,7 @@ class ForgeConnector extends BaseConnector {
|
|
|
22473
22546
|
}
|
|
22474
22547
|
static isHarnessInstalled() {
|
|
22475
22548
|
const home3 = getHomeDir();
|
|
22476
|
-
return existsSync2(
|
|
22549
|
+
return existsSync2(readTrimmedEnv2("FORGE_CONFIG") ?? "") || existsSync2(join6(home3, "forge", ".mcp.json")) || existsSync2(join6(home3, ".forge", ".mcp.json")) || existsSync2(join6(home3, "forge")) || existsSync2(join6(home3, ".forge"));
|
|
22477
22550
|
}
|
|
22478
22551
|
getAgentsPath() {
|
|
22479
22552
|
return join6(this.getForgeHome(), "AGENTS.md");
|
|
@@ -22494,7 +22567,7 @@ class ForgeConnector extends BaseConnector {
|
|
|
22494
22567
|
const body = extras ? `${userContent}${extras}` : userContent;
|
|
22495
22568
|
const header = this.generateHeader(sourcePath, this.name);
|
|
22496
22569
|
const targetPath = this.getAgentsPath();
|
|
22497
|
-
|
|
22570
|
+
writeFileSync3(targetPath, `# ${SIGNET_FORGE_MARKER}
|
|
22498
22571
|
${header}${body}
|
|
22499
22572
|
`, "utf-8");
|
|
22500
22573
|
return targetPath;
|
|
@@ -22555,7 +22628,7 @@ ${header}${body}
|
|
|
22555
22628
|
}
|
|
22556
22629
|
try {
|
|
22557
22630
|
if (readdirSync(skillsDir).length === 0)
|
|
22558
|
-
|
|
22631
|
+
rmSync2(skillsDir, { recursive: true, force: true });
|
|
22559
22632
|
} catch {}
|
|
22560
22633
|
}
|
|
22561
22634
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signetai/connector-forge",
|
|
3
|
-
"version": "0.154.
|
|
3
|
+
"version": "0.154.7",
|
|
4
4
|
"description": "Signet connector for ForgeCode - installs MCP, identity, and skills integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"typecheck": "tsc --noEmit"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@signetai/connector-base": "0.154.
|
|
28
|
-
"@signetai/core": "0.154.
|
|
27
|
+
"@signetai/connector-base": "0.154.7",
|
|
28
|
+
"@signetai/core": "0.154.7"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/node": "^22.0.0",
|