@agentknight/client 0.9.57 → 0.9.61

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.
@@ -13,7 +13,6 @@ import { join, resolve } from "node:path";
13
13
  import { z } from "zod";
14
14
  import { DataDirectoryLease } from "@agentknight/sdk/runtime";
15
15
  import {
16
- PEER_CHAT_TIMEOUT_MS,
17
16
  PeerChatRequestSchema,
18
17
  PeerChatResultSchema
19
18
  } from "@agentknight/sdk/runtime";
@@ -54,7 +53,6 @@ var ResponseSchema = z.discriminatedUnion("ok", [
54
53
  var MAX_MESSAGE_BYTES = 32 * 1024;
55
54
  var MAX_PEER_REQUEST_BYTES = 128 * 1024;
56
55
  var MAX_PEER_RESPONSE_BYTES = 2 * 1024 * 1024;
57
- var PEER_RESPONSE_BUFFER_MS = 5e3;
58
56
  var MAX_SOCKET_PATH_BYTES = 103;
59
57
  var RuntimeCommandError = class extends Error {
60
58
  };
@@ -90,7 +88,7 @@ async function requestPeerChat(descriptor, request, signal) {
90
88
  return exchangeRuntime(descriptor, { token: descriptor.token, command: "peer-chat", payload: payload.data }, (response) => {
91
89
  if (response.reply === void 0) throw new Error("Agent returned no peer-chat reply.");
92
90
  return response.reply;
93
- }, PEER_CHAT_TIMEOUT_MS + PEER_RESPONSE_BUFFER_MS, MAX_PEER_RESPONSE_BYTES, signal);
91
+ }, 0, MAX_PEER_RESPONSE_BYTES, signal);
94
92
  }
95
93
  function exchangeRuntime(descriptor, request, select, timeoutMs, maxResponseBytes, signal) {
96
94
  signal?.throwIfAborted();
@@ -99,7 +97,6 @@ function exchangeRuntime(descriptor, request, select, timeoutMs, maxResponseByte
99
97
  let data = "";
100
98
  let completed = false;
101
99
  const cleanup = () => {
102
- clearTimeout(timeout);
103
100
  signal?.removeEventListener("abort", abort);
104
101
  };
105
102
  const fail = (error) => {
@@ -111,8 +108,7 @@ function exchangeRuntime(descriptor, request, select, timeoutMs, maxResponseByte
111
108
  };
112
109
  const abort = () => fail(signal?.reason instanceof Error ? signal.reason : new Error("Peer chat cancelled."));
113
110
  const onTimeout = () => fail(new Error(`Agent ${request.command} request timed out.`));
114
- const timeout = request.command === "peer-chat" ? setTimeout(onTimeout, timeoutMs) : void 0;
115
- if (request.command !== "peer-chat") socket.setTimeout(timeoutMs, onTimeout);
111
+ socket.setTimeout(timeoutMs, onTimeout);
116
112
  signal?.addEventListener("abort", abort, { once: true });
117
113
  socket.on("error", fail);
118
114
  socket.on("connect", () => socket.write(`${JSON.stringify(request)}
@@ -155,14 +151,12 @@ async function runPeerChat(handler, request, controller) {
155
151
  abort = () => reject(signal.reason);
156
152
  signal.addEventListener("abort", abort, { once: true });
157
153
  });
158
- const timeout = setTimeout(() => controller.abort(new Error("Peer chat timed out.")), PEER_CHAT_TIMEOUT_MS);
159
154
  try {
160
155
  return await Promise.race([Promise.resolve().then(() => {
161
156
  signal.throwIfAborted();
162
157
  return handler(request, signal);
163
158
  }), cancelled]);
164
159
  } finally {
165
- clearTimeout(timeout);
166
160
  signal.removeEventListener("abort", abort);
167
161
  }
168
162
  }
@@ -240,7 +234,7 @@ async function startRuntimeControl(options) {
240
234
  if (options.runPeerChat === void 0) throw new Error("Peer chat is not available on this Agent.");
241
235
  const controller = new AbortController();
242
236
  peerConnections.set(socket, controller);
243
- socket.setTimeout(PEER_CHAT_TIMEOUT_MS + PEER_RESPONSE_BUFFER_MS);
237
+ socket.setTimeout(0);
244
238
  try {
245
239
  reply = PeerChatResultSchema.parse(await runPeerChat(options.runPeerChat, request.payload, controller));
246
240
  } finally {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  SESSION_TIMELINE_PAGE_SIZE
4
- } from "./chunk-RSYKNJHT.js";
4
+ } from "./chunk-GH26GIXM.js";
5
5
 
6
6
  // src/local-sessions.ts
7
7
  import { supportsAgentSelection, codingAgentPresentation } from "@agentknight/sdk";
@@ -7,7 +7,7 @@ import {
7
7
  requestPeerChat,
8
8
  requestRuntime,
9
9
  startRuntimeControl
10
- } from "./chunk-WZIU4HVH.js";
10
+ } from "./chunk-WMAAFZJ3.js";
11
11
  import "./chunk-SPZWIFFP.js";
12
12
  export {
13
13
  RuntimeCommandError,