@signetai/connector-base 1.0.1 → 1.0.2-next.2663
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/agent-dir.js +39 -7
- package/dist/config.d.ts +10 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/index.d.ts +7 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +318 -78
- package/dist/launcher.d.ts +12 -0
- package/dist/launcher.d.ts.map +1 -0
- package/package.json +2 -2
package/dist/agent-dir.js
CHANGED
|
@@ -16106,6 +16106,27 @@ function repairBoardNotices(db) {
|
|
|
16106
16106
|
throw error;
|
|
16107
16107
|
}
|
|
16108
16108
|
}
|
|
16109
|
+
function up172(db) {
|
|
16110
|
+
db.exec(`
|
|
16111
|
+
CREATE TABLE IF NOT EXISTS dreaming_policies (
|
|
16112
|
+
hash TEXT PRIMARY KEY,
|
|
16113
|
+
text TEXT NOT NULL,
|
|
16114
|
+
created_at TEXT NOT NULL
|
|
16115
|
+
);
|
|
16116
|
+
`);
|
|
16117
|
+
const columns = new Set(db.prepare("PRAGMA table_info(dreaming_passes)").all().map((column) => column.name));
|
|
16118
|
+
if (!columns.has("policy_hash"))
|
|
16119
|
+
db.exec("ALTER TABLE dreaming_passes ADD COLUMN policy_hash TEXT");
|
|
16120
|
+
if (!columns.has("policy_source"))
|
|
16121
|
+
db.exec("ALTER TABLE dreaming_passes ADD COLUMN policy_source TEXT CHECK (policy_source IN ('default', 'custom'))");
|
|
16122
|
+
}
|
|
16123
|
+
function up173(db) {
|
|
16124
|
+
db.exec(`
|
|
16125
|
+
CREATE INDEX IF NOT EXISTS idx_memory_artifacts_native_paths
|
|
16126
|
+
ON memory_artifacts(agent_id, harness, source_kind, source_id, source_path, is_deleted)
|
|
16127
|
+
WHERE is_deleted = 0 AND harness IS NOT NULL
|
|
16128
|
+
`);
|
|
16129
|
+
}
|
|
16109
16130
|
var MIGRATIONS = [
|
|
16110
16131
|
{
|
|
16111
16132
|
version: 1,
|
|
@@ -17502,6 +17523,24 @@ var MIGRATIONS = [
|
|
|
17502
17523
|
"board_notices"
|
|
17503
17524
|
]
|
|
17504
17525
|
}
|
|
17526
|
+
},
|
|
17527
|
+
{
|
|
17528
|
+
version: 172,
|
|
17529
|
+
name: "dreaming-pass-policy",
|
|
17530
|
+
up: up172,
|
|
17531
|
+
artifacts: {
|
|
17532
|
+
tables: ["dreaming_policies"],
|
|
17533
|
+
columns: [
|
|
17534
|
+
{ table: "dreaming_passes", column: "policy_hash" },
|
|
17535
|
+
{ table: "dreaming_passes", column: "policy_source" }
|
|
17536
|
+
]
|
|
17537
|
+
}
|
|
17538
|
+
},
|
|
17539
|
+
{
|
|
17540
|
+
version: 173,
|
|
17541
|
+
name: "memory-artifact-native-path-index",
|
|
17542
|
+
up: up173,
|
|
17543
|
+
artifacts: { indexes: ["idx_memory_artifacts_native_paths"] }
|
|
17505
17544
|
}
|
|
17506
17545
|
];
|
|
17507
17546
|
var LATEST_SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1]?.version ?? 0;
|
|
@@ -18022,13 +18061,6 @@ var IDENTITY_FILES = {
|
|
|
18022
18061
|
optional: true,
|
|
18023
18062
|
context: "session",
|
|
18024
18063
|
session: "bootstrap"
|
|
18025
|
-
},
|
|
18026
|
-
dreaming: {
|
|
18027
|
-
path: "DREAMING.md",
|
|
18028
|
-
description: "Dreaming/reflection prompt used only for dreaming sessions",
|
|
18029
|
-
optional: true,
|
|
18030
|
-
context: "session",
|
|
18031
|
-
session: "dreaming"
|
|
18032
18064
|
}
|
|
18033
18065
|
};
|
|
18034
18066
|
var REQUIRED_IDENTITY_KEYS = Object.entries(IDENTITY_FILES).filter(([, spec]) => !spec.optional).map(([key]) => key);
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type ResolvedCommand = {
|
|
2
|
+
readonly command: string;
|
|
3
|
+
readonly args: readonly string[];
|
|
4
|
+
readonly env?: Readonly<Record<string, string>>;
|
|
5
|
+
};
|
|
6
|
+
export declare function isJsonObject(value: unknown): value is Record<string, unknown>;
|
|
7
|
+
export declare function readTrimmedEnv(name: string): string | undefined;
|
|
8
|
+
export declare function readManagedTrimmedEnv(name: string): string | undefined;
|
|
9
|
+
export declare function isExistingFile(path: string | undefined): path is string;
|
|
10
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,eAAe,GAAG;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAChD,CAAC;AAEF,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAE7E;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAK/D;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEtE;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,IAAI,MAAM,CAGvE"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { isJsonObject, isExistingFile, readTrimmedEnv, readManagedTrimmedEnv, type ResolvedCommand } from "./config";
|
|
1
2
|
import { type SymlinkOptions, type SymlinkResult } from "@signetai/core";
|
|
2
3
|
export interface InstallResult {
|
|
3
4
|
success: boolean;
|
|
@@ -44,26 +45,21 @@ export declare function keepSignetApiKeyFilePrivate(path: string): void;
|
|
|
44
45
|
export declare function writeConfigText(path: string, content: string): void;
|
|
45
46
|
export declare function atomicWriteText(path: string, content: string, mode?: number): void;
|
|
46
47
|
export declare function atomicWriteJson(path: string, data: unknown, indent?: number | string): void;
|
|
47
|
-
export
|
|
48
|
-
readonly command: string;
|
|
49
|
-
readonly args: readonly string[];
|
|
50
|
-
readonly env?: Readonly<Record<string, string>>;
|
|
51
|
-
};
|
|
52
|
-
export declare const SIGNET_MCP_STDIO_WORKER_ENV = "SIGNET_MCP_STDIO_WORKER";
|
|
53
|
-
export declare function resolveSignetMcpCommand(): ResolvedCommand;
|
|
54
|
-
export declare function resolveSignetCliCommand(): ResolvedCommand;
|
|
48
|
+
export { SIGNET_MCP_STDIO_WORKER_ENV, isSignetCliLauncher, cliFromMcp, mcpFromCli, parseHookLauncher, quoteCommandArg, readMcpLauncher, renderCommand, resolveSignetCliCommand, resolveSignetMcpCommand, } from "./launcher";
|
|
55
49
|
export declare const MANAGED_DAEMON_URL_DEFAULT = "http://127.0.0.1:3850";
|
|
56
50
|
export declare const MANAGED_AGENT_ID_DEFAULT = "default";
|
|
57
|
-
export declare function isJsonObject(value: unknown): value is Record<string, unknown>;
|
|
58
51
|
export declare function isChildOf(candidate: string, parent: string): boolean;
|
|
59
|
-
export declare function readTrimmedEnv(name: string): string | undefined;
|
|
60
|
-
export declare function readManagedTrimmedEnv(name: string): string | undefined;
|
|
61
52
|
export declare function resolveSignetWorkspacePath(home?: string): string;
|
|
62
53
|
export declare function resolveSignetDaemonUrl(): string;
|
|
63
54
|
export declare function resolveSignetAgentId(): string;
|
|
64
55
|
export declare function resolveSignetApiKey(): string | undefined;
|
|
56
|
+
export declare function resolveInstallApiKey(): Promise<{
|
|
57
|
+
readonly apiKey?: string;
|
|
58
|
+
readonly warning?: string;
|
|
59
|
+
}>;
|
|
65
60
|
export declare function buildSignetRuntimeEnv(opts?: {
|
|
66
61
|
readonly basePath?: string;
|
|
62
|
+
readonly apiKey?: string | null;
|
|
67
63
|
}): Record<string, string>;
|
|
68
64
|
export declare function resolveRemoteDaemonUrl(): string | null;
|
|
69
65
|
export declare function buildManagedExtensionEnvBootstrap(env: {
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,qBAAqB,EAAE,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAoBrH,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,aAAa,EAKlB,MAAM,cAAc,CAAC;AAEtB,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;AAED,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG,UAAU,GAAG,WAAW,GAAG,YAAY,GAAG,SAAS,CAAC;AAEpG,MAAM,WAAW,eAAe;IAC/B,MAAM,EAAE,qBAAqB,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,6BAA6B;IAC7C,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,OAAO,CAAC;IACtB,gCAAgC,EAAE,OAAO,CAAC;CAC1C;AACD,8BAAsB,aAAa;IAClC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IACpC,YAAY,IAAI,MAAM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CN;AAED,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,33 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import { randomBytes } from "node:crypto";
|
|
3
|
+
|
|
4
|
+
// src/config.ts
|
|
5
|
+
import { statSync } from "node:fs";
|
|
6
|
+
function isJsonObject(value) {
|
|
7
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8
|
+
}
|
|
9
|
+
function readTrimmedEnv(name) {
|
|
10
|
+
const value = process.env[name];
|
|
11
|
+
if (typeof value !== "string")
|
|
12
|
+
return;
|
|
13
|
+
const trimmed = value.trim().replace(/[\r\n]+/g, "");
|
|
14
|
+
return trimmed.length > 0 ? trimmed : undefined;
|
|
15
|
+
}
|
|
16
|
+
function readManagedTrimmedEnv(name) {
|
|
17
|
+
return readTrimmedEnv(name);
|
|
18
|
+
}
|
|
19
|
+
function isExistingFile(path) {
|
|
20
|
+
if (!path)
|
|
21
|
+
return false;
|
|
22
|
+
return statSync(path, { throwIfNoEntry: false })?.isFile() ?? false;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// src/index.ts
|
|
3
26
|
import {
|
|
4
27
|
chmodSync,
|
|
5
28
|
closeSync,
|
|
6
29
|
constants,
|
|
7
|
-
existsSync,
|
|
30
|
+
existsSync as existsSync2,
|
|
8
31
|
fchmodSync,
|
|
9
32
|
fstatSync,
|
|
10
33
|
ftruncateSync,
|
|
@@ -12,13 +35,13 @@ import {
|
|
|
12
35
|
readFileSync,
|
|
13
36
|
realpathSync,
|
|
14
37
|
renameSync,
|
|
15
|
-
statSync,
|
|
38
|
+
statSync as statSync3,
|
|
16
39
|
unlinkSync,
|
|
17
40
|
writeFileSync,
|
|
18
41
|
writeSync
|
|
19
42
|
} from "node:fs";
|
|
20
43
|
import { homedir } from "node:os";
|
|
21
|
-
import {
|
|
44
|
+
import { dirname as dirname3, isAbsolute as isAbsolute2, join as join4, relative, sep } from "node:path";
|
|
22
45
|
|
|
23
46
|
// ../../platform/core/dist/index.js
|
|
24
47
|
import { createRequire } from "node:module";
|
|
@@ -16123,6 +16146,27 @@ function repairBoardNotices(db) {
|
|
|
16123
16146
|
throw error;
|
|
16124
16147
|
}
|
|
16125
16148
|
}
|
|
16149
|
+
function up172(db) {
|
|
16150
|
+
db.exec(`
|
|
16151
|
+
CREATE TABLE IF NOT EXISTS dreaming_policies (
|
|
16152
|
+
hash TEXT PRIMARY KEY,
|
|
16153
|
+
text TEXT NOT NULL,
|
|
16154
|
+
created_at TEXT NOT NULL
|
|
16155
|
+
);
|
|
16156
|
+
`);
|
|
16157
|
+
const columns = new Set(db.prepare("PRAGMA table_info(dreaming_passes)").all().map((column) => column.name));
|
|
16158
|
+
if (!columns.has("policy_hash"))
|
|
16159
|
+
db.exec("ALTER TABLE dreaming_passes ADD COLUMN policy_hash TEXT");
|
|
16160
|
+
if (!columns.has("policy_source"))
|
|
16161
|
+
db.exec("ALTER TABLE dreaming_passes ADD COLUMN policy_source TEXT CHECK (policy_source IN ('default', 'custom'))");
|
|
16162
|
+
}
|
|
16163
|
+
function up173(db) {
|
|
16164
|
+
db.exec(`
|
|
16165
|
+
CREATE INDEX IF NOT EXISTS idx_memory_artifacts_native_paths
|
|
16166
|
+
ON memory_artifacts(agent_id, harness, source_kind, source_id, source_path, is_deleted)
|
|
16167
|
+
WHERE is_deleted = 0 AND harness IS NOT NULL
|
|
16168
|
+
`);
|
|
16169
|
+
}
|
|
16126
16170
|
var MIGRATIONS = [
|
|
16127
16171
|
{
|
|
16128
16172
|
version: 1,
|
|
@@ -17519,6 +17563,24 @@ var MIGRATIONS = [
|
|
|
17519
17563
|
"board_notices"
|
|
17520
17564
|
]
|
|
17521
17565
|
}
|
|
17566
|
+
},
|
|
17567
|
+
{
|
|
17568
|
+
version: 172,
|
|
17569
|
+
name: "dreaming-pass-policy",
|
|
17570
|
+
up: up172,
|
|
17571
|
+
artifacts: {
|
|
17572
|
+
tables: ["dreaming_policies"],
|
|
17573
|
+
columns: [
|
|
17574
|
+
{ table: "dreaming_passes", column: "policy_hash" },
|
|
17575
|
+
{ table: "dreaming_passes", column: "policy_source" }
|
|
17576
|
+
]
|
|
17577
|
+
}
|
|
17578
|
+
},
|
|
17579
|
+
{
|
|
17580
|
+
version: 173,
|
|
17581
|
+
name: "memory-artifact-native-path-index",
|
|
17582
|
+
up: up173,
|
|
17583
|
+
artifacts: { indexes: ["idx_memory_artifacts_native_paths"] }
|
|
17522
17584
|
}
|
|
17523
17585
|
];
|
|
17524
17586
|
var LATEST_SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1]?.version ?? 0;
|
|
@@ -17878,7 +17940,7 @@ var DEFAULT_AGENTS_DIRNAME = ".agents";
|
|
|
17878
17940
|
function normalizeWorkspacePath(pathValue, home = homedir4()) {
|
|
17879
17941
|
return resolve6(expandHome(pathValue.trim(), home));
|
|
17880
17942
|
}
|
|
17881
|
-
function
|
|
17943
|
+
function readTrimmedEnv2(env, name) {
|
|
17882
17944
|
const value = env[name];
|
|
17883
17945
|
if (typeof value !== "string")
|
|
17884
17946
|
return;
|
|
@@ -17965,7 +18027,7 @@ function resolveWorkspacePath(options = {}) {
|
|
|
17965
18027
|
}
|
|
17966
18028
|
function resolveEnvWorkspace(env, home, requireExisting) {
|
|
17967
18029
|
for (const key of WORKSPACE_ENV_KEYS) {
|
|
17968
|
-
const raw =
|
|
18030
|
+
const raw = readTrimmedEnv2(env, key);
|
|
17969
18031
|
if (!raw)
|
|
17970
18032
|
continue;
|
|
17971
18033
|
const normalized = normalizeWorkspacePath(raw, home);
|
|
@@ -18039,13 +18101,6 @@ var IDENTITY_FILES = {
|
|
|
18039
18101
|
optional: true,
|
|
18040
18102
|
context: "session",
|
|
18041
18103
|
session: "bootstrap"
|
|
18042
|
-
},
|
|
18043
|
-
dreaming: {
|
|
18044
|
-
path: "DREAMING.md",
|
|
18045
|
-
description: "Dreaming/reflection prompt used only for dreaming sessions",
|
|
18046
|
-
optional: true,
|
|
18047
|
-
context: "session",
|
|
18048
|
-
session: "dreaming"
|
|
18049
18104
|
}
|
|
18050
18105
|
};
|
|
18051
18106
|
var REQUIRED_IDENTITY_KEYS = Object.entries(IDENTITY_FILES).filter(([, spec]) => !spec.optional).map(([key]) => key);
|
|
@@ -18135,6 +18190,210 @@ function escapeRegex(str) {
|
|
|
18135
18190
|
}
|
|
18136
18191
|
var LOCAL_THINKING_EXECUTORS = new Set(["openai-compatible", "llama-cpp", "ollama"]);
|
|
18137
18192
|
|
|
18193
|
+
// src/launcher.ts
|
|
18194
|
+
import { existsSync, statSync as statSync2 } from "node:fs";
|
|
18195
|
+
import { dirname as dirname2, isAbsolute, join as join3, parse, win32 } from "node:path";
|
|
18196
|
+
var SIGNET_MCP_STDIO_WORKER_ENV = "SIGNET_MCP_STDIO_WORKER";
|
|
18197
|
+
function quoteCommandArg(value, platform = process.platform) {
|
|
18198
|
+
if (/^[A-Za-z0-9_./\\:@+=,-]+$/.test(value))
|
|
18199
|
+
return value;
|
|
18200
|
+
if (platform === "win32") {
|
|
18201
|
+
return `"${value.replace(/[%^&|<>!"]/g, (char) => char === "%" ? "%%" : `^${char}`)}"`;
|
|
18202
|
+
}
|
|
18203
|
+
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
18204
|
+
}
|
|
18205
|
+
function renderCommand(launcher) {
|
|
18206
|
+
return [launcher.command, ...launcher.args].map((arg) => quoteCommandArg(arg)).join(" ");
|
|
18207
|
+
}
|
|
18208
|
+
function parseHookLauncher(command) {
|
|
18209
|
+
const clean = command.trim().replace(/^(?:(?:SIGNET_DAEMON_URL|SIGNET_API_KEY|SIGNET_PATH|SIGNET_FETCH_TIMEOUT|SIGNET_SESSION_START_TIMEOUT|SIGNET_PROMPT_SUBMIT_TIMEOUT)=(?:'(?:[^']|'\\'')*'|"[^"]*"|\S+)\s+|set "(?:SIGNET_DAEMON_URL|SIGNET_API_KEY|SIGNET_PATH|SIGNET_FETCH_TIMEOUT|SIGNET_SESSION_START_TIMEOUT|SIGNET_PROMPT_SUBMIT_TIMEOUT)=[^"]*" && )+/i, "");
|
|
18210
|
+
const args = [];
|
|
18211
|
+
let value = "";
|
|
18212
|
+
let quote = "";
|
|
18213
|
+
let started = false;
|
|
18214
|
+
for (let i = 0;i < clean.length; i++) {
|
|
18215
|
+
const char = clean.charAt(i);
|
|
18216
|
+
if (!quote && /[$`;&|<>()]/.test(char))
|
|
18217
|
+
return;
|
|
18218
|
+
if (char === "\\" && !quote && clean.charAt(i + 1) === "'") {
|
|
18219
|
+
value += "'";
|
|
18220
|
+
i++;
|
|
18221
|
+
started = true;
|
|
18222
|
+
continue;
|
|
18223
|
+
}
|
|
18224
|
+
if (char === quote) {
|
|
18225
|
+
quote = "";
|
|
18226
|
+
continue;
|
|
18227
|
+
}
|
|
18228
|
+
if (!quote && (char === "'" || char === '"')) {
|
|
18229
|
+
quote = char;
|
|
18230
|
+
started = true;
|
|
18231
|
+
continue;
|
|
18232
|
+
}
|
|
18233
|
+
if (!quote && /\s/.test(char)) {
|
|
18234
|
+
if (started && value === "hook") {
|
|
18235
|
+
const executable = args.shift();
|
|
18236
|
+
const launcher = executable ? { command: executable, args } : undefined;
|
|
18237
|
+
return isSignetCliLauncher(launcher) ? launcher : undefined;
|
|
18238
|
+
}
|
|
18239
|
+
if (started)
|
|
18240
|
+
args.push(value);
|
|
18241
|
+
value = "";
|
|
18242
|
+
started = false;
|
|
18243
|
+
continue;
|
|
18244
|
+
}
|
|
18245
|
+
value += char;
|
|
18246
|
+
started = true;
|
|
18247
|
+
}
|
|
18248
|
+
return;
|
|
18249
|
+
}
|
|
18250
|
+
function isSignetCliLauncher(launcher) {
|
|
18251
|
+
if (!launcher)
|
|
18252
|
+
return false;
|
|
18253
|
+
if (/^signet(?:\.(?:exe|cmd|bat|ps1))?$/i.test(win32.basename(launcher.command)))
|
|
18254
|
+
return launcher.args.length === 0;
|
|
18255
|
+
return /^(?:node|bun)(?:\.exe)?$/i.test(win32.basename(launcher.command)) && launcher.args.length === 1 && /(?:^|[\\/])signet\.js$/.test(launcher.args[0] ?? "");
|
|
18256
|
+
}
|
|
18257
|
+
function readMcpLauncher(value) {
|
|
18258
|
+
if (!isJsonObject(value) || typeof value.command !== "string" || !value.command)
|
|
18259
|
+
return;
|
|
18260
|
+
const args = value.args ?? [];
|
|
18261
|
+
if (!Array.isArray(args) || !args.every((arg) => typeof arg === "string"))
|
|
18262
|
+
return;
|
|
18263
|
+
const env = {};
|
|
18264
|
+
if (isJsonObject(value.env)) {
|
|
18265
|
+
for (const [key, val] of Object.entries(value.env)) {
|
|
18266
|
+
if (typeof val === "string" && key !== "SIGNET_API_KEY" && key !== "SIGNET_TOKEN")
|
|
18267
|
+
env[key] = val;
|
|
18268
|
+
}
|
|
18269
|
+
}
|
|
18270
|
+
const launcher = { command: value.command, args, ...Object.keys(env).length ? { env } : {} };
|
|
18271
|
+
const name = win32.basename(launcher.command);
|
|
18272
|
+
if (/^signet-mcp(?:\.exe)?$/i.test(name))
|
|
18273
|
+
return launcher;
|
|
18274
|
+
if (/^signet(?:\.(?:exe|cmd|bat|ps1))?$/i.test(name) && env.SIGNET_MCP_STDIO_WORKER === "1")
|
|
18275
|
+
return launcher;
|
|
18276
|
+
if (/^(?:node|bun)(?:\.exe)?$/i.test(name) && args.length === 1 && /(?:^|[\\/])(?:dist[\\/]mcp-stdio|signet)\.js$/.test(args[0] ?? ""))
|
|
18277
|
+
return launcher;
|
|
18278
|
+
return;
|
|
18279
|
+
}
|
|
18280
|
+
function override() {
|
|
18281
|
+
const value = process.env.SIGNET_HOOK_COMMAND?.trim();
|
|
18282
|
+
if (!value) {
|
|
18283
|
+
const command = readManagedTrimmedEnv("SIGNET_CLI_PATH");
|
|
18284
|
+
return command ? { command, args: [] } : undefined;
|
|
18285
|
+
}
|
|
18286
|
+
const message = "SIGNET_HOOK_COMMAND must be an executable path without whitespace or a nonempty JSON argv array of command and arguments";
|
|
18287
|
+
if (!value.startsWith("[")) {
|
|
18288
|
+
if (/\s/.test(value))
|
|
18289
|
+
throw new Error(message);
|
|
18290
|
+
return { command: value, args: [] };
|
|
18291
|
+
}
|
|
18292
|
+
let parsed;
|
|
18293
|
+
try {
|
|
18294
|
+
parsed = JSON.parse(value);
|
|
18295
|
+
} catch {
|
|
18296
|
+
throw new Error(message);
|
|
18297
|
+
}
|
|
18298
|
+
if (!Array.isArray(parsed) || !parsed.every((arg) => typeof arg === "string") || !parsed[0]?.trim()) {
|
|
18299
|
+
throw new Error(message);
|
|
18300
|
+
}
|
|
18301
|
+
return { command: parsed[0], args: parsed.slice(1) };
|
|
18302
|
+
}
|
|
18303
|
+
function cliFromMcp(launcher) {
|
|
18304
|
+
if (!launcher)
|
|
18305
|
+
return;
|
|
18306
|
+
if (isSignetCliLauncher(launcher) && (launcher.env?.SIGNET_MCP_STDIO_WORKER === "1" || /^(?:node|bun)(?:\.exe)?$/i.test(win32.basename(launcher.command)))) {
|
|
18307
|
+
return { command: launcher.command, args: launcher.args };
|
|
18308
|
+
}
|
|
18309
|
+
if (/^signet-mcp(?:\.exe)?$/i.test(win32.basename(launcher.command))) {
|
|
18310
|
+
const cli = { command: launcher.command.replace(/signet-mcp(\.exe)?$/i, "signet$1"), args: launcher.args };
|
|
18311
|
+
return isSignetCliLauncher(cli) ? cli : undefined;
|
|
18312
|
+
}
|
|
18313
|
+
if (launcher.args.length !== 1 || !/(?:^|[\\/])dist[\\/]mcp-stdio\.js$/.test(launcher.args[0] ?? ""))
|
|
18314
|
+
return;
|
|
18315
|
+
const cli = {
|
|
18316
|
+
command: launcher.command,
|
|
18317
|
+
args: launcher.args.map((arg) => arg.replace(/dist[\\/]mcp-stdio\.js$/, "bin/signet.js"))
|
|
18318
|
+
};
|
|
18319
|
+
return isSignetCliLauncher(cli) ? cli : undefined;
|
|
18320
|
+
}
|
|
18321
|
+
function mcpFromCli(launcher) {
|
|
18322
|
+
if (!launcher)
|
|
18323
|
+
return;
|
|
18324
|
+
const script = launcher.args.findIndex((arg) => /(?:^|[\\/])signet\.js$/.test(arg));
|
|
18325
|
+
if (script >= 0 && /(?:^|[\\/])bin[\\/]signet\.js$/.test(launcher.args[script] ?? ""))
|
|
18326
|
+
return {
|
|
18327
|
+
command: launcher.command,
|
|
18328
|
+
args: launcher.args.map((arg, i) => i === script ? arg.replace(/bin[\\/]signet\.js$/, "dist/mcp-stdio.js") : arg)
|
|
18329
|
+
};
|
|
18330
|
+
return { ...launcher, env: { ...launcher.env, SIGNET_MCP_STDIO_WORKER: "1" } };
|
|
18331
|
+
}
|
|
18332
|
+
function discover(mcp, runtime) {
|
|
18333
|
+
const roots = [readManagedTrimmedEnv("SIGNET_WRAPPER_DIR"), readManagedTrimmedEnv("SIGNET_DIR")].filter((root) => Boolean(root));
|
|
18334
|
+
const entries = [
|
|
18335
|
+
...roots.map((root) => join3(root, "bin", "signet.js")),
|
|
18336
|
+
process.argv[1],
|
|
18337
|
+
join3(dirname2(process.execPath), "..", "bin", "signet.js")
|
|
18338
|
+
];
|
|
18339
|
+
const entry = entries.find((path) => path && win32.basename(path) === "signet.js" && isExistingFile(path));
|
|
18340
|
+
const script = entry ? mcp ? join3(dirname2(entry), "..", "dist", "mcp-stdio.js") : entry : undefined;
|
|
18341
|
+
const host = runtime ?? (/^(?:node|bun)(?:\.exe)?$/i.test(win32.basename(process.execPath)) ? process.execPath : undefined);
|
|
18342
|
+
if (host && script && isExistingFile(script))
|
|
18343
|
+
return { command: host, args: [script] };
|
|
18344
|
+
const name = process.platform === "win32" ? "signet.exe" : "signet";
|
|
18345
|
+
const candidates = [
|
|
18346
|
+
...roots.flatMap((root) => [join3(root, "native", name), join3(root, "bin", name)]),
|
|
18347
|
+
process.execPath
|
|
18348
|
+
];
|
|
18349
|
+
const native = candidates.find((path) => /^signet(?:\.exe)?$/i.test(win32.basename(path)) && isExistingFile(path));
|
|
18350
|
+
if (native)
|
|
18351
|
+
return { command: native, args: [], ...mcp ? { env: { SIGNET_MCP_STDIO_WORKER: "1" } } : {} };
|
|
18352
|
+
if (mcp && process.platform === "win32")
|
|
18353
|
+
console.warn(`[signet] Warning: could not resolve mcp-stdio.js from argv[1]="${process.argv[1] ?? ""}". MCP server config will use "signet-mcp" which may fail on Windows without shell:true.`);
|
|
18354
|
+
return { command: mcp ? "signet-mcp" : "signet", args: [] };
|
|
18355
|
+
}
|
|
18356
|
+
function launcherPathStatus(path) {
|
|
18357
|
+
try {
|
|
18358
|
+
if (statSync2(path, { throwIfNoEntry: false }))
|
|
18359
|
+
return "present";
|
|
18360
|
+
} catch (error) {
|
|
18361
|
+
const code = error instanceof Error && "code" in error ? error.code : undefined;
|
|
18362
|
+
if (code !== "ENOTDIR" && code !== "ELOOP")
|
|
18363
|
+
return "unverified";
|
|
18364
|
+
}
|
|
18365
|
+
const root = parse(path).root;
|
|
18366
|
+
const segments = path.slice(root.length).split(/[\\/]/).filter(Boolean);
|
|
18367
|
+
return isAbsolute(path) && segments.length >= 2 && existsSync(join3(root, ...segments.slice(0, 2))) ? "missing" : "unverified";
|
|
18368
|
+
}
|
|
18369
|
+
function reuseLauncher(existing, mcp, runtime) {
|
|
18370
|
+
if (!existing)
|
|
18371
|
+
return discover(mcp, runtime);
|
|
18372
|
+
const paths = [
|
|
18373
|
+
existing.command,
|
|
18374
|
+
.../^(?:node|bun)(?:\.exe)?$/i.test(win32.basename(existing.command)) ? existing.args : []
|
|
18375
|
+
];
|
|
18376
|
+
const statuses = paths.map((path, index) => index === 0 && !/[\\/]/.test(path) ? "present" : launcherPathStatus(path));
|
|
18377
|
+
if (statuses.includes("missing")) {
|
|
18378
|
+
const replacement = discover(mcp, runtime);
|
|
18379
|
+
console.warn(`[signet] Warning: stale launcher ${renderCommand(existing)} was replaced with ${renderCommand(replacement)}.`);
|
|
18380
|
+
return replacement;
|
|
18381
|
+
}
|
|
18382
|
+
if (statuses.includes("unverified")) {
|
|
18383
|
+
console.warn(`[signet] Warning: launcher ${renderCommand(existing)} could not be verified from this environment; keeping it. Set SIGNET_HOOK_COMMAND to override it.`);
|
|
18384
|
+
}
|
|
18385
|
+
return existing;
|
|
18386
|
+
}
|
|
18387
|
+
function resolveSignetCliCommand(existing, runtime) {
|
|
18388
|
+
return override() ?? reuseLauncher(isSignetCliLauncher(existing) ? existing : undefined, false, runtime);
|
|
18389
|
+
}
|
|
18390
|
+
function resolveSignetMcpCommand(existing, runtime) {
|
|
18391
|
+
const configured = override();
|
|
18392
|
+
if (configured)
|
|
18393
|
+
return mcpFromCli(configured) ?? configured;
|
|
18394
|
+
return reuseLauncher(readMcpLauncher(existing), true, runtime);
|
|
18395
|
+
}
|
|
18396
|
+
|
|
18138
18397
|
// src/index.ts
|
|
18139
18398
|
class BaseConnector {
|
|
18140
18399
|
getIconAsset() {
|
|
@@ -18144,20 +18403,20 @@ class BaseConnector {
|
|
|
18144
18403
|
return stripSignetBlock(content);
|
|
18145
18404
|
}
|
|
18146
18405
|
stripLegacySignetBlock(basePath) {
|
|
18147
|
-
const agentsPath =
|
|
18148
|
-
if (!
|
|
18406
|
+
const agentsPath = join4(basePath, "AGENTS.md");
|
|
18407
|
+
if (!existsSync2(agentsPath))
|
|
18149
18408
|
return null;
|
|
18150
18409
|
const raw = readFileSync(agentsPath, "utf-8");
|
|
18151
18410
|
const cleaned = stripSignetBlock(raw);
|
|
18152
18411
|
if (cleaned === raw)
|
|
18153
18412
|
return null;
|
|
18154
18413
|
const root = realpathSync(basePath);
|
|
18155
|
-
const parent = realpathSync(
|
|
18156
|
-
const rel = relative(root,
|
|
18157
|
-
if (rel.startsWith("..") ||
|
|
18414
|
+
const parent = realpathSync(dirname3(agentsPath));
|
|
18415
|
+
const rel = relative(root, join4(parent, "AGENTS.md"));
|
|
18416
|
+
if (rel.startsWith("..") || isAbsolute2(rel)) {
|
|
18158
18417
|
throw new Error(`Target path escapes validated root: ${agentsPath}`);
|
|
18159
18418
|
}
|
|
18160
|
-
const tmp =
|
|
18419
|
+
const tmp = join4(basePath, `.${randomBytes(6).toString("hex")}.tmp`);
|
|
18161
18420
|
try {
|
|
18162
18421
|
writeFileSync(tmp, cleaned, "utf-8");
|
|
18163
18422
|
renameSync(tmp, agentsPath);
|
|
@@ -18175,7 +18434,7 @@ class BaseConnector {
|
|
|
18175
18434
|
generateHeader(sourcePath, targetName) {
|
|
18176
18435
|
const name = targetName || this.name;
|
|
18177
18436
|
const safe = (p) => p.replace(/[\n\r]/g, "");
|
|
18178
|
-
const root =
|
|
18437
|
+
const root = dirname3(sourcePath);
|
|
18179
18438
|
return `# Auto-generated from ${safe(sourcePath)}
|
|
18180
18439
|
# Source: ${safe(sourcePath)}
|
|
18181
18440
|
# Generated: ${new Date().toISOString()}
|
|
@@ -18188,8 +18447,8 @@ class BaseConnector {
|
|
|
18188
18447
|
const files = ["SOUL.md", "IDENTITY.md", "USER.md", "MEMORY.md"];
|
|
18189
18448
|
const parts = [];
|
|
18190
18449
|
for (const name of files) {
|
|
18191
|
-
const filePath =
|
|
18192
|
-
if (!
|
|
18450
|
+
const filePath = join4(basePath, name);
|
|
18451
|
+
if (!existsSync2(filePath))
|
|
18193
18452
|
continue;
|
|
18194
18453
|
try {
|
|
18195
18454
|
const content = readFileSync(filePath, "utf-8").trim();
|
|
@@ -18206,7 +18465,7 @@ ${content}`);
|
|
|
18206
18465
|
`);
|
|
18207
18466
|
}
|
|
18208
18467
|
isDetected() {
|
|
18209
|
-
return
|
|
18468
|
+
return existsSync2(this.getConfigPath());
|
|
18210
18469
|
}
|
|
18211
18470
|
async inspectHealth() {
|
|
18212
18471
|
try {
|
|
@@ -18258,7 +18517,7 @@ function containsSignetApiKey(content) {
|
|
|
18258
18517
|
function keepSignetApiKeyFilePrivate(path) {
|
|
18259
18518
|
let mode;
|
|
18260
18519
|
try {
|
|
18261
|
-
mode =
|
|
18520
|
+
mode = statSync3(path).mode & 511;
|
|
18262
18521
|
} catch {
|
|
18263
18522
|
return;
|
|
18264
18523
|
}
|
|
@@ -18290,11 +18549,11 @@ function writeConfigText(path, content) {
|
|
|
18290
18549
|
}
|
|
18291
18550
|
}
|
|
18292
18551
|
function atomicWriteText(path, content, mode) {
|
|
18293
|
-
const tmp =
|
|
18552
|
+
const tmp = join4(dirname3(path), `.${randomBytes(6).toString("hex")}.tmp`);
|
|
18294
18553
|
let writeMode = mode;
|
|
18295
18554
|
if (writeMode === undefined) {
|
|
18296
18555
|
try {
|
|
18297
|
-
writeMode =
|
|
18556
|
+
writeMode = statSync3(path).mode & 511;
|
|
18298
18557
|
} catch {}
|
|
18299
18558
|
}
|
|
18300
18559
|
if (containsSignetApiKey(content))
|
|
@@ -18313,60 +18572,15 @@ function atomicWriteJson(path, data, indent = 2) {
|
|
|
18313
18572
|
atomicWriteText(path, `${JSON.stringify(data, null, indent)}
|
|
18314
18573
|
`);
|
|
18315
18574
|
}
|
|
18316
|
-
var SIGNET_MCP_STDIO_WORKER_ENV = "SIGNET_MCP_STDIO_WORKER";
|
|
18317
|
-
function resolveRunningNativeSignetBinary() {
|
|
18318
|
-
const executable = process.execPath;
|
|
18319
|
-
if (!/^signet(?:\.exe)?$/i.test(basename2(executable)))
|
|
18320
|
-
return null;
|
|
18321
|
-
try {
|
|
18322
|
-
return statSync(executable).isFile() ? executable : null;
|
|
18323
|
-
} catch {
|
|
18324
|
-
return null;
|
|
18325
|
-
}
|
|
18326
|
-
}
|
|
18327
|
-
function resolvePackagedSignetCommand(bareCommand, scriptDirectory, scriptName, warnOnFallback) {
|
|
18328
|
-
if (process.platform !== "win32")
|
|
18329
|
-
return { command: bareCommand, args: [] };
|
|
18330
|
-
const cliEntry = process.argv[1] ?? "";
|
|
18331
|
-
const scriptPath = join3(cliEntry, "..", "..", scriptDirectory, scriptName);
|
|
18332
|
-
if (cliEntry && existsSync(scriptPath))
|
|
18333
|
-
return { command: process.execPath, args: [scriptPath] };
|
|
18334
|
-
if (warnOnFallback) {
|
|
18335
|
-
console.warn(`[signet] Warning: could not resolve ${scriptName} from argv[1]="${cliEntry}". ` + `MCP server config will use "${bareCommand}" which may fail on Windows without shell:true.`);
|
|
18336
|
-
}
|
|
18337
|
-
return { command: bareCommand, args: [] };
|
|
18338
|
-
}
|
|
18339
|
-
function resolveSignetMcpCommand() {
|
|
18340
|
-
const nativeBinary = resolveRunningNativeSignetBinary();
|
|
18341
|
-
if (nativeBinary)
|
|
18342
|
-
return { command: nativeBinary, args: [], env: { [SIGNET_MCP_STDIO_WORKER_ENV]: "1" } };
|
|
18343
|
-
return resolvePackagedSignetCommand("signet-mcp", "dist", "mcp-stdio.js", true);
|
|
18344
|
-
}
|
|
18345
|
-
function resolveSignetCliCommand() {
|
|
18346
|
-
return resolvePackagedSignetCommand("signet", "bin", "signet.js", false);
|
|
18347
|
-
}
|
|
18348
18575
|
var MANAGED_DAEMON_URL_DEFAULT = "http://127.0.0.1:3850";
|
|
18349
18576
|
var MANAGED_AGENT_ID_DEFAULT = "default";
|
|
18350
|
-
function isJsonObject(value) {
|
|
18351
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
18352
|
-
}
|
|
18353
18577
|
function isChildOf(candidate, parent) {
|
|
18354
18578
|
const rel = relative(parent, candidate);
|
|
18355
|
-
return rel !== "" && rel !== ".." && !rel.startsWith(`..${sep}`) && !
|
|
18356
|
-
}
|
|
18357
|
-
function readTrimmedEnv2(name) {
|
|
18358
|
-
const value = process.env[name];
|
|
18359
|
-
if (typeof value !== "string")
|
|
18360
|
-
return;
|
|
18361
|
-
const trimmed = value.trim().replace(/[\r\n]+/g, "");
|
|
18362
|
-
return trimmed.length > 0 ? trimmed : undefined;
|
|
18363
|
-
}
|
|
18364
|
-
function readManagedTrimmedEnv(name) {
|
|
18365
|
-
return readTrimmedEnv2(name);
|
|
18579
|
+
return rel !== "" && rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute2(rel);
|
|
18366
18580
|
}
|
|
18367
18581
|
function isExistingDirectory2(path) {
|
|
18368
18582
|
try {
|
|
18369
|
-
return
|
|
18583
|
+
return statSync3(path).isDirectory();
|
|
18370
18584
|
} catch {
|
|
18371
18585
|
return false;
|
|
18372
18586
|
}
|
|
@@ -18383,12 +18597,29 @@ function resolveSignetAgentId() {
|
|
|
18383
18597
|
function resolveSignetApiKey() {
|
|
18384
18598
|
return readManagedTrimmedEnv("SIGNET_API_KEY") ?? readManagedTrimmedEnv("SIGNET_TOKEN");
|
|
18385
18599
|
}
|
|
18600
|
+
async function resolveInstallApiKey() {
|
|
18601
|
+
const url = resolveSignetDaemonUrl2();
|
|
18602
|
+
try {
|
|
18603
|
+
const response = await fetch(`${url}/api/mode`, { signal: AbortSignal.timeout(1000), redirect: "error" });
|
|
18604
|
+
if (!response.ok)
|
|
18605
|
+
throw new Error(`HTTP ${response.status}`);
|
|
18606
|
+
const mode = await response.json();
|
|
18607
|
+
if (!isJsonObject(mode) || typeof mode.requiresAuth !== "boolean")
|
|
18608
|
+
throw new Error("response has no boolean requiresAuth");
|
|
18609
|
+
return mode.requiresAuth ? { apiKey: resolveSignetApiKey() } : {};
|
|
18610
|
+
} catch (error) {
|
|
18611
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
18612
|
+
return {
|
|
18613
|
+
warning: `Could not determine daemon auth requirement from ${url}/api/mode (${reason}); SIGNET_API_KEY was omitted. Check SIGNET_DAEMON_URL and daemon connectivity, then rerun signet sync.`
|
|
18614
|
+
};
|
|
18615
|
+
}
|
|
18616
|
+
}
|
|
18386
18617
|
function buildSignetRuntimeEnv(opts = {}) {
|
|
18387
18618
|
const env = {};
|
|
18388
18619
|
if (opts.basePath)
|
|
18389
18620
|
env.SIGNET_PATH = opts.basePath;
|
|
18390
18621
|
const daemonUrl = readManagedTrimmedEnv("SIGNET_DAEMON_URL");
|
|
18391
|
-
const apiKey = resolveSignetApiKey();
|
|
18622
|
+
const apiKey = opts.apiKey === undefined ? resolveSignetApiKey() : opts.apiKey;
|
|
18392
18623
|
const agentId = readManagedTrimmedEnv("SIGNET_AGENT_ID");
|
|
18393
18624
|
if (daemonUrl)
|
|
18394
18625
|
env.SIGNET_DAEMON_URL = resolveSignetDaemonUrl2();
|
|
@@ -18405,7 +18636,7 @@ function buildManagedExtensionEnvBootstrap(env) {
|
|
|
18405
18636
|
const daemonUrl = JSON.stringify(env.daemonUrl);
|
|
18406
18637
|
const agentId = JSON.stringify(env.agentId);
|
|
18407
18638
|
const apiKey = env.apiKey ? JSON.stringify(env.apiKey) : null;
|
|
18408
|
-
const isDefaultWorkspace = env.signetPath ===
|
|
18639
|
+
const isDefaultWorkspace = env.signetPath === join4(homedir(), ".agents");
|
|
18409
18640
|
const workspaceExists = isExistingDirectory2(env.signetPath);
|
|
18410
18641
|
if (!isDefaultWorkspace && !workspaceExists) {
|
|
18411
18642
|
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).`);
|
|
@@ -18436,7 +18667,7 @@ ${signetPathBlock} if (!__signetReadEnv("SIGNET_DAEMON_URL")) {
|
|
|
18436
18667
|
}`;
|
|
18437
18668
|
}
|
|
18438
18669
|
function managedExtensionFilePath(agentDir, filename) {
|
|
18439
|
-
return
|
|
18670
|
+
return join4(agentDir, "extensions", filename);
|
|
18440
18671
|
}
|
|
18441
18672
|
function buildManagedExtensionContent(params) {
|
|
18442
18673
|
if (params.bundle.length === 0) {
|
|
@@ -18475,7 +18706,7 @@ function writeManagedExtensionFile(filePath, content) {
|
|
|
18475
18706
|
atomicWriteText(filePath, content, 384);
|
|
18476
18707
|
return true;
|
|
18477
18708
|
}
|
|
18478
|
-
if ((
|
|
18709
|
+
if ((statSync3(filePath).mode & 63) !== 0)
|
|
18479
18710
|
chmodSync(filePath, 384);
|
|
18480
18711
|
return false;
|
|
18481
18712
|
}
|
|
@@ -18561,7 +18792,7 @@ function runConnectorInstaller(harness, ConnectorClass, options = {}) {
|
|
|
18561
18792
|
setConnectorInstallerEnv("SIGNET_DAEMON_URL", parsed.url);
|
|
18562
18793
|
setConnectorInstallerEnv("SIGNET_API_KEY", parsed.apiKey);
|
|
18563
18794
|
setConnectorInstallerEnv("SIGNET_AGENT_ID", parsed.agentId);
|
|
18564
|
-
const basePath = parsed.path || process.env.SIGNET_PATH ||
|
|
18795
|
+
const basePath = parsed.path || process.env.SIGNET_PATH || join4(homedir(), ".agents");
|
|
18565
18796
|
const connector = new ConnectorClass;
|
|
18566
18797
|
if (parsed.command === "status") {
|
|
18567
18798
|
console.log(connector.isInstalled() ? `${label}: installed` : `${label}: not installed`);
|
|
@@ -18595,15 +18826,24 @@ export {
|
|
|
18595
18826
|
buildManagedExtensionContent,
|
|
18596
18827
|
buildManagedExtensionEnvBootstrap,
|
|
18597
18828
|
buildSignetRuntimeEnv,
|
|
18829
|
+
cliFromMcp,
|
|
18598
18830
|
isChildOf,
|
|
18831
|
+
isExistingFile,
|
|
18599
18832
|
isJsonObject,
|
|
18600
18833
|
isManagedExtensionFile,
|
|
18834
|
+
isSignetCliLauncher,
|
|
18601
18835
|
isSignetGeneratedFile,
|
|
18602
18836
|
keepSignetApiKeyFilePrivate,
|
|
18603
18837
|
managedExtensionFilePath,
|
|
18838
|
+
mcpFromCli,
|
|
18839
|
+
parseHookLauncher,
|
|
18840
|
+
quoteCommandArg,
|
|
18604
18841
|
readManagedTrimmedEnv,
|
|
18605
|
-
|
|
18842
|
+
readMcpLauncher,
|
|
18843
|
+
readTrimmedEnv,
|
|
18606
18844
|
removeManagedExtensionFile,
|
|
18845
|
+
renderCommand,
|
|
18846
|
+
resolveInstallApiKey,
|
|
18607
18847
|
resolveRemoteDaemonUrl,
|
|
18608
18848
|
resolveSignetAgentId,
|
|
18609
18849
|
resolveSignetApiKey,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ResolvedCommand } from "./config";
|
|
2
|
+
export declare const SIGNET_MCP_STDIO_WORKER_ENV = "SIGNET_MCP_STDIO_WORKER";
|
|
3
|
+
export declare function quoteCommandArg(value: string, platform?: NodeJS.Platform): string;
|
|
4
|
+
export declare function renderCommand(launcher: ResolvedCommand): string;
|
|
5
|
+
export declare function parseHookLauncher(command: string): ResolvedCommand | undefined;
|
|
6
|
+
export declare function isSignetCliLauncher(launcher: ResolvedCommand | undefined): boolean;
|
|
7
|
+
export declare function readMcpLauncher(value: unknown): ResolvedCommand | undefined;
|
|
8
|
+
export declare function cliFromMcp(launcher: ResolvedCommand | undefined): ResolvedCommand | undefined;
|
|
9
|
+
export declare function mcpFromCli(launcher: ResolvedCommand | undefined): ResolvedCommand | undefined;
|
|
10
|
+
export declare function resolveSignetCliCommand(existing?: ResolvedCommand, runtime?: string | null): ResolvedCommand;
|
|
11
|
+
export declare function resolveSignetMcpCommand(existing?: ResolvedCommand, runtime?: string | null): ResolvedCommand;
|
|
12
|
+
//# sourceMappingURL=launcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAEA,OAAO,EAAuD,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAErG,eAAO,MAAM,2BAA2B,4BAA4B,CAAC;AAErE,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAAG,MAAM,CAMnG;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,CAE/D;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CA4C9E;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,eAAe,GAAG,SAAS,GAAG,OAAO,CAQlF;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,GAAG,SAAS,CAqB3E;AA0BD,wBAAgB,UAAU,CAAC,QAAQ,EAAE,eAAe,GAAG,SAAS,GAAG,eAAe,GAAG,SAAS,CAoB7F;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,eAAe,GAAG,SAAS,GAAG,eAAe,GAAG,SAAS,CAW7F;AAoED,wBAAgB,uBAAuB,CAAC,QAAQ,CAAC,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,eAAe,CAE5G;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,CAAC,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,eAAe,CAI5G"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signetai/connector-base",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2-next.2663",
|
|
4
4
|
"description": "Base class for Signet harness connectors",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"typecheck": "tsc --noEmit"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@signetai/core": "1.0.
|
|
33
|
+
"@signetai/core": "1.0.2-next.2663",
|
|
34
34
|
"json5": "^2.2.3",
|
|
35
35
|
"jsonc-parser": "3.3.1"
|
|
36
36
|
},
|