type4me: Type4Me (macOS voice input) as a magpie agent (#136, kchen0x)

Adds @magpie-community/agent-type4me: Type4Me (macOS voice input) as a magpie agent. magpie writes the picked model, its /v1 address and Type4Me's key into ~/Library/Application Support/Type4Me/magpie-agent.json, which Type4Me reads before each dictation (joewongjc/type4me#343, merged). The folder is the one Type4Me and Type4Me Dev share (AppDataLocation.sharedProfileName).

Run at the reviewed head dc9d19bd: bun test packages/type4me (4 pass), bun scripts/check.mjs (green). Checked every field against magpie's agentplug.Desc and the file path, keys and folder against Type4Me's MagpieAgentFile and AppDataLocation.

Not done: the first npm publish of a new package name is manual (the package has no trusted publisher yet), and registry.json is not updated in this PR.
This commit is contained in:
Kun Chen
2026-10-15 13:15:03 +08:00
committed by GitHub
parent ec8ae09cc8
commit c4f7bea372
5 changed files with 138 additions and 0 deletions
+1
View File
@@ -63,6 +63,7 @@ it off puts the config back.
| Package | Agent |
|---|---|
| [aider](packages/aider) | [Aider](https://aider.chat): `~/.aider.conf.yml`, through litellm's `openai/` prefix |
| [type4me](packages/type4me) | [Type4Me](https://github.com/joewongjc/type4me), macOS voice input: `~/Library/Application Support/Type4Me/magpie-agent.json`, for its LLM post-processing |
```sh
magpie plugin add @magpie-community/agent-<name>
+57
View File
@@ -0,0 +1,57 @@
# @magpie-community/agent-type4me
[Type4Me](https://github.com/joewongjc/type4me), a macOS voice input app, as a
magpie agent. With this plugin Type4Me is on magpie's Agents page like the
agents magpie ships with: pick one of magpie's models for its LLM
post-processing in Type4Me's row.
```sh
magpie plugin add @magpie-community/agent-type4me
```
Until it is on npm, install it from GitHub:
```sh
magpie plugin add github:kchen0x/magpie-agent-type4me
```
Then pick one of magpie's models in Type4Me's row, or
`magpie type4me magpie/deepseek/deepseek-flash`. magpie writes into
`~/Library/Application Support/Type4Me/magpie-agent.json`:
```json
{
"model": "deepseek/deepseek-flash",
"baseURL": "http://127.0.0.1:3425/v1",
"apiKey": "magpie-…"
}
```
In Type4Me, choose **Magpie (Local Gateway)** under Settings › Models and set
it as the default. Type4Me reads the file before each dictation, so a new model
takes effect on the next one, with no restart.
- Type4Me and Type4Me Dev share that folder: one plugin covers both.
- Picking a model in Type4Me's own settings changes it in magpie too (Type4Me
runs `magpie type4me magpie/<model>`). Type4Me never changes `baseURL` or
`apiKey`.
- Switching Type4Me off in magpie removes the three keys; Type4Me then talks to
magpie directly, with the model picked in Type4Me.
Type4Me works with magpie without this plugin too, listing magpie's models
itself. The plugin adds Type4Me to magpie's Agents page, menu bar and profiles.
How agent plugins work: [usemagpie.ai/docs/plugins#agents](https://usemagpie.ai/docs/plugins#agents).
## Develop
The source lives at [kchen0x/magpie-agent-type4me](https://github.com/kchen0x/magpie-agent-type4me)
and is copied to `packages/type4me` in
[magpie-community/plugins](https://github.com/magpie-community/plugins).
```sh
bun test # what connect returns
magpie plugin add ./type4me.agent.js # try it on your own magpie
```
`agent.config` must match `MagpieAgentFile.defaultURL` in Type4Me.
+12
View File
@@ -0,0 +1,12 @@
{
"name": "@magpie-community/agent-type4me",
"version": "0.1.0",
"description": "Type4Me (macOS voice input) as a magpie agent: pick one of magpie's models for its LLM post-processing on the Agents page",
"type": "module",
"files": ["type4me.agent.js", "README.md"],
"keywords": ["magpie", "magpie-agent", "type4me", "voice-input", "llm-gateway"],
"license": "MIT",
"repository": { "type": "git", "url": "git+https://github.com/magpie-community/plugins.git", "directory": "packages/type4me" },
"homepage": "https://github.com/kchen0x/magpie-agent-type4me",
"magpie": { "agent": "./type4me.agent.js", "icon": "https://raw.githubusercontent.com/kchen0x/magpie-agent-type4me/main/assets/icon.png" }
}
+30
View File
@@ -0,0 +1,30 @@
// Type4Me (a macOS voice input app) keeps the model its LLM post-processing
// uses in ~/Library/Application Support/Type4Me/magpie-agent.json, a folder
// Type4Me and Type4Me Dev share, so one agent covers both builds. It talks to
// magpie's OpenAI Chat Completions endpoint, so magpie's model goes in as is,
// beside magpie's /v1 address and the key magpie keeps for Type4Me.
//
// Type4Me reads the file before each dictation: a new model takes effect on
// the next one, no restart. Type4Me may set the model itself, through
// `magpie type4me magpie/<model>`; it never changes the address or the key.
export const agent = {
id: "type4me",
name: "Type4Me",
// Type4Me's own icon, on the Agents page and the plugin's row
icon: "https://raw.githubusercontent.com/kchen0x/magpie-agent-type4me/main/assets/icon.png",
// must match MagpieAgentFile.defaultURL in Type4Me
config: "~/Library/Application Support/Type4Me/magpie-agent.json",
format: "json",
model: "model",
// Type4Me has no command on PATH; its profile folder says it is installed
dir: "~/Library/Application Support/Type4Me",
ua: ["Type4Me"],
notice: "Type4Me uses the new model on your next dictation. Type4Me 会在下一次语音输入时使用新模型。",
}
export function connect({ gateway }) {
return {
baseURL: gateway.v1,
apiKey: gateway.key,
}
}
+38
View File
@@ -0,0 +1,38 @@
import { expect, test } from "bun:test"
import { agent, connect } from "./type4me.agent.js"
test("says where Type4Me keeps its model", () => {
expect(agent).toMatchObject({
id: "type4me",
config: "~/Library/Application Support/Type4Me/magpie-agent.json",
format: "json",
model: "model",
dir: "~/Library/Application Support/Type4Me",
})
// Type4Me sends magpie's model id as is
expect(agent.prefix).toBeUndefined()
})
test("shows Type4Me's own icon, as the package gives it", async () => {
const pkg = await Bun.file(new URL("./package.json", import.meta.url)).json()
expect(agent.icon).toBe("https://raw.githubusercontent.com/kchen0x/magpie-agent-type4me/main/assets/icon.png")
expect(pkg.magpie.icon).toBe(agent.icon)
})
test("tells the user when a new model takes effect, in English and Chinese", () => {
expect(agent.notice).toContain("next dictation")
expect(agent.notice).toContain("下一次语音输入")
})
test("points Type4Me at magpie's /v1 with its own key, and leaves the model to magpie", () => {
const out = connect({
gateway: { url: "http://127.0.0.1:3425", v1: "http://127.0.0.1:3425/v1", key: "magpie-type4me" },
model: { id: "deepseek/deepseek-flash", name: "DeepSeek Flash" },
models: [],
agent: { id: "type4me", config: "/Users/u/Library/Application Support/Type4Me/magpie-agent.json" },
})
expect(out).toEqual({
baseURL: "http://127.0.0.1:3425/v1",
apiKey: "magpie-type4me",
})
})