hermesdesk-agent 0.1.0-alpha.11 → 0.1.0-alpha.13
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 +6 -2
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/src/agent.js +26 -3
- package/src/config.js +1 -1
- package/src/transport.js +43 -5
- package/src/ui/extension.js +11 -1
- package/src/ui/interactive.js +3 -0
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/NKocur/hermesdesk-agent/actions/workflows/ci.yml)
|
|
4
4
|
|
|
5
|
-
**Windows alpha: 0.1.0-alpha.
|
|
5
|
+
**Windows alpha: 0.1.0-alpha.13.** Community client built on Pi; not affiliated with or endorsed by Earendil Works or Nous Research.
|
|
6
6
|
|
|
7
7
|
A running HermesDesk inference gateway is required. This client does not include a hosted model service, server access, or API keys.
|
|
8
8
|
|
|
@@ -18,7 +18,7 @@ hermesdesk.cmd connect
|
|
|
18
18
|
hermesdesk.cmd doctor
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
Alternatively, download and extract a Windows alpha bundle from [Releases](https://github.com/NKocur/hermesdesk-agent/releases) and run `Install Agent.cmd`. A tarball can also be installed directly with `npm.cmd install -g --ignore-scripts ./hermesdesk-agent-0.1.0-alpha.
|
|
21
|
+
Alternatively, download and extract a Windows alpha bundle from [Releases](https://github.com/NKocur/hermesdesk-agent/releases) and run `Install Agent.cmd`. A tarball can also be installed directly with `npm.cmd install -g --ignore-scripts ./hermesdesk-agent-0.1.0-alpha.13.tgz`.
|
|
22
22
|
|
|
23
23
|
There is no default server address. `connect` asks for your HTTPS model endpoint ending in `/v1`. When the server supports browser sign-in, it opens your browser: sign in to HermesDesk and approve the computer. The CLI receives a short-lived, single-use authorization code on a loopback listener and redeems it with PKCE over HTTPS, then discovers the model and saves the credentials encrypted. You do not copy passwords, API keys, or connection codes. The browser and CLI must be on the same computer. Use `--no-browser` to open the printed browser link yourself. On legacy servers without browser sign-in, the API-key setup remains available; `--manual` explicitly selects it. No server credentials are included in this package.
|
|
24
24
|
|
|
@@ -53,6 +53,8 @@ File tools are restricted to the chosen project and reject outside links and pro
|
|
|
53
53
|
|
|
54
54
|
The root project's `AGENTS.md` is included as instructions when it is an ordinary allowed file under 64 KiB. Existing global Pi/Claude settings are not imported. This first version does not synchronize HermesDesk chats, workspace memory or Hermes's skill-learning loop.
|
|
55
55
|
|
|
56
|
+
HermesDesk pins Pi as an SDK dependency. Automatic Pi update banners and startup changelog notices are suppressed; update this client with `npm.cmd install -g --ignore-scripts hermesdesk-agent@alpha`. The dependency is updated through a tested HermesDesk release.
|
|
57
|
+
|
|
56
58
|
## Headless jobs and automation
|
|
57
59
|
|
|
58
60
|
No terminal window is required. Sign in once with `hermesdesk connect` under the account that runs the job, or provide the existing session-only authentication environment variables. Authentication setup is never prompted during a job. Models still run on your configured HermesDesk/Strata server; tools work on the computer running the CLI.
|
|
@@ -174,6 +176,8 @@ Windows uses its built-in `curl.exe` for model HTTP requests because the retaine
|
|
|
174
176
|
|
|
175
177
|
Press **Ctrl+C** during a run to cancel generation or a running tool and return to the prompt. Pending file/command approvals are dismissed without granting permission. Cancellation does not undo completed actions. Escape also interrupts from the chat editor. When idle, Ctrl+C clears the input; pressing it twice quickly exits. Ctrl+D exits with an empty input.
|
|
176
178
|
|
|
179
|
+
Brief connection failures and transient HTTP errors get up to two retries before the response stream opens. Authentication, validation and request-size errors fail immediately. Once a response is streaming, an interrupted response stops the run; the client does not automatically replay it. Previously completed tool results stay in the conversation, so recovery before a later model response does not repeat those actions. Ctrl+C and job timeouts also cancel retry backoff. Retries can add HTTP attempts within a model-call round. Windows limits connection setup to 20 seconds and reports bounded curl diagnostics with credentials redacted if retries are exhausted. Whole-agent retries remain disabled.
|
|
180
|
+
|
|
177
181
|
## Optional private Worker gateway
|
|
178
182
|
|
|
179
183
|
The generic Worker source and deployment notes are in [worker/](worker/README.md). It requires Cloudflare Access authentication for its configured application and proxies only model discovery and chat completions to a single private VPC Service. It exposes no desktop tools, file APIs, application sessions, or arbitrary destinations. Website Bot Fight Mode can remain enabled when the agent uses a separate `workers.dev` endpoint. Workers VPC is beta; check Cloudflare's current availability, pricing and limits before adopting it.
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hermesdesk-agent",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.13",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "hermesdesk-agent",
|
|
9
|
-
"version": "0.1.0-alpha.
|
|
9
|
+
"version": "0.1.0-alpha.13",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@earendil-works/pi-coding-agent": "1.5.0",
|
package/package.json
CHANGED
package/src/agent.js
CHANGED
|
@@ -73,6 +73,7 @@ export async function createRuntime({
|
|
|
73
73
|
process.env.PI_CODING_AGENT_DIR = agentDir;
|
|
74
74
|
const {
|
|
75
75
|
ModelRuntime,
|
|
76
|
+
VERSION: piVersion,
|
|
76
77
|
SettingsManager,
|
|
77
78
|
SessionManager,
|
|
78
79
|
createAgentSessionServices,
|
|
@@ -93,7 +94,19 @@ export async function createRuntime({
|
|
|
93
94
|
allowModelNetwork: false,
|
|
94
95
|
refreshOnCreate: false,
|
|
95
96
|
});
|
|
96
|
-
const
|
|
97
|
+
const rawFetch = modelFetch(config.baseUrl, access);
|
|
98
|
+
let transportFailure,
|
|
99
|
+
transportAttempts = 0;
|
|
100
|
+
const safeFetch = async (input, init) => {
|
|
101
|
+
transportFailure = undefined;
|
|
102
|
+
transportAttempts++;
|
|
103
|
+
try {
|
|
104
|
+
return await rawFetch(input, init);
|
|
105
|
+
} catch (error) {
|
|
106
|
+
transportFailure = error.message;
|
|
107
|
+
throw error;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
97
110
|
let requestCount = 0;
|
|
98
111
|
modelRuntime.registerProvider("hermesdesk", {
|
|
99
112
|
name: "HermesDesk / Strata",
|
|
@@ -119,6 +132,8 @@ export async function createRuntime({
|
|
|
119
132
|
},
|
|
120
133
|
],
|
|
121
134
|
streamSimple: (model, context, options) => {
|
|
135
|
+
transportFailure = undefined;
|
|
136
|
+
transportAttempts = 0;
|
|
122
137
|
syncThinking();
|
|
123
138
|
if (++requestCount > config.maxRequests)
|
|
124
139
|
throw Error(
|
|
@@ -127,7 +142,9 @@ export async function createRuntime({
|
|
|
127
142
|
return streamSimple(model, context, {
|
|
128
143
|
...options,
|
|
129
144
|
fetch: safeFetch,
|
|
130
|
-
|
|
145
|
+
// The SDK retries only before the response stream is opened.
|
|
146
|
+
// Keep whole-agent retries disabled so partial replies/tools are not replayed.
|
|
147
|
+
maxRetries: 2,
|
|
131
148
|
timeoutMs: 1800000,
|
|
132
149
|
maxTokens: config.maxTokens,
|
|
133
150
|
onPayload: async (payload, m) => {
|
|
@@ -150,13 +167,15 @@ export async function createRuntime({
|
|
|
150
167
|
const settingsManager = SettingsManager.inMemory({
|
|
151
168
|
enableAnalytics: false,
|
|
152
169
|
enableInstallTelemetry: false,
|
|
170
|
+
// SDK release notes are not HermesDesk release notes; keep them out of startup.
|
|
171
|
+
lastChangelogVersion: piVersion,
|
|
153
172
|
packages: [],
|
|
154
173
|
cacheWarming: "off",
|
|
155
174
|
// HermesDesk draws its own header; skip Pi's resource listing at startup.
|
|
156
175
|
quietStartup: "header",
|
|
157
176
|
theme: themeSetting(),
|
|
158
177
|
retry: { enabled: false },
|
|
159
|
-
providerRetry: { maxRetries:
|
|
178
|
+
providerRetry: { maxRetries: 2, timeoutMs: 1800000 },
|
|
160
179
|
compaction: {
|
|
161
180
|
enabled: true,
|
|
162
181
|
reserveTokens: Math.min(
|
|
@@ -257,6 +276,10 @@ export async function createRuntime({
|
|
|
257
276
|
permissionMode: permissions.display,
|
|
258
277
|
read: syncThinking,
|
|
259
278
|
discover: () => discover(config, token, access),
|
|
279
|
+
transportError: () =>
|
|
280
|
+
transportFailure
|
|
281
|
+
? { message: transportFailure, attempts: transportAttempts }
|
|
282
|
+
: undefined,
|
|
260
283
|
}),
|
|
261
284
|
],
|
|
262
285
|
},
|
package/src/config.js
CHANGED
package/src/transport.js
CHANGED
|
@@ -133,6 +133,29 @@ function curlQuote(value) {
|
|
|
133
133
|
'"'
|
|
134
134
|
);
|
|
135
135
|
}
|
|
136
|
+
// Curl diagnostics can include configuration fragments: redact credentials before
|
|
137
|
+
// they reach persisted assistant errors or terminal output.
|
|
138
|
+
export function curlFailureDetail(stderr, request) {
|
|
139
|
+
let text = String(stderr || "");
|
|
140
|
+
for (const name of [
|
|
141
|
+
"authorization",
|
|
142
|
+
"cf-access-client-id",
|
|
143
|
+
"cf-access-client-secret",
|
|
144
|
+
]) {
|
|
145
|
+
const value = request.headers.get(name);
|
|
146
|
+
if (value) {
|
|
147
|
+
text = text.split(value).join("[redacted]");
|
|
148
|
+
if (name === "authorization") {
|
|
149
|
+
const token = value.replace(/^Bearer\s+/i, "");
|
|
150
|
+
if (token) text = text.split(token).join("[redacted]");
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return text
|
|
155
|
+
.replace(/[\r\n\t]+/g, " ")
|
|
156
|
+
.trim()
|
|
157
|
+
.slice(0, 600);
|
|
158
|
+
}
|
|
136
159
|
export async function curlFetch(input, init) {
|
|
137
160
|
const r = new Request(input, init);
|
|
138
161
|
r.signal.throwIfAborted();
|
|
@@ -167,6 +190,10 @@ export async function curlFetch(input, init) {
|
|
|
167
190
|
"--http1.1",
|
|
168
191
|
"--include",
|
|
169
192
|
"--compressed",
|
|
193
|
+
"--connect-timeout",
|
|
194
|
+
"20",
|
|
195
|
+
"--keepalive-time",
|
|
196
|
+
"30",
|
|
170
197
|
"--max-time",
|
|
171
198
|
"1800",
|
|
172
199
|
"--config",
|
|
@@ -205,12 +232,20 @@ export async function curlFetch(input, init) {
|
|
|
205
232
|
reject(error);
|
|
206
233
|
}
|
|
207
234
|
};
|
|
208
|
-
|
|
235
|
+
let stderr = "";
|
|
236
|
+
const fail = (event) => {
|
|
209
237
|
if (bodyClosed) return;
|
|
238
|
+
const code = typeof event === "number" ? event : child.exitCode;
|
|
239
|
+
const detail = curlFailureDetail(
|
|
240
|
+
stderr || (event instanceof Error ? event.message : ""),
|
|
241
|
+
r,
|
|
242
|
+
);
|
|
210
243
|
const error = new Error(
|
|
211
244
|
"Windows HTTP transport failed" +
|
|
212
|
-
(
|
|
213
|
-
|
|
245
|
+
(code ? " (curl " + code + ")" : "") +
|
|
246
|
+
(detail
|
|
247
|
+
? ". " + detail
|
|
248
|
+
: ". Check the server address and connection."),
|
|
214
249
|
);
|
|
215
250
|
finishBody(error);
|
|
216
251
|
if (!settled) {
|
|
@@ -219,7 +254,10 @@ export async function curlFetch(input, init) {
|
|
|
219
254
|
}
|
|
220
255
|
};
|
|
221
256
|
r.signal.addEventListener("abort", abort, { once: true });
|
|
222
|
-
child.stderr.
|
|
257
|
+
child.stderr.on("data", (chunk) => {
|
|
258
|
+
if (stderr.length < 4096)
|
|
259
|
+
stderr += chunk.toString("utf8").slice(0, 4096 - stderr.length);
|
|
260
|
+
});
|
|
223
261
|
child.on("error", fail);
|
|
224
262
|
child.stdin.on("error", () => {});
|
|
225
263
|
child.stdout.on("data", (chunk) => {
|
|
@@ -285,7 +323,7 @@ export async function curlFetch(input, init) {
|
|
|
285
323
|
r.signal.removeEventListener("abort", abort);
|
|
286
324
|
if (bodyClosed) return;
|
|
287
325
|
if (code === 0 && headersDone) finishBody();
|
|
288
|
-
else fail();
|
|
326
|
+
else fail(code);
|
|
289
327
|
});
|
|
290
328
|
if (r.signal.aborted) {
|
|
291
329
|
abort();
|
package/src/ui/extension.js
CHANGED
|
@@ -78,6 +78,7 @@ export function interfaceExtension({
|
|
|
78
78
|
permissionMode,
|
|
79
79
|
read,
|
|
80
80
|
discover,
|
|
81
|
+
transportError,
|
|
81
82
|
activity = createActivity(),
|
|
82
83
|
bell = process.env.HERMESDESK_BELL?.trim().toLowerCase() === "on"
|
|
83
84
|
? () => process.stdout.write("\x07")
|
|
@@ -186,7 +187,16 @@ export function interfaceExtension({
|
|
|
186
187
|
if (message.stopReason === "length" && tui(ctx))
|
|
187
188
|
ctx.ui.notify(truncationNotice(message, read()), "warning");
|
|
188
189
|
if (message.stopReason === "error" && message.errorMessage) {
|
|
189
|
-
const
|
|
190
|
+
const diagnostic = /^Connection error\.?$/i.test(
|
|
191
|
+
message.errorMessage.trim(),
|
|
192
|
+
)
|
|
193
|
+
? transportError?.()
|
|
194
|
+
: undefined;
|
|
195
|
+
const errorMessage = friendlyError(
|
|
196
|
+
diagnostic
|
|
197
|
+
? `${message.errorMessage} ${diagnostic.message} (${diagnostic.attempts} connection ${diagnostic.attempts === 1 ? "attempt" : "attempts"}).`
|
|
198
|
+
: message.errorMessage,
|
|
199
|
+
);
|
|
190
200
|
if (errorMessage !== message.errorMessage)
|
|
191
201
|
return { message: { ...message, errorMessage } };
|
|
192
202
|
}
|
package/src/ui/interactive.js
CHANGED
|
@@ -5,6 +5,9 @@ export async function createInteractiveMode(
|
|
|
5
5
|
runtime,
|
|
6
6
|
{ initialMessage, terminal } = {},
|
|
7
7
|
) {
|
|
8
|
+
// Pi is a pinned SDK dependency. Its standalone update command cannot update
|
|
9
|
+
// HermesDesk, so suppress the SDK's automatic release banner and changelog link.
|
|
10
|
+
process.env.PI_SKIP_VERSION_CHECK = "1";
|
|
8
11
|
const { InteractiveMode } = await loadPi();
|
|
9
12
|
return new InteractiveMode(runtime, {
|
|
10
13
|
verbose: false,
|