hermesdesk-agent 0.1.0-alpha.11 → 0.1.0-alpha.14

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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![CI](https://github.com/NKocur/hermesdesk-agent/actions/workflows/ci.yml/badge.svg)](https://github.com/NKocur/hermesdesk-agent/actions/workflows/ci.yml)
4
4
 
5
- **Windows alpha: 0.1.0-alpha.11.** Community client built on Pi; not affiliated with or endorsed by Earendil Works or Nous Research.
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.11.tgz`.
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.
@@ -70,7 +72,7 @@ Request sources are positional text, `--prompt-file PATH`, or piped UTF-8 text u
70
72
 
71
73
  `--output-format text` streams reply text to stdout and tool notices to stderr. `--output-format json` writes one final JSON object. `--output-format jsonl` streams `start`, `text`, `tool`, `tool_result`, `error` and `done` records; `--json` remains an alias for JSONL. There are no TUI escape sequences or progress spinners. The final result includes `ok`, `status`, `exitCode`, `session`, final/partial `text`, `stopReason`, per-job token `usage` and `durationMs`. Policy refusals appear in `blocked`. Model reasoning is not included in the output stream. Save results using normal shell redirection.
72
74
 
73
- Jobs save their conversations automatically. Use `--continue` for the newest conversation in the selected workspace, or `--session ID` for a specific conversation. History stays on the client computer. Profiles and generation overrides work as in interactive chat; `--max-requests N` bounds model requests for that job. `--timeout SECONDS` applies to an entire job after runtime startup, including tools; without it, the provider's own timeout still applies. Ctrl+C/SIGINT cancels work; SIGTERM cancels and exits. Cancellation does not undo completed actions.
75
+ Jobs save their conversations automatically. Use `--continue` for the newest conversation in the selected workspace, or `--session ID` for a specific conversation. History stays on the client computer. Profiles and generation overrides work as in interactive chat. Jobs have no fixed model-request count. `--timeout SECONDS` applies to an entire job after runtime startup, including tools; without it, the provider's own timeout still applies. Ctrl+C/SIGINT cancels work; SIGTERM cancels and exits. Cancellation does not undo completed actions.
74
76
 
75
77
  File changes are denied unless launched with `--approve-writes`. Shell commands are denied unless launched with `--approve-commands`; this explicitly authorizes model-generated commands with the launching account's permissions, including access outside the workspace. Shell execution has no OS sandbox. `--read-only` takes precedence over both options; protected file-tool paths remain blocked even when writes are pre-approved. Any policy refusal makes the final job status `blocked`, even if the model subsequently writes a response. Ordinary tool failures can be recovered from by the model.
76
78
 
@@ -154,7 +156,6 @@ hermesdesk.cmd config set maxTokens 131072
154
156
  hermesdesk.cmd config set temperature 0.7
155
157
  hermesdesk.cmd config set topP 0.95
156
158
  hermesdesk.cmd config set topK 20
157
- hermesdesk.cmd config set maxRequests 64
158
159
  ```
159
160
 
160
161
  Profiles: `fast` uses 32K with thinking off; `balanced` uses 64K with xhigh thinking; `extended` uses 131K with xhigh thinking. Thinking profiles use Qwen's recommended sampling (temperature 1, top-p .95, top-k 20). `thinkingBudget 0` is automatic. A positive budget is a ceiling, must be below `maxTokens`, and Strata may reduce it to preserve answer space. `maxTokens` includes **thinking plus the final answer**; the model can stop earlier.
@@ -168,12 +169,14 @@ hermesdesk.cmd run "Review this repository" --read-only --max-tokens 65536 --thi
168
169
 
169
170
  Fresh installations default to a 131K total cap with thinking off. Existing saved values are retained: use `config preset extended` to switch to the tested thinking profile. The server must support these limits; older gateways capped output at 8K. Pi's compaction reserves space for the configured output budget.
170
171
 
171
- Changes apply to the next launch. Context is client metadata, not a request to allocate more server context: keep it at or below the server's configured capacity. The updated gateway allows up to 131072 combined output tokens. Input, thinking and answer share the server context; the full 262K-thinking plus 131K-answer allowance in Qwen documentation assumes an extended 1M context. The default request budget is 64 per message and can be set from 1 to 512. Pi's in-chat settings are session-only in this version. Change the server using `hermesdesk connect --url https://your-server/v1`. HTTP is accepted only on loopback addresses.
172
+ Changes apply to the next launch. Context is client metadata, not a request to allocate more server context: keep it at or below the server's configured capacity. The updated gateway allows up to 131072 combined output tokens. Input, thinking and answer share the server context; the full 262K-thinking plus 131K-answer allowance in Qwen documentation assumes an extended 1M context. There is no per-message model-request cap. Legacy `maxRequests` values in saved configurations are ignored; remove the retired `--max-requests` option from scripts. Pi's in-chat settings are session-only in this version. Change the server using `hermesdesk connect --url https://your-server/v1`. HTTP is accepted only on loopback addresses.
172
173
 
173
174
  Windows uses its built-in `curl.exe` for model HTTP requests because the retained Cloudflare bot filter challenged Node fetch and a native Node follow-up request during testing. TLS verification stays enabled, redirects are not followed, credentials are sent through stdin rather than command-line arguments, and disconnects cancel the request. `doctor` checks the connection without loading the model. A browser challenge from zone-wide Bot Fight Mode cannot be solved by an API client; the server owner must configure API-compatible protection. Transport compatibility alone does not guarantee that every computer will be accepted. Cold Strata startup can still take minutes; the client cannot remove server warm-up costs. A Cloudflare 403 is a connection failure, not a model error.
174
175
 
175
176
  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
177
 
178
+ 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.
179
+
177
180
  ## Optional private Worker gateway
178
181
 
179
182
  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/bin/hermesdesk.js CHANGED
@@ -94,9 +94,9 @@ headless accepts JSON lines on stdin: prompt, abort, get_state, shutdown.
94
94
  Exit codes: 0 complete, 1 failure, 2 invalid input, 3 blocked, 4 output limit,
95
95
  124 timed out, 130 cancelled, 143 terminated.
96
96
  Settings: model, context, maxTokens (total thinking + answer), thinking,
97
- reasoningEffort (low|medium|xhigh), thinkingBudget (0=automatic), temperature, topP, topK, maxRequests.
97
+ reasoningEffort (low|medium|xhigh), thinkingBudget (0=automatic), temperature, topP, topK.
98
98
  Run overrides: --profile fast|balanced|extended --max-tokens N --thinking on|off
99
- --reasoning-effort low|medium|xhigh --thinking-budget N --max-requests N
99
+ --reasoning-effort low|medium|xhigh --thinking-budget N
100
100
  `;
101
101
  async function main() {
102
102
  const { values: v, positionals: p } = parseArgs({
@@ -104,7 +104,6 @@ async function main() {
104
104
  options: {
105
105
  profile: { type: "string" },
106
106
  "max-tokens": { type: "string" },
107
- "max-requests": { type: "string" },
108
107
  "prompt-file": { type: "string" },
109
108
  stdin: { type: "boolean" },
110
109
  timeout: { type: "string" },
@@ -361,12 +360,6 @@ async function main() {
361
360
  return;
362
361
  }
363
362
  const overrides = {};
364
- if (v["max-requests"] !== undefined)
365
- overrides.maxRequests = positiveInteger(
366
- v["max-requests"],
367
- "--max-requests",
368
- 512,
369
- );
370
363
  if (v.profile) Object.assign(overrides, profile(v.profile));
371
364
  if (v["max-tokens"] !== undefined)
372
365
  overrides.maxTokens = Number(v["max-tokens"]);
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "hermesdesk-agent",
3
- "version": "0.1.0-alpha.11",
3
+ "version": "0.1.0-alpha.14",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "hermesdesk-agent",
9
- "version": "0.1.0-alpha.11",
9
+ "version": "0.1.0-alpha.14",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@earendil-works/pi-coding-agent": "1.5.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hermesdesk-agent",
3
- "version": "0.1.0-alpha.11",
3
+ "version": "0.1.0-alpha.14",
4
4
  "description": "Pi-based terminal coding client for HermesDesk and Strata",
5
5
  "type": "module",
6
6
  "bin": {
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,8 +94,19 @@ export async function createRuntime({
93
94
  allowModelNetwork: false,
94
95
  refreshOnCreate: false,
95
96
  });
96
- const safeFetch = modelFetch(config.baseUrl, access);
97
- let requestCount = 0;
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
+ };
98
110
  modelRuntime.registerProvider("hermesdesk", {
99
111
  name: "HermesDesk / Strata",
100
112
  baseUrl: config.baseUrl,
@@ -119,15 +131,15 @@ export async function createRuntime({
119
131
  },
120
132
  ],
121
133
  streamSimple: (model, context, options) => {
134
+ transportFailure = undefined;
135
+ transportAttempts = 0;
122
136
  syncThinking();
123
- if (++requestCount > config.maxRequests)
124
- throw Error(
125
- "Request budget reached. Send another message to continue.",
126
- );
127
137
  return streamSimple(model, context, {
128
138
  ...options,
129
139
  fetch: safeFetch,
130
- maxRetries: 0,
140
+ // The SDK retries only before the response stream is opened.
141
+ // Keep whole-agent retries disabled so partial replies/tools are not replayed.
142
+ maxRetries: 2,
131
143
  timeoutMs: 1800000,
132
144
  maxTokens: config.maxTokens,
133
145
  onPayload: async (payload, m) => {
@@ -150,13 +162,15 @@ export async function createRuntime({
150
162
  const settingsManager = SettingsManager.inMemory({
151
163
  enableAnalytics: false,
152
164
  enableInstallTelemetry: false,
165
+ // SDK release notes are not HermesDesk release notes; keep them out of startup.
166
+ lastChangelogVersion: piVersion,
153
167
  packages: [],
154
168
  cacheWarming: "off",
155
169
  // HermesDesk draws its own header; skip Pi's resource listing at startup.
156
170
  quietStartup: "header",
157
171
  theme: themeSetting(),
158
172
  retry: { enabled: false },
159
- providerRetry: { maxRetries: 0, timeoutMs: 1800000 },
173
+ providerRetry: { maxRetries: 2, timeoutMs: 1800000 },
160
174
  compaction: {
161
175
  enabled: true,
162
176
  reserveTokens: Math.min(
@@ -245,10 +259,6 @@ export async function createRuntime({
245
259
  approveCommands,
246
260
  onPolicyBlock,
247
261
  readPermissions: permissions.read,
248
- maxRequests: config.maxRequests,
249
- onAgentStart: () => {
250
- requestCount = 0;
251
- },
252
262
  }),
253
263
  interfaceExtension({
254
264
  version: VERSION,
@@ -257,6 +267,10 @@ export async function createRuntime({
257
267
  permissionMode: permissions.display,
258
268
  read: syncThinking,
259
269
  discover: () => discover(config, token, access),
270
+ transportError: () =>
271
+ transportFailure
272
+ ? { message: transportFailure, attempts: transportAttempts }
273
+ : undefined,
260
274
  }),
261
275
  ],
262
276
  },
package/src/config.js CHANGED
@@ -2,7 +2,7 @@ import fs from "node:fs";
2
2
  import os from "node:os";
3
3
  import path from "node:path";
4
4
  import crypto from "node:crypto";
5
- export const VERSION = "0.1.0-alpha.11";
5
+ export const VERSION = "0.1.0-alpha.14";
6
6
  export const DEFAULTS = {
7
7
  baseUrl: null,
8
8
  model: null,
@@ -14,7 +14,6 @@ export const DEFAULTS = {
14
14
  temperature: 0.7,
15
15
  topP: 0.95,
16
16
  topK: 20,
17
- maxRequests: 64,
18
17
  };
19
18
  export function configHome() {
20
19
  return path.resolve(
@@ -58,7 +57,6 @@ export function validateConfig(input) {
58
57
  ["maxTokens", 1, 131072],
59
58
  ["thinkingBudget", 0, 131071],
60
59
  ["topK", 0, 1000],
61
- ["maxRequests", 1, 512],
62
60
  ])
63
61
  if (!Number.isInteger(c[k]) || c[k] < min || c[k] > max)
64
62
  throw Error(k + " must be an integer from " + min + " to " + max + ".");
package/src/policy.js CHANGED
@@ -63,24 +63,13 @@ export function policyExtension({
63
63
  approveCommands = false,
64
64
  onPolicyBlock = () => {},
65
65
  readPermissions = () => ({ readOnly, approveWrites, approveCommands }),
66
- maxRequests = 16,
67
- onAgentStart = () => {},
68
66
  }) {
69
67
  return (pi) => {
70
- let requests = 0,
71
- lastCall,
68
+ let lastCall,
72
69
  repeats = 0;
73
70
  pi.on("agent_start", () => {
74
- requests = 0;
75
71
  lastCall = undefined;
76
72
  repeats = 0;
77
- onAgentStart();
78
- });
79
- pi.on("before_provider_request", () => {
80
- if (++requests > maxRequests)
81
- throw Error(
82
- "Request budget reached. Continue with a new message if needed.",
83
- );
84
73
  });
85
74
  pi.on("tool_call", async (event, ctx) => {
86
75
  const block = (reason) => {
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
- const fail = () => {
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
- (child.exitCode ? " (curl " + child.exitCode + ")" : "") +
213
- ". Check the server address and connection.",
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.resume();
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();
@@ -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 errorMessage = friendlyError(message.errorMessage);
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
  }
@@ -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,