@elizaos/plugin-nearai 2.0.11-beta.7
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 +23 -0
- package/README.md +43 -0
- package/auto-enable.ts +14 -0
- package/package.json +145 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 elizaOS
|
|
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.
|
|
22
|
+
|
|
23
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# @elizaos/plugin-nearai
|
|
2
|
+
|
|
3
|
+
First-party NEAR AI Cloud TEE inference provider plugin for elizaOS.
|
|
4
|
+
|
|
5
|
+
This plugin targets **NEAR AI Cloud's OpenAI-compatible API** and supports:
|
|
6
|
+
|
|
7
|
+
- `TEXT_SMALL`, `TEXT_LARGE`
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
eliza plugins install @elizaos/plugin-nearai
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Configuration
|
|
16
|
+
|
|
17
|
+
| Variable | Required | Default | Description |
|
|
18
|
+
| --- | --- | --- | --- |
|
|
19
|
+
| `NEARAI_API_KEY` | Yes | - | NEAR AI API key (not needed in browser; use a proxy) |
|
|
20
|
+
| `NEARAI_BASE_URL` | No | `https://cloud-api.near.ai/v1` | OpenAI-compatible API base URL (Node only) |
|
|
21
|
+
| `NEARAI_BROWSER_BASE_URL` | No | - | Proxy base URL for browser builds (omit API key in-browser) |
|
|
22
|
+
| `NEARAI_SMALL_MODEL` | No | `Qwen/Qwen3.6-35B-A3B-FP8` | Small model id |
|
|
23
|
+
| `NEARAI_LARGE_MODEL` | No | `zai-org/GLM-5.1-FP8` | Large model id |
|
|
24
|
+
| `NEARAI_EXPERIMENTAL_TELEMETRY` | No | `false` | Set `true` to enable Vercel AI SDK telemetry |
|
|
25
|
+
|
|
26
|
+
Model ids come from the public NEAR AI catalog at
|
|
27
|
+
`https://cloud-api.near.ai/v1/model/list`. The default models were selected
|
|
28
|
+
from TEE-verifiable text models in that catalog.
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { AgentRuntime, ModelType } from "@elizaos/core";
|
|
34
|
+
import nearaiPlugin from "@elizaos/plugin-nearai";
|
|
35
|
+
|
|
36
|
+
const runtime = new AgentRuntime({ plugins: [nearaiPlugin] });
|
|
37
|
+
|
|
38
|
+
const text = await runtime.useModel(ModelType.TEXT_LARGE, {
|
|
39
|
+
prompt: "Write a haiku about local-first AI.",
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
console.log(text);
|
|
43
|
+
```
|
package/auto-enable.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Auto-enable check for @elizaos/plugin-nearai.
|
|
2
|
+
//
|
|
3
|
+
// Plugin manifest entry point, referenced by package.json's
|
|
4
|
+
// `elizaos.plugin.autoEnableModule`. Keep this module light: env reads only,
|
|
5
|
+
// no service init, no transitive imports of the full plugin runtime.
|
|
6
|
+
type PluginAutoEnableContext = {
|
|
7
|
+
env: Record<string, string | undefined>;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
/** Enable when a NEAR AI API key is present in the environment. */
|
|
11
|
+
export function shouldEnable(ctx: PluginAutoEnableContext): boolean {
|
|
12
|
+
const env = ctx.env;
|
|
13
|
+
return Boolean(env.NEARAI_API_KEY && env.NEARAI_API_KEY.trim() !== "");
|
|
14
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@elizaos/plugin-nearai",
|
|
3
|
+
"version": "2.0.11-beta.7",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/node/index.node.js",
|
|
6
|
+
"module": "dist/node/index.node.js",
|
|
7
|
+
"types": "dist/node/index.d.ts",
|
|
8
|
+
"browser": "dist/browser/index.browser.js",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/elizaos-plugins/plugin-nearai.git"
|
|
12
|
+
},
|
|
13
|
+
"exports": {
|
|
14
|
+
"./package.json": "./package.json",
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/node/index.d.ts",
|
|
17
|
+
"browser": {
|
|
18
|
+
"types": "./dist/browser/index.d.ts",
|
|
19
|
+
"import": "./dist/browser/index.browser.js",
|
|
20
|
+
"default": "./dist/browser/index.browser.js"
|
|
21
|
+
},
|
|
22
|
+
"node": {
|
|
23
|
+
"types": "./dist/node/index.d.ts",
|
|
24
|
+
"import": "./dist/node/index.node.js",
|
|
25
|
+
"default": "./dist/node/index.node.js"
|
|
26
|
+
},
|
|
27
|
+
"import": {
|
|
28
|
+
"types": "./dist/node/index.d.ts",
|
|
29
|
+
"default": "./dist/node/index.node.js"
|
|
30
|
+
},
|
|
31
|
+
"default": {
|
|
32
|
+
"types": "./dist/node/index.d.ts",
|
|
33
|
+
"default": "./dist/node/index.node.js"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"./*.css": "./dist/*.css",
|
|
37
|
+
"./*": {
|
|
38
|
+
"types": "./dist/*.d.ts",
|
|
39
|
+
"import": "./dist/*.js",
|
|
40
|
+
"default": "./dist/*.js"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"files": [
|
|
44
|
+
"dist",
|
|
45
|
+
"auto-enable.ts"
|
|
46
|
+
],
|
|
47
|
+
"elizaos": {
|
|
48
|
+
"plugin": {
|
|
49
|
+
"autoEnableModule": "./auto-enable.ts",
|
|
50
|
+
"capabilities": [
|
|
51
|
+
"text-large",
|
|
52
|
+
"text-small"
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"sideEffects": false,
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"@ai-sdk/openai-compatible": "^2.0.51",
|
|
59
|
+
"@elizaos/core": "2.0.11-beta.7",
|
|
60
|
+
"ai": "^6.0.23"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@biomejs/biome": "^2.4.14",
|
|
64
|
+
"@types/bun": "^1.3.10",
|
|
65
|
+
"@types/node": "^25.0.3",
|
|
66
|
+
"typescript": "^6.0.3",
|
|
67
|
+
"vitest": "^4.1.4"
|
|
68
|
+
},
|
|
69
|
+
"scripts": {
|
|
70
|
+
"dev": "bun run build.ts --watch",
|
|
71
|
+
"clean": "rm -rf dist .turbo .turbo-tsconfig.json tsconfig.tsbuildinfo",
|
|
72
|
+
"format": "bunx @biomejs/biome format --write .",
|
|
73
|
+
"format:check": "bunx @biomejs/biome format .",
|
|
74
|
+
"lint": "bunx @biomejs/biome check --write --unsafe .",
|
|
75
|
+
"lint:check": "bunx @biomejs/biome check . --no-errors-on-unmatched",
|
|
76
|
+
"typecheck": "tsgo --noEmit -p tsconfig.json",
|
|
77
|
+
"test": "bunx vitest run --config vitest.config.ts",
|
|
78
|
+
"test:watch": "bunx vitest --config vitest.config.ts",
|
|
79
|
+
"build": "bun run build.ts",
|
|
80
|
+
"build:ts": "bun run build.ts"
|
|
81
|
+
},
|
|
82
|
+
"publishConfig": {
|
|
83
|
+
"access": "public"
|
|
84
|
+
},
|
|
85
|
+
"agentConfig": {
|
|
86
|
+
"pluginType": "elizaos:plugin:1.0.0",
|
|
87
|
+
"pluginParameters": {
|
|
88
|
+
"NEARAI_API_KEY": {
|
|
89
|
+
"type": "string",
|
|
90
|
+
"description": "API key used to authenticate requests to the NEAR AI Cloud OpenAI-compatible API.",
|
|
91
|
+
"required": true,
|
|
92
|
+
"sensitive": true
|
|
93
|
+
},
|
|
94
|
+
"NEARAI_BASE_URL": {
|
|
95
|
+
"type": "string",
|
|
96
|
+
"description": "Base URL for the NEAR AI Cloud OpenAI-compatible API.",
|
|
97
|
+
"required": false,
|
|
98
|
+
"default": "https://cloud-api.near.ai/v1",
|
|
99
|
+
"sensitive": false
|
|
100
|
+
},
|
|
101
|
+
"NEARAI_SMALL_MODEL": {
|
|
102
|
+
"type": "string",
|
|
103
|
+
"description": "Override the default NEAR AI small model identifier.",
|
|
104
|
+
"required": false,
|
|
105
|
+
"default": "Qwen/Qwen3.6-35B-A3B-FP8",
|
|
106
|
+
"sensitive": false
|
|
107
|
+
},
|
|
108
|
+
"NEARAI_LARGE_MODEL": {
|
|
109
|
+
"type": "string",
|
|
110
|
+
"description": "Override the default NEAR AI large model identifier.",
|
|
111
|
+
"required": false,
|
|
112
|
+
"default": "zai-org/GLM-5.1-FP8",
|
|
113
|
+
"sensitive": false
|
|
114
|
+
},
|
|
115
|
+
"NEARAI_EXPERIMENTAL_TELEMETRY": {
|
|
116
|
+
"type": "boolean",
|
|
117
|
+
"description": "Enable experimental telemetry features for enhanced debugging and usage analytics.",
|
|
118
|
+
"required": false,
|
|
119
|
+
"default": false,
|
|
120
|
+
"sensitive": false
|
|
121
|
+
},
|
|
122
|
+
"NEARAI_BROWSER_BASE_URL": {
|
|
123
|
+
"type": "string",
|
|
124
|
+
"description": "Browser-only proxy endpoint base URL for NEAR AI requests. Do not expose API keys in browser clients.",
|
|
125
|
+
"required": false,
|
|
126
|
+
"sensitive": false
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
"eliza": {
|
|
131
|
+
"platforms": [
|
|
132
|
+
"browser",
|
|
133
|
+
"node"
|
|
134
|
+
],
|
|
135
|
+
"runtime": "both",
|
|
136
|
+
"platformDetails": {
|
|
137
|
+
"browser": "Browser-compatible build available via exports.browser",
|
|
138
|
+
"node": "Node.js build available via exports.node"
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
"peerDependencies": {
|
|
142
|
+
"@elizaos/core": "2.0.11-beta.7"
|
|
143
|
+
},
|
|
144
|
+
"gitHead": "cdbc876f793d96073d7eb0d09715a031ce0cd32e"
|
|
145
|
+
}
|