@signetai/connector-gemini 0.140.5 → 0.142.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 +63 -4
- 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,OAAO,EACN,aAAa,EACb,KAAK,aAAa,EAClB,KAAK,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EACN,aAAa,EACb,KAAK,aAAa,EAClB,KAAK,eAAe,EAIpB,MAAM,wBAAwB,CAAC;AAwBhC,qBAAa,eAAgB,SAAQ,aAAa;IACjD,QAAQ,CAAC,IAAI,YAAY;IACzB,QAAQ,CAAC,SAAS,YAAY;IAE9B,OAAO,CAAC,aAAa;IAIrB,aAAa,IAAI,MAAM;IAIvB,OAAO,CAAC,eAAe;IAgBjB,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAqEjD,SAAS,IAAI,OAAO,CAAC,eAAe,CAAC;IA2B3C,WAAW,IAAI,OAAO;IAOtB,MAAM,CAAC,kBAAkB,IAAI,OAAO;IAIpC,OAAO,CAAC,yBAAyB;IA4BjC,OAAO,CAAC,iBAAiB;IAoCzB,OAAO,CAAC,eAAe;IAqBvB,OAAO,CAAC,gBAAgB;CAcxB;AAED,eAAO,MAAM,eAAe,iBAAwB,CAAC;AACrD,eAAe,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -10459,6 +10459,11 @@ ${content}`);
|
|
|
10459
10459
|
`);
|
|
10460
10460
|
}
|
|
10461
10461
|
}
|
|
10462
|
+
function isSignetGeneratedFile(raw) {
|
|
10463
|
+
const lines = raw.split(`
|
|
10464
|
+
`).slice(0, 6);
|
|
10465
|
+
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]));
|
|
10466
|
+
}
|
|
10462
10467
|
function atomicWriteJson(path, data, indent = 2) {
|
|
10463
10468
|
const content = `${JSON.stringify(data, null, indent)}
|
|
10464
10469
|
`;
|
|
@@ -20606,6 +20611,14 @@ function expandHome2(p, home2 = homedir22()) {
|
|
|
20606
20611
|
}
|
|
20607
20612
|
var LOCAL_BINDS2 = new Set(["127.0.0.1", "localhost", "::1", "::ffff:127.0.0.1"]);
|
|
20608
20613
|
var import_yaml22 = __toESM2(require_dist2(), 1);
|
|
20614
|
+
function parseSimpleYaml(text) {
|
|
20615
|
+
try {
|
|
20616
|
+
const parsed = import_yaml22.default.parse(text);
|
|
20617
|
+
return typeof parsed === "object" && parsed !== null ? parsed : {};
|
|
20618
|
+
} catch {
|
|
20619
|
+
return {};
|
|
20620
|
+
}
|
|
20621
|
+
}
|
|
20609
20622
|
var native2 = null;
|
|
20610
20623
|
try {
|
|
20611
20624
|
const esmRequire = createRequire22(import.meta.url);
|
|
@@ -20632,6 +20645,7 @@ function defaultDiscordDesktopCachePath2() {
|
|
|
20632
20645
|
return resolve32(process.env.XDG_CONFIG_HOME || resolve32(homedir32(), ".config"), "discord");
|
|
20633
20646
|
}
|
|
20634
20647
|
}
|
|
20648
|
+
var IDENTITY_MODES = ["managed", "passthrough", "off"];
|
|
20635
20649
|
var IDENTITY_FILES2 = {
|
|
20636
20650
|
agents: {
|
|
20637
20651
|
path: "AGENTS.md",
|
|
@@ -20688,6 +20702,9 @@ var IDENTITY_FILES2 = {
|
|
|
20688
20702
|
var REQUIRED_IDENTITY_KEYS2 = Object.entries(IDENTITY_FILES2).filter(([, spec]) => !spec.optional).map(([key]) => key);
|
|
20689
20703
|
var OPTIONAL_IDENTITY_KEYS2 = Object.entries(IDENTITY_FILES2).filter(([, spec]) => spec.optional).map(([key]) => key);
|
|
20690
20704
|
function hasValidIdentity(basePath) {
|
|
20705
|
+
const mode = loadIdentityMode(basePath);
|
|
20706
|
+
if (mode !== "managed")
|
|
20707
|
+
return true;
|
|
20691
20708
|
for (const key of REQUIRED_IDENTITY_KEYS2) {
|
|
20692
20709
|
const spec = IDENTITY_FILES2[key];
|
|
20693
20710
|
if (!existsSync10(join10(basePath, spec.path))) {
|
|
@@ -20696,6 +20713,35 @@ function hasValidIdentity(basePath) {
|
|
|
20696
20713
|
}
|
|
20697
20714
|
return true;
|
|
20698
20715
|
}
|
|
20716
|
+
function readRecord(value) {
|
|
20717
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
|
|
20718
|
+
}
|
|
20719
|
+
function isIdentityMode(value) {
|
|
20720
|
+
return typeof value === "string" && IDENTITY_MODES.includes(value);
|
|
20721
|
+
}
|
|
20722
|
+
function resolveIdentityModeFromConfig(config) {
|
|
20723
|
+
const root = readRecord(config);
|
|
20724
|
+
const capabilities = readRecord(root.capabilities);
|
|
20725
|
+
const capabilityIdentity = readRecord(capabilities.identity);
|
|
20726
|
+
if (isIdentityMode(capabilityIdentity.mode))
|
|
20727
|
+
return capabilityIdentity.mode;
|
|
20728
|
+
const identity = readRecord(root.identity);
|
|
20729
|
+
if (isIdentityMode(identity.mode))
|
|
20730
|
+
return identity.mode;
|
|
20731
|
+
if (identity.enabled === false)
|
|
20732
|
+
return "off";
|
|
20733
|
+
return "managed";
|
|
20734
|
+
}
|
|
20735
|
+
function loadIdentityMode(agentsDir) {
|
|
20736
|
+
const agentYaml = join10(agentsDir, "agent.yaml");
|
|
20737
|
+
if (!existsSync10(agentYaml))
|
|
20738
|
+
return "managed";
|
|
20739
|
+
try {
|
|
20740
|
+
return resolveIdentityModeFromConfig(parseSimpleYaml(readFileSync8(agentYaml, "utf-8")));
|
|
20741
|
+
} catch {
|
|
20742
|
+
return "managed";
|
|
20743
|
+
}
|
|
20744
|
+
}
|
|
20699
20745
|
var home2 = homedir72();
|
|
20700
20746
|
var SKIP_SUBTYPES2 = new Set([
|
|
20701
20747
|
"channel_join",
|
|
@@ -20861,6 +20907,7 @@ class GeminiConnector extends BaseConnector {
|
|
|
20861
20907
|
const filesWritten = [];
|
|
20862
20908
|
const configsPatched = [];
|
|
20863
20909
|
const expandedBasePath = expandHome2(basePath || join6(homedir4(), ".agents"));
|
|
20910
|
+
const identityMode = loadIdentityMode(expandedBasePath);
|
|
20864
20911
|
if (!hasValidIdentity(expandedBasePath)) {
|
|
20865
20912
|
return {
|
|
20866
20913
|
success: false,
|
|
@@ -20883,9 +20930,21 @@ class GeminiConnector extends BaseConnector {
|
|
|
20883
20930
|
} else {
|
|
20884
20931
|
configsPatched.push(this.getConfigPath());
|
|
20885
20932
|
}
|
|
20886
|
-
|
|
20887
|
-
|
|
20888
|
-
|
|
20933
|
+
if (identityMode === "managed") {
|
|
20934
|
+
const geminiMdPath = this.generateGeminiMd(expandedBasePath);
|
|
20935
|
+
if (geminiMdPath) {
|
|
20936
|
+
filesWritten.push(geminiMdPath);
|
|
20937
|
+
}
|
|
20938
|
+
} else {
|
|
20939
|
+
const staleGeminiMd = this.getGeminiMdPath();
|
|
20940
|
+
if (existsSync2(staleGeminiMd)) {
|
|
20941
|
+
try {
|
|
20942
|
+
const raw = readFileSync2(staleGeminiMd, "utf-8");
|
|
20943
|
+
if (isSignetGeneratedFile(raw)) {
|
|
20944
|
+
rmSync(staleGeminiMd);
|
|
20945
|
+
}
|
|
20946
|
+
} catch {}
|
|
20947
|
+
}
|
|
20889
20948
|
}
|
|
20890
20949
|
const skillsSource = join6(expandedBasePath, "skills");
|
|
20891
20950
|
const skillsDest = join6(geminiHome, "skills");
|
|
@@ -20911,7 +20970,7 @@ class GeminiConnector extends BaseConnector {
|
|
|
20911
20970
|
const geminiMdPath = this.getGeminiMdPath();
|
|
20912
20971
|
if (existsSync2(geminiMdPath)) {
|
|
20913
20972
|
const raw = readFileSync2(geminiMdPath, "utf-8");
|
|
20914
|
-
if (raw
|
|
20973
|
+
if (isSignetGeneratedFile(raw)) {
|
|
20915
20974
|
rmSync(geminiMdPath);
|
|
20916
20975
|
filesRemoved.push(geminiMdPath);
|
|
20917
20976
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signetai/connector-gemini",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.142.0",
|
|
4
4
|
"description": "Signet connector for Gemini CLI",
|
|
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.
|
|
28
|
-
"@signetai/core": "0.
|
|
27
|
+
"@signetai/connector-base": "0.142.0",
|
|
28
|
+
"@signetai/core": "0.142.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/node": "^22.0.0",
|