monacopilot 0.8.18 → 0.8.20

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.mts CHANGED
@@ -1,15 +1,19 @@
1
- import { ChatCompletion } from 'groq-sdk/resources/chat/completions';
2
- import { Theme, EditorProps as EditorProps$1 } from '@monaco-editor/react';
1
+ import { Theme as Theme$1, EditorProps as EditorProps$1 } from '@monaco-editor/react';
3
2
  export * from '@monaco-editor/react';
4
3
  import React from 'react';
5
4
 
6
- type EditorBuiltInTheme = Theme;
5
+ type EditorBuiltInTheme = Theme$1;
7
6
 
8
- type EndpointType = string;
9
- type FilenameType = string;
10
- type FrameworkType = 'react' | 'angular' | 'vue.js' | 'express' | 'django' | 'flask' | 'spring boot' | 'asp.net core' | 'ruby on rails' | 'laravel' | 'node.js' | 'react native' | 'flutter' | 'tensorflow' | 'pytorch' | 'keras' | 'scikit-learn' | 'fastapi' | 'graphql' | 'redux' | 'electron' | 'next.js' | 'nuxt.js' | 'gatsby' | 'shopify' | 'woocommerce' | 'pandas' | 'numpy' | 'three.js' | 'jest' | 'cypress' | 'selenium' | 'playwright' | 'puppeteer' | 'material-ui' | 'vuetify' | 'ant design';
11
- type CompletionSpeedType = 'little-faster' | 'normal';
12
- type ExternalContextType = {
7
+ /**
8
+ * Themes available for the Monacopilot
9
+ */
10
+ type CustomTheme = 'codesandbox-dark' | 'dracula-soft' | 'dracula' | 'github-dark-dimmed' | 'github-dark' | 'github-light' | 'monokai' | 'nord' | 'one-dark-pro-darker' | 'one-monokai';
11
+ type Theme = EditorBuiltInTheme | CustomTheme;
12
+ type Endpoint = string;
13
+ type Filename = string;
14
+ type Technologies = string[];
15
+ type CompletionSpeed = 'little-faster' | 'normal';
16
+ type ExternalContext = {
13
17
  /**
14
18
  * The relative path from the current editing code in the editor to an external file.
15
19
  *
@@ -24,58 +28,60 @@ type ExternalContextType = {
24
28
  */
25
29
  content: string;
26
30
  }[];
27
- /**
28
- * Themes available for the Rich Monaco Editor.
29
- */
30
- type ThemeType = 'codesandbox-dark' | 'dracula-soft' | 'dracula' | 'github-dark-dimmed' | 'github-dark' | 'github-light' | 'monokai' | 'nord' | 'one-dark-pro-darker' | 'one-monokai';
31
31
  interface EditorProps extends EditorProps$1 {
32
32
  /**
33
33
  * The name of the file you are editing. This is used to provide more relevant completions based on the file's purpose.
34
34
  * For example, if you are editing a file named `utils.js`, the completions will be more relevant to utility functions.
35
35
  */
36
- filename?: FilenameType;
36
+ filename?: Filename;
37
37
  /**
38
38
  * The API endpoint where you started the completion service.
39
39
  * [Learn more](https://monacopilot.vercel.app/docs/guide/copilot-setup#integrating-copilot-to-the-editor)
40
40
  */
41
- endpoint?: EndpointType;
41
+ endpoint?: Endpoint;
42
42
  /**
43
- * The framework you want to use for the completion.
44
- * This can provide framework-specific completions.
45
- * If you don't specify a framework, the completion will be specific to the language (provided as the `language` prop).
43
+ * The technologies (libraries, frameworks, etc.) you want to use for the completion.
44
+ * This can provide technology-specific completions.
45
+ * If you don't specify a technology, the completion will be specific to the language (provided as the `language` prop).
46
+ *
47
+ * @example
48
+ * ['react', 'nextjs', 'tailwindcss', 'tanstack/react-query']
49
+ * ['tensorflow', 'keras', 'numpy', 'pandas']
50
+ * etc.
46
51
  */
47
- framework?: FrameworkType;
52
+ technologies?: Technologies;
48
53
  /**
49
54
  * The theme you want to use for the editor.
50
55
  */
51
- theme?: EditorBuiltInTheme | ThemeType;
56
+ theme?: Theme;
52
57
  /**
53
58
  * Controls the speed of the completion.
54
59
  * Set to `little-faster` for slightly faster completions. Note that this option has a high cost, though not exorbitant.
55
60
  * For a detailed cost comparison, see the [cost overview table](https://monacopilot.vercel.app/docs/copilot-cost-overview).
56
61
  * @default 'normal'
57
62
  */
58
- completionSpeed?: CompletionSpeedType;
63
+ completionSpeed?: CompletionSpeed;
59
64
  /**
60
65
  * Helps to give more relevant completions based on the full context.
61
66
  * You can include things like the contents/codes of other files in the same workspace.
62
67
  */
63
- externalContext?: ExternalContextType;
68
+ externalContext?: ExternalContext;
64
69
  }
65
70
 
66
- type CompletionModelType = 'llama';
67
- type GroqCompletion = ChatCompletion & {
68
- error?: string;
69
- };
70
- interface CompletionRequestParams {
71
+ type CompletionModel = 'llama';
72
+ interface CompletionRequest {
71
73
  completionMetadata: CompletionMetadata;
72
74
  }
75
+ interface CompletionResponse {
76
+ completion?: string;
77
+ error?: string;
78
+ }
73
79
  type CompletionMode = 'fill-in-the-middle' | 'completion';
74
80
  interface CompletionMetadata {
75
81
  language: string | undefined;
76
- filename: FilenameType | undefined;
77
- framework: FrameworkType | undefined;
78
- externalContext: ExternalContextType | undefined;
82
+ filename: Filename | undefined;
83
+ technologies: Technologies | undefined;
84
+ externalContext: ExternalContext | undefined;
79
85
  codeAfterCursor: string;
80
86
  codeBeforeCursor: string;
81
87
  editorState: {
@@ -84,7 +90,7 @@ interface CompletionMetadata {
84
90
  }
85
91
 
86
92
  interface CopilotOptions {
87
- model: CompletionModelType | undefined;
93
+ model: CompletionModel | undefined;
88
94
  }
89
95
 
90
96
  /**
@@ -105,11 +111,14 @@ interface CopilotOptions {
105
111
  declare class Copilot {
106
112
  private apiKey;
107
113
  constructor(apiKey: string, options?: CopilotOptions);
108
- complete({ completionMetadata, }: CompletionRequestParams): Promise<GroqCompletion | {
109
- error: string;
110
- }>;
114
+ /**
115
+ * Sends a completion request to Groq API and returns the completion.
116
+ * @param {CompletionRequest} params - The metadata required to generate the completion.
117
+ * @returns {Promise<CompletionResponse>} The completed code snippet.
118
+ */
119
+ complete({ completionMetadata, }: CompletionRequest): Promise<CompletionResponse>;
111
120
  }
112
121
 
113
- declare const Editor: ({ filename, endpoint, framework, theme, completionSpeed, externalContext, ...props }: EditorProps) => React.JSX.Element;
122
+ declare const Editor: ({ filename, endpoint, technologies, theme, completionSpeed, externalContext, ...props }: EditorProps) => React.JSX.Element;
114
123
 
115
- export { Copilot, Editor, type EditorProps, type EndpointType, type FrameworkType, type ThemeType as Theme };
124
+ export { type CompletionRequest, type CompletionResponse, Copilot, Editor, type EditorProps, type Endpoint, type Technologies, type Theme };
package/dist/index.d.ts CHANGED
@@ -1,15 +1,19 @@
1
- import { ChatCompletion } from 'groq-sdk/resources/chat/completions';
2
- import { Theme, EditorProps as EditorProps$1 } from '@monaco-editor/react';
1
+ import { Theme as Theme$1, EditorProps as EditorProps$1 } from '@monaco-editor/react';
3
2
  export * from '@monaco-editor/react';
4
3
  import React from 'react';
5
4
 
6
- type EditorBuiltInTheme = Theme;
5
+ type EditorBuiltInTheme = Theme$1;
7
6
 
8
- type EndpointType = string;
9
- type FilenameType = string;
10
- type FrameworkType = 'react' | 'angular' | 'vue.js' | 'express' | 'django' | 'flask' | 'spring boot' | 'asp.net core' | 'ruby on rails' | 'laravel' | 'node.js' | 'react native' | 'flutter' | 'tensorflow' | 'pytorch' | 'keras' | 'scikit-learn' | 'fastapi' | 'graphql' | 'redux' | 'electron' | 'next.js' | 'nuxt.js' | 'gatsby' | 'shopify' | 'woocommerce' | 'pandas' | 'numpy' | 'three.js' | 'jest' | 'cypress' | 'selenium' | 'playwright' | 'puppeteer' | 'material-ui' | 'vuetify' | 'ant design';
11
- type CompletionSpeedType = 'little-faster' | 'normal';
12
- type ExternalContextType = {
7
+ /**
8
+ * Themes available for the Monacopilot
9
+ */
10
+ type CustomTheme = 'codesandbox-dark' | 'dracula-soft' | 'dracula' | 'github-dark-dimmed' | 'github-dark' | 'github-light' | 'monokai' | 'nord' | 'one-dark-pro-darker' | 'one-monokai';
11
+ type Theme = EditorBuiltInTheme | CustomTheme;
12
+ type Endpoint = string;
13
+ type Filename = string;
14
+ type Technologies = string[];
15
+ type CompletionSpeed = 'little-faster' | 'normal';
16
+ type ExternalContext = {
13
17
  /**
14
18
  * The relative path from the current editing code in the editor to an external file.
15
19
  *
@@ -24,58 +28,60 @@ type ExternalContextType = {
24
28
  */
25
29
  content: string;
26
30
  }[];
27
- /**
28
- * Themes available for the Rich Monaco Editor.
29
- */
30
- type ThemeType = 'codesandbox-dark' | 'dracula-soft' | 'dracula' | 'github-dark-dimmed' | 'github-dark' | 'github-light' | 'monokai' | 'nord' | 'one-dark-pro-darker' | 'one-monokai';
31
31
  interface EditorProps extends EditorProps$1 {
32
32
  /**
33
33
  * The name of the file you are editing. This is used to provide more relevant completions based on the file's purpose.
34
34
  * For example, if you are editing a file named `utils.js`, the completions will be more relevant to utility functions.
35
35
  */
36
- filename?: FilenameType;
36
+ filename?: Filename;
37
37
  /**
38
38
  * The API endpoint where you started the completion service.
39
39
  * [Learn more](https://monacopilot.vercel.app/docs/guide/copilot-setup#integrating-copilot-to-the-editor)
40
40
  */
41
- endpoint?: EndpointType;
41
+ endpoint?: Endpoint;
42
42
  /**
43
- * The framework you want to use for the completion.
44
- * This can provide framework-specific completions.
45
- * If you don't specify a framework, the completion will be specific to the language (provided as the `language` prop).
43
+ * The technologies (libraries, frameworks, etc.) you want to use for the completion.
44
+ * This can provide technology-specific completions.
45
+ * If you don't specify a technology, the completion will be specific to the language (provided as the `language` prop).
46
+ *
47
+ * @example
48
+ * ['react', 'nextjs', 'tailwindcss', 'tanstack/react-query']
49
+ * ['tensorflow', 'keras', 'numpy', 'pandas']
50
+ * etc.
46
51
  */
47
- framework?: FrameworkType;
52
+ technologies?: Technologies;
48
53
  /**
49
54
  * The theme you want to use for the editor.
50
55
  */
51
- theme?: EditorBuiltInTheme | ThemeType;
56
+ theme?: Theme;
52
57
  /**
53
58
  * Controls the speed of the completion.
54
59
  * Set to `little-faster` for slightly faster completions. Note that this option has a high cost, though not exorbitant.
55
60
  * For a detailed cost comparison, see the [cost overview table](https://monacopilot.vercel.app/docs/copilot-cost-overview).
56
61
  * @default 'normal'
57
62
  */
58
- completionSpeed?: CompletionSpeedType;
63
+ completionSpeed?: CompletionSpeed;
59
64
  /**
60
65
  * Helps to give more relevant completions based on the full context.
61
66
  * You can include things like the contents/codes of other files in the same workspace.
62
67
  */
63
- externalContext?: ExternalContextType;
68
+ externalContext?: ExternalContext;
64
69
  }
65
70
 
66
- type CompletionModelType = 'llama';
67
- type GroqCompletion = ChatCompletion & {
68
- error?: string;
69
- };
70
- interface CompletionRequestParams {
71
+ type CompletionModel = 'llama';
72
+ interface CompletionRequest {
71
73
  completionMetadata: CompletionMetadata;
72
74
  }
75
+ interface CompletionResponse {
76
+ completion?: string;
77
+ error?: string;
78
+ }
73
79
  type CompletionMode = 'fill-in-the-middle' | 'completion';
74
80
  interface CompletionMetadata {
75
81
  language: string | undefined;
76
- filename: FilenameType | undefined;
77
- framework: FrameworkType | undefined;
78
- externalContext: ExternalContextType | undefined;
82
+ filename: Filename | undefined;
83
+ technologies: Technologies | undefined;
84
+ externalContext: ExternalContext | undefined;
79
85
  codeAfterCursor: string;
80
86
  codeBeforeCursor: string;
81
87
  editorState: {
@@ -84,7 +90,7 @@ interface CompletionMetadata {
84
90
  }
85
91
 
86
92
  interface CopilotOptions {
87
- model: CompletionModelType | undefined;
93
+ model: CompletionModel | undefined;
88
94
  }
89
95
 
90
96
  /**
@@ -105,11 +111,14 @@ interface CopilotOptions {
105
111
  declare class Copilot {
106
112
  private apiKey;
107
113
  constructor(apiKey: string, options?: CopilotOptions);
108
- complete({ completionMetadata, }: CompletionRequestParams): Promise<GroqCompletion | {
109
- error: string;
110
- }>;
114
+ /**
115
+ * Sends a completion request to Groq API and returns the completion.
116
+ * @param {CompletionRequest} params - The metadata required to generate the completion.
117
+ * @returns {Promise<CompletionResponse>} The completed code snippet.
118
+ */
119
+ complete({ completionMetadata, }: CompletionRequest): Promise<CompletionResponse>;
111
120
  }
112
121
 
113
- declare const Editor: ({ filename, endpoint, framework, theme, completionSpeed, externalContext, ...props }: EditorProps) => React.JSX.Element;
122
+ declare const Editor: ({ filename, endpoint, technologies, theme, completionSpeed, externalContext, ...props }: EditorProps) => React.JSX.Element;
114
123
 
115
- export { Copilot, Editor, type EditorProps, type EndpointType, type FrameworkType, type ThemeType as Theme };
124
+ export { type CompletionRequest, type CompletionResponse, Copilot, Editor, type EditorProps, type Endpoint, type Technologies, type Theme };