@amaster.ai/employee-runtime-connector 0.1.0-beta.24 → 0.1.0-beta.25
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.
|
@@ -3218,6 +3218,46 @@ function approvedMcpInvocationSucceeded(results, invocationId) {
|
|
|
3218
3218
|
return readString(result2.invocationId) === approvedInvocationId && readString(result2.status) === "succeeded" && !["rejected", "blocked"].includes(readString(result2.providerStatus) ?? "");
|
|
3219
3219
|
}));
|
|
3220
3220
|
}
|
|
3221
|
+
function governedMcpToolResult(structuredContent) {
|
|
3222
|
+
const status = readString(structuredContent.status);
|
|
3223
|
+
if (!status) return null;
|
|
3224
|
+
const invocationId = readString(structuredContent.invocationId);
|
|
3225
|
+
const providerContent = asRecord(structuredContent.content);
|
|
3226
|
+
const providerStatus = readString(providerContent.status);
|
|
3227
|
+
const effectResult = asRecord(asRecord(providerContent.result).effectResult);
|
|
3228
|
+
const intentId = readString(effectResult.artifactIntentId);
|
|
3229
|
+
const manifestId = readString(effectResult.manifestId);
|
|
3230
|
+
const sourceRelativePath = readString(effectResult.sourceRelativePath);
|
|
3231
|
+
const sha256 = readString(effectResult.sha256);
|
|
3232
|
+
const byteSize = readNumber(effectResult.byteSize, 0);
|
|
3233
|
+
const artifactIntent = providerStatus === "pending_reconcile" && intentId && manifestId && sourceRelativePath && /^[a-f0-9]{64}$/.test(sha256 ?? "") && Number.isSafeInteger(byteSize) && byteSize > 0 ? { intentId, manifestId, sourceRelativePath, sha256, byteSize } : null;
|
|
3234
|
+
return {
|
|
3235
|
+
...invocationId ? { invocationId } : {},
|
|
3236
|
+
status,
|
|
3237
|
+
...providerStatus ? { providerStatus } : {},
|
|
3238
|
+
...artifactIntent ? { artifactIntent } : {}
|
|
3239
|
+
};
|
|
3240
|
+
}
|
|
3241
|
+
function codexMcpToolResults(event) {
|
|
3242
|
+
if (event?.type !== "item.completed") return [];
|
|
3243
|
+
const item = asRecord(event.item);
|
|
3244
|
+
if (item.type !== "mcp_tool_call") return [];
|
|
3245
|
+
const result2 = asRecord(item.result);
|
|
3246
|
+
let structuredContent = asRecord(result2.structuredContent);
|
|
3247
|
+
if (Object.keys(structuredContent).length === 0 && Array.isArray(result2.content)) {
|
|
3248
|
+
for (const part of result2.content) {
|
|
3249
|
+
const text = readString(asRecord(part).text);
|
|
3250
|
+
if (!text) continue;
|
|
3251
|
+
try {
|
|
3252
|
+
structuredContent = asRecord(JSON.parse(text));
|
|
3253
|
+
} catch {
|
|
3254
|
+
}
|
|
3255
|
+
if (Object.keys(structuredContent).length > 0) break;
|
|
3256
|
+
}
|
|
3257
|
+
}
|
|
3258
|
+
const parsed = governedMcpToolResult(structuredContent);
|
|
3259
|
+
return parsed ? [parsed] : [];
|
|
3260
|
+
}
|
|
3221
3261
|
function parseCodexJsonl(stdout) {
|
|
3222
3262
|
let sessionId = null;
|
|
3223
3263
|
let summary = "";
|
|
@@ -3237,26 +3277,7 @@ function parseCodexJsonl(stdout) {
|
|
|
3237
3277
|
if (item.type === "agent_message") {
|
|
3238
3278
|
summary = readString(item.text) ?? summary;
|
|
3239
3279
|
}
|
|
3240
|
-
|
|
3241
|
-
const result2 = asRecord(item.result);
|
|
3242
|
-
let structuredContent = asRecord(result2.structuredContent);
|
|
3243
|
-
if (Object.keys(structuredContent).length === 0 && Array.isArray(result2.content)) {
|
|
3244
|
-
for (const part of result2.content) {
|
|
3245
|
-
const text = readString(asRecord(part).text);
|
|
3246
|
-
if (!text) continue;
|
|
3247
|
-
try {
|
|
3248
|
-
structuredContent = asRecord(JSON.parse(text));
|
|
3249
|
-
} catch {
|
|
3250
|
-
}
|
|
3251
|
-
if (Object.keys(structuredContent).length > 0) break;
|
|
3252
|
-
}
|
|
3253
|
-
}
|
|
3254
|
-
const status = readString(structuredContent.status);
|
|
3255
|
-
if (status) {
|
|
3256
|
-
const invocationId = readString(structuredContent.invocationId);
|
|
3257
|
-
mcpToolResults.push({ ...invocationId ? { invocationId } : {}, status });
|
|
3258
|
-
}
|
|
3259
|
-
}
|
|
3280
|
+
mcpToolResults.push(...codexMcpToolResults(event));
|
|
3260
3281
|
continue;
|
|
3261
3282
|
}
|
|
3262
3283
|
if (event.type === "turn.completed") {
|
|
@@ -3612,24 +3633,8 @@ function piMcpToolResults(event) {
|
|
|
3612
3633
|
const message = asRecord(rawMessage);
|
|
3613
3634
|
if (message.role !== "toolResult") continue;
|
|
3614
3635
|
const structuredContent = asRecord(asRecord(asRecord(message.details).mcpResult).structuredContent);
|
|
3615
|
-
const
|
|
3616
|
-
if (
|
|
3617
|
-
const invocationId = readString(structuredContent.invocationId);
|
|
3618
|
-
const providerContent = asRecord(structuredContent.content);
|
|
3619
|
-
const providerStatus = readString(providerContent.status);
|
|
3620
|
-
const effectResult = asRecord(asRecord(providerContent.result).effectResult);
|
|
3621
|
-
const intentId = readString(effectResult.artifactIntentId);
|
|
3622
|
-
const manifestId = readString(effectResult.manifestId);
|
|
3623
|
-
const sourceRelativePath = readString(effectResult.sourceRelativePath);
|
|
3624
|
-
const sha256 = readString(effectResult.sha256);
|
|
3625
|
-
const byteSize = readNumber(effectResult.byteSize, 0);
|
|
3626
|
-
const artifactIntent = providerContent.status === "pending_reconcile" && intentId && manifestId && sourceRelativePath && /^[a-f0-9]{64}$/.test(sha256 ?? "") && Number.isSafeInteger(byteSize) && byteSize > 0 ? { intentId, manifestId, sourceRelativePath, sha256, byteSize } : null;
|
|
3627
|
-
results.push({
|
|
3628
|
-
...invocationId ? { invocationId } : {},
|
|
3629
|
-
status,
|
|
3630
|
-
...providerStatus ? { providerStatus } : {},
|
|
3631
|
-
...artifactIntent ? { artifactIntent } : {}
|
|
3632
|
-
});
|
|
3636
|
+
const parsed = governedMcpToolResult(structuredContent);
|
|
3637
|
+
if (parsed) results.push(parsed);
|
|
3633
3638
|
}
|
|
3634
3639
|
return results;
|
|
3635
3640
|
}
|
|
@@ -4695,7 +4700,7 @@ function readWorkspaceStatus(cwd, opts = {}) {
|
|
|
4695
4700
|
}
|
|
4696
4701
|
|
|
4697
4702
|
// src/amaster-runtime-daemon.mjs
|
|
4698
|
-
var CONNECTOR_VERSION = "0.1.0-beta.
|
|
4703
|
+
var CONNECTOR_VERSION = "0.1.0-beta.25";
|
|
4699
4704
|
var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
|
|
4700
4705
|
var MAX_CHECKPOINT_BYTES = 20 * 1024 * 1024;
|
|
4701
4706
|
var CHECKPOINT_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -6290,8 +6295,8 @@ function createLiveOutputLogger(config, command, executorKind, protectedValues =
|
|
|
6290
6295
|
if (executorKind === "pi" && readString(asRecord(event).type) === "session") {
|
|
6291
6296
|
executorSessionId = readString(asRecord(event).sessionId ?? asRecord(event).id) ?? executorSessionId;
|
|
6292
6297
|
}
|
|
6293
|
-
if (
|
|
6294
|
-
const results = piMcpToolResults(event);
|
|
6298
|
+
if (["codex", "pi"].includes(executorKind) && event) {
|
|
6299
|
+
const results = executorKind === "codex" ? codexMcpToolResults(event) : piMcpToolResults(event);
|
|
6295
6300
|
liveMcpToolResults.push(...results);
|
|
6296
6301
|
if (results.length > 0) onMcpToolResults?.(results);
|
|
6297
6302
|
}
|
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.25";
|
|
9
9
|
|
|
10
10
|
const CAPABILITIES = [
|
|
11
11
|
"remote_registration",
|