@agentproto/adapter-hermes 0.1.1 → 0.3.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.
- package/HERMES.md +77 -5
- package/LICENSE +202 -21
- package/dist/index.mjs +51 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/HERMES.md
CHANGED
|
@@ -28,16 +28,25 @@ session:
|
|
|
28
28
|
idle_timeout_ms: 1800000
|
|
29
29
|
context_carryover: true
|
|
30
30
|
models:
|
|
31
|
-
default:
|
|
31
|
+
default: z-ai/glm-5.2
|
|
32
32
|
allowed:
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
- openai/gpt-4
|
|
33
|
+
- z-ai/glm-5.2
|
|
34
|
+
- deepseek/deepseek-v4-pro
|
|
36
35
|
- meta-llama/llama-3.3-70b
|
|
36
|
+
- openai/gpt-4
|
|
37
|
+
# Anthropic models are reserved for the dedicated claude-code adapter —
|
|
38
|
+
# hermes must NEVER route to them, even if a caller passes the id
|
|
39
|
+
# explicitly. Enforced at compose time (RuntimeConfigError).
|
|
40
|
+
deny:
|
|
41
|
+
- anthropic/*
|
|
42
|
+
- claude-*
|
|
37
43
|
env:
|
|
38
|
-
anthropic: ANTHROPIC_API_KEY
|
|
39
44
|
openrouter: OPENROUTER_API_KEY
|
|
40
45
|
openai: OPENAI_API_KEY
|
|
46
|
+
# hermes keeps its own configured default when given a model via the ACP
|
|
47
|
+
# session config — selection must go through a `/model <id>` control turn
|
|
48
|
+
# instead. See the "Model selection" section below.
|
|
49
|
+
apply: command
|
|
41
50
|
capabilities:
|
|
42
51
|
streaming: true
|
|
43
52
|
tool_calls: true
|
|
@@ -46,6 +55,41 @@ capabilities:
|
|
|
46
55
|
multimodal: true
|
|
47
56
|
resumable: false
|
|
48
57
|
bidirectional: true
|
|
58
|
+
modes:
|
|
59
|
+
- id: default
|
|
60
|
+
description: Standard interactive mode — loads ~/.hermes/config.yaml and auto-injects rules/memory/preloaded skills as usual.
|
|
61
|
+
- id: lean
|
|
62
|
+
description: >-
|
|
63
|
+
Skip ~/.hermes/config.yaml, cutting the skills/rules/memory scaffolding
|
|
64
|
+
hermes would otherwise preload into context. Composed as
|
|
65
|
+
`hermes --ignore-user-config acp` — the global flag MUST precede the
|
|
66
|
+
`acp` subcommand baked into `bin_args`, which is why this needs
|
|
67
|
+
`bin_args_prepend` rather than `bin_args_append`.
|
|
68
|
+
bin_args_prepend: ["--ignore-user-config"]
|
|
69
|
+
options:
|
|
70
|
+
- id: skills
|
|
71
|
+
type: string
|
|
72
|
+
description: >-
|
|
73
|
+
Preload one or more agentskills.io-compatible skills for the session
|
|
74
|
+
(comma-separate for multiple), via hermes' `--skills` global flag.
|
|
75
|
+
Same prepend-before-`acp` constraint as the `lean` mode.
|
|
76
|
+
bin_args_prepend: ["--skills", "{value}"]
|
|
77
|
+
- id: model
|
|
78
|
+
type: string
|
|
79
|
+
description: >-
|
|
80
|
+
Model ID routed through OpenRouter/OpenAI (e.g.
|
|
81
|
+
'deepseek/deepseek-v4-pro', 'z-ai/glm-5.2', 'moonshotai/kimi-k2').
|
|
82
|
+
Free-form: any valid OpenRouter/OpenAI id is accepted even when not
|
|
83
|
+
in `allowed`. Anthropic models are denied (see `models.deny`) — use
|
|
84
|
+
the claude-code adapter for those. Applied via a `/model <id>`
|
|
85
|
+
control turn after the session is created (hermes ignores the ACP
|
|
86
|
+
session model config). Omit to use the hermes default.
|
|
87
|
+
- id: effort
|
|
88
|
+
type: enum
|
|
89
|
+
enum: [low, medium, high, xhigh, max]
|
|
90
|
+
description: >-
|
|
91
|
+
Reasoning effort level passed to hermes via ACP newSession. Omit to
|
|
92
|
+
use the hermes default.
|
|
49
93
|
tags: [hermes, nous, acp, agent-runtime]
|
|
50
94
|
---
|
|
51
95
|
|
|
@@ -74,6 +118,34 @@ resolved from the operator's secret store and passed via
|
|
|
74
118
|
`OPENROUTER_API_KEY`, `ANTHROPIC_API_KEY`, or `OPENAI_API_KEY` MUST
|
|
75
119
|
be present at boot.
|
|
76
120
|
|
|
121
|
+
## Model selection
|
|
122
|
+
|
|
123
|
+
Hermes does **not** read the model from its ACP session config — it keeps
|
|
124
|
+
whatever its own `~/.hermes/config.yaml` resolves as default. So unlike the
|
|
125
|
+
claude-code / claude-sdk adapters (which pin the model at spawn via a CLI
|
|
126
|
+
flag), the `model` option here is applied as a **`/model <id>` control turn
|
|
127
|
+
sent after the session is created** (`models.apply: command`).
|
|
128
|
+
|
|
129
|
+
Two consequences an operator should know:
|
|
130
|
+
|
|
131
|
+
- **Provider is whatever hermes resolves at session start.** The `/model`
|
|
132
|
+
turn only switches the model id; it does not re-resolve the provider. If
|
|
133
|
+
`~/.hermes/config.yaml`'s default provider is `moa` (Mixture of Agents),
|
|
134
|
+
a `/model moonshotai/kimi-k2` turn targets a model moa can't serve and
|
|
135
|
+
fails. Point hermes at the right provider (e.g. set
|
|
136
|
+
`model.default.provider: openrouter`, or a direct `moonshot` provider
|
|
137
|
+
block) before relying on the `model` option. The interactive CLI
|
|
138
|
+
`hermes --model <id>` resolves the provider at launch and does not have
|
|
139
|
+
this constraint.
|
|
140
|
+
- **No `provider` option is exposed.** Agentproto can only set the model
|
|
141
|
+
id, not force OpenRouter/Moonshot routing. To run Kimi through a
|
|
142
|
+
provider-pinned path, prefer the `claude-sdk` adapter with
|
|
143
|
+
`mode: moonshot` (or `mode: openrouter` + a model slug).
|
|
144
|
+
|
|
145
|
+
`models.deny` (`anthropic/*`, `claude-*`) is enforced at compose time — a
|
|
146
|
+
RuntimeConfigError — so the budget arm can never silently burn premium
|
|
147
|
+
Anthropic spend.
|
|
148
|
+
|
|
77
149
|
## Protocol
|
|
78
150
|
|
|
79
151
|
`protocol: acp` — Hermes ships an ACP server in
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,202 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/dist/index.mjs
CHANGED
|
@@ -28,8 +28,16 @@ var hermes = defineAgentCli({
|
|
|
28
28
|
},
|
|
29
29
|
auth: {
|
|
30
30
|
ref: "./SECRETS.md",
|
|
31
|
-
|
|
31
|
+
// No ANTHROPIC_API_KEY — hermes is the budget arm and deliberately does
|
|
32
|
+
// not route to Anthropic (see models.deny). Anthropic stays exclusive to
|
|
33
|
+
// the claude-code adapter.
|
|
34
|
+
state: { env: ["OPENROUTER_API_KEY", "OPENAI_API_KEY"] }
|
|
32
35
|
},
|
|
36
|
+
// Billing-auth (opt-in — no authEnforce, so unconfigured spawns stay
|
|
37
|
+
// ambient). Single-provider adapter: api-key mode SETS providerEnvVar
|
|
38
|
+
// ("openrouter") = OPENROUTER_API_KEY, derived from the catalog. No
|
|
39
|
+
// authSubscription ⇒ `subscription` fails loud with `unsupported_auth_mode`.
|
|
40
|
+
provider: "openrouter",
|
|
33
41
|
sandbox: "./SANDBOX.md",
|
|
34
42
|
protocol: "acp",
|
|
35
43
|
acp: "./hermes-acp.ACP.md",
|
|
@@ -49,18 +57,22 @@ var hermes = defineAgentCli({
|
|
|
49
57
|
models: {
|
|
50
58
|
// Cheap OpenRouter models by default — hermes is the budget delegation
|
|
51
59
|
// arm (a Sonnet default would defeat the purpose). glm-5.2 + deepseek
|
|
52
|
-
// are the go-to cheap coders
|
|
60
|
+
// are the go-to cheap coders. `allowed` is only the curated menu: the
|
|
61
|
+
// `model` option is free-form, so any OpenRouter id (kimi, qwen, …) can
|
|
62
|
+
// still be passed even when it isn't listed here.
|
|
53
63
|
default: "z-ai/glm-5.2",
|
|
54
64
|
allowed: [
|
|
55
65
|
"z-ai/glm-5.2",
|
|
56
66
|
"deepseek/deepseek-v4-pro",
|
|
57
67
|
"meta-llama/llama-3.3-70b",
|
|
58
|
-
"anthropic/claude-sonnet-4-6",
|
|
59
|
-
"anthropic/claude-opus-4-7",
|
|
60
68
|
"openai/gpt-4"
|
|
61
69
|
],
|
|
70
|
+
// Anthropic models are reserved for the dedicated claude-code adapter —
|
|
71
|
+
// hermes must NEVER route to them, even if a caller passes the id
|
|
72
|
+
// explicitly. Enforced at compose time (RuntimeConfigError), so the
|
|
73
|
+
// budget arm can't silently burn premium Anthropic spend.
|
|
74
|
+
deny: ["anthropic/*", "claude-*"],
|
|
62
75
|
env: {
|
|
63
|
-
anthropic: "ANTHROPIC_API_KEY",
|
|
64
76
|
openrouter: "OPENROUTER_API_KEY",
|
|
65
77
|
openai: "OPENAI_API_KEY"
|
|
66
78
|
},
|
|
@@ -78,15 +90,35 @@ var hermes = defineAgentCli({
|
|
|
78
90
|
resumable: false,
|
|
79
91
|
bidirectional: true
|
|
80
92
|
},
|
|
93
|
+
modes: [
|
|
94
|
+
{
|
|
95
|
+
id: "default",
|
|
96
|
+
description: "Standard interactive mode \u2014 loads ~/.hermes/config.yaml and auto-injects rules/memory/preloaded skills as usual."
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: "lean",
|
|
100
|
+
description: "Skip ~/.hermes/config.yaml, cutting the skills/rules/memory scaffolding hermes would otherwise preload into context. Composed as `hermes --ignore-user-config acp` \u2014 the global flag MUST precede the `acp` subcommand baked into `bin_args`, which is why this needs bin_args_prepend rather than bin_args_append.",
|
|
101
|
+
bin_args_prepend: ["--ignore-user-config"],
|
|
102
|
+
status: "noop",
|
|
103
|
+
status_note: "Measured no-op: --ignore-user-config skips ~/.hermes/config.yaml, but hermes skills live in a separate skills dir (not config), so prompt-size is byte-identical. The real lean lever is narrowing the mounted toolset, not this flag."
|
|
104
|
+
}
|
|
105
|
+
],
|
|
81
106
|
options: [
|
|
107
|
+
{
|
|
108
|
+
id: "skills",
|
|
109
|
+
type: "string",
|
|
110
|
+
description: "Preload one or more agentskills.io-compatible skills for the session (comma-separate for multiple), via hermes' `--skills` global flag. Same prepend-before-`acp` constraint as the `lean` mode.",
|
|
111
|
+
bin_args_prepend: ["--skills", "{value}"]
|
|
112
|
+
},
|
|
82
113
|
{
|
|
83
114
|
id: "model",
|
|
84
|
-
// string (not enum) so any valid OpenRouter/
|
|
85
|
-
//
|
|
86
|
-
//
|
|
87
|
-
// config, not from its own CLI args.
|
|
115
|
+
// string (not enum) so any valid OpenRouter/OpenAI model ID is accepted
|
|
116
|
+
// without a code change to expand the list. Applied via ACP
|
|
117
|
+
// newSession(model:...) — hermes reads the model from the ACP session
|
|
118
|
+
// config, not from its own CLI args. Anthropic ids are denied
|
|
119
|
+
// (models.deny) — those are reserved for the claude-code adapter.
|
|
88
120
|
type: "string",
|
|
89
|
-
description: "Model ID routed through OpenRouter/
|
|
121
|
+
description: "Model ID routed through OpenRouter/OpenAI (e.g. 'deepseek/deepseek-v4-pro', 'z-ai/glm-5.2', 'moonshotai/kimi-k2'). Anthropic models are not permitted on hermes \u2014 use the claude-code adapter for those. Applied via a `/model <id>` control turn after the session is created (hermes ignores the ACP session model config). Omit to use the hermes default."
|
|
90
122
|
},
|
|
91
123
|
{
|
|
92
124
|
id: "effort",
|
|
@@ -95,7 +127,15 @@ var hermes = defineAgentCli({
|
|
|
95
127
|
description: "Reasoning effort level passed to hermes via ACP newSession. Omit to use the hermes default."
|
|
96
128
|
}
|
|
97
129
|
],
|
|
98
|
-
tags: ["hermes", "nous", "acp", "agent-runtime"]
|
|
130
|
+
tags: ["hermes", "nous", "acp", "agent-runtime"],
|
|
131
|
+
metadata: {
|
|
132
|
+
// Opts hermes into `agentproto install skill/<slug>` fan-out (no
|
|
133
|
+
// --target given): skills get copied one subdir per skill into
|
|
134
|
+
// hermes's own skills directory, alongside whatever it ships
|
|
135
|
+
// natively. See packages/cli/src/commands/skill-install/types.ts
|
|
136
|
+
// `AdapterSkillsTarget` for the shape + guard.
|
|
137
|
+
skills: { format: "flat-dir", dir: "~/.hermes/skills" }
|
|
138
|
+
}
|
|
99
139
|
});
|
|
100
140
|
function hermesRuntime() {
|
|
101
141
|
return createAgentCliRuntime(hermes);
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;AAyBO,IAAM,SAAyB,cAAA,CAAe;AAAA,EACnD,IAAA,EAAM,QAAA;AAAA,EACN,EAAA,EAAI,QAAA;AAAA,EACJ,WAAA,EACE,qLAAA;AAAA,EACF,OAAA,EAAS,OAAA;AAAA,EACT,GAAA,EAAK,QAAA;AAAA,EACL,QAAA,EAAU,CAAC,KAAK,CAAA;AAAA,EAChB,OAAA,EAAS;AAAA,IACP;AAAA,MACE,MAAA,EAAQ,MAAA;AAAA,MACR,GAAA,EAAK;AAAA;AACP,GACF;AAAA,EACA,aAAA,EAAe;AAAA,IACb,GAAA,EAAK,kBAAA;AAAA,IACL,KAAA,EAAO,sBAAA;AAAA,IACP,KAAA,EAAO,iBAAA;AAAA,IACP,UAAA,EAAY;AAAA,GACd;AAAA,EACA,IAAA,EAAM;AAAA,IACJ,GAAA,EAAK,cAAA;AAAA,IACL,OAAO,EAAE,GAAA,EAAK,CAAC,oBAAA,EAAsB,mBAAA,EAAqB,gBAAgB,CAAA;AAAE,GAC9E;AAAA,EACA,OAAA,EAAS,cAAA;AAAA,EACT,QAAA,EAAU,KAAA;AAAA,EACV,GAAA,EAAK,qBAAA;AAAA,EACL,OAAA,EAAS;AAAA,IACP,IAAA,EAAM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n * @agentproto/adapter-hermes — AIP-45 adapter for Nous Research's Hermes Agent.\n *\n * Re-exports a `defineAgentCli` instance plus the runtime factory so\n * a host can boot Hermes with one import:\n *\n * import { hermes, hermesRuntime } from \"@agentproto/adapter-hermes\"\n * const session = await hermesRuntime().start({ env: { OPENROUTER_API_KEY } })\n * for await (const evt of session.send({ role: \"user\", content: \"...\" })) {\n * console.log(evt)\n * }\n * await session.close()\n *\n * The companion HERMES.md / SECRETS.md / hermes-acp.ACP.md files in\n * this package describe the manifest, secret slots, and ACP wire\n * profile.\n */\n\nimport {\n createAgentCliRuntime,\n defineAgentCli,\n type AgentCliHandle,\n type AgentCliRuntime,\n} from \"@agentproto/driver-agent-cli\"\n\nexport const hermes: AgentCliHandle = defineAgentCli({\n name: \"hermes\",\n id: \"hermes\",\n description:\n \"Nous Research's Hermes Agent — autonomous CLI agent with skills, sandboxes, memory plugins, and a built-in ACP server. Spawned as `hermes acp` and driven over stdio JSON-RPC.\",\n version: \"0.1.0\",\n bin: \"hermes\",\n bin_args: [\"acp\"],\n install: [\n {\n method: \"curl\",\n url: \"https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh\",\n },\n ],\n version_check: {\n cmd: \"hermes --version\",\n parse: \"(\\\\d+\\\\.\\\\d+\\\\.\\\\d+)\",\n range: \">=0.13.0 <1.0.0\",\n timeout_ms: 5000,\n },\n auth: {\n ref: \"./SECRETS.md\",\n state: { env: [\"OPENROUTER_API_KEY\", \"ANTHROPIC_API_KEY\", \"OPENAI_API_KEY\"] },\n },\n sandbox: \"./SANDBOX.md\",\n protocol: \"acp\",\n acp: \"./hermes-acp.ACP.md\",\n session: {\n mode: \"persistent\",\n idle_timeout_ms: 1_800_000,\n context_carryover: true,\n // hermes's own ACP server has been observed to hit its internal\n // max-tool-iterations cap, produce a final answer, and then never\n // send the `prompt` JSON-RPC response — hanging the daemon's turn\n // drain loop forever with no other adapter-side signal available.\n // 5 minutes of true silence (reset on any ACP traffic, so a long\n // legitimate tool-call chain doesn't false-positive) is generous\n // enough to not trip during normal use.\n turn_idle_timeout_ms: 300_000,\n },\n models: {\n // Cheap OpenRouter models by default — hermes is the budget delegation\n // arm (a Sonnet default would defeat the purpose). glm-5.2 + deepseek\n // are the go-to cheap coders; the bigger models stay available.\n default: \"z-ai/glm-5.2\",\n allowed: [\n \"z-ai/glm-5.2\",\n \"deepseek/deepseek-v4-pro\",\n \"meta-llama/llama-3.3-70b\",\n \"anthropic/claude-sonnet-4-6\",\n \"anthropic/claude-opus-4-7\",\n \"openai/gpt-4\",\n ],\n env: {\n anthropic: \"ANTHROPIC_API_KEY\",\n openrouter: \"OPENROUTER_API_KEY\",\n openai: \"OPENAI_API_KEY\",\n },\n // hermes keeps its own configured default when given a model via the\n // ACP session config — selection must go through a `/model <id>`\n // control turn instead. See AgentCliModels.apply.\n apply: \"command\",\n },\n capabilities: {\n streaming: true,\n tool_calls: true,\n sub_agents: true,\n file_io: true,\n multimodal: true,\n resumable: false,\n bidirectional: true,\n },\n options: [\n {\n id: \"model\",\n // string (not enum) so any valid OpenRouter/Anthropic/OpenAI model ID is\n // accepted without requiring a code change to expand the list. Applied via\n // ACP newSession(model:...) — hermes reads the model from the ACP session\n // config, not from its own CLI args.\n type: \"string\" as const,\n description:\n \"Model ID routed through OpenRouter/Anthropic/OpenAI \" +\n \"(e.g. 'anthropic/claude-sonnet-4-6', 'deepseek/deepseek-v4-pro', 'z-ai/glm-5.2'). \" +\n \"Applied via a `/model <id>` control turn after the session is created \" +\n \"(hermes ignores the ACP session model config). \" +\n \"Omit to use the hermes default.\",\n },\n {\n id: \"effort\",\n type: \"enum\" as const,\n enum: [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n description:\n \"Reasoning effort level passed to hermes via ACP newSession. \" +\n \"Omit to use the hermes default.\",\n },\n ],\n tags: [\"hermes\", \"nous\", \"acp\", \"agent-runtime\"],\n})\n\nexport function hermesRuntime(): AgentCliRuntime {\n return createAgentCliRuntime(hermes)\n}\n\nimport { homedir } from \"node:os\"\nimport { join } from \"node:path\"\n\n/** Best-effort read of a hermes session's cost/token usage from its state.db.\n *\n * hermes writes the per-turn cost to state.db slightly AFTER the ACP turn\n * ends, so a single read right at turn-end usually finds the cost column\n * still null. We poll a few times with a short backoff until the cost lands\n * (or give up — best-effort, never throws). Bounded so a missing write can't\n * hang the caller (the turn-end path awaits this). */\nexport async function readHermesUsage(\n sessionId: string,\n): Promise<{ costUsd?: number; tokensIn?: number; tokensOut?: number } | null> {\n try {\n // node:sqlite is a Node 22+ builtin. Build the specifier at runtime so the\n // bundler (esbuild/tsup) can't statically rewrite it — it strips the\n // `node:` prefix off this not-yet-recognised builtin, turning the import\n // into a missing `sqlite` package that throws and silently yields null.\n const sqliteSpecifier = [\"node\", \"sqlite\"].join(\":\")\n const { DatabaseSync } = (await import(sqliteSpecifier)) as unknown as {\n DatabaseSync: new (p: string, o?: { readOnly?: boolean }) => {\n prepare(sql: string): { get(...a: unknown[]): unknown }\n close(): void\n }\n }\n const dbPath = join(homedir(), \".hermes\", \"state.db\")\n const ATTEMPTS = 6\n const DELAY_MS = 130\n let last: { costUsd?: number; tokensIn?: number; tokensOut?: number } | null = null\n for (let i = 0; i < ATTEMPTS; i++) {\n const db = new DatabaseSync(dbPath, { readOnly: true })\n const row = db.prepare(\n \"select estimated_cost_usd as cost, input_tokens as ti, output_tokens as to_ from sessions where id = ?\",\n ).get(sessionId) as { cost?: number; ti?: number; to_?: number } | undefined\n db.close()\n if (row) {\n last = { costUsd: row.cost, tokensIn: row.ti, tokensOut: row.to_ }\n // Cost has landed (non-null) → done. Otherwise keep polling: the row\n // exists but hermes hasn't written the cost for this turn yet.\n if (row.cost !== null && row.cost !== undefined) return last\n }\n if (i < ATTEMPTS - 1) await new Promise(r => setTimeout(r, DELAY_MS))\n }\n return last\n } catch {\n return null\n }\n}\n\nexport type { AgentCliHandle, AgentCliRuntime }\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;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,IAAI,QAAQ,CAAA,CAAA,KAAK,UAAA,CAAW,CAAA,EAAG,QAAQ,CAAC,CAAA;AAAA,IACtE;AACA,IAAA,OAAO,IAAA;AAAA,EACT,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF","file":"index.mjs","sourcesContent":["/**\n * @agentproto/adapter-hermes — AIP-45 adapter for Nous Research's Hermes Agent.\n *\n * Re-exports a `defineAgentCli` instance plus the runtime factory so\n * a host can boot Hermes with one import:\n *\n * import { hermes, hermesRuntime } from \"@agentproto/adapter-hermes\"\n * const session = await hermesRuntime().start({ env: { OPENROUTER_API_KEY } })\n * for await (const evt of session.send({ role: \"user\", content: \"...\" })) {\n * console.log(evt)\n * }\n * await session.close()\n *\n * The companion HERMES.md / SECRETS.md / hermes-acp.ACP.md files in\n * this package describe the manifest, secret slots, and ACP wire\n * profile.\n */\n\nimport {\n createAgentCliRuntime,\n defineAgentCli,\n type AgentCliHandle,\n type AgentCliRuntime,\n} from \"@agentproto/driver-agent-cli\"\n\nexport const hermes: AgentCliHandle = defineAgentCli({\n name: \"hermes\",\n id: \"hermes\",\n description:\n \"Nous Research's Hermes Agent — autonomous CLI agent with skills, sandboxes, memory plugins, and a built-in ACP server. Spawned as `hermes acp` and driven over stdio JSON-RPC.\",\n version: \"0.1.0\",\n bin: \"hermes\",\n bin_args: [\"acp\"],\n install: [\n {\n method: \"curl\",\n url: \"https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh\",\n },\n ],\n version_check: {\n cmd: \"hermes --version\",\n parse: \"(\\\\d+\\\\.\\\\d+\\\\.\\\\d+)\",\n range: \">=0.13.0 <1.0.0\",\n timeout_ms: 5000,\n },\n auth: {\n ref: \"./SECRETS.md\",\n // No ANTHROPIC_API_KEY — hermes is the budget arm and deliberately does\n // not route to Anthropic (see models.deny). Anthropic stays exclusive to\n // the claude-code adapter.\n state: { env: [\"OPENROUTER_API_KEY\", \"OPENAI_API_KEY\"] },\n },\n // Billing-auth (opt-in — no authEnforce, so unconfigured spawns stay\n // ambient). Single-provider adapter: api-key mode SETS providerEnvVar\n // (\"openrouter\") = OPENROUTER_API_KEY, derived from the catalog. No\n // authSubscription ⇒ `subscription` fails loud with `unsupported_auth_mode`.\n provider: \"openrouter\",\n sandbox: \"./SANDBOX.md\",\n protocol: \"acp\",\n acp: \"./hermes-acp.ACP.md\",\n session: {\n mode: \"persistent\",\n idle_timeout_ms: 1_800_000,\n context_carryover: true,\n // hermes's own ACP server has been observed to hit its internal\n // max-tool-iterations cap, produce a final answer, and then never\n // send the `prompt` JSON-RPC response — hanging the daemon's turn\n // drain loop forever with no other adapter-side signal available.\n // 5 minutes of true silence (reset on any ACP traffic, so a long\n // legitimate tool-call chain doesn't false-positive) is generous\n // enough to not trip during normal use.\n turn_idle_timeout_ms: 300_000,\n },\n models: {\n // Cheap OpenRouter models by default — hermes is the budget delegation\n // arm (a Sonnet default would defeat the purpose). glm-5.2 + deepseek\n // are the go-to cheap coders. `allowed` is only the curated menu: the\n // `model` option is free-form, so any OpenRouter id (kimi, qwen, …) can\n // still be passed even when it isn't listed here.\n default: \"z-ai/glm-5.2\",\n allowed: [\n \"z-ai/glm-5.2\",\n \"deepseek/deepseek-v4-pro\",\n \"meta-llama/llama-3.3-70b\",\n \"openai/gpt-4\",\n ],\n // Anthropic models are reserved for the dedicated claude-code adapter —\n // hermes must NEVER route to them, even if a caller passes the id\n // explicitly. Enforced at compose time (RuntimeConfigError), so the\n // budget arm can't silently burn premium Anthropic spend.\n deny: [\"anthropic/*\", \"claude-*\"],\n env: {\n openrouter: \"OPENROUTER_API_KEY\",\n openai: \"OPENAI_API_KEY\",\n },\n // hermes keeps its own configured default when given a model via the\n // ACP session config — selection must go through a `/model <id>`\n // control turn instead. See AgentCliModels.apply.\n apply: \"command\",\n },\n capabilities: {\n streaming: true,\n tool_calls: true,\n sub_agents: true,\n file_io: true,\n multimodal: true,\n resumable: false,\n bidirectional: true,\n },\n modes: [\n {\n id: \"default\",\n description:\n \"Standard interactive mode — loads ~/.hermes/config.yaml and auto-injects \" +\n \"rules/memory/preloaded skills as usual.\",\n },\n {\n id: \"lean\",\n description:\n \"Skip ~/.hermes/config.yaml, cutting the skills/rules/memory scaffolding hermes \" +\n \"would otherwise preload into context. Composed as `hermes --ignore-user-config \" +\n \"acp` — the global flag MUST precede the `acp` subcommand baked into `bin_args`, \" +\n \"which is why this needs bin_args_prepend rather than bin_args_append.\",\n bin_args_prepend: [\"--ignore-user-config\"],\n status: \"noop\",\n status_note:\n \"Measured no-op: --ignore-user-config skips ~/.hermes/config.yaml, but hermes \" +\n \"skills live in a separate skills dir (not config), so prompt-size is \" +\n \"byte-identical. The real lean lever is narrowing the mounted toolset, not \" +\n \"this flag.\",\n },\n ],\n options: [\n {\n id: \"skills\",\n type: \"string\" as const,\n description:\n \"Preload one or more agentskills.io-compatible skills for the session \" +\n \"(comma-separate for multiple), via hermes' `--skills` global flag. Same \" +\n \"prepend-before-`acp` constraint as the `lean` mode.\",\n bin_args_prepend: [\"--skills\", \"{value}\"],\n },\n {\n id: \"model\",\n // string (not enum) so any valid OpenRouter/OpenAI model ID is accepted\n // without a code change to expand the list. Applied via ACP\n // newSession(model:...) — hermes reads the model from the ACP session\n // config, not from its own CLI args. Anthropic ids are denied\n // (models.deny) — those are reserved for the claude-code adapter.\n type: \"string\" as const,\n description:\n \"Model ID routed through OpenRouter/OpenAI \" +\n \"(e.g. 'deepseek/deepseek-v4-pro', 'z-ai/glm-5.2', 'moonshotai/kimi-k2'). \" +\n \"Anthropic models are not permitted on hermes — use the claude-code \" +\n \"adapter for those. \" +\n \"Applied via a `/model <id>` control turn after the session is created \" +\n \"(hermes ignores the ACP session model config). \" +\n \"Omit to use the hermes default.\",\n },\n {\n id: \"effort\",\n type: \"enum\" as const,\n enum: [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n description:\n \"Reasoning effort level passed to hermes via ACP newSession. \" +\n \"Omit to use the hermes default.\",\n },\n ],\n tags: [\"hermes\", \"nous\", \"acp\", \"agent-runtime\"],\n metadata: {\n // Opts hermes into `agentproto install skill/<slug>` fan-out (no\n // --target given): skills get copied one subdir per skill into\n // hermes's own skills directory, alongside whatever it ships\n // natively. See packages/cli/src/commands/skill-install/types.ts\n // `AdapterSkillsTarget` for the shape + guard.\n skills: { format: \"flat-dir\", dir: \"~/.hermes/skills\" },\n },\n})\n\nexport function hermesRuntime(): AgentCliRuntime {\n return createAgentCliRuntime(hermes)\n}\n\nimport { homedir } from \"node:os\"\nimport { join } from \"node:path\"\n\n/** Best-effort read of a hermes session's cost/token usage from its state.db.\n *\n * hermes writes the per-turn cost to state.db slightly AFTER the ACP turn\n * ends, so a single read right at turn-end usually finds the cost column\n * still null. We poll a few times with a short backoff until the cost lands\n * (or give up — best-effort, never throws). Bounded so a missing write can't\n * hang the caller (the turn-end path awaits this). */\nexport async function readHermesUsage(\n sessionId: string,\n): Promise<{ costUsd?: number; tokensIn?: number; tokensOut?: number } | null> {\n try {\n // node:sqlite is a Node 22+ builtin. Build the specifier at runtime so the\n // bundler (esbuild/tsup) can't statically rewrite it — it strips the\n // `node:` prefix off this not-yet-recognised builtin, turning the import\n // into a missing `sqlite` package that throws and silently yields null.\n const sqliteSpecifier = [\"node\", \"sqlite\"].join(\":\")\n const { DatabaseSync } = (await import(sqliteSpecifier)) as unknown as {\n DatabaseSync: new (p: string, o?: { readOnly?: boolean }) => {\n prepare(sql: string): { get(...a: unknown[]): unknown }\n close(): void\n }\n }\n const dbPath = join(homedir(), \".hermes\", \"state.db\")\n const ATTEMPTS = 6\n const DELAY_MS = 130\n let last: { costUsd?: number; tokensIn?: number; tokensOut?: number } | null = null\n for (let i = 0; i < ATTEMPTS; i++) {\n const db = new DatabaseSync(dbPath, { readOnly: true })\n const row = db.prepare(\n \"select estimated_cost_usd as cost, input_tokens as ti, output_tokens as to_ from sessions where id = ?\",\n ).get(sessionId) as { cost?: number; ti?: number; to_?: number } | undefined\n db.close()\n if (row) {\n last = { costUsd: row.cost, tokensIn: row.ti, tokensOut: row.to_ }\n // Cost has landed (non-null) → done. Otherwise keep polling: the row\n // exists but hermes hasn't written the cost for this turn yet.\n if (row.cost !== null && row.cost !== undefined) return last\n }\n if (i < ATTEMPTS - 1) await new Promise(r => setTimeout(r, DELAY_MS))\n }\n return last\n } catch {\n return null\n }\n}\n\nexport type { AgentCliHandle, AgentCliRuntime }\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentproto/adapter-hermes",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "@agentproto/adapter-hermes — AIP-45 AGENT-CLI adapter for Nous Research's Hermes Agent. Spawns `hermes acp` and drives it as an agentproto agent CLI via the ACP protocol arm of @agentproto/driver-agent-cli.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agentproto",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"url": "https://github.com/agentproto/ts",
|
|
18
18
|
"directory": "adapters/hermes"
|
|
19
19
|
},
|
|
20
|
-
"license": "
|
|
20
|
+
"license": "Apache-2.0",
|
|
21
21
|
"type": "module",
|
|
22
22
|
"main": "dist/index.mjs",
|
|
23
23
|
"module": "dist/index.mjs",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@agentproto/driver-agent-cli": "0.
|
|
46
|
+
"@agentproto/driver-agent-cli": "1.0.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/node": "^25.6.2",
|