@signetai/connector-opencode 0.163.18 → 0.164.0
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.d.ts.map +1 -1
- package/dist/index.js +103 -92
- package/package.json +3 -3
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAKH,OAAO,EACN,aAAa,EACb,KAAK,aAAa,EAClB,KAAK,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAKH,OAAO,EACN,aAAa,EACb,KAAK,aAAa,EAClB,KAAK,eAAe,EASpB,MAAM,wBAAwB,CAAC;AA+DhC;;;;;GAKG;AACH,qBAAa,iBAAkB,SAAQ,aAAa;IACnD,QAAQ,CAAC,IAAI,cAAc;IAC3B,QAAQ,CAAC,SAAS,cAAc;IAEhC,SAAS,CAAC,eAAe,IAAI,MAAM;IAInC,aAAa,IAAI,MAAM;IAUvB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,oBAAoB;IAI5B;;;;;;;;OAQG;IACG,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAyGvD;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,eAAe,CAAC;IAqC3C;;OAEG;IACH,WAAW,IAAI,OAAO;IAItB;;OAEG;IACH,MAAM,CAAC,kBAAkB,IAAI,OAAO;IAqBpC;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAmBzB,OAAO,CAAC,UAAU;IASlB,OAAO,CAAC,wBAAwB;IAMhC,OAAO,CAAC,oBAAoB;IAS5B,OAAO,CAAC,mBAAmB;IAM3B,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,cAAc;IAatB,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,iBAAiB;IA8BzB,OAAO,CAAC,eAAe;IAavB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,qBAAqB,CAM3C;IAEF,OAAO,CAAC,qBAAqB;IAS7B,OAAO,CAAC,mBAAmB;IAa3B,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,mBAAmB;IAW3B;;OAEG;YACW,gBAAgB;CAmB9B;AAMD,eAAO,MAAM,iBAAiB,mBAA0B,CAAC;AACzD,eAAe,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -11173,6 +11173,79 @@ var __dirname2 = dirname(__filename2);
|
|
|
11173
11173
|
var import_yaml = __toESM2(require_dist(), 1);
|
|
11174
11174
|
var LOCAL_BINDS = new Set(["127.0.0.1", "localhost", "::1", "::ffff:127.0.0.1"]);
|
|
11175
11175
|
var import_yaml2 = __toESM2(require_dist(), 1);
|
|
11176
|
+
function readEnv(env, name) {
|
|
11177
|
+
const value = env[name];
|
|
11178
|
+
if (typeof value !== "string")
|
|
11179
|
+
return;
|
|
11180
|
+
const trimmed = value.trim();
|
|
11181
|
+
return trimmed.length > 0 ? trimmed : undefined;
|
|
11182
|
+
}
|
|
11183
|
+
function normalizePort(raw, fallback) {
|
|
11184
|
+
if (!raw)
|
|
11185
|
+
return String(fallback);
|
|
11186
|
+
if (!/^\d+$/.test(raw)) {
|
|
11187
|
+
throw new Error(`SIGNET_PORT must be an integer between 1 and 65535: ${raw}`);
|
|
11188
|
+
}
|
|
11189
|
+
const port = Number.parseInt(raw, 10);
|
|
11190
|
+
if (!Number.isFinite(port) || port < 1 || port > 65535) {
|
|
11191
|
+
throw new Error(`SIGNET_PORT must be an integer between 1 and 65535: ${raw}`);
|
|
11192
|
+
}
|
|
11193
|
+
return String(port);
|
|
11194
|
+
}
|
|
11195
|
+
function bracketIpv6Host(host) {
|
|
11196
|
+
if (host.startsWith("[") || !host.includes(":"))
|
|
11197
|
+
return host;
|
|
11198
|
+
return `[${host}]`;
|
|
11199
|
+
}
|
|
11200
|
+
function assertPlainHost(raw) {
|
|
11201
|
+
if (raw.includes("/") || raw.includes("@") || raw.includes("?") || raw.includes("#")) {
|
|
11202
|
+
throw new Error(`SIGNET_HOST must be a hostname or IP address, not a URL: ${raw}`);
|
|
11203
|
+
}
|
|
11204
|
+
const host = raw.startsWith("[") && raw.endsWith("]") ? raw.slice(1, -1) : raw;
|
|
11205
|
+
if (host.includes(":")) {
|
|
11206
|
+
if (/^[0-9A-Fa-f:.]+$/.test(host))
|
|
11207
|
+
return;
|
|
11208
|
+
throw new Error(`SIGNET_HOST must be a hostname or IP address: ${raw}`);
|
|
11209
|
+
}
|
|
11210
|
+
if (!/^[A-Za-z0-9]([A-Za-z0-9.-]*[A-Za-z0-9])?$/.test(host)) {
|
|
11211
|
+
throw new Error(`SIGNET_HOST must be a hostname or IP address: ${raw}`);
|
|
11212
|
+
}
|
|
11213
|
+
}
|
|
11214
|
+
function normalizeDaemonUrl(raw, source) {
|
|
11215
|
+
let parsed;
|
|
11216
|
+
try {
|
|
11217
|
+
parsed = new URL(raw);
|
|
11218
|
+
} catch {
|
|
11219
|
+
throw new Error(`${source} must be an http(s) URL: ${raw}`);
|
|
11220
|
+
}
|
|
11221
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
|
11222
|
+
throw new Error(`${source} must use http or https: ${raw}`);
|
|
11223
|
+
}
|
|
11224
|
+
if (parsed.username || parsed.password) {
|
|
11225
|
+
throw new Error(`${source} must not include username or password credentials`);
|
|
11226
|
+
}
|
|
11227
|
+
if (parsed.search || parsed.hash) {
|
|
11228
|
+
throw new Error(`${source} must not include query strings or fragments`);
|
|
11229
|
+
}
|
|
11230
|
+
if (parsed.pathname !== "/" && parsed.pathname !== "") {
|
|
11231
|
+
throw new Error(`${source} must point at the daemon origin, not a path: ${raw}`);
|
|
11232
|
+
}
|
|
11233
|
+
return parsed.toString().replace(/\/$/, "");
|
|
11234
|
+
}
|
|
11235
|
+
function resolveSignetDaemonUrl(opts = {}) {
|
|
11236
|
+
const env = opts.env ?? process.env;
|
|
11237
|
+
const fallbackHost = opts.defaultHost ?? "127.0.0.1";
|
|
11238
|
+
const fallbackPort = opts.defaultPort ?? 3850;
|
|
11239
|
+
const explicit = readEnv(env, "SIGNET_DAEMON_URL");
|
|
11240
|
+
if (explicit)
|
|
11241
|
+
return normalizeDaemonUrl(explicit, "SIGNET_DAEMON_URL");
|
|
11242
|
+
if (opts.configUrl)
|
|
11243
|
+
return normalizeDaemonUrl(opts.configUrl, "daemon.url");
|
|
11244
|
+
const host = readEnv(env, "SIGNET_HOST") ?? fallbackHost;
|
|
11245
|
+
assertPlainHost(host);
|
|
11246
|
+
const port = normalizePort(readEnv(env, "SIGNET_PORT"), fallbackPort);
|
|
11247
|
+
return normalizeDaemonUrl(`http://${bracketIpv6Host(host)}:${port}`, "SIGNET_HOST/SIGNET_PORT");
|
|
11248
|
+
}
|
|
11176
11249
|
var native = null;
|
|
11177
11250
|
try {
|
|
11178
11251
|
const esmRequire = createRequire2(import.meta.url);
|
|
@@ -11506,6 +11579,33 @@ function readTrimmedEnv2(name) {
|
|
|
11506
11579
|
const trimmed = value.trim().replace(/[\r\n]+/g, "");
|
|
11507
11580
|
return trimmed.length > 0 ? trimmed : undefined;
|
|
11508
11581
|
}
|
|
11582
|
+
function readManagedTrimmedEnv(name) {
|
|
11583
|
+
return readTrimmedEnv2(name);
|
|
11584
|
+
}
|
|
11585
|
+
function resolveSignetDaemonUrl2() {
|
|
11586
|
+
return resolveSignetDaemonUrl();
|
|
11587
|
+
}
|
|
11588
|
+
function resolveSignetApiKey() {
|
|
11589
|
+
return readManagedTrimmedEnv("SIGNET_API_KEY") ?? readManagedTrimmedEnv("SIGNET_TOKEN");
|
|
11590
|
+
}
|
|
11591
|
+
function buildSignetRuntimeEnv(opts = {}) {
|
|
11592
|
+
const env = {};
|
|
11593
|
+
if (opts.basePath)
|
|
11594
|
+
env.SIGNET_PATH = opts.basePath;
|
|
11595
|
+
const daemonUrl = readManagedTrimmedEnv("SIGNET_DAEMON_URL");
|
|
11596
|
+
const apiKey = resolveSignetApiKey();
|
|
11597
|
+
const agentId = readManagedTrimmedEnv("SIGNET_AGENT_ID");
|
|
11598
|
+
if (daemonUrl)
|
|
11599
|
+
env.SIGNET_DAEMON_URL = resolveSignetDaemonUrl2();
|
|
11600
|
+
if (apiKey)
|
|
11601
|
+
env.SIGNET_API_KEY = apiKey;
|
|
11602
|
+
if (agentId)
|
|
11603
|
+
env.SIGNET_AGENT_ID = agentId;
|
|
11604
|
+
return env;
|
|
11605
|
+
}
|
|
11606
|
+
function resolveRemoteDaemonUrl() {
|
|
11607
|
+
return readManagedTrimmedEnv("SIGNET_DAEMON_URL") ? resolveSignetDaemonUrl2() : null;
|
|
11608
|
+
}
|
|
11509
11609
|
|
|
11510
11610
|
// ../../../libs/connector-base/dist/lenient-json.js
|
|
11511
11611
|
var __create = Object.create;
|
|
@@ -24684,79 +24784,6 @@ function parseSimpleYaml(text) {
|
|
|
24684
24784
|
return {};
|
|
24685
24785
|
}
|
|
24686
24786
|
}
|
|
24687
|
-
function readEnv(env, name) {
|
|
24688
|
-
const value = env[name];
|
|
24689
|
-
if (typeof value !== "string")
|
|
24690
|
-
return;
|
|
24691
|
-
const trimmed = value.trim();
|
|
24692
|
-
return trimmed.length > 0 ? trimmed : undefined;
|
|
24693
|
-
}
|
|
24694
|
-
function normalizePort(raw, fallback) {
|
|
24695
|
-
if (!raw)
|
|
24696
|
-
return String(fallback);
|
|
24697
|
-
if (!/^\d+$/.test(raw)) {
|
|
24698
|
-
throw new Error(`SIGNET_PORT must be an integer between 1 and 65535: ${raw}`);
|
|
24699
|
-
}
|
|
24700
|
-
const port = Number.parseInt(raw, 10);
|
|
24701
|
-
if (!Number.isFinite(port) || port < 1 || port > 65535) {
|
|
24702
|
-
throw new Error(`SIGNET_PORT must be an integer between 1 and 65535: ${raw}`);
|
|
24703
|
-
}
|
|
24704
|
-
return String(port);
|
|
24705
|
-
}
|
|
24706
|
-
function bracketIpv6Host(host) {
|
|
24707
|
-
if (host.startsWith("[") || !host.includes(":"))
|
|
24708
|
-
return host;
|
|
24709
|
-
return `[${host}]`;
|
|
24710
|
-
}
|
|
24711
|
-
function assertPlainHost(raw) {
|
|
24712
|
-
if (raw.includes("/") || raw.includes("@") || raw.includes("?") || raw.includes("#")) {
|
|
24713
|
-
throw new Error(`SIGNET_HOST must be a hostname or IP address, not a URL: ${raw}`);
|
|
24714
|
-
}
|
|
24715
|
-
const host = raw.startsWith("[") && raw.endsWith("]") ? raw.slice(1, -1) : raw;
|
|
24716
|
-
if (host.includes(":")) {
|
|
24717
|
-
if (/^[0-9A-Fa-f:.]+$/.test(host))
|
|
24718
|
-
return;
|
|
24719
|
-
throw new Error(`SIGNET_HOST must be a hostname or IP address: ${raw}`);
|
|
24720
|
-
}
|
|
24721
|
-
if (!/^[A-Za-z0-9]([A-Za-z0-9.-]*[A-Za-z0-9])?$/.test(host)) {
|
|
24722
|
-
throw new Error(`SIGNET_HOST must be a hostname or IP address: ${raw}`);
|
|
24723
|
-
}
|
|
24724
|
-
}
|
|
24725
|
-
function normalizeDaemonUrl(raw, source) {
|
|
24726
|
-
let parsed;
|
|
24727
|
-
try {
|
|
24728
|
-
parsed = new URL(raw);
|
|
24729
|
-
} catch {
|
|
24730
|
-
throw new Error(`${source} must be an http(s) URL: ${raw}`);
|
|
24731
|
-
}
|
|
24732
|
-
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
|
24733
|
-
throw new Error(`${source} must use http or https: ${raw}`);
|
|
24734
|
-
}
|
|
24735
|
-
if (parsed.username || parsed.password) {
|
|
24736
|
-
throw new Error(`${source} must not include username or password credentials`);
|
|
24737
|
-
}
|
|
24738
|
-
if (parsed.search || parsed.hash) {
|
|
24739
|
-
throw new Error(`${source} must not include query strings or fragments`);
|
|
24740
|
-
}
|
|
24741
|
-
if (parsed.pathname !== "/" && parsed.pathname !== "") {
|
|
24742
|
-
throw new Error(`${source} must point at the daemon origin, not a path: ${raw}`);
|
|
24743
|
-
}
|
|
24744
|
-
return parsed.toString().replace(/\/$/, "");
|
|
24745
|
-
}
|
|
24746
|
-
function resolveSignetDaemonUrl(opts = {}) {
|
|
24747
|
-
const env = opts.env ?? process.env;
|
|
24748
|
-
const fallbackHost = opts.defaultHost ?? "127.0.0.1";
|
|
24749
|
-
const fallbackPort = opts.defaultPort ?? 3850;
|
|
24750
|
-
const explicit = readEnv(env, "SIGNET_DAEMON_URL");
|
|
24751
|
-
if (explicit)
|
|
24752
|
-
return normalizeDaemonUrl(explicit, "SIGNET_DAEMON_URL");
|
|
24753
|
-
if (opts.configUrl)
|
|
24754
|
-
return normalizeDaemonUrl(opts.configUrl, "daemon.url");
|
|
24755
|
-
const host = readEnv(env, "SIGNET_HOST") ?? fallbackHost;
|
|
24756
|
-
assertPlainHost(host);
|
|
24757
|
-
const port = normalizePort(readEnv(env, "SIGNET_PORT"), fallbackPort);
|
|
24758
|
-
return normalizeDaemonUrl(`http://${bracketIpv6Host(host)}:${port}`, "SIGNET_HOST/SIGNET_PORT");
|
|
24759
|
-
}
|
|
24760
24787
|
var native2 = null;
|
|
24761
24788
|
try {
|
|
24762
24789
|
const esmRequire = createRequire22(import.meta.url);
|
|
@@ -28728,21 +28755,8 @@ Set the \\\`cycles\\\` parameter to \\\`"ref"\\\` to resolve cyclical schemas wi
|
|
|
28728
28755
|
|
|
28729
28756
|
// src/index.ts
|
|
28730
28757
|
var API_KEY_FILE_NAME = ".signet-api-key";
|
|
28731
|
-
function signetRuntimeEnv() {
|
|
28732
|
-
const env = {};
|
|
28733
|
-
const daemonUrl = configuredDaemonUrl();
|
|
28734
|
-
const apiKey = readTrimmedEnv2("SIGNET_API_KEY") ?? readTrimmedEnv2("SIGNET_TOKEN");
|
|
28735
|
-
const agentId = readTrimmedEnv2("SIGNET_AGENT_ID");
|
|
28736
|
-
if (daemonUrl)
|
|
28737
|
-
env.SIGNET_DAEMON_URL = daemonUrl;
|
|
28738
|
-
if (apiKey)
|
|
28739
|
-
env.SIGNET_API_KEY = apiKey;
|
|
28740
|
-
if (agentId)
|
|
28741
|
-
env.SIGNET_AGENT_ID = agentId;
|
|
28742
|
-
return env;
|
|
28743
|
-
}
|
|
28744
28758
|
function buildPluginBundle(apiKeyFilePath) {
|
|
28745
|
-
const env =
|
|
28759
|
+
const env = buildSignetRuntimeEnv();
|
|
28746
28760
|
if (apiKeyFilePath)
|
|
28747
28761
|
Reflect.deleteProperty(env, "SIGNET_API_KEY");
|
|
28748
28762
|
const assignments = Object.entries(env).map(([key, value]) => `process.env[${JSON.stringify(key)}] = ${JSON.stringify(value)};`);
|
|
@@ -28778,10 +28792,7 @@ function writeConfigValue(configPath, path, value) {
|
|
|
28778
28792
|
atomicWriteText(configPath, hasBom ? `\uFEFF${updated}` : updated);
|
|
28779
28793
|
}
|
|
28780
28794
|
function configuredDaemonUrl() {
|
|
28781
|
-
|
|
28782
|
-
if (!daemonUrl)
|
|
28783
|
-
return;
|
|
28784
|
-
return resolveSignetDaemonUrl({ env: { SIGNET_DAEMON_URL: daemonUrl } });
|
|
28795
|
+
return resolveRemoteDaemonUrl() ?? undefined;
|
|
28785
28796
|
}
|
|
28786
28797
|
|
|
28787
28798
|
class OpenCodeConnector extends BaseConnector {
|
|
@@ -29026,7 +29037,7 @@ class OpenCodeConnector extends BaseConnector {
|
|
|
29026
29037
|
}
|
|
29027
29038
|
const resolvedMcp = resolveSignetMcpCommand();
|
|
29028
29039
|
const mcpCommand = [resolvedMcp.command, ...resolvedMcp.args];
|
|
29029
|
-
const environment =
|
|
29040
|
+
const environment = buildSignetRuntimeEnv();
|
|
29030
29041
|
if (apiKeyFile)
|
|
29031
29042
|
environment.SIGNET_API_KEY = `{file:${apiKeyFile}}`;
|
|
29032
29043
|
writeConfigValue(configPath, ["mcp", "signet"], {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signetai/connector-opencode",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.164.0",
|
|
4
4
|
"description": "Signet connector for OpenCode - installs hooks and generates config",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"typecheck": "tsc --noEmit"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@signetai/connector-base": "0.
|
|
29
|
-
"@signetai/core": "0.
|
|
28
|
+
"@signetai/connector-base": "0.164.0",
|
|
29
|
+
"@signetai/core": "0.164.0",
|
|
30
30
|
"jsonc-parser": "3.3.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|