@signetai/connector-base 0.154.4 → 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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAMH,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,aAAa,EAKlB,MAAM,cAAc,CAAC;AAMtB,MAAM,WAAW,aAAa;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC/B,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAMD;;;;;;;;;;;;;;;GAeG;AACH,8BAAsB,aAAa;IAClC;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAMpC;;;;;OAKG;IACH,SAAS,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAInD;;;;OAIG;IACH,SAAS,CAAC,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAmBjE;;;;;OAKG;IACH,SAAS,CAAC,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,aAAa;IAItG;;;;;OAKG;IACH,SAAS,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM;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M,GAAG,MAAM,CAEnF;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAGhF;AAUD,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAKpF;AAMD,MAAM,WAAW,yBAAyB;IACzC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,KAAK,oBAAoB,GAAG,UAAU,aAAa,CAAC;AAmFpD,wBAAgB,qBAAqB,CACpC,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,oBAAoB,EACpC,OAAO,GAAE,yBAA8B,GACrC,IAAI,CAsCN;AAMD,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC"}
package/dist/index.js CHANGED
@@ -32,9 +32,9 @@ 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, unlinkSync as unlinkSync2, writeFileSync } from "node:fs";
35
+ import { existsSync, readFileSync, renameSync, statSync as statSync2, unlinkSync as unlinkSync2, writeFileSync } from "node:fs";
36
36
  import { homedir } from "node:os";
37
- import { dirname as dirname2, join as join3, resolve } from "node:path";
37
+ import { dirname as dirname3, join as join3 } from "node:path";
38
38
 
39
39
  // ../../platform/core/dist/index.js
40
40
  import { createRequire } from "node:module";
@@ -42,12 +42,15 @@ import { dirname, join } from "node:path";
42
42
  import { fileURLToPath } from "node:url";
43
43
  import { homedir as homedir2 } from "os";
44
44
  import { join as join2 } from "path";
45
+ import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync3, rmSync, statSync, writeFileSync as writeFileSync2 } from "node:fs";
46
+ import { homedir as homedir3 } from "node:os";
47
+ import { dirname as dirname2, join as join5, resolve } from "node:path";
45
48
  import { createRequire as createRequire2 } from "node:module";
46
- import { homedir as homedir3, platform as platform2 } from "node:os";
47
- import { basename, dirname as dirname3, resolve as resolve3 } from "node:path";
48
- import { homedir as homedir7 } from "node:os";
49
- import { existsSync as existsSync12, lstatSync, mkdirSync as mkdirSync8, readdirSync as readdirSync6, symlinkSync, unlinkSync } from "node:fs";
50
- import { join as join12 } from "node:path";
49
+ import { homedir as homedir4, platform as platform2 } from "node:os";
50
+ import { basename, dirname as dirname4, resolve as resolve4 } from "node:path";
51
+ import { homedir as homedir8 } from "node:os";
52
+ import { existsSync as existsSync13, lstatSync, mkdirSync as mkdirSync9, readdirSync as readdirSync6, symlinkSync, unlinkSync } from "node:fs";
53
+ import { join as join13 } from "node:path";
51
54
  var __create2 = Object.create;
52
55
  var __getProtoOf2 = Object.getPrototypeOf;
53
56
  var __defProp2 = Object.defineProperty;
@@ -10804,6 +10807,109 @@ function resolveSignetDaemonUrl(opts = {}) {
10804
10807
  const port = normalizePort(readEnv(env, "SIGNET_PORT"), fallbackPort);
10805
10808
  return normalizeDaemonUrl(`http://${bracketIpv6Host(host)}:${port}`, "SIGNET_HOST/SIGNET_PORT");
10806
10809
  }
10810
+ var WORKSPACE_ENV_KEYS = ["SIGNET_PATH", "SIGNET_WORKSPACE"];
10811
+ var DEFAULT_AGENTS_DIRNAME = ".agents";
10812
+ function normalizeWorkspacePath(pathValue, home = homedir3()) {
10813
+ return resolve(expandHome(pathValue.trim(), home));
10814
+ }
10815
+ function readTrimmedEnv(env, name) {
10816
+ const value = env[name];
10817
+ if (typeof value !== "string")
10818
+ return;
10819
+ const trimmed = value.trim();
10820
+ return trimmed.length > 0 ? trimmed : undefined;
10821
+ }
10822
+ function readConfigHome(env, home) {
10823
+ const raw = env.XDG_CONFIG_HOME;
10824
+ if (typeof raw !== "string")
10825
+ return join5(home, ".config");
10826
+ const trimmed = raw.trim();
10827
+ return trimmed.length > 0 ? normalizeWorkspacePath(trimmed, home) : join5(home, ".config");
10828
+ }
10829
+ function isExistingDirectory(path) {
10830
+ try {
10831
+ return statSync(path).isDirectory();
10832
+ } catch {
10833
+ return false;
10834
+ }
10835
+ }
10836
+ function isRecord4(value) {
10837
+ return typeof value === "object" && value !== null && !Array.isArray(value);
10838
+ }
10839
+ function getWorkspaceConfigPath(env = process.env, home = homedir3()) {
10840
+ return join5(readConfigHome(env, home), "signet", "workspace.json");
10841
+ }
10842
+ function readConfiguredWorkspacePath(env = process.env, home = homedir3(), options = {}) {
10843
+ const strict = options.strict ?? false;
10844
+ const configPath = getWorkspaceConfigPath(env, home);
10845
+ if (!existsSync4(configPath))
10846
+ return null;
10847
+ let raw;
10848
+ try {
10849
+ raw = JSON.parse(readFileSync3(configPath, "utf-8"));
10850
+ } catch (err) {
10851
+ if (strict) {
10852
+ const detail = err instanceof Error ? err.message : String(err);
10853
+ throw new Error(`Invalid Signet workspace config at ${configPath}: ${detail}`);
10854
+ }
10855
+ return null;
10856
+ }
10857
+ if (!isRecord4(raw) || !("workspace" in raw)) {
10858
+ if (strict)
10859
+ throw new Error(`Invalid Signet workspace config at ${configPath}: missing workspace`);
10860
+ return null;
10861
+ }
10862
+ const workspace = raw.workspace;
10863
+ if (typeof workspace !== "string" || workspace.trim().length === 0) {
10864
+ if (strict)
10865
+ throw new Error(`Invalid Signet workspace config at ${configPath}: workspace must be a non-empty string`);
10866
+ return null;
10867
+ }
10868
+ return normalizeWorkspacePath(workspace, home);
10869
+ }
10870
+ function resolveWorkspacePath(options = {}) {
10871
+ const env = options.env ?? process.env;
10872
+ const home = options.home ?? homedir3();
10873
+ const strict = options.strict ?? false;
10874
+ const requireExistingEnvPath = options.requireExistingEnvPath ?? false;
10875
+ const configPath = getWorkspaceConfigPath(env, home);
10876
+ const envPath = resolveEnvWorkspace(env, home, requireExistingEnvPath);
10877
+ const configValue = readConfiguredWorkspacePath(env, home, { strict: envPath ? false : strict });
10878
+ if (envPath) {
10879
+ return {
10880
+ path: envPath,
10881
+ source: "env",
10882
+ configPath,
10883
+ configuredPath: configValue
10884
+ };
10885
+ }
10886
+ if (configValue) {
10887
+ return {
10888
+ path: configValue,
10889
+ source: "config",
10890
+ configPath,
10891
+ configuredPath: configValue
10892
+ };
10893
+ }
10894
+ return {
10895
+ path: join5(home, DEFAULT_AGENTS_DIRNAME),
10896
+ source: "default",
10897
+ configPath,
10898
+ configuredPath: configValue
10899
+ };
10900
+ }
10901
+ function resolveEnvWorkspace(env, home, requireExisting) {
10902
+ for (const key of WORKSPACE_ENV_KEYS) {
10903
+ const raw = readTrimmedEnv(env, key);
10904
+ if (!raw)
10905
+ continue;
10906
+ const normalized = normalizeWorkspacePath(raw, home);
10907
+ if (!requireExisting || isExistingDirectory(normalized))
10908
+ return normalized;
10909
+ console.warn(`[signet] ${key}="${raw}" does not point to an existing workspace directory; using the default workspace resolution instead.`);
10910
+ }
10911
+ return null;
10912
+ }
10807
10913
  var native = null;
10808
10914
  try {
10809
10915
  const esmRequire = createRequire2(import.meta.url);
@@ -10878,11 +10984,11 @@ var VALID_GITHUB_RESOURCE_TYPES = new Set(DEFAULT_GITHUB_RESOURCE_TYPES);
10878
10984
  function defaultDiscordDesktopCachePath() {
10879
10985
  switch (platform2()) {
10880
10986
  case "darwin":
10881
- return resolve3(homedir3(), "Library", "Application Support", "discord");
10987
+ return resolve4(homedir4(), "Library", "Application Support", "discord");
10882
10988
  case "win32":
10883
- return resolve3(process.env.APPDATA || resolve3(homedir3(), "AppData", "Roaming"), "discord");
10989
+ return resolve4(process.env.APPDATA || resolve4(homedir4(), "AppData", "Roaming"), "discord");
10884
10990
  default:
10885
- return resolve3(process.env.XDG_CONFIG_HOME || resolve3(homedir3(), ".config"), "discord");
10991
+ return resolve4(process.env.XDG_CONFIG_HOME || resolve4(homedir4(), ".config"), "discord");
10886
10992
  }
10887
10993
  }
10888
10994
  var IDENTITY_FILES = {
@@ -10950,15 +11056,15 @@ function symlinkSkills(sourceDir, targetDir, options = {}) {
10950
11056
  skipped: [],
10951
11057
  errors: []
10952
11058
  };
10953
- if (!existsSync12(sourceDir)) {
11059
+ if (!existsSync13(sourceDir)) {
10954
11060
  return result;
10955
11061
  }
10956
- const targetParent = join12(targetDir, "..");
10957
- if (!existsSync12(targetParent)) {
10958
- mkdirSync8(targetParent, { recursive: true });
11062
+ const targetParent = join13(targetDir, "..");
11063
+ if (!existsSync13(targetParent)) {
11064
+ mkdirSync9(targetParent, { recursive: true });
10959
11065
  }
10960
- if (!existsSync12(targetDir)) {
10961
- mkdirSync8(targetDir, { recursive: true });
11066
+ if (!existsSync13(targetDir)) {
11067
+ mkdirSync9(targetDir, { recursive: true });
10962
11068
  }
10963
11069
  let entries;
10964
11070
  try {
@@ -10971,8 +11077,8 @@ function symlinkSkills(sourceDir, targetDir, options = {}) {
10971
11077
  return result;
10972
11078
  }
10973
11079
  for (const entry of entries) {
10974
- const srcPath = join12(sourceDir, entry);
10975
- const destPath = join12(targetDir, entry);
11080
+ const srcPath = join13(sourceDir, entry);
11081
+ const destPath = join13(targetDir, entry);
10976
11082
  try {
10977
11083
  const src = lstatSync(srcPath);
10978
11084
  if (src.isSymbolicLink() || !src.isDirectory()) {
@@ -11013,7 +11119,7 @@ function symlinkSkills(sourceDir, targetDir, options = {}) {
11013
11119
  }
11014
11120
  return result;
11015
11121
  }
11016
- var home = homedir7();
11122
+ var home = homedir8();
11017
11123
  var SIGNET_BLOCK_START = "<!-- SIGNET:START -->";
11018
11124
  var SIGNET_BLOCK_END = "<!-- SIGNET:END -->";
11019
11125
  function stripSignetBlock(content) {
@@ -11171,7 +11277,7 @@ class BaseConnector {
11171
11277
  generateHeader(sourcePath, targetName) {
11172
11278
  const name = targetName || this.name;
11173
11279
  const safe = (p) => p.replace(/[\n\r]/g, "");
11174
- const root = dirname2(sourcePath);
11280
+ const root = dirname3(sourcePath);
11175
11281
  return `# Auto-generated from ${safe(sourcePath)}
11176
11282
  # Source: ${safe(sourcePath)}
11177
11283
  # Generated: ${new Date().toISOString()}
@@ -11208,11 +11314,11 @@ function isSignetGeneratedFile(raw) {
11208
11314
  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]));
11209
11315
  }
11210
11316
  function atomicWriteText(path, content, mode) {
11211
- const tmp = join3(dirname2(path), `.${randomBytes(6).toString("hex")}.tmp`);
11317
+ const tmp = join3(dirname3(path), `.${randomBytes(6).toString("hex")}.tmp`);
11212
11318
  let writeMode = mode;
11213
11319
  if (writeMode === undefined) {
11214
11320
  try {
11215
- writeMode = statSync(path).mode & 511;
11321
+ writeMode = statSync2(path).mode & 511;
11216
11322
  } catch {}
11217
11323
  }
11218
11324
  try {
@@ -11256,30 +11362,15 @@ function readManagedTrimmedEnv(name) {
11256
11362
  const trimmed = value.trim();
11257
11363
  return trimmed.length > 0 ? trimmed : undefined;
11258
11364
  }
11259
- function resolveSignetWorkspacePath(home2 = homedir()) {
11260
- const configured = readManagedTrimmedEnv("SIGNET_PATH");
11261
- if (configured)
11262
- return resolve(expandHome(configured));
11263
- const defaultWorkspace = join3(home2, ".agents");
11264
- const configHome = readManagedTrimmedEnv("XDG_CONFIG_HOME") ?? join3(home2, ".config");
11265
- const workspaceConfigPath = join3(configHome, "signet", "workspace.json");
11266
- if (!existsSync(workspaceConfigPath))
11267
- return defaultWorkspace;
11268
- let raw;
11365
+ function isExistingDirectory2(path) {
11269
11366
  try {
11270
- raw = JSON.parse(readFileSync(workspaceConfigPath, "utf8"));
11271
- } catch (err) {
11272
- const detail = err instanceof Error ? err.message : String(err);
11273
- throw new Error(`Invalid Signet workspace config at ${workspaceConfigPath}: ${detail}`);
11274
- }
11275
- if (typeof raw !== "object" || raw === null || !("workspace" in raw)) {
11276
- throw new Error(`Invalid Signet workspace config at ${workspaceConfigPath}: missing workspace`);
11277
- }
11278
- const workspace = raw.workspace;
11279
- if (typeof workspace !== "string" || workspace.trim().length === 0) {
11280
- throw new Error(`Invalid Signet workspace config at ${workspaceConfigPath}: workspace must be a non-empty string`);
11367
+ return statSync2(path).isDirectory();
11368
+ } catch {
11369
+ return false;
11281
11370
  }
11282
- return resolve(expandHome(workspace.trim()));
11371
+ }
11372
+ function resolveSignetWorkspacePath(home2 = homedir()) {
11373
+ return resolveWorkspacePath({ home: home2, strict: true, requireExistingEnvPath: true }).path;
11283
11374
  }
11284
11375
  function resolveSignetDaemonUrl2() {
11285
11376
  return resolveSignetDaemonUrl();
@@ -11291,10 +11382,18 @@ function resolveSignetApiKey() {
11291
11382
  return readManagedTrimmedEnv("SIGNET_API_KEY") ?? readManagedTrimmedEnv("SIGNET_TOKEN");
11292
11383
  }
11293
11384
  function buildManagedExtensionEnvBootstrap(env) {
11294
- const workspace = JSON.stringify(env.signetPath);
11295
11385
  const daemonUrl = JSON.stringify(env.daemonUrl);
11296
11386
  const agentId = JSON.stringify(env.agentId);
11297
11387
  const apiKey = env.apiKey ? JSON.stringify(env.apiKey) : null;
11388
+ const isDefaultWorkspace = env.signetPath === join3(homedir(), ".agents");
11389
+ const workspaceExists = isExistingDirectory2(env.signetPath);
11390
+ if (!isDefaultWorkspace && !workspaceExists) {
11391
+ console.warn(`[signet] resolved workspace "${env.signetPath}" does not exist; not embedding it in the managed extension to avoid propagating a stale path (issue #1016).`);
11392
+ }
11393
+ const signetPathBlock = isDefaultWorkspace || !workspaceExists ? "" : ` if (!__signetReadEnv("SIGNET_PATH")) {
11394
+ Reflect.set(__signetRuntimeEnv, "SIGNET_PATH", ${JSON.stringify(env.signetPath)});
11395
+ }
11396
+ `;
11298
11397
  return `const __signetRuntimeProcess = Reflect.get(globalThis, "process");
11299
11398
  if (__signetRuntimeProcess && typeof __signetRuntimeProcess === "object") {
11300
11399
  const __signetRuntimeEnv = Reflect.get(__signetRuntimeProcess, "env");
@@ -11304,10 +11403,7 @@ if (__signetRuntimeProcess && typeof __signetRuntimeProcess === "object") {
11304
11403
  return typeof value === "string" && value.trim().length > 0 ? value : undefined;
11305
11404
  };
11306
11405
  if (__signetRuntimeEnv && typeof __signetRuntimeEnv === "object") {
11307
- if (!__signetReadEnv("SIGNET_PATH")) {
11308
- Reflect.set(__signetRuntimeEnv, "SIGNET_PATH", ${workspace});
11309
- }
11310
- if (!__signetReadEnv("SIGNET_DAEMON_URL")) {
11406
+ ${signetPathBlock} if (!__signetReadEnv("SIGNET_DAEMON_URL")) {
11311
11407
  Reflect.set(__signetRuntimeEnv, "SIGNET_DAEMON_URL", ${daemonUrl});
11312
11408
  }
11313
11409
  if (!__signetReadEnv("SIGNET_AGENT_ID")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signetai/connector-base",
3
- "version": "0.154.4",
3
+ "version": "0.154.7",
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.154.4",
29
+ "@signetai/core": "0.154.7",
30
30
  "json5": "^2.2.3",
31
31
  "jsonc-parser": "3.3.1"
32
32
  },