@xmemo/client 0.4.143 → 0.4.144
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/package.json +1 -1
- package/src/cli.js +37 -27
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -2604,23 +2604,27 @@ async function mergeAntigravityMcpConfig(configPath, mcpUrl, identity) {
|
|
|
2604
2604
|
await bestEffortChmod(configPath, 0o600);
|
|
2605
2605
|
}
|
|
2606
2606
|
|
|
2607
|
-
function antigravityIdeJsonServerConfig(mcpUrl) {
|
|
2607
|
+
function antigravityIdeJsonServerConfig(mcpUrl, identity = envReferenceIdentity('antigravity')) {
|
|
2608
2608
|
return {
|
|
2609
2609
|
type: 'http',
|
|
2610
|
-
url: mcpUrl
|
|
2610
|
+
url: mcpUrl,
|
|
2611
|
+
headers: {
|
|
2612
|
+
[AGENT_ID_HEADER]: identity.agentId,
|
|
2613
|
+
[AGENT_INSTANCE_HEADER]: identity.agentInstanceId
|
|
2614
|
+
}
|
|
2611
2615
|
};
|
|
2612
2616
|
}
|
|
2613
2617
|
|
|
2614
|
-
function antigravityIdeJsonConfig(mcpUrl) {
|
|
2618
|
+
function antigravityIdeJsonConfig(mcpUrl, identity = envReferenceIdentity('antigravity')) {
|
|
2615
2619
|
return {
|
|
2616
2620
|
mcpServers: {
|
|
2617
|
-
[MCP_SERVER_NAME]: antigravityIdeJsonServerConfig(mcpUrl)
|
|
2621
|
+
[MCP_SERVER_NAME]: antigravityIdeJsonServerConfig(mcpUrl, identity)
|
|
2618
2622
|
}
|
|
2619
2623
|
};
|
|
2620
2624
|
}
|
|
2621
2625
|
|
|
2622
|
-
function antigravityIdeJsonSnippet(mcpUrl, identity = envReferenceIdentity('antigravity
|
|
2623
|
-
return `${JSON.stringify(antigravityIdeJsonConfig(mcpUrl), null, 2)}\n`;
|
|
2626
|
+
function antigravityIdeJsonSnippet(mcpUrl, identity = envReferenceIdentity('antigravity')) {
|
|
2627
|
+
return `${JSON.stringify(antigravityIdeJsonConfig(mcpUrl, identity), null, 2)}\n`;
|
|
2624
2628
|
}
|
|
2625
2629
|
|
|
2626
2630
|
async function mergeAntigravityIdeMcpConfig(configPath, mcpUrl, identity) {
|
|
@@ -2640,29 +2644,33 @@ async function mergeAntigravityIdeMcpConfig(configPath, mcpUrl, identity) {
|
|
|
2640
2644
|
throw new UsageError(`MCP config already contains mcpServers.${existingName}. Edit ${configPath} manually to avoid duplicate server definitions.`);
|
|
2641
2645
|
}
|
|
2642
2646
|
|
|
2643
|
-
parsed.mcpServers[MCP_SERVER_NAME] = antigravityIdeJsonServerConfig(mcpUrl);
|
|
2647
|
+
parsed.mcpServers[MCP_SERVER_NAME] = antigravityIdeJsonServerConfig(mcpUrl, identity);
|
|
2644
2648
|
await fs.mkdir(path.dirname(configPath), { recursive: true, mode: 0o700 });
|
|
2645
2649
|
await fs.writeFile(configPath, `${JSON.stringify(parsed, null, 2)}\n`, { mode: 0o600 });
|
|
2646
2650
|
await bestEffortChmod(configPath, 0o600);
|
|
2647
2651
|
}
|
|
2648
2652
|
|
|
2649
|
-
function antigravity2JsonServerConfig(mcpUrl) {
|
|
2653
|
+
function antigravity2JsonServerConfig(mcpUrl, identity = envReferenceIdentity('antigravity')) {
|
|
2650
2654
|
return {
|
|
2651
2655
|
type: 'http',
|
|
2652
|
-
url: mcpUrl
|
|
2656
|
+
url: mcpUrl,
|
|
2657
|
+
headers: {
|
|
2658
|
+
[AGENT_ID_HEADER]: identity.agentId,
|
|
2659
|
+
[AGENT_INSTANCE_HEADER]: identity.agentInstanceId
|
|
2660
|
+
}
|
|
2653
2661
|
};
|
|
2654
2662
|
}
|
|
2655
2663
|
|
|
2656
|
-
function antigravity2JsonConfig(mcpUrl) {
|
|
2664
|
+
function antigravity2JsonConfig(mcpUrl, identity = envReferenceIdentity('antigravity')) {
|
|
2657
2665
|
return {
|
|
2658
2666
|
mcpServers: {
|
|
2659
|
-
[MCP_SERVER_NAME]: antigravity2JsonServerConfig(mcpUrl)
|
|
2667
|
+
[MCP_SERVER_NAME]: antigravity2JsonServerConfig(mcpUrl, identity)
|
|
2660
2668
|
}
|
|
2661
2669
|
};
|
|
2662
2670
|
}
|
|
2663
2671
|
|
|
2664
|
-
function antigravity2JsonSnippet(mcpUrl, identity = envReferenceIdentity('
|
|
2665
|
-
return `${JSON.stringify(antigravity2JsonConfig(mcpUrl), null, 2)}\n`;
|
|
2672
|
+
function antigravity2JsonSnippet(mcpUrl, identity = envReferenceIdentity('antigravity')) {
|
|
2673
|
+
return `${JSON.stringify(antigravity2JsonConfig(mcpUrl, identity), null, 2)}\n`;
|
|
2666
2674
|
}
|
|
2667
2675
|
|
|
2668
2676
|
async function mergeAntigravity2McpConfig(configPath, mcpUrl, identity) {
|
|
@@ -2682,13 +2690,13 @@ async function mergeAntigravity2McpConfig(configPath, mcpUrl, identity) {
|
|
|
2682
2690
|
throw new UsageError(`MCP config already contains mcpServers.${existingName}. Edit ${configPath} manually to avoid duplicate server definitions.`);
|
|
2683
2691
|
}
|
|
2684
2692
|
|
|
2685
|
-
parsed.mcpServers[MCP_SERVER_NAME] = antigravity2JsonServerConfig(mcpUrl);
|
|
2693
|
+
parsed.mcpServers[MCP_SERVER_NAME] = antigravity2JsonServerConfig(mcpUrl, identity);
|
|
2686
2694
|
await fs.mkdir(path.dirname(configPath), { recursive: true, mode: 0o700 });
|
|
2687
2695
|
await fs.writeFile(configPath, `${JSON.stringify(parsed, null, 2)}\n`, { mode: 0o600 });
|
|
2688
2696
|
await bestEffortChmod(configPath, 0o600);
|
|
2689
2697
|
}
|
|
2690
2698
|
|
|
2691
|
-
function antigravityCliJsonServerConfig(mcpUrl, identity = envReferenceIdentity('antigravity
|
|
2699
|
+
function antigravityCliJsonServerConfig(mcpUrl, identity = envReferenceIdentity('antigravity')) {
|
|
2692
2700
|
return {
|
|
2693
2701
|
httpUrl: mcpUrl,
|
|
2694
2702
|
headers: {
|
|
@@ -2698,7 +2706,7 @@ function antigravityCliJsonServerConfig(mcpUrl, identity = envReferenceIdentity(
|
|
|
2698
2706
|
};
|
|
2699
2707
|
}
|
|
2700
2708
|
|
|
2701
|
-
function antigravityCliJsonConfig(mcpUrl, identity = envReferenceIdentity('antigravity
|
|
2709
|
+
function antigravityCliJsonConfig(mcpUrl, identity = envReferenceIdentity('antigravity')) {
|
|
2702
2710
|
return {
|
|
2703
2711
|
mcpServers: {
|
|
2704
2712
|
[MCP_SERVER_NAME]: antigravityCliJsonServerConfig(mcpUrl, identity)
|
|
@@ -2706,7 +2714,7 @@ function antigravityCliJsonConfig(mcpUrl, identity = envReferenceIdentity('antig
|
|
|
2706
2714
|
};
|
|
2707
2715
|
}
|
|
2708
2716
|
|
|
2709
|
-
function antigravityCliJsonSnippet(mcpUrl, identity = envReferenceIdentity('antigravity
|
|
2717
|
+
function antigravityCliJsonSnippet(mcpUrl, identity = envReferenceIdentity('antigravity')) {
|
|
2710
2718
|
return `${JSON.stringify(antigravityCliJsonConfig(mcpUrl, identity), null, 2)}\n`;
|
|
2711
2719
|
}
|
|
2712
2720
|
|
|
@@ -2829,27 +2837,28 @@ function geminiJsonSnippet(mcpUrl, identity = envReferenceIdentity('gemini-cli')
|
|
|
2829
2837
|
}
|
|
2830
2838
|
|
|
2831
2839
|
async function agentIdentity(clientId, env) {
|
|
2840
|
+
const targetClientId = (clientId === 'antigravity-ide' || clientId === 'antigravity2' || clientId === 'antigravity-cli') ? 'antigravity' : clientId;
|
|
2832
2841
|
const configuredInstanceId = env[AGENT_INSTANCE_ENV_VAR];
|
|
2833
2842
|
if (configuredInstanceId) {
|
|
2834
2843
|
return {
|
|
2835
|
-
agentId:
|
|
2844
|
+
agentId: targetClientId,
|
|
2836
2845
|
agentInstanceId: configuredInstanceId,
|
|
2837
2846
|
path: `${AGENT_INSTANCE_ENV_VAR} environment variable`
|
|
2838
2847
|
};
|
|
2839
2848
|
}
|
|
2840
2849
|
|
|
2841
|
-
const identityPath = agentInstanceIdentityPath(env,
|
|
2850
|
+
const identityPath = agentInstanceIdentityPath(env, targetClientId);
|
|
2842
2851
|
const existing = await readAgentInstanceIdentity(identityPath);
|
|
2843
2852
|
if (existing) {
|
|
2844
|
-
return { agentId:
|
|
2853
|
+
return { agentId: targetClientId, agentInstanceId: existing, path: identityPath };
|
|
2845
2854
|
}
|
|
2846
2855
|
|
|
2847
|
-
const generated = `xmemo-${
|
|
2856
|
+
const generated = `xmemo-${targetClientId}-${randomUUID()}`;
|
|
2848
2857
|
await fs.mkdir(path.dirname(identityPath), { recursive: true, mode: 0o700 });
|
|
2849
2858
|
await bestEffortChmod(path.dirname(identityPath), 0o700);
|
|
2850
|
-
await fs.writeFile(identityPath, `${JSON.stringify({ version: 1, agentId:
|
|
2859
|
+
await fs.writeFile(identityPath, `${JSON.stringify({ version: 1, agentId: targetClientId, agentInstanceId: generated }, null, 2)}\n`, { mode: 0o600 });
|
|
2851
2860
|
await bestEffortChmod(identityPath, 0o600);
|
|
2852
|
-
return { agentId:
|
|
2861
|
+
return { agentId: targetClientId, agentInstanceId: generated, path: identityPath };
|
|
2853
2862
|
}
|
|
2854
2863
|
|
|
2855
2864
|
async function readAgentInstanceIdentity(identityPath) {
|
|
@@ -2867,8 +2876,9 @@ function agentInstanceIdentityPath(env, clientId) {
|
|
|
2867
2876
|
}
|
|
2868
2877
|
|
|
2869
2878
|
function envReferenceIdentity(clientId) {
|
|
2879
|
+
const targetClientId = (clientId === 'antigravity-ide' || clientId === 'antigravity2' || clientId === 'antigravity-cli') ? 'antigravity' : clientId;
|
|
2870
2880
|
return {
|
|
2871
|
-
agentId:
|
|
2881
|
+
agentId: targetClientId,
|
|
2872
2882
|
agentInstanceId: `\${${AGENT_INSTANCE_ENV_VAR}}`,
|
|
2873
2883
|
path: `${AGENT_INSTANCE_ENV_VAR} environment variable`
|
|
2874
2884
|
};
|
|
@@ -2938,7 +2948,7 @@ function defaultGeminiConfigPath(env) {
|
|
|
2938
2948
|
|
|
2939
2949
|
function defaultAntigravityConfigPath(env) {
|
|
2940
2950
|
const home = env.USERPROFILE || env.HOME || os.homedir();
|
|
2941
|
-
return path.join(home, '.gemini', '
|
|
2951
|
+
return path.join(home, '.gemini', 'config', 'mcp_config.json');
|
|
2942
2952
|
}
|
|
2943
2953
|
|
|
2944
2954
|
function defaultAntigravityIdeConfigPath(env) {
|
|
@@ -2948,12 +2958,12 @@ function defaultAntigravityIdeConfigPath(env) {
|
|
|
2948
2958
|
|
|
2949
2959
|
function defaultAntigravity2ConfigPath(env) {
|
|
2950
2960
|
const home = env.USERPROFILE || env.HOME || os.homedir();
|
|
2951
|
-
return path.join(home, '.
|
|
2961
|
+
return path.join(home, '.gemini', 'config', 'mcp_config.json');
|
|
2952
2962
|
}
|
|
2953
2963
|
|
|
2954
2964
|
function defaultAntigravityCliConfigPath(env) {
|
|
2955
2965
|
const home = env.USERPROFILE || env.HOME || os.homedir();
|
|
2956
|
-
return path.join(home, '.
|
|
2966
|
+
return path.join(home, '.gemini', 'config', 'mcp_config.json');
|
|
2957
2967
|
}
|
|
2958
2968
|
|
|
2959
2969
|
function defaultCopilotConfigPath(env) {
|