monacopilot 0.8.19 → 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 TechnologiesType = string[];
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,21 +28,17 @@ type ExternalContextType = {
24
28
  */
25
29
  content: string;
26
30
  }[];
27
- /**
28
- * Themes available for the Monacopilot
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
43
  * The technologies (libraries, frameworks, etc.) you want to use for the completion.
44
44
  * This can provide technology-specific completions.
@@ -49,38 +49,39 @@ interface EditorProps extends EditorProps$1 {
49
49
  * ['tensorflow', 'keras', 'numpy', 'pandas']
50
50
  * etc.
51
51
  */
52
- technologies?: TechnologiesType;
52
+ technologies?: Technologies;
53
53
  /**
54
54
  * The theme you want to use for the editor.
55
55
  */
56
- theme?: EditorBuiltInTheme | ThemeType;
56
+ theme?: Theme;
57
57
  /**
58
58
  * Controls the speed of the completion.
59
59
  * Set to `little-faster` for slightly faster completions. Note that this option has a high cost, though not exorbitant.
60
60
  * For a detailed cost comparison, see the [cost overview table](https://monacopilot.vercel.app/docs/copilot-cost-overview).
61
61
  * @default 'normal'
62
62
  */
63
- completionSpeed?: CompletionSpeedType;
63
+ completionSpeed?: CompletionSpeed;
64
64
  /**
65
65
  * Helps to give more relevant completions based on the full context.
66
66
  * You can include things like the contents/codes of other files in the same workspace.
67
67
  */
68
- externalContext?: ExternalContextType;
68
+ externalContext?: ExternalContext;
69
69
  }
70
70
 
71
- type CompletionModelType = 'llama';
72
- type GroqCompletion = ChatCompletion & {
73
- error?: string;
74
- };
75
- interface CompletionRequestParams {
71
+ type CompletionModel = 'llama';
72
+ interface CompletionRequest {
76
73
  completionMetadata: CompletionMetadata;
77
74
  }
75
+ interface CompletionResponse {
76
+ completion?: string;
77
+ error?: string;
78
+ }
78
79
  type CompletionMode = 'fill-in-the-middle' | 'completion';
79
80
  interface CompletionMetadata {
80
81
  language: string | undefined;
81
- filename: FilenameType | undefined;
82
- technologies: TechnologiesType | undefined;
83
- externalContext: ExternalContextType | undefined;
82
+ filename: Filename | undefined;
83
+ technologies: Technologies | undefined;
84
+ externalContext: ExternalContext | undefined;
84
85
  codeAfterCursor: string;
85
86
  codeBeforeCursor: string;
86
87
  editorState: {
@@ -89,7 +90,7 @@ interface CompletionMetadata {
89
90
  }
90
91
 
91
92
  interface CopilotOptions {
92
- model: CompletionModelType | undefined;
93
+ model: CompletionModel | undefined;
93
94
  }
94
95
 
95
96
  /**
@@ -110,11 +111,14 @@ interface CopilotOptions {
110
111
  declare class Copilot {
111
112
  private apiKey;
112
113
  constructor(apiKey: string, options?: CopilotOptions);
113
- complete({ completionMetadata, }: CompletionRequestParams): Promise<GroqCompletion | {
114
- error: string;
115
- }>;
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>;
116
120
  }
117
121
 
118
122
  declare const Editor: ({ filename, endpoint, technologies, theme, completionSpeed, externalContext, ...props }: EditorProps) => React.JSX.Element;
119
123
 
120
- export { Copilot, Editor, type EditorProps, type EndpointType, type TechnologiesType, 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 TechnologiesType = string[];
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,21 +28,17 @@ type ExternalContextType = {
24
28
  */
25
29
  content: string;
26
30
  }[];
27
- /**
28
- * Themes available for the Monacopilot
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
43
  * The technologies (libraries, frameworks, etc.) you want to use for the completion.
44
44
  * This can provide technology-specific completions.
@@ -49,38 +49,39 @@ interface EditorProps extends EditorProps$1 {
49
49
  * ['tensorflow', 'keras', 'numpy', 'pandas']
50
50
  * etc.
51
51
  */
52
- technologies?: TechnologiesType;
52
+ technologies?: Technologies;
53
53
  /**
54
54
  * The theme you want to use for the editor.
55
55
  */
56
- theme?: EditorBuiltInTheme | ThemeType;
56
+ theme?: Theme;
57
57
  /**
58
58
  * Controls the speed of the completion.
59
59
  * Set to `little-faster` for slightly faster completions. Note that this option has a high cost, though not exorbitant.
60
60
  * For a detailed cost comparison, see the [cost overview table](https://monacopilot.vercel.app/docs/copilot-cost-overview).
61
61
  * @default 'normal'
62
62
  */
63
- completionSpeed?: CompletionSpeedType;
63
+ completionSpeed?: CompletionSpeed;
64
64
  /**
65
65
  * Helps to give more relevant completions based on the full context.
66
66
  * You can include things like the contents/codes of other files in the same workspace.
67
67
  */
68
- externalContext?: ExternalContextType;
68
+ externalContext?: ExternalContext;
69
69
  }
70
70
 
71
- type CompletionModelType = 'llama';
72
- type GroqCompletion = ChatCompletion & {
73
- error?: string;
74
- };
75
- interface CompletionRequestParams {
71
+ type CompletionModel = 'llama';
72
+ interface CompletionRequest {
76
73
  completionMetadata: CompletionMetadata;
77
74
  }
75
+ interface CompletionResponse {
76
+ completion?: string;
77
+ error?: string;
78
+ }
78
79
  type CompletionMode = 'fill-in-the-middle' | 'completion';
79
80
  interface CompletionMetadata {
80
81
  language: string | undefined;
81
- filename: FilenameType | undefined;
82
- technologies: TechnologiesType | undefined;
83
- externalContext: ExternalContextType | undefined;
82
+ filename: Filename | undefined;
83
+ technologies: Technologies | undefined;
84
+ externalContext: ExternalContext | undefined;
84
85
  codeAfterCursor: string;
85
86
  codeBeforeCursor: string;
86
87
  editorState: {
@@ -89,7 +90,7 @@ interface CompletionMetadata {
89
90
  }
90
91
 
91
92
  interface CopilotOptions {
92
- model: CompletionModelType | undefined;
93
+ model: CompletionModel | undefined;
93
94
  }
94
95
 
95
96
  /**
@@ -110,11 +111,14 @@ interface CopilotOptions {
110
111
  declare class Copilot {
111
112
  private apiKey;
112
113
  constructor(apiKey: string, options?: CopilotOptions);
113
- complete({ completionMetadata, }: CompletionRequestParams): Promise<GroqCompletion | {
114
- error: string;
115
- }>;
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>;
116
120
  }
117
121
 
118
122
  declare const Editor: ({ filename, endpoint, technologies, theme, completionSpeed, externalContext, ...props }: EditorProps) => React.JSX.Element;
119
123
 
120
- export { Copilot, Editor, type EditorProps, type EndpointType, type TechnologiesType, type ThemeType as Theme };
124
+ export { type CompletionRequest, type CompletionResponse, Copilot, Editor, type EditorProps, type Endpoint, type Technologies, type Theme };