@amaster.ai/employee-runtime-connector 0.1.1-beta.259 → 0.1.1-beta.260
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/dist/amaster-runtime-daemon.mjs +32 -10
- package/dist/amaster-runtime.mjs +1 -1
- package/dist/templates/.mirrorx-preset-templates.json +2 -2
- package/dist/templates//346/257/217/345/221/250/347/216/260/351/207/221/345/277/253/347/205/247/346/250/241/346/235/277.xlsx +0 -0
- package/package.json +1 -1
|
@@ -83,6 +83,13 @@ function buildRuntimeConnectorAuthHeaders(config) {
|
|
|
83
83
|
}
|
|
84
84
|
var RESPONSE_BODY_PREVIEW_LIMIT = 256;
|
|
85
85
|
var BEST_EFFORT_POST_TIMEOUT_MS = 5e3;
|
|
86
|
+
var DEFAULT_RUNTIME_REQUEST_TIMEOUT_MS = 6e4;
|
|
87
|
+
function runtimeConnectorRequestSignal(config = {}, options = {}) {
|
|
88
|
+
const parsed = Number(options.timeoutMs ?? config.requestTimeoutMs ?? DEFAULT_RUNTIME_REQUEST_TIMEOUT_MS);
|
|
89
|
+
const timeoutMs = Number.isFinite(parsed) && parsed > 0 ? Math.max(1, Math.floor(parsed)) : DEFAULT_RUNTIME_REQUEST_TIMEOUT_MS;
|
|
90
|
+
const deadline = AbortSignal.timeout(timeoutMs);
|
|
91
|
+
return options.signal ? AbortSignal.any([options.signal, deadline]) : deadline;
|
|
92
|
+
}
|
|
86
93
|
function bestEffortPostTimeoutMs(value) {
|
|
87
94
|
const parsed = Number(value ?? BEST_EFFORT_POST_TIMEOUT_MS);
|
|
88
95
|
return Number.isFinite(parsed) && parsed > 0 ? Math.max(1, Math.floor(parsed)) : BEST_EFFORT_POST_TIMEOUT_MS;
|
|
@@ -137,7 +144,7 @@ async function postRuntimeConnectorJson(config, path, payload, options = {}) {
|
|
|
137
144
|
...buildRuntimeConnectorAuthHeaders(config)
|
|
138
145
|
},
|
|
139
146
|
body: JSON.stringify(payload),
|
|
140
|
-
signal: options
|
|
147
|
+
signal: runtimeConnectorRequestSignal(config, options)
|
|
141
148
|
});
|
|
142
149
|
const text3 = await res.text();
|
|
143
150
|
return parseRuntimeConnectorResponse(res, "POST", path, text3);
|
|
@@ -152,7 +159,7 @@ async function consumeRuntimeBrowserCredentialRef(config, connectorId, commandId
|
|
|
152
159
|
...buildRuntimeConnectorAuthHeaders(config)
|
|
153
160
|
},
|
|
154
161
|
body: JSON.stringify(grant),
|
|
155
|
-
signal: options
|
|
162
|
+
signal: runtimeConnectorRequestSignal(config, options)
|
|
156
163
|
});
|
|
157
164
|
const contentType = res.headers.get("content-type") ?? "";
|
|
158
165
|
const cacheControl = res.headers.get("cache-control") ?? "";
|
|
@@ -186,7 +193,7 @@ async function postRuntimeWebEvidence(config, connectorId, commandId, evidence,
|
|
|
186
193
|
options
|
|
187
194
|
);
|
|
188
195
|
}
|
|
189
|
-
async function postRuntimeConnectorBytes(config, path, body, headers = {}) {
|
|
196
|
+
async function postRuntimeConnectorBytes(config, path, body, headers = {}, options = {}) {
|
|
190
197
|
if (!Buffer.isBuffer(body)) throw new TypeError("Runtime connector byte upload body must be a Buffer");
|
|
191
198
|
const res = await fetch(`${config.serverUrl}${path}`, {
|
|
192
199
|
method: "POST",
|
|
@@ -195,7 +202,8 @@ async function postRuntimeConnectorBytes(config, path, body, headers = {}) {
|
|
|
195
202
|
"content-type": "application/octet-stream",
|
|
196
203
|
...buildRuntimeConnectorAuthHeaders(config)
|
|
197
204
|
},
|
|
198
|
-
body
|
|
205
|
+
body,
|
|
206
|
+
signal: runtimeConnectorRequestSignal(config, options)
|
|
199
207
|
});
|
|
200
208
|
const text3 = await res.text();
|
|
201
209
|
return parseRuntimeConnectorResponse(res, "POST", path, text3);
|
|
@@ -5349,6 +5357,7 @@ var amasterRuntimeConnectorPollCommandsSchema = external_exports.object({
|
|
|
5349
5357
|
limit: external_exports.number().int().min(1).max(50).default(1),
|
|
5350
5358
|
maxConcurrentCommands: external_exports.number().int().min(1).max(50).optional(),
|
|
5351
5359
|
maxConcurrentBusinessCommands: external_exports.number().int().min(1).max(3).optional(),
|
|
5360
|
+
maxConcurrentConversationCommands: external_exports.number().int().min(0).max(1).optional(),
|
|
5352
5361
|
leaseId: external_exports.string().trim().min(1).optional(),
|
|
5353
5362
|
leaseSeconds: external_exports.number().int().min(1).max(3600).default(60)
|
|
5354
5363
|
});
|
|
@@ -28894,8 +28903,7 @@ function normalizeRuntimeExecutionLane(value) {
|
|
|
28894
28903
|
return value === "conversation" ? "conversation" : "business";
|
|
28895
28904
|
}
|
|
28896
28905
|
function runtimeExecutionLaneForCapabilities(value, capabilities) {
|
|
28897
|
-
|
|
28898
|
-
return lane === "conversation" && !(Array.isArray(capabilities) && capabilities.includes("execution_lanes_v1")) ? "business" : lane;
|
|
28906
|
+
return normalizeRuntimeExecutionLane(value);
|
|
28899
28907
|
}
|
|
28900
28908
|
function localRuntimeCommandLimit(input) {
|
|
28901
28909
|
const businessLimit = Number.isInteger(input.businessLimit) && input.businessLimit > 0 ? Math.min(input.businessLimit, 3) : 1;
|
|
@@ -28903,6 +28911,7 @@ function localRuntimeCommandLimit(input) {
|
|
|
28903
28911
|
return Math.min(4, businessLimit + (supportsExecutionLanes ? 1 : 0));
|
|
28904
28912
|
}
|
|
28905
28913
|
function selectRuntimeCommandsWithinLaneLimits(input) {
|
|
28914
|
+
const supportsExecutionLanes = Array.isArray(input.capabilities) && input.capabilities.includes("execution_lanes_v1");
|
|
28906
28915
|
const businessLimit = Number.isInteger(input.businessLimit) && input.businessLimit > 0 ? Math.min(input.businessLimit, 3) : 1;
|
|
28907
28916
|
const totalLimit = Number.isInteger(input.totalLimit) && input.totalLimit > 0 ? Math.min(input.totalLimit, 4) : 1;
|
|
28908
28917
|
const counts = { business: 0, conversation: 0 };
|
|
@@ -28912,6 +28921,7 @@ function selectRuntimeCommandsWithinLaneLimits(input) {
|
|
|
28912
28921
|
const selected = [];
|
|
28913
28922
|
for (const command of Array.isArray(input.commands) ? input.commands : []) {
|
|
28914
28923
|
const lane = runtimeExecutionLaneForCapabilities(command?.executionLane, input.capabilities);
|
|
28924
|
+
if (lane === "conversation" && !supportsExecutionLanes) continue;
|
|
28915
28925
|
const total = counts.business + counts.conversation;
|
|
28916
28926
|
if (total >= totalLimit) continue;
|
|
28917
28927
|
if (lane === "business" && counts.business >= businessLimit) continue;
|
|
@@ -33697,6 +33707,9 @@ function text2(value) {
|
|
|
33697
33707
|
function number2(value) {
|
|
33698
33708
|
return Number.isSafeInteger(value) && value >= 0 ? value : null;
|
|
33699
33709
|
}
|
|
33710
|
+
function issueAttachmentsAreRequired(command, taskResourceInput) {
|
|
33711
|
+
return command?.executionLane === "conversation" || taskResourceInput?.kind === "attachment";
|
|
33712
|
+
}
|
|
33700
33713
|
function assertRequiredTaskAttachmentMaterialized(input, materialized) {
|
|
33701
33714
|
if (input?.kind !== "attachment") return;
|
|
33702
33715
|
if (input.state !== "prepared") throw new Error("required_attachment_not_prepared");
|
|
@@ -33718,7 +33731,7 @@ function assertRequiredTaskAttachmentMaterialized(input, materialized) {
|
|
|
33718
33731
|
}
|
|
33719
33732
|
|
|
33720
33733
|
// src/amaster-runtime-daemon.mjs
|
|
33721
|
-
var CONNECTOR_VERSION = "0.1.1-beta.
|
|
33734
|
+
var CONNECTOR_VERSION = "0.1.1-beta.260";
|
|
33722
33735
|
var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
|
|
33723
33736
|
var daemonRequire = createRequire2(import.meta.url);
|
|
33724
33737
|
var MAX_CHECKPOINT_BYTES = 20 * 1024 * 1024;
|
|
@@ -34802,7 +34815,10 @@ function heartbeatRequestsStop(body, command) {
|
|
|
34802
34815
|
return null;
|
|
34803
34816
|
}
|
|
34804
34817
|
function startActiveRunHeartbeats(config, command, abortController) {
|
|
34818
|
+
let inFlight = false;
|
|
34805
34819
|
const sendHeartbeat = () => {
|
|
34820
|
+
if (inFlight) return Promise.resolve();
|
|
34821
|
+
inFlight = true;
|
|
34806
34822
|
return heartbeat(config, { logMode: "compact" }).then((body) => {
|
|
34807
34823
|
const stopReason = heartbeatRequestsStop(body, command);
|
|
34808
34824
|
if (stopReason && !abortController.signal.aborted) {
|
|
@@ -34818,6 +34834,8 @@ function startActiveRunHeartbeats(config, command, abortController) {
|
|
|
34818
34834
|
const message = err instanceof Error ? err.message : String(err);
|
|
34819
34835
|
process.stderr.write(`AMaster daemon active-run heartbeat failed; continuing command execution: ${message}
|
|
34820
34836
|
`);
|
|
34837
|
+
}).finally(() => {
|
|
34838
|
+
inFlight = false;
|
|
34821
34839
|
});
|
|
34822
34840
|
};
|
|
34823
34841
|
sendHeartbeat();
|
|
@@ -37451,7 +37469,8 @@ async function runtimeApiJson(runtimeAuth, path) {
|
|
|
37451
37469
|
headers: {
|
|
37452
37470
|
Authorization: `Bearer ${apiKey}`,
|
|
37453
37471
|
...runId ? { "X-Paperclip-Run-Id": runId } : {}
|
|
37454
|
-
}
|
|
37472
|
+
},
|
|
37473
|
+
signal: runtimeConnectorRequestSignal()
|
|
37455
37474
|
});
|
|
37456
37475
|
const text3 = await res.text();
|
|
37457
37476
|
const body = text3 ? JSON.parse(text3) : null;
|
|
@@ -37484,7 +37503,8 @@ async function runtimeApiBuffer(runtimeAuth, path) {
|
|
|
37484
37503
|
headers: {
|
|
37485
37504
|
Authorization: `Bearer ${apiKey}`,
|
|
37486
37505
|
...runId ? { "X-Paperclip-Run-Id": runId } : {}
|
|
37487
|
-
}
|
|
37506
|
+
},
|
|
37507
|
+
signal: runtimeConnectorRequestSignal()
|
|
37488
37508
|
});
|
|
37489
37509
|
if (!res.ok) {
|
|
37490
37510
|
const text3 = await res.text();
|
|
@@ -38149,7 +38169,7 @@ async function executeRunCommand(config, command) {
|
|
|
38149
38169
|
try {
|
|
38150
38170
|
materializedAttachments = [...requiredArtifactInputs, ...await materializeIssueAttachments(config, command, workspace)];
|
|
38151
38171
|
} catch (err) {
|
|
38152
|
-
if (commandTaskResourceInput(command)
|
|
38172
|
+
if (issueAttachmentsAreRequired(command, commandTaskResourceInput(command))) throw err;
|
|
38153
38173
|
await ingestLog(config, command, "system", "warn", `Failed to materialize issue attachments: ${err instanceof Error ? err.message : String(err)}`, {
|
|
38154
38174
|
error: err instanceof Error ? err.message : String(err)
|
|
38155
38175
|
});
|
|
@@ -39264,6 +39284,7 @@ async function runOnce(config) {
|
|
|
39264
39284
|
limit: Math.max(1, availableSlots),
|
|
39265
39285
|
maxConcurrentCommands: maxConcurrentCommands(config),
|
|
39266
39286
|
maxConcurrentBusinessCommands: maxConcurrentBusinessCommands(config),
|
|
39287
|
+
maxConcurrentConversationCommands: oriaSessionActive ? 0 : 1,
|
|
39267
39288
|
leaseId,
|
|
39268
39289
|
leaseSeconds: config.leaseSeconds
|
|
39269
39290
|
});
|
|
@@ -39301,6 +39322,7 @@ async function dispatchAvailableCommands(config, options = {}) {
|
|
|
39301
39322
|
limit: Math.max(1, availableSlots),
|
|
39302
39323
|
maxConcurrentCommands: maxConcurrentCommands(config),
|
|
39303
39324
|
maxConcurrentBusinessCommands: maxConcurrentBusinessCommands(config),
|
|
39325
|
+
maxConcurrentConversationCommands: oriaSessionActive ? 0 : 1,
|
|
39304
39326
|
leaseId,
|
|
39305
39327
|
leaseSeconds: config.leaseSeconds
|
|
39306
39328
|
});
|
package/dist/amaster-runtime.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { homedir, hostname } from "node:os";
|
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
8
|
import { BUILD_SUPPORTED_CAPABILITIES } from "./amaster-runtime-daemon/capability-registry.mjs";
|
|
9
9
|
|
|
10
|
-
const CONNECTOR_VERSION = "0.1.1-beta.
|
|
10
|
+
const CONNECTOR_VERSION = "0.1.1-beta.260";
|
|
11
11
|
|
|
12
12
|
const CONFIG_KEY_MAP = new Map([
|
|
13
13
|
["server_url", "AMASTER_EMPLOYEE_SERVER_URL"],
|
|
@@ -118,8 +118,8 @@
|
|
|
118
118
|
},
|
|
119
119
|
{
|
|
120
120
|
"name": "每周现金快照模板.xlsx",
|
|
121
|
-
"bytes":
|
|
122
|
-
"sha256": "
|
|
121
|
+
"bytes": 89998,
|
|
122
|
+
"sha256": "bd191901d55bf0d93260766dbd7afcc2427c5645c2dd3c00ba87da43b33bac9d"
|
|
123
123
|
},
|
|
124
124
|
{
|
|
125
125
|
"name": "法定财务报表模板.xlsx",
|
|
Binary file
|