@amaster.ai/employee-runtime-connector 0.1.0-beta.23 → 0.1.0-beta.24
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.
|
@@ -3917,6 +3917,38 @@ function prepareRuntimeArtifactUploads(cwd, mcpToolResults) {
|
|
|
3917
3917
|
return [...uploads.values()];
|
|
3918
3918
|
}
|
|
3919
3919
|
|
|
3920
|
+
// src/amaster-runtime-daemon/runtime-artifact-ingest-queue.mjs
|
|
3921
|
+
function createRuntimeArtifactIngestQueue({ ingest, onError }) {
|
|
3922
|
+
const handledIntentIds = /* @__PURE__ */ new Set();
|
|
3923
|
+
const artifacts = [];
|
|
3924
|
+
let error = null;
|
|
3925
|
+
let queue = Promise.resolve();
|
|
3926
|
+
return {
|
|
3927
|
+
enqueue(results) {
|
|
3928
|
+
if (error) return;
|
|
3929
|
+
const pending = results.filter((result2) => {
|
|
3930
|
+
const intentId = readString(asRecord(result2).artifactIntent?.intentId);
|
|
3931
|
+
if (!intentId || handledIntentIds.has(intentId)) return false;
|
|
3932
|
+
handledIntentIds.add(intentId);
|
|
3933
|
+
return true;
|
|
3934
|
+
});
|
|
3935
|
+
if (pending.length === 0) return;
|
|
3936
|
+
queue = queue.then(async () => artifacts.push(...await ingest(pending))).catch((caught) => {
|
|
3937
|
+
error ??= caught;
|
|
3938
|
+
onError?.(caught);
|
|
3939
|
+
});
|
|
3940
|
+
},
|
|
3941
|
+
hasHandled(intentId) {
|
|
3942
|
+
return handledIntentIds.has(intentId);
|
|
3943
|
+
},
|
|
3944
|
+
async flush() {
|
|
3945
|
+
await queue;
|
|
3946
|
+
if (error) throw error;
|
|
3947
|
+
return [...artifacts];
|
|
3948
|
+
}
|
|
3949
|
+
};
|
|
3950
|
+
}
|
|
3951
|
+
|
|
3920
3952
|
// src/amaster-runtime-daemon/workspace-guard.mjs
|
|
3921
3953
|
import { createHash as createHash4 } from "node:crypto";
|
|
3922
3954
|
import { existsSync as existsSync5, mkdirSync as mkdirSync4, realpathSync as realpathSync2, statSync as statSync3 } from "node:fs";
|
|
@@ -4663,7 +4695,7 @@ function readWorkspaceStatus(cwd, opts = {}) {
|
|
|
4663
4695
|
}
|
|
4664
4696
|
|
|
4665
4697
|
// src/amaster-runtime-daemon.mjs
|
|
4666
|
-
var CONNECTOR_VERSION = "0.1.0-beta.
|
|
4698
|
+
var CONNECTOR_VERSION = "0.1.0-beta.24";
|
|
4667
4699
|
var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
|
|
4668
4700
|
var MAX_CHECKPOINT_BYTES = 20 * 1024 * 1024;
|
|
4669
4701
|
var CHECKPOINT_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -6160,7 +6192,7 @@ function redactProtectedText(value, protectedValues = []) {
|
|
|
6160
6192
|
}
|
|
6161
6193
|
return text;
|
|
6162
6194
|
}
|
|
6163
|
-
function createLiveOutputLogger(config, command, executorKind, protectedValues = []) {
|
|
6195
|
+
function createLiveOutputLogger(config, command, executorKind, protectedValues = [], onMcpToolResults = null) {
|
|
6164
6196
|
const buffers = { stdout: "", stderr: "" };
|
|
6165
6197
|
const displayCounts = { stdout: 0, stderr: 0, system: 0 };
|
|
6166
6198
|
const sourceCounts = { stdout: 0, stderr: 0 };
|
|
@@ -6258,7 +6290,11 @@ function createLiveOutputLogger(config, command, executorKind, protectedValues =
|
|
|
6258
6290
|
if (executorKind === "pi" && readString(asRecord(event).type) === "session") {
|
|
6259
6291
|
executorSessionId = readString(asRecord(event).sessionId ?? asRecord(event).id) ?? executorSessionId;
|
|
6260
6292
|
}
|
|
6261
|
-
if (executorKind === "pi" && event)
|
|
6293
|
+
if (executorKind === "pi" && event) {
|
|
6294
|
+
const results = piMcpToolResults(event);
|
|
6295
|
+
liveMcpToolResults.push(...results);
|
|
6296
|
+
if (results.length > 0) onMcpToolResults?.(results);
|
|
6297
|
+
}
|
|
6262
6298
|
let entry = null;
|
|
6263
6299
|
if (event && shouldPreserveExecutorJsonlForTranscript(executorKind, event)) {
|
|
6264
6300
|
entry = {
|
|
@@ -6609,8 +6645,8 @@ function runOrphanReaper(config, options = {}) {
|
|
|
6609
6645
|
return finishSummary();
|
|
6610
6646
|
}
|
|
6611
6647
|
const refs = activeRuntimeExecutionRefs();
|
|
6612
|
-
|
|
6613
|
-
|
|
6648
|
+
let processRows = null;
|
|
6649
|
+
let processCwdsByPid = null;
|
|
6614
6650
|
for (const workdir of walkManagedWorkdirs(config.runtimeWorkspacesRoot)) {
|
|
6615
6651
|
const manifest = readWorkspaceManifest(workspaceManifestPath(workdir));
|
|
6616
6652
|
if (!manifest || manifest.managed !== true) continue;
|
|
@@ -6619,6 +6655,8 @@ function runOrphanReaper(config, options = {}) {
|
|
|
6619
6655
|
summary.protectedWorkdirCount += 1;
|
|
6620
6656
|
continue;
|
|
6621
6657
|
}
|
|
6658
|
+
processRows ??= allProcessRows();
|
|
6659
|
+
processCwdsByPid ??= allProcessCwdsByPid();
|
|
6622
6660
|
const residents = listWorkspaceResidentProcesses(workdir, null, { processRows, processCwdsByPid });
|
|
6623
6661
|
if (residents.length === 0) continue;
|
|
6624
6662
|
summary.orphanWorkdirCount += 1;
|
|
@@ -7791,7 +7829,18 @@ async function executeRunCommand(config, command) {
|
|
|
7791
7829
|
const abortController = new AbortController();
|
|
7792
7830
|
const stopActiveRunHeartbeats = startActiveRunHeartbeats(config, command, abortController);
|
|
7793
7831
|
const protectedExecutorValues = managedMcpProfile?.protectedValues ?? (managedMcpProfile ? [governedMcp.sessionToken] : []);
|
|
7794
|
-
const
|
|
7832
|
+
const runtimeArtifacts = [];
|
|
7833
|
+
const runtimeArtifactIngest = createRuntimeArtifactIngestQueue({
|
|
7834
|
+
ingest: (results) => ingestRuntimeArtifacts(config, command, cwd, results),
|
|
7835
|
+
onError: () => abortController.abort()
|
|
7836
|
+
});
|
|
7837
|
+
const liveOutputLogger = createLiveOutputLogger(
|
|
7838
|
+
config,
|
|
7839
|
+
command,
|
|
7840
|
+
executor.kind,
|
|
7841
|
+
protectedExecutorValues,
|
|
7842
|
+
(results) => runtimeArtifactIngest.enqueue(results)
|
|
7843
|
+
);
|
|
7795
7844
|
let execution;
|
|
7796
7845
|
try {
|
|
7797
7846
|
try {
|
|
@@ -7812,6 +7861,7 @@ async function executeRunCommand(config, command) {
|
|
|
7812
7861
|
} finally {
|
|
7813
7862
|
await liveOutputLogger.flush();
|
|
7814
7863
|
}
|
|
7864
|
+
runtimeArtifacts.push(...await runtimeArtifactIngest.flush());
|
|
7815
7865
|
execution.stdout = redactProtectedText(execution.stdout, protectedExecutorValues);
|
|
7816
7866
|
execution.stderr = redactProtectedText(execution.stderr, protectedExecutorValues);
|
|
7817
7867
|
patchActiveRunCommand(command, {
|
|
@@ -7868,7 +7918,15 @@ async function executeRunCommand(config, command) {
|
|
|
7868
7918
|
...Array.isArray(parsed.mcpToolResults) ? parsed.mcpToolResults.map(asRecord) : [],
|
|
7869
7919
|
...liveOutputLogger.mcpToolResults().map(asRecord)
|
|
7870
7920
|
];
|
|
7871
|
-
|
|
7921
|
+
runtimeArtifacts.push(...await ingestRuntimeArtifacts(
|
|
7922
|
+
config,
|
|
7923
|
+
command,
|
|
7924
|
+
cwd,
|
|
7925
|
+
mcpToolResults.filter((result3) => {
|
|
7926
|
+
const intentId = readString(asRecord(result3).artifactIntent?.intentId);
|
|
7927
|
+
return !intentId || !runtimeArtifactIngest.hasHandled(intentId);
|
|
7928
|
+
})
|
|
7929
|
+
));
|
|
7872
7930
|
const shouldPreserveNativeSession = managedMcpProfile && parsed.sessionId && (execution.exitCode === 0 || execution.completionOutputType === "approval_required") && !execution.timedOut && execution.cancelled !== true && !execution.spawnError && ["codex", "pi"].includes(executor.kind) && mcpToolResults.some((result3) => readString(result3.status) === "approval_required");
|
|
7873
7931
|
if (shouldPreserveNativeSession) {
|
|
7874
7932
|
try {
|
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.24";
|
|
9
9
|
|
|
10
10
|
const CAPABILITIES = [
|
|
11
11
|
"remote_registration",
|