100milionseek 0.1.1 → 0.1.3

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/package.json CHANGED
@@ -1,10 +1,12 @@
1
- {
1
+ {
2
2
  "name": "100milionseek",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./opencode.mjs",
7
- "exports": { ".": "./opencode2.mjs" },
7
+ "exports": {
8
+ ".": "./opencode2.mjs"
9
+ },
8
10
  "description": "100milionseek provider plugin for Magpie: free daily-token deepseek V4.1 Flash, quota from the x-quota headers, and the JEV judge model as a routing classifier",
9
11
  "keywords": [
10
12
  "opencode",
@@ -46,9 +48,9 @@
46
48
  "name": "100milionseek",
47
49
  "summary": {
48
50
  "en": "Free deepseek V4.1 Flash on 100milionseek, with the daily token allowance read from the API's own quota headers",
49
- "zh": "100milionseek 涓婂厤璐圭殑 deepseek V4.1 Flash锛屾瘡鏃ラ搴︾洿鎺ヨ API 鐨勯厤棰濆搷搴斿ご"
51
+ "zh": "100milionseek 上免费的 deepseek V4.1 Flash,每日额度直接读 API 的配额响应头"
50
52
  },
51
53
  "maxConcurrency": 5,
52
- "icon": "https://100milionseek.top/favicon.svg"
54
+ "icon": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiI+PHJlY3Qgd2lkdGg9IjMyIiBoZWlnaHQ9IjMyIiByeD0iOCIgZmlsbD0iIzBiMGYwZCIvPjxyZWN0IHg9IjciIHk9IjkiIHdpZHRoPSIzLjIiIGhlaWdodD0iMTQiIHJ4PSIxLjIiIGZpbGw9IiMxMGI5ODEiLz48cmVjdCB4PSIxMi42IiB5PSI5IiB3aWR0aD0iNS42IiBoZWlnaHQ9IjE0IiByeD0iMi44IiBmaWxsPSJub25lIiBzdHJva2U9IiNmZmYiIHN0cm9rZS13aWR0aD0iMi40Ii8+PHJlY3QgeD0iMjAuNCIgeT0iOSIgd2lkdGg9IjUuNiIgaGVpZ2h0PSIxNCIgcng9IjIuOCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjIuNCIvPjwvc3ZnPg=="
53
55
  }
54
56
  }
package/src/index.mjs CHANGED
@@ -157,6 +157,23 @@ export async function HundredMilionSeekPlugin(input, options = {}) {
157
157
  type: "api",
158
158
  label: "100milionseek API key",
159
159
  placeholder: "hms-…",
160
+ // The key is collected through a prompt, so magpie hands it to
161
+ // `authorize` as `inputs.key`. Without `prompts`, older hosts draw
162
+ // their own key box and call `authorize` with no key at all, and
163
+ // newer ones have nowhere to ask for one.
164
+ prompts: [
165
+ {
166
+ type: "password",
167
+ key: "key",
168
+ message: "100milionseek API key",
169
+ placeholder: "hms-…",
170
+ validate: (value) => {
171
+ if (typeof value !== "string" || !value.trim()) return "An API key is required.";
172
+ if (/[\r\n]/.test(value)) return "The key must not contain line breaks.";
173
+ return undefined;
174
+ },
175
+ },
176
+ ],
160
177
  // Checked before it is stored, so a typo fails at sign-in instead of
161
178
  // as a 401 in the middle of a chat. A network failure is not the
162
179
  // key's fault and must not refuse it.
@@ -66,6 +66,21 @@ test("auth names the provider, its five slots and its icon", async () => {
66
66
  assert.equal(plugin.auth.checkin, undefined);
67
67
  });
68
68
 
69
+ test("the key is asked for through a prompt, so magpie hands it to authorize", async () => {
70
+ // Without `prompts` the host draws its own key box and calls authorize with
71
+ // no key, which is what produced "An API key is required" at sign-in.
72
+ const plugin = await HundredMilionSeekPlugin({}, { fetchImpl: async () => json({}) });
73
+ const [method] = plugin.auth.methods;
74
+ assert.ok(Array.isArray(method.prompts) && method.prompts.length >= 1);
75
+ const keyPrompt = method.prompts.find((p) => p.key === "key");
76
+ assert.ok(keyPrompt, "there is a prompt that submits `key`");
77
+ assert.equal(typeof keyPrompt.validate, "function");
78
+ // The prompt's own validation rejects an empty or multi-line key.
79
+ assert.match(keyPrompt.validate(" "), /required/i);
80
+ assert.match(keyPrompt.validate("hms-a\r\nb"), /line break/i);
81
+ assert.equal(keyPrompt.validate("hms-ok"), undefined);
82
+ });
83
+
69
84
  test("the sign-in check accepts a working key and remembers the allowance it saw", async () => {
70
85
  const { calls, fetchImpl } = recorder(json({ object: "list", data: [] }, 200, QUOTA));
71
86
  const plugin = await HundredMilionSeekPlugin({}, { fetchImpl });