@amaster.ai/employee-runtime-connector 0.1.0-beta.39 → 0.1.0-beta.40
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.
|
@@ -4127,6 +4127,43 @@ function buildRuntimeConnectorAuthHeaders(config) {
|
|
|
4127
4127
|
if (config.token) return { Authorization: `Bearer ${config.token}` };
|
|
4128
4128
|
return {};
|
|
4129
4129
|
}
|
|
4130
|
+
var RESPONSE_BODY_PREVIEW_LIMIT = 256;
|
|
4131
|
+
function summarizeResponseBody(text) {
|
|
4132
|
+
const redacted = String(text).replace(/\bBearer\s+[A-Za-z0-9._~+/-]{8,}/gi, "Bearer <redacted>").replace(
|
|
4133
|
+
/(["']?(?:access[_-]?token|api[_-]?key|connector[_-]?token|secret)["']?\s*[:=]\s*["']?)[^"',\s}]+/gi,
|
|
4134
|
+
"$1<redacted>"
|
|
4135
|
+
).replace(/\s+/g, " ").trim();
|
|
4136
|
+
if (redacted.length <= RESPONSE_BODY_PREVIEW_LIMIT) return redacted;
|
|
4137
|
+
return `${redacted.slice(0, RESPONSE_BODY_PREVIEW_LIMIT)}\u2026`;
|
|
4138
|
+
}
|
|
4139
|
+
function describeRuntimeConnectorResponse(responseContentType, text) {
|
|
4140
|
+
const contentType = responseContentType || "unknown";
|
|
4141
|
+
const preview = summarizeResponseBody(text);
|
|
4142
|
+
return `content-type=${contentType}, body-length=${Buffer.byteLength(text)}, body-preview=${JSON.stringify(preview)}`;
|
|
4143
|
+
}
|
|
4144
|
+
function parseRuntimeConnectorResponse(res, method, path, text) {
|
|
4145
|
+
const responseContentType = res.headers.get("content-type") || null;
|
|
4146
|
+
if (!res.ok) {
|
|
4147
|
+
const responseDescription = describeRuntimeConnectorResponse(responseContentType, text);
|
|
4148
|
+
const error = new Error(`${method} ${path} returned HTTP ${res.status}: ${responseDescription}`);
|
|
4149
|
+
error.httpStatus = res.status;
|
|
4150
|
+
error.responseContentType = responseContentType;
|
|
4151
|
+
throw error;
|
|
4152
|
+
}
|
|
4153
|
+
if (!text) return null;
|
|
4154
|
+
try {
|
|
4155
|
+
return JSON.parse(text);
|
|
4156
|
+
} catch (cause) {
|
|
4157
|
+
const responseDescription = describeRuntimeConnectorResponse(responseContentType, text);
|
|
4158
|
+
const error = new Error(
|
|
4159
|
+
`${method} ${path} returned HTTP ${res.status} with invalid JSON: ${responseDescription}`,
|
|
4160
|
+
{ cause }
|
|
4161
|
+
);
|
|
4162
|
+
error.httpStatus = res.status;
|
|
4163
|
+
error.responseContentType = responseContentType;
|
|
4164
|
+
throw error;
|
|
4165
|
+
}
|
|
4166
|
+
}
|
|
4130
4167
|
async function postRuntimeConnectorJson(config, path, payload, options = {}) {
|
|
4131
4168
|
const res = await fetch(`${config.serverUrl}${path}`, {
|
|
4132
4169
|
method: "POST",
|
|
@@ -4138,13 +4175,7 @@ async function postRuntimeConnectorJson(config, path, payload, options = {}) {
|
|
|
4138
4175
|
signal: options.signal
|
|
4139
4176
|
});
|
|
4140
4177
|
const text = await res.text();
|
|
4141
|
-
|
|
4142
|
-
if (!res.ok) {
|
|
4143
|
-
const error = new Error(`POST ${path} returned HTTP ${res.status}: ${text}`);
|
|
4144
|
-
error.httpStatus = res.status;
|
|
4145
|
-
throw error;
|
|
4146
|
-
}
|
|
4147
|
-
return body;
|
|
4178
|
+
return parseRuntimeConnectorResponse(res, "POST", path, text);
|
|
4148
4179
|
}
|
|
4149
4180
|
async function postRuntimeConnectorBytes(config, path, body, headers = {}) {
|
|
4150
4181
|
if (!Buffer.isBuffer(body)) throw new TypeError("Runtime connector byte upload body must be a Buffer");
|
|
@@ -4158,13 +4189,7 @@ async function postRuntimeConnectorBytes(config, path, body, headers = {}) {
|
|
|
4158
4189
|
body
|
|
4159
4190
|
});
|
|
4160
4191
|
const text = await res.text();
|
|
4161
|
-
|
|
4162
|
-
if (!res.ok) {
|
|
4163
|
-
const error = new Error(`POST ${path} returned HTTP ${res.status}: ${text}`);
|
|
4164
|
-
error.httpStatus = res.status;
|
|
4165
|
-
throw error;
|
|
4166
|
-
}
|
|
4167
|
-
return response;
|
|
4192
|
+
return parseRuntimeConnectorResponse(res, "POST", path, text);
|
|
4168
4193
|
}
|
|
4169
4194
|
function retryableRuntimeConnectorPost(error) {
|
|
4170
4195
|
const status = Number(error?.httpStatus);
|
|
@@ -5613,7 +5638,7 @@ function readWorkspaceStatus(cwd, opts = {}) {
|
|
|
5613
5638
|
}
|
|
5614
5639
|
|
|
5615
5640
|
// src/amaster-runtime-daemon.mjs
|
|
5616
|
-
var CONNECTOR_VERSION = "0.1.0-beta.
|
|
5641
|
+
var CONNECTOR_VERSION = "0.1.0-beta.40";
|
|
5617
5642
|
var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
|
|
5618
5643
|
var MAX_CHECKPOINT_BYTES = 20 * 1024 * 1024;
|
|
5619
5644
|
var CHECKPOINT_TTL_MS = 24 * 60 * 60 * 1e3;
|
package/dist/amaster-runtime.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { dirname, join, resolve } from "node:path";
|
|
|
5
5
|
import { homedir, hostname } from "node:os";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
|
|
8
|
-
const CONNECTOR_VERSION = "0.1.0-beta.
|
|
8
|
+
const CONNECTOR_VERSION = "0.1.0-beta.40";
|
|
9
9
|
|
|
10
10
|
const CAPABILITIES = [
|
|
11
11
|
"remote_registration",
|