maple-opencode-plugin 0.1.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 +35 -0
- package/index.d.ts +33 -0
- package/index.mjs +100 -0
- package/package.json +14 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
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
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# OpenCode Maple AI Plugin
|
|
2
|
+
|
|
3
|
+
An OpenCode plugin that adds [Maple AI](https://trymaple.ai) as a provider,
|
|
4
|
+
enabling end-to-end encrypted LLM inference running in Trusted Execution
|
|
5
|
+
Environments (TEEs).
|
|
6
|
+
|
|
7
|
+
## Prerequisites
|
|
8
|
+
|
|
9
|
+
Each user needs:
|
|
10
|
+
|
|
11
|
+
1. A **Maple account** at [trymaple.ai](https://trymaple.ai)
|
|
12
|
+
2. **Funded API credits**
|
|
13
|
+
3. An **API key** created from the [Maple dashboard](https://trymaple.ai)
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
Add the plugin to your OpenCode config:
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"$schema": "https://opencode.ai/config.json",
|
|
22
|
+
"plugin": ["maple-opencode-plugin"]
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## License
|
|
27
|
+
|
|
28
|
+
MIT
|
|
29
|
+
|
|
30
|
+
## Links
|
|
31
|
+
|
|
32
|
+
- [Maple AI](https://trymaple.ai)
|
|
33
|
+
- [Maple AI Documentation](https://docs.opensecret.cloud/docs/maple-ai/)
|
|
34
|
+
- [OpenCode](https://opencode.ai)
|
|
35
|
+
- [OpenCode Plugin Documentation](https://opencode.ai/docs/plugins)
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for OpenCode Maple AI Plugin
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { Plugin } from "@opencode-ai/plugin";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Model configuration for Maple AI models
|
|
9
|
+
*/
|
|
10
|
+
export interface MapleModel {
|
|
11
|
+
name: string;
|
|
12
|
+
limit: {
|
|
13
|
+
context: number;
|
|
14
|
+
output: number;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* OpenCode plugin for Maple AI provider
|
|
20
|
+
*
|
|
21
|
+
* Provides end-to-end encrypted LLM inference through Maple AI's TEE infrastructure.
|
|
22
|
+
*
|
|
23
|
+
* @returns Plugin configuration
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```json
|
|
27
|
+
* {
|
|
28
|
+
* "$schema": "https://opencode.ai/config.json",
|
|
29
|
+
* "plugin": ["opencode-maple-ai"]
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export function MapleAIPlugin(): Promise<Plugin>;
|
package/index.mjs
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { createCustomFetch } from "@opensecret/react";
|
|
2
|
+
|
|
3
|
+
const MAPLE_API_URL = "https://enclave.trymaple.ai";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Available Maple AI models with their specifications
|
|
7
|
+
*/
|
|
8
|
+
const MAPLE_MODELS = {
|
|
9
|
+
"llama-3.3-70b": {
|
|
10
|
+
name: "Llama 3.3 70B",
|
|
11
|
+
limit: { context: 128000, output: 8192 },
|
|
12
|
+
},
|
|
13
|
+
"gpt-oss-120b": {
|
|
14
|
+
name: "GPT-OSS 120B",
|
|
15
|
+
limit: { context: 128000, output: 8192 },
|
|
16
|
+
},
|
|
17
|
+
"deepseek-r1-0528": {
|
|
18
|
+
name: "DeepSeek R1",
|
|
19
|
+
limit: { context: 64000, output: 8192 },
|
|
20
|
+
},
|
|
21
|
+
"kimi-k2-thinking": {
|
|
22
|
+
name: "Kimi K2 Thinking",
|
|
23
|
+
limit: { context: 128000, output: 16384 },
|
|
24
|
+
},
|
|
25
|
+
"qwen3-coder-480b": {
|
|
26
|
+
name: "Qwen3 Coder 480B",
|
|
27
|
+
limit: { context: 32768, output: 8192 },
|
|
28
|
+
},
|
|
29
|
+
"qwen3-vl-30b": {
|
|
30
|
+
name: "Qwen3 VL 30B",
|
|
31
|
+
limit: { context: 32768, output: 8192 },
|
|
32
|
+
},
|
|
33
|
+
"gemma-3-27b": {
|
|
34
|
+
name: "Gemma 3 27B",
|
|
35
|
+
limit: { context: 8192, output: 8192 },
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @type {import('@opencode-ai/plugin').Plugin}
|
|
41
|
+
*/
|
|
42
|
+
export async function MapleAIPlugin() {
|
|
43
|
+
return {
|
|
44
|
+
async config(input) {
|
|
45
|
+
input.provider = input.provider || {};
|
|
46
|
+
const provider = input.provider["maple-ai"] || {};
|
|
47
|
+
|
|
48
|
+
provider.name ||= "Maple AI";
|
|
49
|
+
provider.options = provider.options || {};
|
|
50
|
+
provider.options.baseURL ||= `${MAPLE_API_URL}/v1`;
|
|
51
|
+
provider.options.includeUsage ??= true;
|
|
52
|
+
|
|
53
|
+
// Set up models with their configurations
|
|
54
|
+
provider.models = provider.models || {};
|
|
55
|
+
for (const [id, config] of Object.entries(MAPLE_MODELS)) {
|
|
56
|
+
if (!provider.models[id]) {
|
|
57
|
+
provider.models[id] = {
|
|
58
|
+
name: config.name,
|
|
59
|
+
limit: config.limit,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
input.provider["maple-ai"] = provider;
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
auth: {
|
|
68
|
+
provider: "maple-ai",
|
|
69
|
+
async loader(getAuth, provider) {
|
|
70
|
+
// Get the API key from auth
|
|
71
|
+
const auth = await getAuth();
|
|
72
|
+
|
|
73
|
+
if (!auth?.key) {
|
|
74
|
+
throw new Error(
|
|
75
|
+
"Maple AI API key not found. Please run `/connect` and add your Maple AI API key.\n\n" +
|
|
76
|
+
"Get your API key from: https://trymaple.ai",
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Create custom fetch with TEE attestation and encryption
|
|
81
|
+
const customFetch = createCustomFetch({
|
|
82
|
+
apiKey: auth.key,
|
|
83
|
+
apiUrl: MAPLE_API_URL,
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
apiKey: auth.key,
|
|
88
|
+
fetch: (input, init) => {
|
|
89
|
+
// Use the custom fetch that handles:
|
|
90
|
+
// 1. TEE Attestation
|
|
91
|
+
// 2. End-to-End Encryption
|
|
92
|
+
// 3. Secure Key Exchange
|
|
93
|
+
// 4. Response Decryption
|
|
94
|
+
return customFetch(input, init);
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "maple-opencode-plugin",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "OpenCode plugin to add Maple AI as a provider with end-to-end encrypted LLM inference",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "index.mjs",
|
|
7
|
+
"types": "index.d.ts",
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@opensecret/react": "^1.5.4"
|
|
10
|
+
},
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"@opencode-ai/plugin": "^1.1.25"
|
|
13
|
+
}
|
|
14
|
+
}
|