@symerian/symi 3.0.18 → 3.0.19
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/build-info.json +3 -3
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/package.json +1 -1
- package/extensions/copilot-proxy/README.md +0 -24
- package/extensions/copilot-proxy/index.ts +0 -154
- package/extensions/copilot-proxy/node_modules/.bin/symi +0 -21
- package/extensions/copilot-proxy/package.json +0 -15
- package/extensions/copilot-proxy/symi.plugin.json +0 -9
- package/extensions/device-pair/index.ts +0 -642
- package/extensions/device-pair/symi.plugin.json +0 -20
- package/extensions/diagnostics-otel/index.ts +0 -15
- package/extensions/diagnostics-otel/node_modules/.bin/acorn +0 -21
- package/extensions/diagnostics-otel/node_modules/.bin/symi +0 -21
- package/extensions/diagnostics-otel/package.json +0 -27
- package/extensions/diagnostics-otel/src/service.test.ts +0 -290
- package/extensions/diagnostics-otel/src/service.ts +0 -666
- package/extensions/diagnostics-otel/symi.plugin.json +0 -8
- package/extensions/google-antigravity-auth/README.md +0 -24
- package/extensions/google-antigravity-auth/index.ts +0 -424
- package/extensions/google-antigravity-auth/node_modules/.bin/symi +0 -21
- package/extensions/google-antigravity-auth/package.json +0 -15
- package/extensions/google-antigravity-auth/symi.plugin.json +0 -9
- package/extensions/google-gemini-cli-auth/README.md +0 -35
- package/extensions/google-gemini-cli-auth/index.ts +0 -75
- package/extensions/google-gemini-cli-auth/node_modules/.bin/symi +0 -21
- package/extensions/google-gemini-cli-auth/oauth.test.ts +0 -162
- package/extensions/google-gemini-cli-auth/oauth.ts +0 -636
- package/extensions/google-gemini-cli-auth/package.json +0 -15
- package/extensions/google-gemini-cli-auth/symi.plugin.json +0 -9
- package/extensions/learning-loop/index.ts +0 -159
- package/extensions/learning-loop/node_modules/.bin/symi +0 -21
- package/extensions/learning-loop/package.json +0 -18
- package/extensions/learning-loop/src/analytics/gateway-methods.ts +0 -230
- package/extensions/learning-loop/src/analytics/metrics-aggregator.ts +0 -153
- package/extensions/learning-loop/src/capture/run-tracker.ts +0 -181
- package/extensions/learning-loop/src/capture/serializer.ts +0 -74
- package/extensions/learning-loop/src/db.ts +0 -583
- package/extensions/learning-loop/src/feedback/explicit-feedback.ts +0 -58
- package/extensions/learning-loop/src/feedback/implicit-signals.ts +0 -89
- package/extensions/learning-loop/src/graph/edge-inference.ts +0 -189
- package/extensions/learning-loop/src/graph/graph-retrieval.ts +0 -144
- package/extensions/learning-loop/src/graph/graph-store.ts +0 -183
- package/extensions/learning-loop/src/hooks.ts +0 -244
- package/extensions/learning-loop/src/injection/cache.ts +0 -73
- package/extensions/learning-loop/src/injection/context-injector.ts +0 -104
- package/extensions/learning-loop/src/injection/prompt-builder.ts +0 -43
- package/extensions/learning-loop/src/learning/embedding-bridge.ts +0 -54
- package/extensions/learning-loop/src/learning/learning-extractor.ts +0 -217
- package/extensions/learning-loop/src/learning/learning-store.ts +0 -158
- package/extensions/learning-loop/src/learning/retrieval.ts +0 -87
- package/extensions/learning-loop/src/math/confidence-intervals.ts +0 -62
- package/extensions/learning-loop/src/math/ewma.ts +0 -51
- package/extensions/learning-loop/src/math/weighted-scorer.ts +0 -42
- package/extensions/learning-loop/src/schema.ts +0 -176
- package/extensions/learning-loop/src/scoring/normalization.ts +0 -32
- package/extensions/learning-loop/src/scoring/quality-engine.ts +0 -78
- package/extensions/learning-loop/src/scoring/signal-extractors.ts +0 -155
- package/extensions/learning-loop/src/test/context-injector.test.ts +0 -142
- package/extensions/learning-loop/src/test/fixes.test.ts +0 -1286
- package/extensions/learning-loop/src/test/graph.test.ts +0 -711
- package/extensions/learning-loop/src/test/integration.test.ts +0 -312
- package/extensions/learning-loop/src/test/learning-store.test.ts +0 -191
- package/extensions/learning-loop/src/test/math.test.ts +0 -148
- package/extensions/learning-loop/src/test/quality-engine.test.ts +0 -231
- package/extensions/learning-loop/src/test/run-tracker.test.ts +0 -143
- package/extensions/learning-loop/src/types.ts +0 -281
- package/extensions/learning-loop/symi.plugin.json +0 -46
- package/extensions/llm-task/README.md +0 -97
- package/extensions/llm-task/index.ts +0 -6
- package/extensions/llm-task/package.json +0 -12
- package/extensions/llm-task/src/llm-task-tool.test.ts +0 -138
- package/extensions/llm-task/src/llm-task-tool.ts +0 -249
- package/extensions/llm-task/symi.plugin.json +0 -21
- package/extensions/memory-lancedb/config.ts +0 -161
- package/extensions/memory-lancedb/index.test.ts +0 -330
- package/extensions/memory-lancedb/index.ts +0 -670
- package/extensions/memory-lancedb/node_modules/.bin/arrow2csv +0 -21
- package/extensions/memory-lancedb/node_modules/.bin/openai +0 -21
- package/extensions/memory-lancedb/node_modules/.bin/symi +0 -21
- package/extensions/memory-lancedb/package.json +0 -20
- package/extensions/memory-lancedb/symi.plugin.json +0 -71
- package/extensions/minimax-portal-auth/README.md +0 -33
- package/extensions/minimax-portal-auth/index.ts +0 -161
- package/extensions/minimax-portal-auth/node_modules/.bin/symi +0 -21
- package/extensions/minimax-portal-auth/oauth.ts +0 -247
- package/extensions/minimax-portal-auth/package.json +0 -15
- package/extensions/minimax-portal-auth/symi.plugin.json +0 -9
- package/extensions/model-equalizer/index.ts +0 -80
- package/extensions/model-equalizer/skills/model-equalizer/SKILL.md +0 -58
- package/extensions/model-equalizer/src/detection.ts +0 -62
- package/extensions/model-equalizer/src/enhancer.ts +0 -63
- package/extensions/model-equalizer/src/test/detection.test.ts +0 -218
- package/extensions/model-equalizer/src/test/enhancer.test.ts +0 -137
- package/extensions/model-equalizer/src/test/integration.test.ts +0 -185
- package/extensions/model-equalizer/src/types.ts +0 -24
- package/extensions/model-equalizer/symi.plugin.json +0 -12
- package/extensions/phone-control/index.ts +0 -421
- package/extensions/phone-control/symi.plugin.json +0 -10
- package/extensions/pipeline/README.md +0 -75
- package/extensions/pipeline/SKILL.md +0 -97
- package/extensions/pipeline/index.ts +0 -18
- package/extensions/pipeline/package.json +0 -11
- package/extensions/pipeline/src/pipeline-tool.test.ts +0 -345
- package/extensions/pipeline/src/pipeline-tool.ts +0 -266
- package/extensions/pipeline/src/windows-spawn.test.ts +0 -148
- package/extensions/pipeline/src/windows-spawn.ts +0 -193
- package/extensions/pipeline/symi.plugin.json +0 -10
- package/extensions/qwen-portal-auth/README.md +0 -24
- package/extensions/qwen-portal-auth/index.ts +0 -134
- package/extensions/qwen-portal-auth/oauth.ts +0 -190
- package/extensions/qwen-portal-auth/symi.plugin.json +0 -9
- package/extensions/talk-voice/index.ts +0 -150
- package/extensions/talk-voice/symi.plugin.json +0 -10
- package/extensions/thread-ownership/index.test.ts +0 -180
- package/extensions/thread-ownership/index.ts +0 -133
- package/extensions/thread-ownership/symi.plugin.json +0 -28
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
-
|
|
4
|
-
case `uname` in
|
|
5
|
-
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
-
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
-
basedir=`cygpath -w "$basedir"`
|
|
8
|
-
fi
|
|
9
|
-
;;
|
|
10
|
-
esac
|
|
11
|
-
|
|
12
|
-
if [ -z "$NODE_PATH" ]; then
|
|
13
|
-
export NODE_PATH="/home/symi/projects/symi/node_modules/.pnpm/openai@6.22.0_ws@8.19.0_zod@4.3.6/node_modules/openai/bin/node_modules:/home/symi/projects/symi/node_modules/.pnpm/openai@6.22.0_ws@8.19.0_zod@4.3.6/node_modules/openai/node_modules:/home/symi/projects/symi/node_modules/.pnpm/openai@6.22.0_ws@8.19.0_zod@4.3.6/node_modules:/home/symi/projects/symi/node_modules/.pnpm/node_modules"
|
|
14
|
-
else
|
|
15
|
-
export NODE_PATH="/home/symi/projects/symi/node_modules/.pnpm/openai@6.22.0_ws@8.19.0_zod@4.3.6/node_modules/openai/bin/node_modules:/home/symi/projects/symi/node_modules/.pnpm/openai@6.22.0_ws@8.19.0_zod@4.3.6/node_modules/openai/node_modules:/home/symi/projects/symi/node_modules/.pnpm/openai@6.22.0_ws@8.19.0_zod@4.3.6/node_modules:/home/symi/projects/symi/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
|
-
fi
|
|
17
|
-
if [ -x "$basedir/node" ]; then
|
|
18
|
-
exec "$basedir/node" "$basedir/../openai/bin/cli" "$@"
|
|
19
|
-
else
|
|
20
|
-
exec node "$basedir/../openai/bin/cli" "$@"
|
|
21
|
-
fi
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
-
|
|
4
|
-
case `uname` in
|
|
5
|
-
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
-
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
-
basedir=`cygpath -w "$basedir"`
|
|
8
|
-
fi
|
|
9
|
-
;;
|
|
10
|
-
esac
|
|
11
|
-
|
|
12
|
-
if [ -z "$NODE_PATH" ]; then
|
|
13
|
-
export NODE_PATH="/home/symi/projects/symi/node_modules:/home/symi/projects/node_modules:/home/symi/node_modules:/home/node_modules:/node_modules:/home/symi/projects/symi/node_modules/.pnpm/node_modules"
|
|
14
|
-
else
|
|
15
|
-
export NODE_PATH="/home/symi/projects/symi/node_modules:/home/symi/projects/node_modules:/home/symi/node_modules:/home/node_modules:/node_modules:/home/symi/projects/symi/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
|
-
fi
|
|
17
|
-
if [ -x "$basedir/node" ]; then
|
|
18
|
-
exec "$basedir/node" "$basedir/../@symerian/symi/symi.mjs" "$@"
|
|
19
|
-
else
|
|
20
|
-
exec node "$basedir/../@symerian/symi/symi.mjs" "$@"
|
|
21
|
-
fi
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@symi/memory-lancedb",
|
|
3
|
-
"version": "3.0.9",
|
|
4
|
-
"private": true,
|
|
5
|
-
"description": "Symi LanceDB-backed long-term memory plugin with auto-recall/capture",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"dependencies": {
|
|
8
|
-
"@lancedb/lancedb": "^0.26.2",
|
|
9
|
-
"@sinclair/typebox": "0.34.48",
|
|
10
|
-
"openai": "^6.22.0"
|
|
11
|
-
},
|
|
12
|
-
"devDependencies": {
|
|
13
|
-
"@symerian/symi": "workspace:*"
|
|
14
|
-
},
|
|
15
|
-
"symi": {
|
|
16
|
-
"extensions": [
|
|
17
|
-
"./index.ts"
|
|
18
|
-
]
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "memory-lancedb",
|
|
3
|
-
"kind": "memory",
|
|
4
|
-
"uiHints": {
|
|
5
|
-
"embedding.apiKey": {
|
|
6
|
-
"label": "OpenAI API Key",
|
|
7
|
-
"sensitive": true,
|
|
8
|
-
"placeholder": "sk-proj-...",
|
|
9
|
-
"help": "API key for OpenAI embeddings (or use ${OPENAI_API_KEY})"
|
|
10
|
-
},
|
|
11
|
-
"embedding.model": {
|
|
12
|
-
"label": "Embedding Model",
|
|
13
|
-
"placeholder": "text-embedding-3-small",
|
|
14
|
-
"help": "OpenAI embedding model to use"
|
|
15
|
-
},
|
|
16
|
-
"dbPath": {
|
|
17
|
-
"label": "Database Path",
|
|
18
|
-
"placeholder": "~/.symi/memory/lancedb",
|
|
19
|
-
"advanced": true
|
|
20
|
-
},
|
|
21
|
-
"autoCapture": {
|
|
22
|
-
"label": "Auto-Capture",
|
|
23
|
-
"help": "Automatically capture important information from conversations"
|
|
24
|
-
},
|
|
25
|
-
"autoRecall": {
|
|
26
|
-
"label": "Auto-Recall",
|
|
27
|
-
"help": "Automatically inject relevant memories into context"
|
|
28
|
-
},
|
|
29
|
-
"captureMaxChars": {
|
|
30
|
-
"label": "Capture Max Chars",
|
|
31
|
-
"help": "Maximum message length eligible for auto-capture",
|
|
32
|
-
"advanced": true,
|
|
33
|
-
"placeholder": "500"
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
"configSchema": {
|
|
37
|
-
"type": "object",
|
|
38
|
-
"additionalProperties": false,
|
|
39
|
-
"properties": {
|
|
40
|
-
"embedding": {
|
|
41
|
-
"type": "object",
|
|
42
|
-
"additionalProperties": false,
|
|
43
|
-
"properties": {
|
|
44
|
-
"apiKey": {
|
|
45
|
-
"type": "string"
|
|
46
|
-
},
|
|
47
|
-
"model": {
|
|
48
|
-
"type": "string",
|
|
49
|
-
"enum": ["text-embedding-3-small", "text-embedding-3-large"]
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
"required": ["apiKey"]
|
|
53
|
-
},
|
|
54
|
-
"dbPath": {
|
|
55
|
-
"type": "string"
|
|
56
|
-
},
|
|
57
|
-
"autoCapture": {
|
|
58
|
-
"type": "boolean"
|
|
59
|
-
},
|
|
60
|
-
"autoRecall": {
|
|
61
|
-
"type": "boolean"
|
|
62
|
-
},
|
|
63
|
-
"captureMaxChars": {
|
|
64
|
-
"type": "number",
|
|
65
|
-
"minimum": 100,
|
|
66
|
-
"maximum": 10000
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
"required": ["embedding"]
|
|
70
|
-
}
|
|
71
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# MiniMax OAuth (Symi plugin)
|
|
2
|
-
|
|
3
|
-
OAuth provider plugin for **MiniMax** (OAuth).
|
|
4
|
-
|
|
5
|
-
## Enable
|
|
6
|
-
|
|
7
|
-
Bundled plugins are disabled by default. Enable this one:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
symi plugins enable minimax-portal-auth
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Restart the Gateway after enabling.
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
symi gateway restart
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Authenticate
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
symi models auth login --provider minimax-portal --set-default
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
You will be prompted to select an endpoint:
|
|
26
|
-
|
|
27
|
-
- **Global** - International users, optimized for overseas access (`api.minimax.io`)
|
|
28
|
-
- **China** - Optimized for users in China (`api.minimaxi.com`)
|
|
29
|
-
|
|
30
|
-
## Notes
|
|
31
|
-
|
|
32
|
-
- MiniMax OAuth uses a user-code login flow.
|
|
33
|
-
- Currently, OAuth login is supported only for the Coding plan
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
emptyPluginConfigSchema,
|
|
3
|
-
type SymiPluginApi,
|
|
4
|
-
type ProviderAuthContext,
|
|
5
|
-
type ProviderAuthResult,
|
|
6
|
-
} from "symi/plugin-sdk";
|
|
7
|
-
import { loginMiniMaxPortalOAuth, type MiniMaxRegion } from "./oauth.js";
|
|
8
|
-
|
|
9
|
-
const PROVIDER_ID = "minimax-portal";
|
|
10
|
-
const PROVIDER_LABEL = "MiniMax";
|
|
11
|
-
const DEFAULT_MODEL = "MiniMax-M2.5";
|
|
12
|
-
const DEFAULT_BASE_URL_CN = "https://api.minimaxi.com/anthropic";
|
|
13
|
-
const DEFAULT_BASE_URL_GLOBAL = "https://api.minimax.io/anthropic";
|
|
14
|
-
const DEFAULT_CONTEXT_WINDOW = 200000;
|
|
15
|
-
const DEFAULT_MAX_TOKENS = 8192;
|
|
16
|
-
const OAUTH_PLACEHOLDER = "minimax-oauth";
|
|
17
|
-
|
|
18
|
-
function getDefaultBaseUrl(region: MiniMaxRegion): string {
|
|
19
|
-
return region === "cn" ? DEFAULT_BASE_URL_CN : DEFAULT_BASE_URL_GLOBAL;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function modelRef(modelId: string): string {
|
|
23
|
-
return `${PROVIDER_ID}/${modelId}`;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function buildModelDefinition(params: {
|
|
27
|
-
id: string;
|
|
28
|
-
name: string;
|
|
29
|
-
input: Array<"text" | "image">;
|
|
30
|
-
reasoning?: boolean;
|
|
31
|
-
}) {
|
|
32
|
-
return {
|
|
33
|
-
id: params.id,
|
|
34
|
-
name: params.name,
|
|
35
|
-
reasoning: params.reasoning ?? false,
|
|
36
|
-
input: params.input,
|
|
37
|
-
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
38
|
-
contextWindow: DEFAULT_CONTEXT_WINDOW,
|
|
39
|
-
maxTokens: DEFAULT_MAX_TOKENS,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function createOAuthHandler(region: MiniMaxRegion) {
|
|
44
|
-
const defaultBaseUrl = getDefaultBaseUrl(region);
|
|
45
|
-
const regionLabel = region === "cn" ? "CN" : "Global";
|
|
46
|
-
|
|
47
|
-
return async (ctx: ProviderAuthContext): Promise<ProviderAuthResult> => {
|
|
48
|
-
const progress = ctx.prompter.progress(`Starting MiniMax OAuth (${regionLabel})…`);
|
|
49
|
-
try {
|
|
50
|
-
const result = await loginMiniMaxPortalOAuth({
|
|
51
|
-
openUrl: ctx.openUrl,
|
|
52
|
-
note: ctx.prompter.note,
|
|
53
|
-
progress,
|
|
54
|
-
region,
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
progress.stop("MiniMax OAuth complete");
|
|
58
|
-
|
|
59
|
-
if (result.notification_message) {
|
|
60
|
-
await ctx.prompter.note(result.notification_message, "MiniMax OAuth");
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const profileId = `${PROVIDER_ID}:default`;
|
|
64
|
-
const baseUrl = result.resourceUrl || defaultBaseUrl;
|
|
65
|
-
|
|
66
|
-
return {
|
|
67
|
-
profiles: [
|
|
68
|
-
{
|
|
69
|
-
profileId,
|
|
70
|
-
credential: {
|
|
71
|
-
type: "oauth" as const,
|
|
72
|
-
provider: PROVIDER_ID,
|
|
73
|
-
access: result.access,
|
|
74
|
-
refresh: result.refresh,
|
|
75
|
-
expires: result.expires,
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
configPatch: {
|
|
80
|
-
models: {
|
|
81
|
-
providers: {
|
|
82
|
-
[PROVIDER_ID]: {
|
|
83
|
-
baseUrl,
|
|
84
|
-
apiKey: OAUTH_PLACEHOLDER,
|
|
85
|
-
api: "anthropic-messages",
|
|
86
|
-
models: [
|
|
87
|
-
buildModelDefinition({
|
|
88
|
-
id: "MiniMax-M2.1",
|
|
89
|
-
name: "MiniMax M2.1",
|
|
90
|
-
input: ["text"],
|
|
91
|
-
}),
|
|
92
|
-
buildModelDefinition({
|
|
93
|
-
id: "MiniMax-M2.5",
|
|
94
|
-
name: "MiniMax M2.5",
|
|
95
|
-
input: ["text"],
|
|
96
|
-
reasoning: true,
|
|
97
|
-
}),
|
|
98
|
-
],
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
agents: {
|
|
103
|
-
defaults: {
|
|
104
|
-
models: {
|
|
105
|
-
[modelRef("MiniMax-M2.1")]: { alias: "minimax-m2.1" },
|
|
106
|
-
[modelRef("MiniMax-M2.5")]: { alias: "minimax-m2.5" },
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
defaultModel: modelRef(DEFAULT_MODEL),
|
|
112
|
-
notes: [
|
|
113
|
-
"MiniMax OAuth tokens auto-refresh. Re-run login if refresh fails or access is revoked.",
|
|
114
|
-
`Base URL defaults to ${defaultBaseUrl}. Override models.providers.${PROVIDER_ID}.baseUrl if needed.`,
|
|
115
|
-
...(result.notification_message ? [result.notification_message] : []),
|
|
116
|
-
],
|
|
117
|
-
};
|
|
118
|
-
} catch (err) {
|
|
119
|
-
const errorMsg = err instanceof Error ? err.message : String(err);
|
|
120
|
-
progress.stop(`MiniMax OAuth failed: ${errorMsg}`);
|
|
121
|
-
await ctx.prompter.note(
|
|
122
|
-
"If OAuth fails, verify your MiniMax account has portal access and try again.",
|
|
123
|
-
"MiniMax OAuth",
|
|
124
|
-
);
|
|
125
|
-
throw err;
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
const minimaxPortalPlugin = {
|
|
131
|
-
id: "minimax-portal-auth",
|
|
132
|
-
name: "MiniMax OAuth",
|
|
133
|
-
description: "OAuth flow for MiniMax models",
|
|
134
|
-
configSchema: emptyPluginConfigSchema(),
|
|
135
|
-
register(api: SymiPluginApi) {
|
|
136
|
-
api.registerProvider({
|
|
137
|
-
id: PROVIDER_ID,
|
|
138
|
-
label: PROVIDER_LABEL,
|
|
139
|
-
docsPath: "/providers/minimax",
|
|
140
|
-
aliases: ["minimax"],
|
|
141
|
-
auth: [
|
|
142
|
-
{
|
|
143
|
-
id: "oauth",
|
|
144
|
-
label: "MiniMax OAuth (Global)",
|
|
145
|
-
hint: "Global endpoint - api.minimax.io",
|
|
146
|
-
kind: "device_code",
|
|
147
|
-
run: createOAuthHandler("global"),
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
id: "oauth-cn",
|
|
151
|
-
label: "MiniMax OAuth (CN)",
|
|
152
|
-
hint: "CN endpoint - api.minimaxi.com",
|
|
153
|
-
kind: "device_code",
|
|
154
|
-
run: createOAuthHandler("cn"),
|
|
155
|
-
},
|
|
156
|
-
],
|
|
157
|
-
});
|
|
158
|
-
},
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
export default minimaxPortalPlugin;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
-
|
|
4
|
-
case `uname` in
|
|
5
|
-
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
-
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
-
basedir=`cygpath -w "$basedir"`
|
|
8
|
-
fi
|
|
9
|
-
;;
|
|
10
|
-
esac
|
|
11
|
-
|
|
12
|
-
if [ -z "$NODE_PATH" ]; then
|
|
13
|
-
export NODE_PATH="/home/symi/projects/symi/node_modules:/home/symi/projects/node_modules:/home/symi/node_modules:/home/node_modules:/node_modules:/home/symi/projects/symi/node_modules/.pnpm/node_modules"
|
|
14
|
-
else
|
|
15
|
-
export NODE_PATH="/home/symi/projects/symi/node_modules:/home/symi/projects/node_modules:/home/symi/node_modules:/home/node_modules:/node_modules:/home/symi/projects/symi/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
|
-
fi
|
|
17
|
-
if [ -x "$basedir/node" ]; then
|
|
18
|
-
exec "$basedir/node" "$basedir/../@symerian/symi/symi.mjs" "$@"
|
|
19
|
-
else
|
|
20
|
-
exec node "$basedir/../@symerian/symi/symi.mjs" "$@"
|
|
21
|
-
fi
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
2
|
-
|
|
3
|
-
export type MiniMaxRegion = "cn" | "global";
|
|
4
|
-
|
|
5
|
-
const MINIMAX_OAUTH_CONFIG = {
|
|
6
|
-
cn: {
|
|
7
|
-
baseUrl: "https://api.minimaxi.com",
|
|
8
|
-
clientId: "78257093-7e40-4613-99e0-527b14b39113",
|
|
9
|
-
},
|
|
10
|
-
global: {
|
|
11
|
-
baseUrl: "https://api.minimax.io",
|
|
12
|
-
clientId: "78257093-7e40-4613-99e0-527b14b39113",
|
|
13
|
-
},
|
|
14
|
-
} as const;
|
|
15
|
-
|
|
16
|
-
const MINIMAX_OAUTH_SCOPE = "group_id profile model.completion";
|
|
17
|
-
const MINIMAX_OAUTH_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:user_code";
|
|
18
|
-
|
|
19
|
-
function getOAuthEndpoints(region: MiniMaxRegion) {
|
|
20
|
-
const config = MINIMAX_OAUTH_CONFIG[region];
|
|
21
|
-
return {
|
|
22
|
-
codeEndpoint: `${config.baseUrl}/oauth/code`,
|
|
23
|
-
tokenEndpoint: `${config.baseUrl}/oauth/token`,
|
|
24
|
-
clientId: config.clientId,
|
|
25
|
-
baseUrl: config.baseUrl,
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export type MiniMaxOAuthAuthorization = {
|
|
30
|
-
user_code: string;
|
|
31
|
-
verification_uri: string;
|
|
32
|
-
expired_in: number;
|
|
33
|
-
interval?: number;
|
|
34
|
-
state: string;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export type MiniMaxOAuthToken = {
|
|
38
|
-
access: string;
|
|
39
|
-
refresh: string;
|
|
40
|
-
expires: number;
|
|
41
|
-
resourceUrl?: string;
|
|
42
|
-
notification_message?: string;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
type TokenPending = { status: "pending"; message?: string };
|
|
46
|
-
|
|
47
|
-
type TokenResult =
|
|
48
|
-
| { status: "success"; token: MiniMaxOAuthToken }
|
|
49
|
-
| TokenPending
|
|
50
|
-
| { status: "error"; message: string };
|
|
51
|
-
|
|
52
|
-
function toFormUrlEncoded(data: Record<string, string>): string {
|
|
53
|
-
return Object.entries(data)
|
|
54
|
-
.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
|
|
55
|
-
.join("&");
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function generatePkce(): { verifier: string; challenge: string; state: string } {
|
|
59
|
-
const verifier = randomBytes(32).toString("base64url");
|
|
60
|
-
const challenge = createHash("sha256").update(verifier).digest("base64url");
|
|
61
|
-
const state = randomBytes(16).toString("base64url");
|
|
62
|
-
return { verifier, challenge, state };
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
async function requestOAuthCode(params: {
|
|
66
|
-
challenge: string;
|
|
67
|
-
state: string;
|
|
68
|
-
region: MiniMaxRegion;
|
|
69
|
-
}): Promise<MiniMaxOAuthAuthorization> {
|
|
70
|
-
const endpoints = getOAuthEndpoints(params.region);
|
|
71
|
-
const response = await fetch(endpoints.codeEndpoint, {
|
|
72
|
-
method: "POST",
|
|
73
|
-
headers: {
|
|
74
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
75
|
-
Accept: "application/json",
|
|
76
|
-
"x-request-id": randomUUID(),
|
|
77
|
-
},
|
|
78
|
-
body: toFormUrlEncoded({
|
|
79
|
-
response_type: "code",
|
|
80
|
-
client_id: endpoints.clientId,
|
|
81
|
-
scope: MINIMAX_OAUTH_SCOPE,
|
|
82
|
-
code_challenge: params.challenge,
|
|
83
|
-
code_challenge_method: "S256",
|
|
84
|
-
state: params.state,
|
|
85
|
-
}),
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
if (!response.ok) {
|
|
89
|
-
const text = await response.text();
|
|
90
|
-
throw new Error(`MiniMax OAuth authorization failed: ${text || response.statusText}`);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const payload = (await response.json()) as MiniMaxOAuthAuthorization & { error?: string };
|
|
94
|
-
if (!payload.user_code || !payload.verification_uri) {
|
|
95
|
-
throw new Error(
|
|
96
|
-
payload.error ??
|
|
97
|
-
"MiniMax OAuth authorization returned an incomplete payload (missing user_code or verification_uri).",
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
if (payload.state !== params.state) {
|
|
101
|
-
throw new Error("MiniMax OAuth state mismatch: possible CSRF attack or session corruption.");
|
|
102
|
-
}
|
|
103
|
-
return payload;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
async function pollOAuthToken(params: {
|
|
107
|
-
userCode: string;
|
|
108
|
-
verifier: string;
|
|
109
|
-
region: MiniMaxRegion;
|
|
110
|
-
}): Promise<TokenResult> {
|
|
111
|
-
const endpoints = getOAuthEndpoints(params.region);
|
|
112
|
-
const response = await fetch(endpoints.tokenEndpoint, {
|
|
113
|
-
method: "POST",
|
|
114
|
-
headers: {
|
|
115
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
116
|
-
Accept: "application/json",
|
|
117
|
-
},
|
|
118
|
-
body: toFormUrlEncoded({
|
|
119
|
-
grant_type: MINIMAX_OAUTH_GRANT_TYPE,
|
|
120
|
-
client_id: endpoints.clientId,
|
|
121
|
-
user_code: params.userCode,
|
|
122
|
-
code_verifier: params.verifier,
|
|
123
|
-
}),
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
const text = await response.text();
|
|
127
|
-
let payload:
|
|
128
|
-
| {
|
|
129
|
-
status?: string;
|
|
130
|
-
base_resp?: { status_code?: number; status_msg?: string };
|
|
131
|
-
}
|
|
132
|
-
| undefined;
|
|
133
|
-
if (text) {
|
|
134
|
-
try {
|
|
135
|
-
payload = JSON.parse(text) as typeof payload;
|
|
136
|
-
} catch {
|
|
137
|
-
payload = undefined;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if (!response.ok) {
|
|
142
|
-
return {
|
|
143
|
-
status: "error",
|
|
144
|
-
message:
|
|
145
|
-
(payload?.base_resp?.status_msg ?? text) || "MiniMax OAuth failed to parse response.",
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
if (!payload) {
|
|
150
|
-
return { status: "error", message: "MiniMax OAuth failed to parse response." };
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
const tokenPayload = payload as {
|
|
154
|
-
status: string;
|
|
155
|
-
access_token?: string | null;
|
|
156
|
-
refresh_token?: string | null;
|
|
157
|
-
expired_in?: number | null;
|
|
158
|
-
token_type?: string;
|
|
159
|
-
resource_url?: string;
|
|
160
|
-
notification_message?: string;
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
if (tokenPayload.status === "error") {
|
|
164
|
-
return { status: "error", message: "An error occurred. Please try again later" };
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
if (tokenPayload.status != "success") {
|
|
168
|
-
return { status: "pending", message: "current user code is not authorized" };
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
if (!tokenPayload.access_token || !tokenPayload.refresh_token || !tokenPayload.expired_in) {
|
|
172
|
-
return { status: "error", message: "MiniMax OAuth returned incomplete token payload." };
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return {
|
|
176
|
-
status: "success",
|
|
177
|
-
token: {
|
|
178
|
-
access: tokenPayload.access_token,
|
|
179
|
-
refresh: tokenPayload.refresh_token,
|
|
180
|
-
expires: tokenPayload.expired_in,
|
|
181
|
-
resourceUrl: tokenPayload.resource_url,
|
|
182
|
-
notification_message: tokenPayload.notification_message,
|
|
183
|
-
},
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
export async function loginMiniMaxPortalOAuth(params: {
|
|
188
|
-
openUrl: (url: string) => Promise<void>;
|
|
189
|
-
note: (message: string, title?: string) => Promise<void>;
|
|
190
|
-
progress: { update: (message: string) => void; stop: (message?: string) => void };
|
|
191
|
-
region?: MiniMaxRegion;
|
|
192
|
-
}): Promise<MiniMaxOAuthToken> {
|
|
193
|
-
const region = params.region ?? "global";
|
|
194
|
-
const { verifier, challenge, state } = generatePkce();
|
|
195
|
-
const oauth = await requestOAuthCode({ challenge, state, region });
|
|
196
|
-
const verificationUrl = oauth.verification_uri;
|
|
197
|
-
|
|
198
|
-
const noteLines = [
|
|
199
|
-
`Open ${verificationUrl} to approve access.`,
|
|
200
|
-
`If prompted, enter the code ${oauth.user_code}.`,
|
|
201
|
-
`Interval: ${oauth.interval ?? "default (2000ms)"}, Expires at: ${oauth.expired_in} unix timestamp`,
|
|
202
|
-
];
|
|
203
|
-
await params.note(noteLines.join("\n"), "MiniMax OAuth");
|
|
204
|
-
|
|
205
|
-
try {
|
|
206
|
-
await params.openUrl(verificationUrl);
|
|
207
|
-
} catch {
|
|
208
|
-
// Fall back to manual copy/paste if browser open fails.
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
let pollIntervalMs = oauth.interval ? oauth.interval : 2000;
|
|
212
|
-
const expireTimeMs = oauth.expired_in;
|
|
213
|
-
|
|
214
|
-
while (Date.now() < expireTimeMs) {
|
|
215
|
-
params.progress.update("Waiting for MiniMax OAuth approval…");
|
|
216
|
-
const result = await pollOAuthToken({
|
|
217
|
-
userCode: oauth.user_code,
|
|
218
|
-
verifier,
|
|
219
|
-
region,
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
// // Debug: print poll result
|
|
223
|
-
// await params.note(
|
|
224
|
-
// `status: ${result.status}` +
|
|
225
|
-
// (result.status === "success" ? `\ntoken: ${JSON.stringify(result.token, null, 2)}` : "") +
|
|
226
|
-
// (result.status === "error" ? `\nmessage: ${result.message}` : "") +
|
|
227
|
-
// (result.status === "pending" && result.message ? `\nmessage: ${result.message}` : ""),
|
|
228
|
-
// "MiniMax OAuth Poll Result",
|
|
229
|
-
// );
|
|
230
|
-
|
|
231
|
-
if (result.status === "success") {
|
|
232
|
-
return result.token;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
if (result.status === "error") {
|
|
236
|
-
throw new Error(`MiniMax OAuth failed: ${result.message}`);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
if (result.status === "pending") {
|
|
240
|
-
pollIntervalMs = Math.min(pollIntervalMs * 1.5, 10000);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
throw new Error("MiniMax OAuth timed out waiting for authorization.");
|
|
247
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@symi/minimax-portal-auth",
|
|
3
|
-
"version": "3.0.9",
|
|
4
|
-
"private": true,
|
|
5
|
-
"description": "Symi MiniMax Portal OAuth provider plugin",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"devDependencies": {
|
|
8
|
-
"@symerian/symi": "workspace:*"
|
|
9
|
-
},
|
|
10
|
-
"symi": {
|
|
11
|
-
"extensions": [
|
|
12
|
-
"./index.ts"
|
|
13
|
-
]
|
|
14
|
-
}
|
|
15
|
-
}
|