@agent-relay/utils 2.0.31 → 2.0.32

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.
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var client_helpers_exports = {};
20
+ __export(client_helpers_exports, {
21
+ createRequestEnvelope: () => createRequestEnvelope,
22
+ createRequestHandler: () => createRequestHandler,
23
+ generateRequestId: () => generateRequestId,
24
+ handleResponse: () => handleResponse,
25
+ isMatchingResponse: () => isMatchingResponse,
26
+ toReleaseResult: () => toReleaseResult,
27
+ toSpawnResult: () => toSpawnResult
28
+ });
29
+ module.exports = __toCommonJS(client_helpers_exports);
30
+ var import_node_net = require("node:net");
31
+ var import_node_crypto = require("node:crypto");
32
+ var import_protocol = require("@agent-relay/protocol");
33
+ function isMatchingResponse(response, requestId, correlationId) {
34
+ const responsePayload = response.payload;
35
+ const ackPayload = response.type === "ACK" ? response.payload : null;
36
+ return response.id === requestId || responsePayload?.replyTo === requestId || !!correlationId && (responsePayload?.correlationId === correlationId || ackPayload?.correlationId === correlationId);
37
+ }
38
+ function handleResponse(response, resolve, reject) {
39
+ const responsePayload = response.payload;
40
+ if (response.type === "ERROR") {
41
+ reject(
42
+ new Error(responsePayload?.message || responsePayload?.code || "Unknown error")
43
+ );
44
+ } else if (response.type === "ACK" || response.type === "SPAWN_RESULT" || response.type === "RELEASE_RESULT") {
45
+ resolve(response.payload);
46
+ } else if (responsePayload?.error && !responsePayload?.success) {
47
+ reject(new Error(responsePayload.error));
48
+ } else {
49
+ resolve(response.payload);
50
+ }
51
+ }
52
+ function createRequestEnvelope(type, payload, requestId, options) {
53
+ const envelope = {
54
+ v: import_protocol.PROTOCOL_VERSION,
55
+ type,
56
+ id: requestId,
57
+ ts: Date.now(),
58
+ payload,
59
+ from: options?.envelopeProps?.from,
60
+ to: options?.envelopeProps?.to
61
+ };
62
+ if (options?.payloadMeta) {
63
+ envelope.payload_meta = options.payloadMeta;
64
+ }
65
+ return envelope;
66
+ }
67
+ function toSpawnResult(payload) {
68
+ return {
69
+ success: payload.success,
70
+ error: payload.error,
71
+ pid: payload.pid,
72
+ name: payload.name
73
+ };
74
+ }
75
+ function toReleaseResult(payload) {
76
+ return {
77
+ success: payload.success,
78
+ error: payload.error,
79
+ name: payload.name
80
+ };
81
+ }
82
+ function createRequestHandler(socketPath, envelope, options) {
83
+ return new Promise((resolve, reject) => {
84
+ const correlationId = options.payloadMeta?.sync?.correlationId;
85
+ let timedOut = false;
86
+ const parser = new import_protocol.FrameParser();
87
+ parser.setLegacyMode(true);
88
+ const socket = (0, import_node_net.createConnection)(socketPath);
89
+ const timeoutId = setTimeout(() => {
90
+ timedOut = true;
91
+ socket.destroy();
92
+ reject(new Error(`Request timeout after ${options.timeout}ms`));
93
+ }, options.timeout);
94
+ socket.on("connect", () => {
95
+ socket.write((0, import_protocol.encodeFrameLegacy)(envelope));
96
+ });
97
+ socket.on("data", (data) => {
98
+ if (timedOut) return;
99
+ const frames = parser.push(data);
100
+ for (const response of frames) {
101
+ if (isMatchingResponse(response, envelope.id, correlationId)) {
102
+ clearTimeout(timeoutId);
103
+ socket.end();
104
+ handleResponse(response, resolve, reject);
105
+ return;
106
+ }
107
+ }
108
+ });
109
+ socket.on("error", (err) => {
110
+ clearTimeout(timeoutId);
111
+ reject(err);
112
+ });
113
+ });
114
+ }
115
+ function generateRequestId(prefix = "") {
116
+ return `${prefix}${Date.now().toString(36)}-${(0, import_node_crypto.randomUUID)().slice(0, 8)}`;
117
+ }
118
+ // Annotate the CommonJS export names for ESM import in node:
119
+ 0 && (module.exports = {
120
+ createRequestEnvelope,
121
+ createRequestHandler,
122
+ generateRequestId,
123
+ handleResponse,
124
+ isMatchingResponse,
125
+ toReleaseResult,
126
+ toSpawnResult
127
+ });
package/dist/cjs/index.js CHANGED
@@ -24,6 +24,7 @@ __reExport(index_exports, require("./update-checker.js"), module.exports);
24
24
  __reExport(index_exports, require("./error-tracking.js"), module.exports);
25
25
  __reExport(index_exports, require("./model-mapping.js"), module.exports);
26
26
  __reExport(index_exports, require("./relay-pty-path.js"), module.exports);
27
+ __reExport(index_exports, require("./client-helpers.js"), module.exports);
27
28
  // Annotate the CommonJS export names for ESM import in node:
28
29
  0 && (module.exports = {
29
30
  ...require("./name-generator.js"),
@@ -34,5 +35,6 @@ __reExport(index_exports, require("./relay-pty-path.js"), module.exports);
34
35
  ...require("./update-checker.js"),
35
36
  ...require("./error-tracking.js"),
36
37
  ...require("./model-mapping.js"),
37
- ...require("./relay-pty-path.js")
38
+ ...require("./relay-pty-path.js"),
39
+ ...require("./client-helpers.js")
38
40
  });
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Shared client helpers for SDK and MCP implementations
3
+ *
4
+ * This module provides common request/response handling and type aliases
5
+ * to ensure SDK and MCP clients stay in lockstep and avoid inconsistencies.
6
+ */
7
+ import { type Envelope, type MessageType, type SpawnResultPayload, type ReleaseResultPayload } from '@agent-relay/protocol';
8
+ /**
9
+ * Common return type aliases to ensure consistency between SDK and MCP
10
+ */
11
+ export type SpawnResult = {
12
+ success: boolean;
13
+ error?: string;
14
+ pid?: number;
15
+ name?: string;
16
+ };
17
+ export type ReleaseResult = {
18
+ success: boolean;
19
+ error?: string;
20
+ name?: string;
21
+ };
22
+ /**
23
+ * Options for request/response operations
24
+ */
25
+ export interface RequestOptions {
26
+ /** Custom timeout in milliseconds */
27
+ timeoutMs?: number;
28
+ /** Payload metadata (for sync operations) */
29
+ payloadMeta?: {
30
+ sync?: {
31
+ blocking?: boolean;
32
+ correlationId?: string;
33
+ timeoutMs?: number;
34
+ };
35
+ };
36
+ /** Envelope properties (from/to) */
37
+ envelopeProps?: {
38
+ from?: string;
39
+ to?: string;
40
+ };
41
+ }
42
+ /**
43
+ * Response matching logic for request/response operations
44
+ */
45
+ export declare function isMatchingResponse(response: Envelope, requestId: string, correlationId?: string): boolean;
46
+ /**
47
+ * Handle response resolution/rejection logic
48
+ */
49
+ export declare function handleResponse<T>(response: Envelope, resolve: (value: T) => void, reject: (error: Error) => void): void;
50
+ /**
51
+ * Create a request envelope
52
+ */
53
+ export declare function createRequestEnvelope(type: MessageType, payload: Record<string, unknown>, requestId: string, options?: RequestOptions): Envelope;
54
+ /**
55
+ * Convert SpawnResultPayload to SpawnResult
56
+ */
57
+ export declare function toSpawnResult(payload: SpawnResultPayload): SpawnResult;
58
+ /**
59
+ * Convert ReleaseResultPayload to ReleaseResult
60
+ */
61
+ export declare function toReleaseResult(payload: ReleaseResultPayload): ReleaseResult;
62
+ /**
63
+ * Create a request/response handler using a socket connection
64
+ * This is the core logic shared between SDK and MCP clients
65
+ */
66
+ export declare function createRequestHandler<T>(socketPath: string, envelope: Envelope, options: RequestOptions & {
67
+ timeout: number;
68
+ }): Promise<T>;
69
+ /**
70
+ * Generate a unique request ID
71
+ */
72
+ export declare function generateRequestId(prefix?: string): string;
73
+ //# sourceMappingURL=client-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-helpers.d.ts","sourceRoot":"","sources":["../src/client-helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,WAAW,EAEhB,KAAK,kBAAkB,EAC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AChC,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,cAAc,GACvB,QAAQ,CAiBV;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,kBAAkB,GAAG,WAAW,CAOtE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CAM5E;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EACpC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,cAAc,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GAC5C,OAAO,CAAC,CAAC,CAAC,CAsCZ;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,SAAK,GAAG,MAAM,CAErD"}
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Shared client helpers for SDK and MCP implementations
3
+ *
4
+ * This module provides common request/response handling and type aliases
5
+ * to ensure SDK and MCP clients stay in lockstep and avoid inconsistencies.
6
+ */
7
+ import { createConnection } from 'node:net';
8
+ import { randomUUID } from 'node:crypto';
9
+ import { encodeFrameLegacy, FrameParser, PROTOCOL_VERSION, } from '@agent-relay/protocol';
10
+ /**
11
+ * Response matching logic for request/response operations
12
+ */
13
+ export function isMatchingResponse(response, requestId, correlationId) {
14
+ const responsePayload = response.payload;
15
+ // For ACK messages, match by correlationId
16
+ const ackPayload = response.type === 'ACK' ? response.payload : null;
17
+ return (response.id === requestId ||
18
+ responsePayload?.replyTo === requestId ||
19
+ (!!correlationId &&
20
+ (responsePayload?.correlationId === correlationId ||
21
+ ackPayload?.correlationId === correlationId)));
22
+ }
23
+ /**
24
+ * Handle response resolution/rejection logic
25
+ */
26
+ export function handleResponse(response, resolve, reject) {
27
+ const responsePayload = response.payload;
28
+ if (response.type === 'ERROR') {
29
+ reject(new Error(responsePayload?.message || responsePayload?.code || 'Unknown error'));
30
+ }
31
+ else if (response.type === 'ACK' ||
32
+ response.type === 'SPAWN_RESULT' ||
33
+ response.type === 'RELEASE_RESULT') {
34
+ // ACK, SPAWN_RESULT, and RELEASE_RESULT are valid responses even if they contain error info
35
+ // For ACK, the error is in response field; for spawn/release, it's in error field
36
+ resolve(response.payload);
37
+ }
38
+ else if (responsePayload?.error && !responsePayload?.success) {
39
+ // For other response types, reject if there's an error and no success flag
40
+ reject(new Error(responsePayload.error));
41
+ }
42
+ else {
43
+ resolve(response.payload);
44
+ }
45
+ }
46
+ /**
47
+ * Create a request envelope
48
+ */
49
+ export function createRequestEnvelope(type, payload, requestId, options) {
50
+ const envelope = {
51
+ v: PROTOCOL_VERSION,
52
+ type,
53
+ id: requestId,
54
+ ts: Date.now(),
55
+ payload,
56
+ from: options?.envelopeProps?.from,
57
+ to: options?.envelopeProps?.to,
58
+ };
59
+ if (options?.payloadMeta) {
60
+ envelope.payload_meta =
61
+ options.payloadMeta;
62
+ }
63
+ return envelope;
64
+ }
65
+ /**
66
+ * Convert SpawnResultPayload to SpawnResult
67
+ */
68
+ export function toSpawnResult(payload) {
69
+ return {
70
+ success: payload.success,
71
+ error: payload.error,
72
+ pid: payload.pid,
73
+ name: payload.name,
74
+ };
75
+ }
76
+ /**
77
+ * Convert ReleaseResultPayload to ReleaseResult
78
+ */
79
+ export function toReleaseResult(payload) {
80
+ return {
81
+ success: payload.success,
82
+ error: payload.error,
83
+ name: payload.name,
84
+ };
85
+ }
86
+ /**
87
+ * Create a request/response handler using a socket connection
88
+ * This is the core logic shared between SDK and MCP clients
89
+ */
90
+ export function createRequestHandler(socketPath, envelope, options) {
91
+ return new Promise((resolve, reject) => {
92
+ const correlationId = options.payloadMeta?.sync?.correlationId;
93
+ let timedOut = false;
94
+ const parser = new FrameParser();
95
+ parser.setLegacyMode(true); // Use legacy 4-byte header format
96
+ const socket = createConnection(socketPath);
97
+ const timeoutId = setTimeout(() => {
98
+ timedOut = true;
99
+ socket.destroy();
100
+ reject(new Error(`Request timeout after ${options.timeout}ms`));
101
+ }, options.timeout);
102
+ socket.on('connect', () => {
103
+ socket.write(encodeFrameLegacy(envelope));
104
+ });
105
+ socket.on('data', (data) => {
106
+ if (timedOut)
107
+ return;
108
+ const frames = parser.push(data);
109
+ for (const response of frames) {
110
+ if (isMatchingResponse(response, envelope.id, correlationId)) {
111
+ clearTimeout(timeoutId);
112
+ socket.end();
113
+ handleResponse(response, resolve, reject);
114
+ return;
115
+ }
116
+ }
117
+ });
118
+ socket.on('error', (err) => {
119
+ clearTimeout(timeoutId);
120
+ reject(err);
121
+ });
122
+ });
123
+ }
124
+ /**
125
+ * Generate a unique request ID
126
+ */
127
+ export function generateRequestId(prefix = '') {
128
+ return `${prefix}${Date.now().toString(36)}-${randomUUID().slice(0, 8)}`;
129
+ }
130
+ //# sourceMappingURL=client-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-helpers.js","sourceRoot":"","sources":["../src/client-helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAe,MAAM,UAAU,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAML,iBAAiB,EACjB,WAAW,EACX,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAuC/B;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,QAAkB,EAClB,SAAiB,EACjB,aAAsB;IAEtB,MAAM,eAAe,GAAG,QAAQ,CAAC,OAGhC,CAAC;IAEF,2CAA2C;IAC3C,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAE,QAAQ,CAAC,OAAsB,CAAC,CAAC,CAAC,IAAI,CAAC;IAErF,OAAO,CACL,QAAQ,CAAC,EAAE,KAAK,SAAS;QACzB,eAAe,EAAE,OAAO,KAAK,SAAS;QACtC,CAAC,CAAC,CAAC,aAAa;YACd,CAAC,eAAe,EAAE,aAAa,KAAK,aAAa;gBAC/C,UAAU,EAAE,aAAa,KAAK,aAAa,C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AM,CAAC,KAAK,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;YACzB,IAAI,QAAQ;gBAAE,OAAO;YAErB,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACjC,KAAK,MAAM,QAAQ,IAAI,MAAM,EAAE,CAAC;gBAC9B,IAAI,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,EAAE,aAAa,CAAC,EAAE,CAAC;oBAC7D,YAAY,CAAC,SAAS,CAAC,CAAC;oBACxB,MAAM,CAAC,GAAG,EAAE,CAAC;oBACb,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;oBAC1C,OAAO;gBACT,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;YACzB,YAAY,CAAC,SAAS,CAAC,CAAC;YACxB,MAAM,CAAC,GAAG,CAAC,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAM,GAAG,EAAE;IAC3C,OAAO,GAAG,MAAM,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,UAAU,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;AAC3E,CAAC"}
package/dist/index.d.ts CHANGED
@@ -7,4 +7,5 @@ export * from './update-checker.js';
7
7
  export * from './error-tracking.js';
8
8
  export * from './model-mapping.js';
9
9
  export * from './relay-pty-path.js';
10
+ export * from './client-helpers.js';
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -7,4 +7,5 @@ export * from './update-checker.js';
7
7
  export * from './error-tracking.js';
8
8
  export * from './model-mapping.js';
9
9
  export * from './relay-pty-path.js';
10
+ export * from './client-helpers.js';
10
11
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-relay/utils",
3
- "version": "2.0.31",
3
+ "version": "2.0.32",
4
4
  "description": "Shared utilities for agent-relay: logging, name generation, command resolution, update checking",
5
5
  "type": "module",
6
6
  "main": "dist/cjs/index.js",
@@ -66,6 +66,12 @@
66
66
  "import": "./dist/relay-pty-path.js",
67
67
  "default": "./dist/cjs/relay-pty-path.js"
68
68
  },
69
+ "./client-helpers": {
70
+ "types": "./dist/client-helpers.d.ts",
71
+ "require": "./dist/cjs/client-helpers.js",
72
+ "import": "./dist/client-helpers.js",
73
+ "default": "./dist/cjs/client-helpers.js"
74
+ },
69
75
  "./package.json": "./package.json"
70
76
  },
71
77
  "files": [
@@ -88,6 +94,7 @@
88
94
  "vitest": "^3.2.4"
89
95
  },
90
96
  "dependencies": {
97
+ "@agent-relay/protocol": "2.0.32",
91
98
  "compare-versions": "^6.1.1"
92
99
  },
93
100
  "publishConfig": {