@node-agent/provider 0.0.0-stage → 0.1.6
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/LICENSE +21 -0
- package/README.md +167 -2
- package/dist/i18n/en.json +105 -0
- package/dist/i18n/zh-CN.json +105 -0
- package/dist/icon.svg +6 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +372 -0
- package/dist/index.js.map +1 -0
- package/dist/mode.d.ts +26 -0
- package/dist/mode.js +39 -0
- package/dist/mode.js.map +1 -0
- package/dist/persistency/history.d.ts +11 -0
- package/dist/persistency/history.js +50 -0
- package/dist/persistency/history.js.map +1 -0
- package/dist/persistency/index.d.ts +23 -0
- package/dist/persistency/index.js +33 -0
- package/dist/persistency/index.js.map +1 -0
- package/dist/persistency/local.d.ts +20 -0
- package/dist/persistency/local.js +50 -0
- package/dist/persistency/local.js.map +1 -0
- package/dist/providers/anthropic.d.ts +28 -0
- package/dist/providers/anthropic.js +538 -0
- package/dist/providers/anthropic.js.map +1 -0
- package/dist/providers/base.d.ts +262 -0
- package/dist/providers/base.js +871 -0
- package/dist/providers/base.js.map +1 -0
- package/dist/providers/deepseek.d.ts +18 -0
- package/dist/providers/deepseek.js +73 -0
- package/dist/providers/deepseek.js.map +1 -0
- package/dist/providers/index.d.ts +13 -0
- package/dist/providers/index.js +30 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/responses.d.ts +28 -0
- package/dist/providers/responses.js +310 -0
- package/dist/providers/responses.js.map +1 -0
- package/dist/serve.d.ts +2 -0
- package/dist/serve.js +28 -0
- package/dist/serve.js.map +1 -0
- package/dist/ui.html +324 -0
- package/package.json +193 -4
- package/src/icon.svg +6 -0
- package/src/ui.html +324 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 LKJacky
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,168 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @node-agent/provider
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A node that owns the stack's LLM credentials and serves chat to whoever asks. It keeps no
|
|
4
|
+
conversation: a caller sends the whole transcript, gets an answer, and the provider remembers nothing
|
|
5
|
+
between requests.
|
|
6
|
+
|
|
7
|
+
The TypeScript implementation lives in src/ and the Python twin remains in python/; they expose the
|
|
8
|
+
same capabilities and wire translations. npm install && npm run build builds the TS node, and
|
|
9
|
+
npm start runs it against the bus.
|
|
10
|
+
|
|
11
|
+
Capabilities:
|
|
12
|
+
|
|
13
|
+
- `provider.providers({ action: list | save | delete, name, config })` — the named rows, never the keys
|
|
14
|
+
- `provider.chat({ name, messages, tools?, max_completion_tokens? })` — one finished answer
|
|
15
|
+
- `provider.start_stream({ name, messages, tools?, max_completion_tokens? })` → `{ stream_id, topic }` —
|
|
16
|
+
an id for one stream; the model is not dialled yet
|
|
17
|
+
- `provider.stream_ready({ stream_id })` — the caller is subscribed to `provider.stream.<stream_id>`;
|
|
18
|
+
the answer now arrives there as `chunk` events and a closing `done` (an `error` event if it fails)
|
|
19
|
+
- `provider.cancel_stream({ stream_id })` — stop a stream by the id it was given, started or not,
|
|
20
|
+
and the page (`ui`) that makes the rows
|
|
21
|
+
|
|
22
|
+
A stream is three calls because an event is only delivered to a node that was already subscribed when
|
|
23
|
+
it was published: the id comes back first, the caller subscribes to it, and only then does
|
|
24
|
+
`stream_ready` let the model speak. No first delta can be published into an empty room, and the id
|
|
25
|
+
is forgotten when the stream ends, fails, is cancelled, or waits more than a minute for a ready.
|
|
26
|
+
|
|
27
|
+
A row is `{ type, model_name, base_url, timeout, api_key, organization?, thinking_effort? }`, saved in
|
|
28
|
+
history and handed
|
|
29
|
+
back by `dump`/`build`. Three protocols sit behind that one shape, which is the whole point of the node:
|
|
30
|
+
the agent, the page and a transcript never learn which wire an answer came from.
|
|
31
|
+
|
|
32
|
+
## The three protocols
|
|
33
|
+
|
|
34
|
+
| | `openai` | `anthropic` | `responses` |
|
|
35
|
+
|---|---|---|---|
|
|
36
|
+
| speaks | `POST {base}/chat/completions` | `POST {base}/v1/messages` | `POST {base}/responses` |
|
|
37
|
+
| base URL to write | `https://api.openai.com/v1` | `https://api.anthropic.com`, or a gateway prefix like `https://api.llm.mioffice.cn:18443/anthropic` | `https://api.openai.com/v1`, or a gateway like `https://api.llm.mioffice.cn:18443/v1` |
|
|
38
|
+
| `organization` | sent when set | never | never |
|
|
39
|
+
| the system prompt | a message with `role: system` | the `system` field | the `instructions` field |
|
|
40
|
+
| a tool call | `tool_calls`, arguments as JSON text | a `tool_use` block, arguments as an object | a `function_call` item, arguments as JSON text |
|
|
41
|
+
| a tool's answer | a message with `role: tool` | a `tool_result` block in a user turn | a `function_call_output` item |
|
|
42
|
+
| thinking effort | `reasoning_effort`, when set | `thinking` + `output_config.effort`, when set | `reasoning.effort`, when set |
|
|
43
|
+
| the limit | `max_completion_tokens`, optional | `max_tokens`, required — 8192 if the caller names none | `max_output_tokens`, 8192 if the caller names none |
|
|
44
|
+
| a stream | one delta per chunk | named events, flattened to the same deltas | named events, flattened to the same deltas |
|
|
45
|
+
|
|
46
|
+
Both non-chat-completions protocols go through their official SDK — `anthropic` for the Messages API
|
|
47
|
+
and `openai` for the Responses API. Their own retries are turned off, so the attempts this node
|
|
48
|
+
documents are the only ones that happen. `responses` needs `openai>=1.66`, where the Responses
|
|
49
|
+
resource arrived.
|
|
50
|
+
|
|
51
|
+
## Pointing a row at Claude
|
|
52
|
+
|
|
53
|
+
On the provider page, `Protocol` picks the wire and the rest of the form follows it — Base URL gets
|
|
54
|
+
that protocol's placeholder, and `Organization` disappears for a Claude row. For the MIOFFICE gateway,
|
|
55
|
+
whose Claude ids are served by its Anthropic surface and not by its OpenAI-shaped one:
|
|
56
|
+
|
|
57
|
+
- Protocol: **Anthropic (Claude)**
|
|
58
|
+
- Base URL: `https://api.llm.mioffice.cn:18443/anthropic`
|
|
59
|
+
- Model: `ppio/anthropic/claude-opus-5-5`
|
|
60
|
+
- API key: the gateway's key
|
|
61
|
+
|
|
62
|
+
That gateway does answer OpenAI-shaped requests at `https://api.llm.mioffice.cn:18443/v1`, which is why
|
|
63
|
+
the two protocols are both here — but with that model id it refuses (`400 Not supported model`), and
|
|
64
|
+
the ids it does list (`anthropic/claude-opus-5-5`) answer `401` asking for a provider prefix. The
|
|
65
|
+
Messages API is where the `ppio/`-prefixed ids are routed, so a Claude row that used the `openai`
|
|
66
|
+
protocol against this gateway would fail at the first token.
|
|
67
|
+
|
|
68
|
+
## Pointing a row at an OpenAI Responses model
|
|
69
|
+
|
|
70
|
+
OpenAI's newer API surface is Responses, and the MIOFFICE gateway follows that: an
|
|
71
|
+
`azure_openai/…` id is answered on `/responses` and nowhere else.
|
|
72
|
+
|
|
73
|
+
- Protocol: **OpenAI (Responses API)**
|
|
74
|
+
- Base URL: `https://api.llm.mioffice.cn:18443/v1`
|
|
75
|
+
- Model: `azure_openai/gpt-5.6-sol`
|
|
76
|
+
- API key: the gateway's key
|
|
77
|
+
|
|
78
|
+
That row posts to `POST {base}/responses` with `instructions` for the system prompt, an `input` list
|
|
79
|
+
of messages, `function_call`s and `function_call_output`s, flat function tools, and
|
|
80
|
+
`max_output_tokens`. A `400`/`401` comes back through the node as an error that quotes the
|
|
81
|
+
endpoint's own message (this gateway answers `401` with `模型不存在` for an unknown model id), so a
|
|
82
|
+
wrong model name is visible in the transcript instead of only a status code.
|
|
83
|
+
|
|
84
|
+
## Thinking effort
|
|
85
|
+
|
|
86
|
+
`thinking_effort` is one optional string per row, and blank means the endpoint's own default. The page
|
|
87
|
+
is a select beside the protocol's: `Provider default` (empty), the seven usual levels — `none`,
|
|
88
|
+
`minimal`, `low`, `medium`, `high`, `xhigh`, `max` — and `Custom…`, which reveals a text field for a
|
|
89
|
+
level a gateway knows and this page does not. A saved preset reopens on that preset; any other value
|
|
90
|
+
reopens on `Custom…` with the text field filled in.
|
|
91
|
+
|
|
92
|
+
| row value | `openai` chat | `anthropic` | `responses` |
|
|
93
|
+
|---|---|---|---|
|
|
94
|
+
| unset / blank | nothing sent | nothing sent | nothing sent |
|
|
95
|
+
| `none` | `reasoning_effort: "none"` | `thinking: {"type": "disabled"}`, no `output_config` | `reasoning: {"effort": "none"}` |
|
|
96
|
+
| `minimal` | `"minimal"` | adaptive thinking, `effort: "low"` | `"minimal"` |
|
|
97
|
+
| `xhigh` | `"xhigh"` | adaptive thinking, `effort: "xhigh"` | `"xhigh"` |
|
|
98
|
+
| `low`/`medium`/`high`/`max` | as written | adaptive thinking, `effort` as written | as written |
|
|
99
|
+
| anything else | as written | adaptive thinking, `effort` as written | as written |
|
|
100
|
+
|
|
101
|
+
Only `minimal` needs a name of its own: the Messages API has no such level, so it is sent as `low`.
|
|
102
|
+
|
|
103
|
+
## State: the agent chooses full context or a delta
|
|
104
|
+
|
|
105
|
+
The Responses API stores each response and can continue from it with `previous_response_id` (the
|
|
106
|
+
MIOFFICE gateway does exactly that: a follow-up carrying only the new question and the previous id
|
|
107
|
+
still answers from the earlier turn). The agent owns that policy now:
|
|
108
|
+
|
|
109
|
+
- the first request, a compression replay and a provider switch carry the whole transcript and no
|
|
110
|
+
`previous_response_id`;
|
|
111
|
+
- an ordinary next turn carries only its unsent suffix plus the id the last response returned;
|
|
112
|
+
- `store: true` is sent because a response that is not stored has no id to continue from;
|
|
113
|
+
- the completed response's `id` is returned as the neutral `previous_response_id` in both the chat and
|
|
114
|
+
streaming shapes;
|
|
115
|
+
- thinking/reasoning items the endpoint returns are surfaced as text (`reasoning_content`) and never
|
|
116
|
+
carried back, the same way the Anthropic path treats its thinking blocks.
|
|
117
|
+
|
|
118
|
+
The Anthropic Messages API has no comparable handle. `AnthropicProvider` accepts the argument for the
|
|
119
|
+
common provider interface, ignores it, and returns `previous_response_id: null`; every Claude turn
|
|
120
|
+
therefore sends the active transcript in full.
|
|
121
|
+
|
|
122
|
+
## What is refused, and where
|
|
123
|
+
|
|
124
|
+
- a row with no `model_name`, or no key (the page says so before saving, `Provider.build` and `_body`
|
|
125
|
+
say it again) — and the blank row a fresh stack starts with fails with the same sentence;
|
|
126
|
+
- `type` that is not one of `openai`, `anthropic`, `responses`;
|
|
127
|
+
- a timeout that is not a number, and a base URL the page can see is missing `http(s)://`;
|
|
128
|
+
- a `tool_calls` entry whose arguments are not a JSON object, named before a request leaves;
|
|
129
|
+
- a content part neither protocol can carry (`image_url` is translated; anything else is an error);
|
|
130
|
+
- an Anthropic classifier refusal (`stop_reason: "refusal"`): it is raised as an error carrying
|
|
131
|
+
`stop_details.category` and `stop_details.explanation`, never returned as an empty assistant
|
|
132
|
+
message. The same check runs on the `message_delta` event of a stream.
|
|
133
|
+
|
|
134
|
+
## Retries
|
|
135
|
+
|
|
136
|
+
One policy, in the base class every protocol extends — `Provider`, the `BaseProvider` of
|
|
137
|
+
`src/providers/base.ts`. A provider says how to make **one** attempt and nothing else: which statuses
|
|
138
|
+
are retried, how long to wait, when to stop, and how the failure is wrapped are decided in one place.
|
|
139
|
+
|
|
140
|
+
- **Retried:** any answer that is not a 2xx — `400`, `401`, `403`, `404`, `408`, `409`, `425`, `429`
|
|
141
|
+
and every 5xx — a dropped or refused connection, and an upstream "no slot right now" body. A spent
|
|
142
|
+
concurrency slot usually arrives as a 429, but a gateway also sends it as a 400, a 403 or a 503 with
|
|
143
|
+
`concurrency`, `rate limit`, `overloaded`, `并发` or `限流` in the body, so the body is read too,
|
|
144
|
+
whatever status carries it.
|
|
145
|
+
- **Never retried:** a request the caller aborted — before it is sent, while it runs, or while it
|
|
146
|
+
waits out a backoff — and a failure with neither a status nor a dead socket behind it (a malformed
|
|
147
|
+
answer would fail the same way again). A stream is retried only until its first chunk; after that
|
|
148
|
+
the stream fails instead, because a retry would repeat what the reader has already seen.
|
|
149
|
+
- **Skipping a status on purpose:** `NODE_AGENT_MODEL_NO_RETRY_STATUSES=401,403` (also `4xx`,
|
|
150
|
+
`400-499`). Nothing is skipped silently — the default is "retry everything", and this variable is
|
|
151
|
+
the only way to say otherwise. A 429 or an upstream limit body is retried even then: it is a wait,
|
|
152
|
+
not a verdict.
|
|
153
|
+
- **Waiting:** `NODE_AGENT_MODEL_ATTEMPTS` (8, the first attempt included) attempts;
|
|
154
|
+
`NODE_AGENT_MODEL_BACKOFF` (1 s) doubled per attempt with jitter, capped by
|
|
155
|
+
`NODE_AGENT_MODEL_MAX_DELAY` (60 s). A `Retry-After` header — seconds or a date — wins over both.
|
|
156
|
+
- **The failure:** once the attempts are spent, one `ProviderCallError` carries `provider`, `host`,
|
|
157
|
+
`attempts`, `status`, `kind` (`connection` / `rate_limit` / `server` / `http` / `aborted` /
|
|
158
|
+
`unknown`) and `streamStarted`, and its message holds the whole cause chain, so a caller can tell a
|
|
159
|
+
dead socket from a 429 without parsing a sentence.
|
|
160
|
+
|
|
161
|
+
## Tests
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
cd node_agent/nodes/provider
|
|
165
|
+
npm test
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Tests use a fake provider client, so no real API key is needed and no network call is made.
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
{
|
|
2
|
+
"new": "New provider",
|
|
3
|
+
"heading": "LLM provider",
|
|
4
|
+
"form": {
|
|
5
|
+
"name": "Name",
|
|
6
|
+
"protocol": "Protocol",
|
|
7
|
+
"model": "Model",
|
|
8
|
+
"baseUrl": "Base URL",
|
|
9
|
+
"apiKey": "API key",
|
|
10
|
+
"organization": "Organization",
|
|
11
|
+
"timeout": "Timeout (seconds)",
|
|
12
|
+
"thinking": "Thinking effort",
|
|
13
|
+
"thinkingCustom": "Custom effort",
|
|
14
|
+
"keyNew": "API key",
|
|
15
|
+
"keyKeep": "Leave blank to keep the current key",
|
|
16
|
+
"save": "Save",
|
|
17
|
+
"test": "Test",
|
|
18
|
+
"delete": "Delete"
|
|
19
|
+
},
|
|
20
|
+
"type": {
|
|
21
|
+
"openai": "OpenAI-compatible",
|
|
22
|
+
"deepseek": "DeepSeek",
|
|
23
|
+
"anthropic": "Anthropic (Claude)",
|
|
24
|
+
"responses": "OpenAI (Responses API)"
|
|
25
|
+
},
|
|
26
|
+
"hint": {
|
|
27
|
+
"openai": "OpenAI-compatible: any server that speaks /v1/chat/completions, a gateway included.",
|
|
28
|
+
"deepseek": "DeepSeek: the native chat-completions API, with its thinking switch handled for you. Leave the base URL blank to use api.deepseek.com; a gateway in front of DeepSeek takes its own address.",
|
|
29
|
+
"anthropic": "Anthropic (Claude): the native Messages API. A gateway that routes Claude only there needs its own address (what comes before /v1/messages) and a model id as that gateway lists it.",
|
|
30
|
+
"responses": "OpenAI (Responses API): posts to /responses instead of /chat/completions, for a deployment or gateway that serves a model there (e.g. MIOFFICE azure_openai/gpt-5.6-sol). The base URL is what comes before /responses."
|
|
31
|
+
},
|
|
32
|
+
"thinking": {
|
|
33
|
+
"default": "Provider default",
|
|
34
|
+
"none": "none",
|
|
35
|
+
"minimal": "minimal",
|
|
36
|
+
"low": "low",
|
|
37
|
+
"medium": "medium",
|
|
38
|
+
"high": "high",
|
|
39
|
+
"xhigh": "very high",
|
|
40
|
+
"max": "max",
|
|
41
|
+
"custom": "Custom…"
|
|
42
|
+
},
|
|
43
|
+
"note": {
|
|
44
|
+
"persistent": "Provider settings are saved in history.",
|
|
45
|
+
"volatile": "Provider settings are kept until this node stops."
|
|
46
|
+
},
|
|
47
|
+
"error": {
|
|
48
|
+
"call": "Provider operation failed",
|
|
49
|
+
"callFailed": "Provider call failed",
|
|
50
|
+
"required": "A name and a model are both required.",
|
|
51
|
+
"baseUrl": "The base URL starts with http:// or https://.",
|
|
52
|
+
"selectFirst": "Save or select a provider first."
|
|
53
|
+
},
|
|
54
|
+
"status": {
|
|
55
|
+
"saved": "Saved provider “{name}”."
|
|
56
|
+
},
|
|
57
|
+
"test": {
|
|
58
|
+
"testing": "Testing…",
|
|
59
|
+
"usage": " ({prompt} in / {completion} out)",
|
|
60
|
+
"ok": "{reply}{usage} — tested “{name}” with its saved config.",
|
|
61
|
+
"empty": "Provider call succeeded (empty reply).{usage} Tested “{name}” with its saved config."
|
|
62
|
+
},
|
|
63
|
+
"confirm": {
|
|
64
|
+
"delete": "Delete provider “{name}”?"
|
|
65
|
+
},
|
|
66
|
+
"label": {
|
|
67
|
+
"node": "Provider",
|
|
68
|
+
"desc": "Named LLM serving: OpenAI, Anthropic and Responses behind one row",
|
|
69
|
+
"caps": {
|
|
70
|
+
"providers": "Providers",
|
|
71
|
+
"chat": "Chat",
|
|
72
|
+
"start_stream": "Start a stream",
|
|
73
|
+
"stream_ready": "Stream ready",
|
|
74
|
+
"cancel_stream": "Cancel a stream",
|
|
75
|
+
"ui": "Providers page"
|
|
76
|
+
},
|
|
77
|
+
"args": {
|
|
78
|
+
"providers": {
|
|
79
|
+
"action": "Action",
|
|
80
|
+
"name": "Name",
|
|
81
|
+
"config": "Configuration"
|
|
82
|
+
},
|
|
83
|
+
"chat": {
|
|
84
|
+
"name": "Provider",
|
|
85
|
+
"messages": "Messages",
|
|
86
|
+
"tools": "Tools",
|
|
87
|
+
"max_completion_tokens": "Max reply tokens",
|
|
88
|
+
"previous_response_id": "Previous response id"
|
|
89
|
+
},
|
|
90
|
+
"start_stream": {
|
|
91
|
+
"name": "Provider",
|
|
92
|
+
"messages": "Messages",
|
|
93
|
+
"tools": "Tools",
|
|
94
|
+
"max_completion_tokens": "Max reply tokens",
|
|
95
|
+
"previous_response_id": "Previous response id"
|
|
96
|
+
},
|
|
97
|
+
"stream_ready": {
|
|
98
|
+
"stream_id": "Stream id"
|
|
99
|
+
},
|
|
100
|
+
"cancel_stream": {
|
|
101
|
+
"stream_id": "Stream id"
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
{
|
|
2
|
+
"new": "新建服务商",
|
|
3
|
+
"heading": "模型服务",
|
|
4
|
+
"form": {
|
|
5
|
+
"name": "名称",
|
|
6
|
+
"protocol": "协议",
|
|
7
|
+
"model": "模型",
|
|
8
|
+
"baseUrl": "基础 URL",
|
|
9
|
+
"apiKey": "API 密钥",
|
|
10
|
+
"organization": "组织",
|
|
11
|
+
"timeout": "超时(秒)",
|
|
12
|
+
"thinking": "思考强度",
|
|
13
|
+
"thinkingCustom": "自定义强度",
|
|
14
|
+
"keyNew": "API 密钥",
|
|
15
|
+
"keyKeep": "留空则保留现有密钥",
|
|
16
|
+
"save": "保存",
|
|
17
|
+
"test": "测试",
|
|
18
|
+
"delete": "删除"
|
|
19
|
+
},
|
|
20
|
+
"type": {
|
|
21
|
+
"openai": "OpenAI 兼容",
|
|
22
|
+
"deepseek": "DeepSeek",
|
|
23
|
+
"anthropic": "Anthropic(Claude)",
|
|
24
|
+
"responses": "OpenAI(Responses API)"
|
|
25
|
+
},
|
|
26
|
+
"hint": {
|
|
27
|
+
"openai": "OpenAI 兼容:任何支持 /v1/chat/completions 的服务端,网关也包括在内。",
|
|
28
|
+
"deepseek": "DeepSeek:原生 chat-completions API,思考开关由本节点处理。基础 URL 留空即使用 api.deepseek.com;如果 DeepSeek 前面有网关,则填网关自己的地址。",
|
|
29
|
+
"anthropic": "Anthropic(Claude):原生 Messages API。只在它上面转发 Claude 的网关需要自己的地址(/v1/messages 之前的部分),以及该网关列出的模型 id。",
|
|
30
|
+
"responses": "OpenAI(Responses API):向 /responses 而不是 /chat/completions 提交请求,用于在 /responses 上提供某个模型的部署或网关(例如 MIOFFICE azure_openai/gpt-5.6-sol)。基础 URL 是 /responses 之前的部分。"
|
|
31
|
+
},
|
|
32
|
+
"thinking": {
|
|
33
|
+
"default": "服务商默认",
|
|
34
|
+
"none": "不思考",
|
|
35
|
+
"minimal": "极少",
|
|
36
|
+
"low": "低",
|
|
37
|
+
"medium": "中",
|
|
38
|
+
"high": "高",
|
|
39
|
+
"xhigh": "很高",
|
|
40
|
+
"max": "最大",
|
|
41
|
+
"custom": "自定义…"
|
|
42
|
+
},
|
|
43
|
+
"note": {
|
|
44
|
+
"persistent": "服务商设置已保存在历史记录中。",
|
|
45
|
+
"volatile": "服务商设置只在此节点运行期间保留。"
|
|
46
|
+
},
|
|
47
|
+
"error": {
|
|
48
|
+
"call": "服务商操作失败",
|
|
49
|
+
"callFailed": "服务商调用失败",
|
|
50
|
+
"required": "名称和模型都必须填写。",
|
|
51
|
+
"baseUrl": "基础 URL 要以 http:// 或 https:// 开头。",
|
|
52
|
+
"selectFirst": "请先保存或选择一个服务商。"
|
|
53
|
+
},
|
|
54
|
+
"status": {
|
|
55
|
+
"saved": "已保存服务商“{name}”。"
|
|
56
|
+
},
|
|
57
|
+
"test": {
|
|
58
|
+
"testing": "测试中…",
|
|
59
|
+
"usage": "(输入 {prompt} / 输出 {completion})",
|
|
60
|
+
"ok": "{reply}{usage} — 已用其保存的配置测试“{name}”。",
|
|
61
|
+
"empty": "服务商调用成功(回复为空)。{usage} 已用其保存的配置测试“{name}”。"
|
|
62
|
+
},
|
|
63
|
+
"confirm": {
|
|
64
|
+
"delete": "删除服务商“{name}”?"
|
|
65
|
+
},
|
|
66
|
+
"label": {
|
|
67
|
+
"node": "模型服务",
|
|
68
|
+
"desc": "按名字配置的模型服务:OpenAI、Anthropic 与 Responses 合并为一行",
|
|
69
|
+
"caps": {
|
|
70
|
+
"providers": "模型服务商",
|
|
71
|
+
"chat": "对话",
|
|
72
|
+
"start_stream": "开启流式回复",
|
|
73
|
+
"stream_ready": "流就绪",
|
|
74
|
+
"cancel_stream": "取消流",
|
|
75
|
+
"ui": "模型服务页面"
|
|
76
|
+
},
|
|
77
|
+
"args": {
|
|
78
|
+
"providers": {
|
|
79
|
+
"action": "操作",
|
|
80
|
+
"name": "名称",
|
|
81
|
+
"config": "配置"
|
|
82
|
+
},
|
|
83
|
+
"chat": {
|
|
84
|
+
"name": "服务商",
|
|
85
|
+
"messages": "消息",
|
|
86
|
+
"tools": "工具",
|
|
87
|
+
"max_completion_tokens": "最大回复 token 数",
|
|
88
|
+
"previous_response_id": "上一条响应 id"
|
|
89
|
+
},
|
|
90
|
+
"start_stream": {
|
|
91
|
+
"name": "服务商",
|
|
92
|
+
"messages": "消息",
|
|
93
|
+
"tools": "工具",
|
|
94
|
+
"max_completion_tokens": "最大回复 token 数",
|
|
95
|
+
"previous_response_id": "上一条响应 id"
|
|
96
|
+
},
|
|
97
|
+
"stream_ready": {
|
|
98
|
+
"stream_id": "流 id"
|
|
99
|
+
},
|
|
100
|
+
"cancel_stream": {
|
|
101
|
+
"stream_id": "流 id"
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
package/dist/icon.svg
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
2
|
+
<!-- A plug in green, its lead in amber: which model the agent is wired to. -->
|
|
3
|
+
<path stroke="#16a34a" d="M9 3.5v5M15 3.5v5" />
|
|
4
|
+
<path stroke="#16a34a" d="M6.5 8.5h11V11a5.5 5.5 0 0 1-11 0z" />
|
|
5
|
+
<path stroke="#f59e0b" d="M12 16.5v4" />
|
|
6
|
+
</svg>
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Node, type NodeContext, type NodeHandlers } from '@node-agent/sdk';
|
|
3
|
+
import type { JsonObject } from './providers/base.js';
|
|
4
|
+
export type ProviderConfig = JsonObject;
|
|
5
|
+
export type InstalledProvider = {
|
|
6
|
+
name: string;
|
|
7
|
+
config: ProviderConfig;
|
|
8
|
+
has_api_key: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type ProviderState = {
|
|
11
|
+
providers: InstalledProvider[];
|
|
12
|
+
persistent: boolean;
|
|
13
|
+
};
|
|
14
|
+
/** How long a stream id waits for its `stream_ready` before it is dropped: a caller that asked for a
|
|
15
|
+
* stream and never opened it must not leave a row of session state behind forever. */
|
|
16
|
+
export declare const STREAM_PENDING_MS = 60000;
|
|
17
|
+
export declare class ProviderNode extends Node {
|
|
18
|
+
readonly handlers: NodeHandlers;
|
|
19
|
+
constructor(ctx: NodeContext);
|
|
20
|
+
}
|
|
21
|
+
export default ProviderNode;
|