@omp-provider-capabilities/junie 0.0.0-stage → 0.3.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/LICENSE +21 -0
- package/README.md +40 -2
- package/package.json +65 -4
- package/src/agent-sdk.ts +94 -0
- package/src/index.ts +177 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Enver Francisco
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,41 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @omp-provider-capabilities/junie
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
JetBrains Junie provider features for OMP: BYOK support, self-hosted models, MCP integration, and ACP protocol.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **BYOK Support**: Bring Your Own Key for 9 providers (Anthropic, OpenAI, Google, xAI, OpenRouter, GitHub Copilot, LiteLLM, Ollama, LM Studio)
|
|
8
|
+
- **Mellum Model Hosting**: Self-hosted model configuration (Ollama, vLLM, Hugging Face)
|
|
9
|
+
- **MCP Integration**: Model Context Protocol for tool sharing
|
|
10
|
+
- **IDE Debugger Tools**: Native IDE integration with debugger capabilities
|
|
11
|
+
- **ACP Protocol**: Co-lead maintainer of Agent Client Protocol
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
Install via OMP plugin manager:
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
omp plugin install @omp-provider-capabilities/junie
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Install from GitHub:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
omp plugin install https://github.com/blyzer/omp-provider-capabilities/tree/main/packages/junie
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Link a local checkout:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
omp plugin link /path/to/omp-provider-capabilities/packages/junie
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Load the extension source for one invocation:
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
omp -e /path/to/omp-provider-capabilities/packages/junie/src/index.ts
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## License
|
|
40
|
+
|
|
41
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,67 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omp-provider-capabilities/junie",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "JetBrains Junie provider capabilities - BYOK agent, Mellum models, MCP, ACP",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"types": "src/index.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./src/index.ts"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"LICENSE",
|
|
13
|
+
"src/",
|
|
14
|
+
"README.md",
|
|
15
|
+
"omp.extensions.json"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"test": "bun test"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@omp-provider-capabilities/core": "^0.1.0"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"omp-package",
|
|
28
|
+
"omp-plugin",
|
|
29
|
+
"omp-extension",
|
|
30
|
+
"oh-my-pi",
|
|
31
|
+
"junie",
|
|
32
|
+
"jetbrains",
|
|
33
|
+
"mellum",
|
|
34
|
+
"byok",
|
|
35
|
+
"acp",
|
|
36
|
+
"mcp"
|
|
37
|
+
],
|
|
38
|
+
"author": "blyzer",
|
|
39
|
+
"license": "MIT",
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "git+https://github.com/blyzer/omp-provider-capabilities.git",
|
|
43
|
+
"directory": "packages/junie"
|
|
44
|
+
},
|
|
45
|
+
"omp": {
|
|
46
|
+
"extensions": [
|
|
47
|
+
"./src/index.ts"
|
|
48
|
+
],
|
|
49
|
+
"settings": {
|
|
50
|
+
"harness.enabled": {
|
|
51
|
+
"type": "boolean",
|
|
52
|
+
"default": true,
|
|
53
|
+
"description": "Enable Junie harness"
|
|
54
|
+
},
|
|
55
|
+
"mcp.enabled": {
|
|
56
|
+
"type": "boolean",
|
|
57
|
+
"default": true,
|
|
58
|
+
"description": "Enable MCP integration"
|
|
59
|
+
},
|
|
60
|
+
"acp.enabled": {
|
|
61
|
+
"type": "boolean",
|
|
62
|
+
"default": true,
|
|
63
|
+
"description": "Enable ACP protocol support"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
package/src/agent-sdk.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Junie Agent SDK wrapper.
|
|
3
|
+
*
|
|
4
|
+
* Wraps JetBrains Junie's API for multi-turn agent loops via direct HTTP.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type {
|
|
8
|
+
AgentSDK,
|
|
9
|
+
AgentConfig,
|
|
10
|
+
AgentResult,
|
|
11
|
+
AgentMessage,
|
|
12
|
+
AgentTool,
|
|
13
|
+
} from "@omp-provider-capabilities/core";
|
|
14
|
+
|
|
15
|
+
export class JunieAgentSDK implements AgentSDK {
|
|
16
|
+
public provider = "junie";
|
|
17
|
+
private apiKey: string;
|
|
18
|
+
|
|
19
|
+
constructor(apiKey: string) {
|
|
20
|
+
this.apiKey = apiKey;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
isAvailable(): boolean {
|
|
24
|
+
return !!this.apiKey;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async run(prompt: string, config: AgentConfig): Promise<AgentResult> {
|
|
28
|
+
const history: AgentMessage[] = [...(config.history || [])];
|
|
29
|
+
const maxTurns = config.maxTurns || 10;
|
|
30
|
+
let toolCallCount = 0;
|
|
31
|
+
|
|
32
|
+
const messages: Array<{ role: string; content: string }> = [
|
|
33
|
+
...(config.history || []).map((m) => ({ role: m.role, content: m.content })),
|
|
34
|
+
{ role: "user", content: prompt },
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
if (config.instruction) {
|
|
38
|
+
messages.unshift({ role: "system", content: config.instruction });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
for (let turn = 0; turn < maxTurns; turn++) {
|
|
42
|
+
const response = await fetch("https://api.jetbrains.com/junie/v1/chat/completions", {
|
|
43
|
+
method: "POST",
|
|
44
|
+
headers: {
|
|
45
|
+
"Content-Type": "application/json",
|
|
46
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
47
|
+
},
|
|
48
|
+
body: JSON.stringify({
|
|
49
|
+
model: config.model || "junie-2.0",
|
|
50
|
+
messages,
|
|
51
|
+
max_tokens: 4096,
|
|
52
|
+
tools: config.tools?.map((t) => ({
|
|
53
|
+
type: "function",
|
|
54
|
+
function: { name: t.name, description: t.description, parameters: t.parameters },
|
|
55
|
+
})),
|
|
56
|
+
}),
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
if (!response.ok) {
|
|
60
|
+
const errorText = await response.text();
|
|
61
|
+
return { output: "", history, toolCallCount, error: `Junie API error: ${response.status} ${errorText}` };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const data = await response.json();
|
|
65
|
+
const choices = data.choices || [];
|
|
66
|
+
if (choices.length === 0) break;
|
|
67
|
+
|
|
68
|
+
const message = choices[0].message;
|
|
69
|
+
if (message.tool_calls) {
|
|
70
|
+
toolCallCount += message.tool_calls.length;
|
|
71
|
+
for (const tc of message.tool_calls) {
|
|
72
|
+
messages.push({ role: "assistant", content: JSON.stringify(tc) });
|
|
73
|
+
const tool = config.tools?.find((t) => t.name === tc.function?.name);
|
|
74
|
+
let result = "Tool not found";
|
|
75
|
+
if (tool) {
|
|
76
|
+
try {
|
|
77
|
+
result = await tool.execute(tc.function?.arguments ? JSON.parse(tc.function.arguments) : {});
|
|
78
|
+
} catch (e) {
|
|
79
|
+
result = `Tool error: ${e instanceof Error ? e.message : String(e)}`;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
messages.push({ role: "tool", content: result });
|
|
83
|
+
history.push({ role: "tool", content: result, toolCallId: tc.id, toolName: tc.function?.name });
|
|
84
|
+
}
|
|
85
|
+
} else if (message.content) {
|
|
86
|
+
messages.push({ role: "assistant", content: message.content });
|
|
87
|
+
history.push({ role: "assistant", content: message.content });
|
|
88
|
+
return { output: message.content, history, toolCallCount };
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return { output: "", history, toolCallCount };
|
|
93
|
+
}
|
|
94
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JetBrains Junie provider capabilities.
|
|
3
|
+
*
|
|
4
|
+
* Junie is a BYOK (Bring Your Own Key) coding agent by JetBrains.
|
|
5
|
+
* It doesn't have its own batch API or server-side tools, but provides:
|
|
6
|
+
*
|
|
7
|
+
* - **Mellum models**: Open-source models (Mellum1 4B, Mellum2 12B MoE)
|
|
8
|
+
* that can be self-hosted via Ollama, vLLM, or Hugging Face.
|
|
9
|
+
* - **MCP integration**: Full MCP client support for external tools.
|
|
10
|
+
* - **IDE debugger tools**: Debugger MCP toolset for agentic debugging.
|
|
11
|
+
* - **ACP protocol**: Co-lead maintainer of Agent Client Protocol.
|
|
12
|
+
* - **BYOK support**: Works with Anthropic, OpenAI, Google, xAI, OpenRouter,
|
|
13
|
+
* GitHub Copilot, or custom endpoints (LiteLLM, Ollama, LM Studio).
|
|
14
|
+
*
|
|
15
|
+
* This package provides the capability metadata and integration points
|
|
16
|
+
* for Junie-specific features within the OMP provider capabilities ecosystem.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Junie provider identifier.
|
|
21
|
+
*/
|
|
22
|
+
export const JUNIE_PROVIDER_ID = "junie" as const;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Mellum model identifiers available through Junie.
|
|
26
|
+
*/
|
|
27
|
+
export const MELLUM_MODELS = [
|
|
28
|
+
"mellum-4b-base",
|
|
29
|
+
"mellum-4b-dpo-all",
|
|
30
|
+
"mellum2-12b",
|
|
31
|
+
"mellum2.1-12b-thinking",
|
|
32
|
+
] as const;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Junie-specific capabilities.
|
|
36
|
+
*/
|
|
37
|
+
export interface JunieCapabilities {
|
|
38
|
+
/** Whether batch API is available. */
|
|
39
|
+
batchApi: boolean;
|
|
40
|
+
/** Whether server-side tools are available. */
|
|
41
|
+
serverSideTools: boolean;
|
|
42
|
+
/** Whether prompt caching is available. */
|
|
43
|
+
promptCaching: boolean;
|
|
44
|
+
/** Whether context compaction is available. */
|
|
45
|
+
contextCompaction: boolean;
|
|
46
|
+
/** Whether agent SDK is available. */
|
|
47
|
+
agentSdk: boolean;
|
|
48
|
+
/** Whether MCP server integration is available. */
|
|
49
|
+
mcpIntegration: boolean;
|
|
50
|
+
/** Whether IDE debugger tools are available. */
|
|
51
|
+
debuggerTools: boolean;
|
|
52
|
+
/** Whether ACP protocol is supported. */
|
|
53
|
+
acpSupport: boolean;
|
|
54
|
+
/** Whether BYOK (Bring Your Own Key) is supported. */
|
|
55
|
+
byokSupport: boolean;
|
|
56
|
+
/** List of BYOK providers supported. */
|
|
57
|
+
byokProviders: string[];
|
|
58
|
+
/** Whether Mellum models can be self-hosted. */
|
|
59
|
+
mellumSelfHosted: boolean;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Returns the capabilities of the Junie provider.
|
|
64
|
+
*/
|
|
65
|
+
export function getJunieCapabilities(): JunieCapabilities {
|
|
66
|
+
return {
|
|
67
|
+
// Standard provider capabilities
|
|
68
|
+
batchApi: false,
|
|
69
|
+
serverSideTools: false,
|
|
70
|
+
promptCaching: false,
|
|
71
|
+
contextCompaction: false,
|
|
72
|
+
agentSdk: false,
|
|
73
|
+
|
|
74
|
+
// Junie-specific capabilities
|
|
75
|
+
mcpIntegration: true,
|
|
76
|
+
debuggerTools: true,
|
|
77
|
+
acpSupport: true,
|
|
78
|
+
byokSupport: true,
|
|
79
|
+
byokProviders: [
|
|
80
|
+
"anthropic",
|
|
81
|
+
"openai",
|
|
82
|
+
"google",
|
|
83
|
+
"xai",
|
|
84
|
+
"openrouter",
|
|
85
|
+
"github-copilot",
|
|
86
|
+
"liteLLM",
|
|
87
|
+
"ollama",
|
|
88
|
+
"lm-studio",
|
|
89
|
+
],
|
|
90
|
+
mellumSelfHosted: true,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Check if a model is a Mellum model.
|
|
96
|
+
*/
|
|
97
|
+
export function isMellumModel(modelId: string): boolean {
|
|
98
|
+
return modelId.toLowerCase().includes("mellum");
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Get the recommended self-hosting configuration for a Mellum model.
|
|
103
|
+
*/
|
|
104
|
+
export function getMellumHostingConfig(
|
|
105
|
+
modelId: string,
|
|
106
|
+
): {
|
|
107
|
+
ollamaCommand?: string;
|
|
108
|
+
vllmCommand?: string;
|
|
109
|
+
huggingFaceRepo?: string;
|
|
110
|
+
contextWindow: number;
|
|
111
|
+
vramRequired: string;
|
|
112
|
+
} | null {
|
|
113
|
+
const lower = modelId.toLowerCase();
|
|
114
|
+
|
|
115
|
+
if (lower.includes("mellum2")) {
|
|
116
|
+
return {
|
|
117
|
+
ollamaCommand: "ollama run hf.co/JetBrains/Mellum2.1-12B-A2.5B-Thinking-GGUF:Q4_K_M",
|
|
118
|
+
vllmCommand: "vllm serve JetBrains/Mellum2-12B --tensor-parallel-size 1",
|
|
119
|
+
huggingFaceRepo: "JetBrains/Mellum2-12B",
|
|
120
|
+
contextWindow: 131072,
|
|
121
|
+
vramRequired: "24GB",
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (lower.includes("mellum-4b")) {
|
|
126
|
+
return {
|
|
127
|
+
ollamaCommand: "ollama pull JetBrains/Mellum-4b-base",
|
|
128
|
+
vllmCommand: "vllm serve JetBrains/Mellum-4b-dpo-all",
|
|
129
|
+
huggingFaceRepo: "JetBrains/Mellum-4b-dpo-all",
|
|
130
|
+
contextWindow: 8192,
|
|
131
|
+
vramRequired: "8GB",
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Junie authentication methods.
|
|
140
|
+
*/
|
|
141
|
+
export type JunieAuthMethod =
|
|
142
|
+
| "jetbrains-account"
|
|
143
|
+
| "junie-api-key"
|
|
144
|
+
| "byok";
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Get the authentication URL for Junie CLI.
|
|
148
|
+
*/
|
|
149
|
+
export function getJunieAuthUrl(method: JunieAuthMethod): string {
|
|
150
|
+
switch (method) {
|
|
151
|
+
case "jetbrains-account":
|
|
152
|
+
return "https://account.jetbrains.com";
|
|
153
|
+
case "junie-api-key":
|
|
154
|
+
return "https://junie.jetbrains.com/cli";
|
|
155
|
+
case "byok":
|
|
156
|
+
return ""; // BYOK uses provider-specific auth
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Environment variables used by Junie.
|
|
162
|
+
*/
|
|
163
|
+
export const JUNIE_ENV_VARS = {
|
|
164
|
+
/** API key for usage-based billing. */
|
|
165
|
+
apiKey: "JUNIE_API_KEY",
|
|
166
|
+
/** Custom cache directory. */
|
|
167
|
+
cacheDir: "JUNIE_CACHE_DIR",
|
|
168
|
+
/** Model to use. */
|
|
169
|
+
model: "JUNIE_MODEL",
|
|
170
|
+
/** Effort level. */
|
|
171
|
+
effort: "JUNIE_EFFORT",
|
|
172
|
+
/** Trust project without prompting. */
|
|
173
|
+
trustProject: "JUNIE_TRUST_PROJECT",
|
|
174
|
+
/** Log prompt usage. */
|
|
175
|
+
logPromptUsage: "JUNIE_LOG_PROMPT_USAGE",
|
|
176
|
+
} as const;
|
|
177
|
+
export { JunieAgentSDK } from './agent-sdk';
|