@amaster.ai/employee-runtime-connector 0.1.1-beta.44 → 0.1.1-beta.45
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 +140 -42
- package/dist/amaster-runtime.mjs +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
// src/amaster-runtime-daemon.mjs
|
|
5
5
|
import { createHash as createHash12 } from "node:crypto";
|
|
6
|
-
import { chmodSync as chmodSync4, copyFileSync as copyFileSync2, existsSync as existsSync11, lstatSync as lstatSync5, mkdirSync as mkdirSync7, mkdtempSync, readFileSync as
|
|
6
|
+
import { chmodSync as chmodSync4, copyFileSync as copyFileSync2, existsSync as existsSync11, lstatSync as lstatSync5, mkdirSync as mkdirSync7, mkdtempSync, readFileSync as readFileSync10, readdirSync as readdirSync9, realpathSync as realpathSync5, renameSync as renameSync6, rmSync as rmSync5, statSync as statSync8, symlinkSync as symlinkSync2, unlinkSync as unlinkSync2, writeFileSync as writeFileSync7 } from "node:fs";
|
|
7
7
|
import { arch as arch3, homedir as homedir3, hostname as hostname2, platform as platform3, tmpdir } from "node:os";
|
|
8
8
|
import { basename as basename6, delimiter as delimiter3, dirname as dirname7, extname as extname2, isAbsolute as isAbsolute6, join as join12, relative as relative6, resolve as resolve9 } from "node:path";
|
|
9
9
|
import { spawn, spawnSync as spawnSync5 } from "node:child_process";
|
|
@@ -4162,13 +4162,52 @@ function selectExecutor(config, command) {
|
|
|
4162
4162
|
}
|
|
4163
4163
|
|
|
4164
4164
|
// src/amaster-runtime-daemon/executor-process.mjs
|
|
4165
|
+
import { readdirSync as readdirSync4, readFileSync as readFileSync4 } from "node:fs";
|
|
4166
|
+
var TERMINAL_LINUX_PROCESS_STATES = /* @__PURE__ */ new Set(["Z", "X", "x"]);
|
|
4165
4167
|
function processGroupIdForChild(child, processPlatform = process.platform) {
|
|
4166
4168
|
return processPlatform === "win32" || typeof child.pid !== "number" || child.pid <= 0 ? null : child.pid;
|
|
4167
4169
|
}
|
|
4168
|
-
function
|
|
4170
|
+
function linuxProcState(stat) {
|
|
4171
|
+
const commandEnd = stat.lastIndexOf(")");
|
|
4172
|
+
if (commandEnd === -1) return null;
|
|
4173
|
+
const fields = stat.slice(commandEnd + 1).trim().split(/\s+/);
|
|
4174
|
+
if (fields.length < 3) return null;
|
|
4175
|
+
const processGroupId = Number.parseInt(fields[2], 10);
|
|
4176
|
+
return Number.isInteger(processGroupId) ? { state: fields[0], processGroupId } : null;
|
|
4177
|
+
}
|
|
4178
|
+
function linuxProcessGroupHasLiveMembers(processGroupId, procRoot = "/proc", fsApi = { readdirSync: readdirSync4, readFileSync: readFileSync4 }) {
|
|
4179
|
+
let entries;
|
|
4180
|
+
try {
|
|
4181
|
+
entries = fsApi.readdirSync(procRoot, { withFileTypes: true });
|
|
4182
|
+
} catch {
|
|
4183
|
+
return null;
|
|
4184
|
+
}
|
|
4185
|
+
let foundMember = false;
|
|
4186
|
+
let unreadableMember = false;
|
|
4187
|
+
for (const entry of entries) {
|
|
4188
|
+
if (!entry.isDirectory() || !/^\d+$/.test(entry.name)) continue;
|
|
4189
|
+
let parsed;
|
|
4190
|
+
try {
|
|
4191
|
+
parsed = linuxProcState(fsApi.readFileSync(`${procRoot}/${entry.name}/stat`, "utf8"));
|
|
4192
|
+
} catch {
|
|
4193
|
+
unreadableMember = true;
|
|
4194
|
+
continue;
|
|
4195
|
+
}
|
|
4196
|
+
if (parsed?.processGroupId !== processGroupId) continue;
|
|
4197
|
+
foundMember = true;
|
|
4198
|
+
if (!TERMINAL_LINUX_PROCESS_STATES.has(parsed.state)) return true;
|
|
4199
|
+
}
|
|
4200
|
+
if (foundMember) return false;
|
|
4201
|
+
return unreadableMember ? null : false;
|
|
4202
|
+
}
|
|
4203
|
+
function isExecutorProcessAlive(child, processGroupId = processGroupIdForChild(child), processApi = process, inspectLinuxProcessGroup = linuxProcessGroupHasLiveMembers) {
|
|
4169
4204
|
if (processGroupId !== null) {
|
|
4170
4205
|
try {
|
|
4171
4206
|
processApi.kill(-processGroupId, 0);
|
|
4207
|
+
if (processApi.platform === "linux") {
|
|
4208
|
+
const hasLiveMembers = inspectLinuxProcessGroup(processGroupId);
|
|
4209
|
+
if (hasLiveMembers !== null) return hasLiveMembers;
|
|
4210
|
+
}
|
|
4172
4211
|
return true;
|
|
4173
4212
|
} catch (error) {
|
|
4174
4213
|
if (error?.code === "ESRCH") return false;
|
|
@@ -4181,6 +4220,13 @@ function isProcessIdAlive(pid, processApi = process) {
|
|
|
4181
4220
|
if (!Number.isInteger(pid) || pid <= 0) return false;
|
|
4182
4221
|
try {
|
|
4183
4222
|
processApi.kill(pid, 0);
|
|
4223
|
+
if (processApi.platform === "linux") {
|
|
4224
|
+
try {
|
|
4225
|
+
const parsed = linuxProcState(readFileSync4(`/proc/${pid}/stat`, "utf8"));
|
|
4226
|
+
if (parsed && TERMINAL_LINUX_PROCESS_STATES.has(parsed.state)) return false;
|
|
4227
|
+
} catch {
|
|
4228
|
+
}
|
|
4229
|
+
}
|
|
4184
4230
|
return true;
|
|
4185
4231
|
} catch (error) {
|
|
4186
4232
|
return error?.code !== "ESRCH";
|
|
@@ -4226,7 +4272,7 @@ function isTerminalResultOutboxStatus(status) {
|
|
|
4226
4272
|
}
|
|
4227
4273
|
|
|
4228
4274
|
// src/amaster-runtime-daemon/run-completion-state.mjs
|
|
4229
|
-
import { existsSync as existsSync4, mkdirSync as mkdirSync4, readFileSync as
|
|
4275
|
+
import { existsSync as existsSync4, mkdirSync as mkdirSync4, readFileSync as readFileSync5, readdirSync as readdirSync5, renameSync as renameSync3, unlinkSync, writeFileSync as writeFileSync4 } from "node:fs";
|
|
4230
4276
|
import { join as join5 } from "node:path";
|
|
4231
4277
|
var RUN_COMPLETION_STATE_VERSION = 1;
|
|
4232
4278
|
var RUN_COMPLETION_USAGE_SCHEMA_VERSION = "runtime-command-usage-v1";
|
|
@@ -4465,11 +4511,11 @@ function writeRunCompletionState(directory, state) {
|
|
|
4465
4511
|
return filePath;
|
|
4466
4512
|
}
|
|
4467
4513
|
function readRunCompletionState(filePath) {
|
|
4468
|
-
return assertValidRunCompletionState(JSON.parse(
|
|
4514
|
+
return assertValidRunCompletionState(JSON.parse(readFileSync5(filePath, "utf8")));
|
|
4469
4515
|
}
|
|
4470
4516
|
function listRunCompletionStateFiles(directory) {
|
|
4471
4517
|
if (!existsSync4(directory)) return [];
|
|
4472
|
-
return
|
|
4518
|
+
return readdirSync5(directory).filter((name) => name.endsWith(".json")).sort().map((name) => join5(directory, name));
|
|
4473
4519
|
}
|
|
4474
4520
|
function removeRunCompletionState(directory, commandId) {
|
|
4475
4521
|
const filePath = join5(directory, runCompletionStateFileName(commandId));
|
|
@@ -5524,6 +5570,27 @@ function interactionResolutionText(context) {
|
|
|
5524
5570
|
jsonText(resolution)
|
|
5525
5571
|
].filter(Boolean).join("\n");
|
|
5526
5572
|
}
|
|
5573
|
+
function currentIssueMetadataReadText(input) {
|
|
5574
|
+
const issueId = readString(input.issueId) ?? readString(asRecord(asRecord(input.context).paperclipIssue).id);
|
|
5575
|
+
if (!issueId) {
|
|
5576
|
+
return "Required current-issue read is unavailable because the current Issue id is missing. Stop without recording a disposition.";
|
|
5577
|
+
}
|
|
5578
|
+
if (!input.hasGovernedMcp) {
|
|
5579
|
+
return "Required current-issue read is unavailable because managed governed MCP is missing. Stop without recording a disposition.";
|
|
5580
|
+
}
|
|
5581
|
+
const args = { issueId };
|
|
5582
|
+
const directToolName = managedDirectToolName(input, "amaster.read_issue");
|
|
5583
|
+
if (directToolName) {
|
|
5584
|
+
return `Required current-issue read: call \`${directToolName}\` with these exact object arguments: ${JSON.stringify(args)}`;
|
|
5585
|
+
}
|
|
5586
|
+
if (input.executorKind === "pi" && managedPiMcpProxyAvailable(input)) {
|
|
5587
|
+
return `Required current-issue read: emit an actual \`mcp\` tool call with these exact proxy arguments: ${JSON.stringify(managedPiMcpProxyCall("amaster.read_issue", args))}`;
|
|
5588
|
+
}
|
|
5589
|
+
if (input.managedMcpToolMode === "direct_typed") {
|
|
5590
|
+
return "Required current-issue read is unavailable because amaster.read_issue is absent from the attested direct tool catalog. Stop without recording a disposition.";
|
|
5591
|
+
}
|
|
5592
|
+
return `Required current-issue read: call amaster.read_issue with these exact arguments: ${JSON.stringify(args)}`;
|
|
5593
|
+
}
|
|
5527
5594
|
function recoveryInstructionText(input) {
|
|
5528
5595
|
const context = asRecord(input.context);
|
|
5529
5596
|
if (input.wakeReason === "finish_successful_run_handoff" && context.handoffRequired === true) {
|
|
@@ -5580,7 +5647,9 @@ function recoveryInstructionText(input) {
|
|
|
5580
5647
|
].join("\n");
|
|
5581
5648
|
return [
|
|
5582
5649
|
"This is a status-only source recovery. Do not repeat the original source work or create or revise deliverables.",
|
|
5583
|
-
|
|
5650
|
+
`Before choosing or recording any disposition, execute this required current-issue read and inspect result.content.documents for every persisted document identity: ${currentIssueMetadataReadText(input)}`,
|
|
5651
|
+
"Do not claim that a durable document is absent from workspace or Delivery-readiness evidence. The required read is authoritative for current Issue document metadata; use amaster.read_issue_document only when a returned key needs body inspection.",
|
|
5652
|
+
"After the required read succeeds, inspect the existing task and run evidence, then choose exactly one explicit disposition using task-governance actions:",
|
|
5584
5653
|
"- done only when the existing evidence already satisfies acceptance;",
|
|
5585
5654
|
"- in_review or input when a specific human review or answer is required;",
|
|
5586
5655
|
blockedDisposition,
|
|
@@ -6732,7 +6801,7 @@ function resolveAgentInstructionSystemKernelBundle(bundle, options = {}) {
|
|
|
6732
6801
|
}
|
|
6733
6802
|
|
|
6734
6803
|
// src/amaster-runtime-daemon/config-state.mjs
|
|
6735
|
-
import { existsSync as existsSync5, mkdirSync as mkdirSync5, readFileSync as
|
|
6804
|
+
import { existsSync as existsSync5, mkdirSync as mkdirSync5, readFileSync as readFileSync6, renameSync as renameSync4, rmSync as rmSync3, writeFileSync as writeFileSync5 } from "node:fs";
|
|
6736
6805
|
import { homedir as homedir2, hostname } from "node:os";
|
|
6737
6806
|
import { dirname as dirname4, join as join6 } from "node:path";
|
|
6738
6807
|
|
|
@@ -6885,7 +6954,7 @@ function readState(env) {
|
|
|
6885
6954
|
const path = stateFilePath(env);
|
|
6886
6955
|
if (!existsSync5(path)) return {};
|
|
6887
6956
|
try {
|
|
6888
|
-
const state = JSON.parse(
|
|
6957
|
+
const state = JSON.parse(readFileSync6(path, "utf8"));
|
|
6889
6958
|
if (!state || typeof state !== "object" || Array.isArray(state)) {
|
|
6890
6959
|
throw new TypeError("runtime connector state must be a JSON object");
|
|
6891
6960
|
}
|
|
@@ -8667,7 +8736,7 @@ var bestEffortPostJson = bestEffortPostRuntimeConnectorJson;
|
|
|
8667
8736
|
|
|
8668
8737
|
// src/amaster-runtime-daemon/runtime-artifact-upload.mjs
|
|
8669
8738
|
import { createHash as createHash8 } from "node:crypto";
|
|
8670
|
-
import { closeSync, constants, fstatSync, lstatSync as lstatSync4, openSync, readFileSync as
|
|
8739
|
+
import { closeSync, constants, fstatSync, lstatSync as lstatSync4, openSync, readFileSync as readFileSync7, realpathSync as realpathSync3 } from "node:fs";
|
|
8671
8740
|
import { isAbsolute as isAbsolute3, relative as relative3, resolve as resolve4 } from "node:path";
|
|
8672
8741
|
var SHA256_PATTERN = /^[a-f0-9]{64}$/;
|
|
8673
8742
|
function requiredString(value, name) {
|
|
@@ -8719,7 +8788,7 @@ function readOwnedWorkspaceFile(rootPath, sourceRelativePath, label = "Runtime w
|
|
|
8719
8788
|
);
|
|
8720
8789
|
}
|
|
8721
8790
|
}
|
|
8722
|
-
const body =
|
|
8791
|
+
const body = readFileSync7(descriptor);
|
|
8723
8792
|
options.afterRead?.({ sourcePath, descriptor });
|
|
8724
8793
|
const after = fstatSync(descriptor);
|
|
8725
8794
|
const pathAfter = lstatSync4(sourcePath);
|
|
@@ -8867,23 +8936,48 @@ function prepareRuntimeDocumentUploads(cwd, mcpToolResults) {
|
|
|
8867
8936
|
// src/amaster-runtime-daemon/runtime-document-ingest-queue.mjs
|
|
8868
8937
|
function createRuntimeDocumentIngestQueue({ ingest }) {
|
|
8869
8938
|
const handledCallIds = /* @__PURE__ */ new Set();
|
|
8939
|
+
const documentIdentityByCallId = /* @__PURE__ */ new Map();
|
|
8940
|
+
const finalizedDocumentIdentities = /* @__PURE__ */ new Set();
|
|
8870
8941
|
const receipts = [];
|
|
8871
8942
|
const errors = [];
|
|
8872
8943
|
let queue = Promise.resolve();
|
|
8944
|
+
const documentIdentity = (intent) => {
|
|
8945
|
+
const sourceRelativePath = readString(asRecord(intent).sourceRelativePath);
|
|
8946
|
+
const sha2562 = readString(asRecord(intent).sha256);
|
|
8947
|
+
const byteSize = asRecord(intent).byteSize;
|
|
8948
|
+
return sourceRelativePath && sha2562 && Number.isSafeInteger(byteSize) && byteSize > 0 ? `document:${sourceRelativePath}\0${sha2562}\0${byteSize}` : null;
|
|
8949
|
+
};
|
|
8950
|
+
const retainReceipts = (nextReceipts) => {
|
|
8951
|
+
receipts.push(...nextReceipts);
|
|
8952
|
+
for (const receipt of nextReceipts) {
|
|
8953
|
+
const callId = readString(asRecord(receipt).callId);
|
|
8954
|
+
const identity2 = callId ? documentIdentityByCallId.get(callId) : null;
|
|
8955
|
+
if (identity2) finalizedDocumentIdentities.add(identity2);
|
|
8956
|
+
}
|
|
8957
|
+
};
|
|
8873
8958
|
return {
|
|
8874
8959
|
enqueue(results) {
|
|
8875
8960
|
const pending = results.filter((result3) => {
|
|
8876
|
-
const
|
|
8877
|
-
|
|
8961
|
+
const intent = asRecord(result3).workspaceDocumentIntent;
|
|
8962
|
+
const callId = readString(asRecord(intent).callId);
|
|
8963
|
+
if (!callId || handledCallIds.has(callId)) return false;
|
|
8878
8964
|
handledCallIds.add(callId);
|
|
8965
|
+
documentIdentityByCallId.set(callId, documentIdentity(intent) ?? `call:${callId}`);
|
|
8879
8966
|
return true;
|
|
8880
8967
|
});
|
|
8881
8968
|
if (pending.length === 0) return;
|
|
8969
|
+
const pendingIdentities = new Set(pending.map((result3) => {
|
|
8970
|
+
const callId = readString(asRecord(asRecord(result3).workspaceDocumentIntent).callId);
|
|
8971
|
+
return callId ? documentIdentityByCallId.get(callId) : null;
|
|
8972
|
+
}).filter(Boolean));
|
|
8882
8973
|
queue = queue.then(async () => {
|
|
8883
8974
|
try {
|
|
8884
|
-
|
|
8975
|
+
retainReceipts(await ingest(pending));
|
|
8885
8976
|
} catch (error) {
|
|
8886
|
-
errors.push(
|
|
8977
|
+
errors.push({
|
|
8978
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
8979
|
+
identities: pendingIdentities
|
|
8980
|
+
});
|
|
8887
8981
|
}
|
|
8888
8982
|
});
|
|
8889
8983
|
},
|
|
@@ -8892,8 +8986,12 @@ function createRuntimeDocumentIngestQueue({ ingest }) {
|
|
|
8892
8986
|
},
|
|
8893
8987
|
async flush() {
|
|
8894
8988
|
await queue;
|
|
8895
|
-
|
|
8896
|
-
|
|
8989
|
+
const unresolvedErrors = errors.filter(({ identities }) => identities.size === 0 || [...identities].some((identity2) => !finalizedDocumentIdentities.has(identity2))).map(({ error }) => error);
|
|
8990
|
+
if (unresolvedErrors.length > 0) {
|
|
8991
|
+
throw new AggregateError(
|
|
8992
|
+
unresolvedErrors,
|
|
8993
|
+
`${unresolvedErrors.length} Runtime Document ingest operation(s) failed`
|
|
8994
|
+
);
|
|
8897
8995
|
}
|
|
8898
8996
|
return [...receipts];
|
|
8899
8997
|
}
|
|
@@ -8979,7 +9077,7 @@ import { existsSync as existsSync7, mkdirSync as mkdirSync6, realpathSync as rea
|
|
|
8979
9077
|
import { basename as basename4, join as join8, isAbsolute as isAbsolute4, relative as relative4, resolve as resolve5 } from "node:path";
|
|
8980
9078
|
|
|
8981
9079
|
// src/amaster-runtime-daemon/workspace-manifest.mjs
|
|
8982
|
-
import { chownSync as chownSync2, existsSync as existsSync6, readFileSync as
|
|
9080
|
+
import { chownSync as chownSync2, existsSync as existsSync6, readFileSync as readFileSync8, renameSync as renameSync5, rmSync as rmSync4, statSync as statSync3, writeFileSync as writeFileSync6 } from "node:fs";
|
|
8983
9081
|
import { basename as basename3, dirname as dirname5, join as join7 } from "node:path";
|
|
8984
9082
|
var WORKSPACE_MANIFEST_FILENAME = ".amaster-runtime.json";
|
|
8985
9083
|
function syncManifestDirOwnership(manifestPath, deps = {}) {
|
|
@@ -9008,7 +9106,7 @@ function workspaceManifestPath(workspaceOrCwd) {
|
|
|
9008
9106
|
function readWorkspaceManifest(manifestPath) {
|
|
9009
9107
|
if (!manifestPath || !existsSync6(manifestPath)) return null;
|
|
9010
9108
|
try {
|
|
9011
|
-
const parsed = JSON.parse(
|
|
9109
|
+
const parsed = JSON.parse(readFileSync8(manifestPath, "utf8"));
|
|
9012
9110
|
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
9013
9111
|
} catch {
|
|
9014
9112
|
return null;
|
|
@@ -9164,7 +9262,7 @@ function resolveExecutionWorkspace(config, command, opts = {}) {
|
|
|
9164
9262
|
}
|
|
9165
9263
|
|
|
9166
9264
|
// src/amaster-runtime-daemon/workspace-gc.mjs
|
|
9167
|
-
import { existsSync as existsSync8, readdirSync as
|
|
9265
|
+
import { existsSync as existsSync8, readdirSync as readdirSync6, statSync as statSync5 } from "node:fs";
|
|
9168
9266
|
import { join as join9, resolve as resolve6 } from "node:path";
|
|
9169
9267
|
function readIsoTime(value) {
|
|
9170
9268
|
if (typeof value !== "string" || !value.trim()) return null;
|
|
@@ -9182,7 +9280,7 @@ function walkWorkdirs(root) {
|
|
|
9182
9280
|
if (!current) continue;
|
|
9183
9281
|
let entries = [];
|
|
9184
9282
|
try {
|
|
9185
|
-
entries =
|
|
9283
|
+
entries = readdirSync6(current, { withFileTypes: true });
|
|
9186
9284
|
} catch {
|
|
9187
9285
|
continue;
|
|
9188
9286
|
}
|
|
@@ -9215,7 +9313,7 @@ function directorySizeBytes(path) {
|
|
|
9215
9313
|
if (stat.isDirectory()) {
|
|
9216
9314
|
let entries = [];
|
|
9217
9315
|
try {
|
|
9218
|
-
entries =
|
|
9316
|
+
entries = readdirSync6(current, { withFileTypes: true });
|
|
9219
9317
|
} catch {
|
|
9220
9318
|
continue;
|
|
9221
9319
|
}
|
|
@@ -9292,11 +9390,11 @@ function planManagedWorkspaceGcDryRun(input) {
|
|
|
9292
9390
|
}
|
|
9293
9391
|
|
|
9294
9392
|
// src/amaster-runtime-daemon/runtime-status-summary.mjs
|
|
9295
|
-
import { existsSync as existsSync9, readdirSync as
|
|
9393
|
+
import { existsSync as existsSync9, readdirSync as readdirSync7, statSync as statSync6 } from "node:fs";
|
|
9296
9394
|
import { dirname as dirname6, join as join10, resolve as resolve7 } from "node:path";
|
|
9297
9395
|
function runtimeStatusDirectoryEntries(path) {
|
|
9298
9396
|
try {
|
|
9299
|
-
return
|
|
9397
|
+
return readdirSync7(path, { withFileTypes: true });
|
|
9300
9398
|
} catch {
|
|
9301
9399
|
return [];
|
|
9302
9400
|
}
|
|
@@ -9546,7 +9644,7 @@ function summarizeAmasterRuntimeVersionDrift(input = {}) {
|
|
|
9546
9644
|
// src/amaster-runtime-daemon/workspace-status.mjs
|
|
9547
9645
|
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
9548
9646
|
import { createHash as createHash11 } from "node:crypto";
|
|
9549
|
-
import { existsSync as existsSync10, readdirSync as
|
|
9647
|
+
import { existsSync as existsSync10, readdirSync as readdirSync8, readFileSync as readFileSync9, statSync as statSync7 } from "node:fs";
|
|
9550
9648
|
import { basename as basename5, extname, isAbsolute as isAbsolute5, join as join11, relative as relative5, resolve as resolve8 } from "node:path";
|
|
9551
9649
|
var WORKSPACE_RUNTIME_SERVICES_FILENAME = ".amaster-runtime-services.json";
|
|
9552
9650
|
var ARTIFACT_EXTENSIONS = /* @__PURE__ */ new Map([
|
|
@@ -9616,7 +9714,7 @@ function sanitizeTrackedChange(line) {
|
|
|
9616
9714
|
return isSafeRelativePath(path) ? line : null;
|
|
9617
9715
|
}
|
|
9618
9716
|
function sha256File(filePath) {
|
|
9619
|
-
return createHash11("sha256").update(
|
|
9717
|
+
return createHash11("sha256").update(readFileSync9(filePath)).digest("hex");
|
|
9620
9718
|
}
|
|
9621
9719
|
function artifactHashCacheKey(relativePath, stat) {
|
|
9622
9720
|
return `${relativePath}\0${stat.size}\0${stat.mtimeMs}`;
|
|
@@ -9654,7 +9752,7 @@ function scanArtifactCandidates(cwd, opts = {}) {
|
|
|
9654
9752
|
const current = stack.pop();
|
|
9655
9753
|
let entries;
|
|
9656
9754
|
try {
|
|
9657
|
-
entries =
|
|
9755
|
+
entries = readdirSync8(current, { withFileTypes: true });
|
|
9658
9756
|
} catch {
|
|
9659
9757
|
continue;
|
|
9660
9758
|
}
|
|
@@ -9746,7 +9844,7 @@ function readRuntimeServicesSnapshot(cwd) {
|
|
|
9746
9844
|
const snapshotPath = join11(resolve8(cwd), WORKSPACE_RUNTIME_SERVICES_FILENAME);
|
|
9747
9845
|
if (!existsSync10(snapshotPath)) return [];
|
|
9748
9846
|
try {
|
|
9749
|
-
const parsed = JSON.parse(
|
|
9847
|
+
const parsed = JSON.parse(readFileSync9(snapshotPath, "utf8"));
|
|
9750
9848
|
const rawServices = Array.isArray(parsed) ? parsed : Array.isArray(parsed?.services) ? parsed.services : [];
|
|
9751
9849
|
return rawServices.map((entry) => sanitizeRuntimeService(entry)).filter((entry) => entry !== null).slice(0, 50);
|
|
9752
9850
|
} catch {
|
|
@@ -9991,7 +10089,7 @@ var source_acquisition_compatibility_default = {
|
|
|
9991
10089
|
};
|
|
9992
10090
|
|
|
9993
10091
|
// src/amaster-runtime-daemon.mjs
|
|
9994
|
-
var CONNECTOR_VERSION = "0.1.1-beta.
|
|
10092
|
+
var CONNECTOR_VERSION = "0.1.1-beta.45";
|
|
9995
10093
|
var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
|
|
9996
10094
|
var SOURCE_ACQUISITION_CAPABILITY = source_acquisition_compatibility_default.profileVersion;
|
|
9997
10095
|
var SOURCE_ACQUISITION_PROFILE_VERSION = source_acquisition_compatibility_default.profileVersion;
|
|
@@ -10032,7 +10130,7 @@ function resultOutboxPendingCount(config) {
|
|
|
10032
10130
|
if (!existsSync11(dir)) return 0;
|
|
10033
10131
|
try {
|
|
10034
10132
|
let pending = 0;
|
|
10035
|
-
for (const file of
|
|
10133
|
+
for (const file of readdirSync9(dir).filter((name) => name.endsWith(".json"))) {
|
|
10036
10134
|
if (readValidResultOutboxEntryOrQuarantine(config, file, join12(dir, file))) {
|
|
10037
10135
|
pending += 1;
|
|
10038
10136
|
}
|
|
@@ -10109,7 +10207,7 @@ function resultOutboxActiveRunCommands(config) {
|
|
|
10109
10207
|
if (!existsSync11(dir)) return [];
|
|
10110
10208
|
const outboxPending = resultOutboxPendingCount(config);
|
|
10111
10209
|
const entries = [];
|
|
10112
|
-
for (const file of
|
|
10210
|
+
for (const file of readdirSync9(dir).filter((name) => name.endsWith(".json")).sort()) {
|
|
10113
10211
|
const entry = readValidResultOutboxEntryOrQuarantine(config, file, join12(dir, file));
|
|
10114
10212
|
if (!entry) continue;
|
|
10115
10213
|
const activeRun = asRecord(entry.activeRun);
|
|
@@ -10142,10 +10240,10 @@ function resultOutboxFailedRunCommands(config) {
|
|
|
10142
10240
|
const dir = resultOutboxInvalidDir(config);
|
|
10143
10241
|
if (!existsSync11(dir)) return [];
|
|
10144
10242
|
const entries = [];
|
|
10145
|
-
for (const file of
|
|
10243
|
+
for (const file of readdirSync9(dir).filter((name) => name.endsWith(".json")).sort().slice(-100)) {
|
|
10146
10244
|
let entry;
|
|
10147
10245
|
try {
|
|
10148
|
-
entry = asRecord(JSON.parse(
|
|
10246
|
+
entry = asRecord(JSON.parse(readFileSync10(join12(dir, file), "utf8")));
|
|
10149
10247
|
} catch {
|
|
10150
10248
|
continue;
|
|
10151
10249
|
}
|
|
@@ -10212,7 +10310,7 @@ function safeExpandPath(value) {
|
|
|
10212
10310
|
}
|
|
10213
10311
|
function safeJsonObjectFromFile(filePath) {
|
|
10214
10312
|
try {
|
|
10215
|
-
const parsed = JSON.parse(
|
|
10313
|
+
const parsed = JSON.parse(readFileSync10(filePath, "utf8"));
|
|
10216
10314
|
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
10217
10315
|
} catch {
|
|
10218
10316
|
return null;
|
|
@@ -10229,7 +10327,7 @@ function safeDirectorySummary(pathValue) {
|
|
|
10229
10327
|
}
|
|
10230
10328
|
let entryCount = 0;
|
|
10231
10329
|
let truncated = false;
|
|
10232
|
-
for (const name of
|
|
10330
|
+
for (const name of readdirSync9(pathValue)) {
|
|
10233
10331
|
if (name.startsWith(".")) continue;
|
|
10234
10332
|
entryCount += 1;
|
|
10235
10333
|
if (entryCount >= MAX_PI_CAPABILITY_SOURCE_ENTRIES) {
|
|
@@ -10253,7 +10351,7 @@ function safeSkillRootSummary(kind, source, pathValue) {
|
|
|
10253
10351
|
let truncated = false;
|
|
10254
10352
|
if (directory.available && pathValue) {
|
|
10255
10353
|
try {
|
|
10256
|
-
for (const name of
|
|
10354
|
+
for (const name of readdirSync9(pathValue)) {
|
|
10257
10355
|
if (name.startsWith(".")) continue;
|
|
10258
10356
|
const skillDir = join12(pathValue, name);
|
|
10259
10357
|
try {
|
|
@@ -11226,7 +11324,7 @@ function sourceAcquisitionRuntimeProfile(config, command) {
|
|
|
11226
11324
|
}
|
|
11227
11325
|
function readJsonFile2(filePath) {
|
|
11228
11326
|
try {
|
|
11229
|
-
const parsed = JSON.parse(
|
|
11327
|
+
const parsed = JSON.parse(readFileSync10(filePath, "utf8"));
|
|
11230
11328
|
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
|
|
11231
11329
|
} catch {
|
|
11232
11330
|
return {};
|
|
@@ -12147,7 +12245,7 @@ function allProcessCwdsByPid() {
|
|
|
12147
12245
|
if (process.platform === "linux") {
|
|
12148
12246
|
const procEntries = (() => {
|
|
12149
12247
|
try {
|
|
12150
|
-
return
|
|
12248
|
+
return readdirSync9("/proc", { withFileTypes: true });
|
|
12151
12249
|
} catch {
|
|
12152
12250
|
return [];
|
|
12153
12251
|
}
|
|
@@ -12250,7 +12348,7 @@ function walkManagedWorkdirs(root) {
|
|
|
12250
12348
|
if (!current) continue;
|
|
12251
12349
|
let entries = [];
|
|
12252
12350
|
try {
|
|
12253
|
-
entries =
|
|
12351
|
+
entries = readdirSync9(current, { withFileTypes: true });
|
|
12254
12352
|
} catch {
|
|
12255
12353
|
continue;
|
|
12256
12354
|
}
|
|
@@ -13927,7 +14025,7 @@ function moveResultOutboxEntryToInvalid(config, file, fullPath, reason, detail,
|
|
|
13927
14025
|
function readValidResultOutboxEntryOrQuarantine(config, file, fullPath) {
|
|
13928
14026
|
let entry;
|
|
13929
14027
|
try {
|
|
13930
|
-
entry = JSON.parse(
|
|
14028
|
+
entry = JSON.parse(readFileSync10(fullPath, "utf8"));
|
|
13931
14029
|
} catch (err) {
|
|
13932
14030
|
const message = err instanceof Error ? err.message : String(err);
|
|
13933
14031
|
moveResultOutboxEntryToInvalid(config, file, fullPath, "malformed_result_outbox_json", message);
|
|
@@ -13987,7 +14085,7 @@ function quarantineResultOutboxEntry(config, fullPath, file, entry, reason, err)
|
|
|
13987
14085
|
async function flushResultOutbox(config) {
|
|
13988
14086
|
const dir = resultOutboxDir(config);
|
|
13989
14087
|
if (!existsSync11(dir)) return { attempted: 0, completed: 0 };
|
|
13990
|
-
const files =
|
|
14088
|
+
const files = readdirSync9(dir).filter((name) => name.endsWith(".json")).sort();
|
|
13991
14089
|
let completed = 0;
|
|
13992
14090
|
for (const file of files) {
|
|
13993
14091
|
const fullPath = join12(dir, file);
|
|
@@ -14368,7 +14466,7 @@ function safeCheckpointRelativePath(rawPath) {
|
|
|
14368
14466
|
return normalized;
|
|
14369
14467
|
}
|
|
14370
14468
|
function hashFileSha256(filePath) {
|
|
14371
|
-
return createHash12("sha256").update(
|
|
14469
|
+
return createHash12("sha256").update(readFileSync10(filePath)).digest("hex");
|
|
14372
14470
|
}
|
|
14373
14471
|
async function materializeIssueCheckpoint(config, command, workspace) {
|
|
14374
14472
|
const checkpointDir = issueCheckpointDir(workspace);
|
|
@@ -14376,7 +14474,7 @@ async function materializeIssueCheckpoint(config, command, workspace) {
|
|
|
14376
14474
|
if (!existsSync11(manifestPath)) return [];
|
|
14377
14475
|
let manifest;
|
|
14378
14476
|
try {
|
|
14379
|
-
manifest = asRecord(JSON.parse(
|
|
14477
|
+
manifest = asRecord(JSON.parse(readFileSync10(manifestPath, "utf8")));
|
|
14380
14478
|
} catch (err) {
|
|
14381
14479
|
rmSync5(checkpointDir, { recursive: true, force: true });
|
|
14382
14480
|
throw new Error(`invalid issue checkpoint manifest: ${err instanceof Error ? err.message : String(err)}`);
|
package/dist/amaster-runtime.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { basename, dirname, join, resolve } from "node:path";
|
|
|
6
6
|
import { homedir, hostname } from "node:os";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
8
|
|
|
9
|
-
const CONNECTOR_VERSION = "0.1.1-beta.
|
|
9
|
+
const CONNECTOR_VERSION = "0.1.1-beta.45";
|
|
10
10
|
|
|
11
11
|
const CAPABILITIES = [
|
|
12
12
|
"remote_registration",
|