@mizuka-wu/magpie-agent-shibei 0.0.0-stage → 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.
Files changed (3) hide show
  1. package/README.md +27 -2
  2. package/agent.js +20 -0
  3. package/package.json +11 -4
package/README.md CHANGED
@@ -1,3 +1,28 @@
1
- # Temporary Holding Version
1
+ # shibei-magpie-agent
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ magpie 的 agent 适配插件:给 magpie 的 **Agents 页**加一行「拾贝 Shibei」
4
+ ([Obsidian AI 插件 拾贝](https://github.com/mizuka-wu/obsidian-shibei),本仓库主目录)。
5
+
6
+ 接上后:模型在 magpie 里选(订阅/API key/local 模型都在),请求走 magpie 网关,
7
+ Usage 页按 `shibei` 计账;断开自动恢复拾贝原来的本地配置。
8
+
9
+ ## 装
10
+
11
+ ```
12
+ magpie plugin add @mizuka-wu/magpie-agent-shibei
13
+ ```
14
+
15
+ (未发布 npm 时从源码装:`magpie plugin add <本仓库 clone>/magpie-agent`)
16
+
17
+ ## 用
18
+
19
+ 1. magpie 的 Agents 页出现「拾贝 Shibei」行 → Connect → 挑一个 magpie 模型
20
+ 2. 回到 Obsidian 运行命令 **「拾贝:重新载入 magpie 接入」**(免重启;不跑则下次启动 Obsidian 生效)
21
+ 3. 之后在 magpie 切模型,同样跑一下重载命令即可
22
+
23
+ ## 原理
24
+
25
+ 插件声明拾贝的托管文件 `~/.config/shibei/magpie.json`(json):magpie 连接时写入
26
+ `{ baseUrl, model, apiKey }`(key 为 `magpie-shibei`,网关按此计账),断开时恢复原样。
27
+ 拾贝端(≥ 对应版本)启动与重载命令时读它,存在即覆盖 vault 配置;文件没了自动回退。
28
+ 拾贝的模型走 OpenAI-compatible provider,`/v1` 端点与 CORS(`app://obsidian.md`)均被 magpie 网关原生支持。
package/agent.js ADDED
@@ -0,0 +1,20 @@
1
+ // magpie agent adapter for 拾贝 Shibei(Obsidian AI 插件)。
2
+ // magpie 把接入写进拾贝的全局托管文件 ~/.config/shibei/magpie.json;
3
+ // 拾贝启动或运行命令「拾贝:重新载入 magpie 接入」时优先读取它
4
+ // (baseUrl/model/apiKey 覆盖 vault 配置,断开后自动回到本地配置)。
5
+ export const agent = {
6
+ id: 'shibei',
7
+ name: '拾贝 Shibei',
8
+ dir: '~/.config/shibei', // 检测锚点:拾贝首次存密钥/接入时创建
9
+ config: '~/.config/shibei/magpie.json',
10
+ format: 'json',
11
+ model: 'model',
12
+ // 拾贝靠重载读配置:改接后跑一次它的重载命令即可,无需重启 Obsidian
13
+ notice: '在 Obsidian 里运行「拾贝:重新载入 magpie 接入」立即生效。',
14
+ };
15
+
16
+ // magpie 写入 baseUrl + key(拾贝的 openai-compatible provider 直接吃 /v1 端点;
17
+ // key 用 magpie-shibei,Usage 页按拾贝计账)
18
+ export function connect({ gateway }) {
19
+ return { baseUrl: gateway.v1, apiKey: gateway.key };
20
+ }
package/package.json CHANGED
@@ -1,6 +1,13 @@
1
1
  {
2
2
  "name": "@mizuka-wu/magpie-agent-shibei",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "magpie agent adapter for 拾贝 Shibei (Obsidian AI plugin): a Shibei row on magpie's Agents page.",
5
+ "keywords": ["magpie-plugin", "magpie-agent", "obsidian", "shibei"],
6
+ "license": "MIT",
7
+ "publishConfig": { "access": "public", "provenance": true },
8
+ "repository": { "type": "git", "url": "https://github.com/mizuka-wu/obsidian-shibei", "directory": "magpie-agent" },
9
+ "magpie": {
10
+ "agent": "./agent.js"
11
+ },
12
+ "files": ["agent.js", "README.md"]
13
+ }