magpie-aws-quick-bridge 0.1.0 → 0.1.2
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/README.md +18 -11
- package/index.mjs +2 -3
- package/package.json +5 -1
- package/plugin/chat.mjs +3 -3
- package/plugin/messages.mjs +1 -1
- package/plugin/oauth.mjs +2 -1
- package/plugin/toolbridge.mjs +3 -2
- package/plugin/upstream.mjs +1 -1
- package/plugin/wire.mjs +1 -1
package/README.md
CHANGED
|
@@ -2,9 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
# magpie-AWS-Quick-bridge
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<p align="center">
|
|
6
|
+
作者:<a href="https://github.com/DaBinBinah">DaBinBinah</a> ·
|
|
7
|
+
<a href="https://x.com/yedabinbinah">X / Twitter @yedabinbinah</a> ·
|
|
8
|
+
<a href="https://www.npmjs.com/package/magpie-aws-quick-bridge">npm</a>
|
|
9
|
+
</p>
|
|
6
10
|
|
|
7
|
-
|
|
11
|
+
我做的一个 [Magpie](https://usemagpie.ai) 供应商插件,把 **Amazon Quick(QuickWork)** 接入 Magpie:在 Magpie 里登录 Amazon Quick 账号后,Claude Code、Codex、OpenCode 等所有 agent 都能以 `aws-quick/<model>` 使用它。
|
|
12
|
+
|
|
13
|
+
使用中遇到问题或有建议,欢迎提 [issue](https://github.com/DaBinBinah/magpie-AWS-Quick-bridge/issues),或者在 [X 上找我](https://x.com/yedabinbinah)。
|
|
8
14
|
|
|
9
15
|
> 非官方项目,与 Amazon / AWS 无关联。请仅在你拥有或获得明确授权的账号上使用,并遵守相关服务条款。
|
|
10
16
|
|
|
@@ -81,8 +87,6 @@ magpie plugin login aws-quick
|
|
|
81
87
|
magpie plugin options magpie-AWS-Quick-bridge '{"thinking_effort": "medium", "timezone": "Asia/Shanghai", "locale": "zh-CN"}'
|
|
82
88
|
```
|
|
83
89
|
|
|
84
|
-
名称与原项目 `config.json` 保持一致:
|
|
85
|
-
|
|
86
90
|
| 选项 | 默认 | 说明 |
|
|
87
91
|
|---|---|---|
|
|
88
92
|
| `thinking_effort` | 空 | 请求没有指定推理档位时使用:`off`、`low`、`medium`、`high` |
|
|
@@ -134,7 +138,6 @@ plugin/messages.mjs OpenAI 消息 → user_message 文本与 system_prompt
|
|
|
134
138
|
plugin/toolbridge.mjs 客户端工具的文本协议与流式解析
|
|
135
139
|
plugin/chat.mjs chat completions 的 JSON / SSE 回复
|
|
136
140
|
test/ 单元测试、模拟上游、端到端测试
|
|
137
|
-
cmd/ internal/ 原 Go 版 quickproxy(docs/quickproxy.md)
|
|
138
141
|
```
|
|
139
142
|
|
|
140
143
|
## 开发与测试
|
|
@@ -186,7 +189,7 @@ m provider test aws-quick
|
|
|
186
189
|
|
|
187
190
|
## 限制
|
|
188
191
|
|
|
189
|
-
-
|
|
192
|
+
- **真实上游的验证范围**:我目前只对仓库里的模拟上游做过端到端验证(包括在 Magpie 里登录、粘贴回调登录和经网关请求),还没有用真实的 Amazon Quick 账号验证过。`gateway` / `social_gateway` 的 CBOR 路径属实验性。
|
|
190
193
|
- 只有聊天。`temperature`、`max_tokens`、`stop`、`response_format` 等采样参数不会传给上游;`n > 1` 返回 400。
|
|
191
194
|
- 输入只有文本:图片、音频、文件会变成 `[image]`、`[audio]`、`[file]` 占位。
|
|
192
195
|
- 工具桥接是文本协议,模型偶尔可能不遵守;回复以 `{`、`[` 或反引号开头时会先整段缓冲,以判断它是不是一个没带标记的工具调用。
|
|
@@ -195,11 +198,15 @@ m provider test aws-quick
|
|
|
195
198
|
- 以 OpenCode v1 插件的形式导出(`export default { id, server }`),只在 Magpie 里验证过,没有提供 OpenCode 2.x 的入口。
|
|
196
199
|
- 上游接口可能随官方客户端更新而变化;登录或聊天失败时先重新登录,必要时调整 `app_version`。
|
|
197
200
|
|
|
198
|
-
##
|
|
201
|
+
## 作者
|
|
199
202
|
|
|
200
|
-
|
|
203
|
+
DaBinBinah
|
|
204
|
+
|
|
205
|
+
- X / Twitter:[@yedabinbinah](https://x.com/yedabinbinah)
|
|
206
|
+
- GitHub:[DaBinBinah](https://github.com/DaBinBinah)
|
|
207
|
+
|
|
208
|
+
## License
|
|
201
209
|
|
|
202
|
-
|
|
210
|
+
[GNU General Public License v3.0](LICENSE)。
|
|
203
211
|
|
|
204
|
-
|
|
205
|
-
- [Magpie](https://usemagpie.ai) 与 [magpie-community/plugins](https://github.com/magpie-community/plugins)
|
|
212
|
+
Magpie 插件部分(`index.mjs`、`plugin/`、`test/`)© 2026 DaBinBinah。登录流程、协议编解码和工具桥接移植自 [aws-quickwork-2api](https://github.com/jasonxu114514/aws-quickwork-2api)(© Jason Xu,GPL-3.0);按 GPL-3.0 的要求保留这条来源说明,并以同一许可证发布。
|
package/index.mjs
CHANGED
|
@@ -18,7 +18,7 @@ const REFRESH_LEAD_MS = 10 * 60_000
|
|
|
18
18
|
|
|
19
19
|
const MODEL_NAMES = { smart: "Quick Smart", fast: "Quick Fast", balanced: "Quick Balanced", auto: "Quick Auto" }
|
|
20
20
|
|
|
21
|
-
// "30s", "5m", "1h"
|
|
21
|
+
// "30s", "5m", "1h" or a number of seconds.
|
|
22
22
|
function durationMs(value, fallback) {
|
|
23
23
|
if (typeof value === "number" && value > 0) return value * 1000
|
|
24
24
|
const m = /^\s*(\d+(?:\.\d+)?)\s*(ms|s|m|h)?\s*$/.exec(String(value ?? ""))
|
|
@@ -28,8 +28,7 @@ function durationMs(value, fallback) {
|
|
|
28
28
|
|
|
29
29
|
const text = (value, fallback = "") => (typeof value === "string" && value.trim() ? value.trim() : fallback)
|
|
30
30
|
|
|
31
|
-
// The plugin's options (plugins.json)
|
|
32
|
-
// config.json uses.
|
|
31
|
+
// The plugin's options (plugins.json).
|
|
33
32
|
function settings(options = {}) {
|
|
34
33
|
// 0 takes any free port
|
|
35
34
|
const port = typeof options.callback_port === "number" ? options.callback_port : Number(options.callback_port || NaN)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "magpie-aws-quick-bridge",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "OpenCode / magpie provider plugin: Amazon Quick (QuickWork) with its own desktop sign-in, as OpenAI-compatible chat with streaming and tool calls",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.mjs",
|
|
@@ -22,6 +22,10 @@
|
|
|
22
22
|
"quickwork"
|
|
23
23
|
],
|
|
24
24
|
"license": "GPL-3.0-only",
|
|
25
|
+
"author": {
|
|
26
|
+
"name": "DaBinBinah",
|
|
27
|
+
"url": "https://x.com/yedabinbinah"
|
|
28
|
+
},
|
|
25
29
|
"repository": {
|
|
26
30
|
"type": "git",
|
|
27
31
|
"url": "git+https://github.com/DaBinBinah/magpie-AWS-Quick-bridge.git"
|
package/plugin/chat.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// OpenAI chat completions on top of one Amazon Quick turn, ported from
|
|
2
|
-
// internal/proxy/server.go. Account rotation and retries
|
|
3
|
-
// request is tried once and a failure is answered with a
|
|
4
|
-
// act on.
|
|
2
|
+
// aws-quickwork-2api's internal/proxy/server.go. Account rotation and retries
|
|
3
|
+
// are magpie's, so a request is tried once and a failure is answered with a
|
|
4
|
+
// status magpie can act on.
|
|
5
5
|
|
|
6
6
|
import { callId, formatPrompt, lastUserText, systemPrompt, titleFor, uuid } from "./messages.mjs"
|
|
7
7
|
import { BridgeStream, buildToolBridgePrompt, parseClientToolCalls, parseToolChoice, requestedToolNames } from "./toolbridge.mjs"
|
package/plugin/messages.mjs
CHANGED
package/plugin/oauth.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Native Amazon Quick desktop sign-in and token refresh, ported from
|
|
2
|
-
// internal/oauth. Nothing here needs the official
|
|
2
|
+
// aws-quickwork-2api's internal/oauth. Nothing here needs the official
|
|
3
|
+
// desktop app.
|
|
3
4
|
|
|
4
5
|
import { createHash, randomBytes, timingSafeEqual } from "node:crypto"
|
|
5
6
|
|
package/plugin/toolbridge.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Client tools over a text protocol, ported from
|
|
2
|
-
// internal/proxy/toolbridge.go. Amazon Quick accepts no
|
|
3
|
-
// so they travel in the system prompt and come back as
|
|
2
|
+
// aws-quickwork-2api's internal/proxy/toolbridge.go. Amazon Quick accepts no
|
|
3
|
+
// client tool schemas, so they travel in the system prompt and come back as
|
|
4
|
+
// markers in the text.
|
|
4
5
|
|
|
5
6
|
import { argumentString, callId } from "./messages.mjs"
|
|
6
7
|
|
package/plugin/upstream.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// One chat turn over the Amazon Quick bidi WebSocket, ported from
|
|
2
|
-
// internal/proxy/upstream.go.
|
|
2
|
+
// aws-quickwork-2api's internal/proxy/upstream.go.
|
|
3
3
|
|
|
4
4
|
import { argumentString, callId, titleFor, uuid } from "./messages.mjs"
|
|
5
5
|
import { GATEWAY_WS_PATH } from "./oauth.mjs"
|
package/plugin/wire.mjs
CHANGED