@amaster.ai/employee-runtime-connector 0.1.1-beta.312 → 0.1.1-beta.314
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.
|
@@ -13619,6 +13619,47 @@ var mirrorXIssueHandlingDiagnosticSchema = external_exports.object({
|
|
|
13619
13619
|
reasonParams: reasonParamsSchema,
|
|
13620
13620
|
sourceRefs: external_exports.array(issueProgressSourceRefSchema)
|
|
13621
13621
|
}).strict();
|
|
13622
|
+
var mirrorXRecoveryCompletionSchema = external_exports.object({
|
|
13623
|
+
actionId: external_exports.string().uuid(),
|
|
13624
|
+
actionRevision: external_exports.number().int().positive(),
|
|
13625
|
+
executionEpoch: external_exports.number().int().positive(),
|
|
13626
|
+
state: external_exports.enum(["allowed", "blocked"]),
|
|
13627
|
+
blockerGates: external_exports.array(external_exports.string())
|
|
13628
|
+
}).strict().superRefine((value, ctx) => {
|
|
13629
|
+
if (value.state === "allowed" !== (value.blockerGates.length === 0)) {
|
|
13630
|
+
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "Completion eligibility must agree with terminal blockers", path: ["state"] });
|
|
13631
|
+
}
|
|
13632
|
+
});
|
|
13633
|
+
var mirrorXIssueHandlingOperationSchema = external_exports.enum([
|
|
13634
|
+
"activate",
|
|
13635
|
+
"continue",
|
|
13636
|
+
"recover",
|
|
13637
|
+
"retry",
|
|
13638
|
+
"review",
|
|
13639
|
+
"dismiss_to_review",
|
|
13640
|
+
"force_done",
|
|
13641
|
+
"accept",
|
|
13642
|
+
"update_wait",
|
|
13643
|
+
"resolve_wait"
|
|
13644
|
+
]);
|
|
13645
|
+
var mirrorXIssueHandlingOperationCapabilitySchema = external_exports.discriminatedUnion("state", [
|
|
13646
|
+
external_exports.object({ state: external_exports.literal("allowed"), reasonCode: external_exports.null() }).strict(),
|
|
13647
|
+
external_exports.object({ state: external_exports.literal("forbidden"), reasonCode: external_exports.literal("actor_not_authorized") }).strict(),
|
|
13648
|
+
external_exports.object({ state: external_exports.literal("unavailable"), reasonCode: external_exports.enum([
|
|
13649
|
+
"target_stale",
|
|
13650
|
+
"assignee_missing",
|
|
13651
|
+
"review_path_missing",
|
|
13652
|
+
"company_paused",
|
|
13653
|
+
"operation_not_required",
|
|
13654
|
+
"delivery_not_ready",
|
|
13655
|
+
"execution_stages_pending",
|
|
13656
|
+
"agent_unavailable"
|
|
13657
|
+
]) }).strict()
|
|
13658
|
+
]);
|
|
13659
|
+
var mirrorXIssueHandlingOperationsSchema = external_exports.object({
|
|
13660
|
+
intentId: external_exports.string().regex(/^intent:v1:[a-f0-9]{64}$/),
|
|
13661
|
+
capabilities: external_exports.record(mirrorXIssueHandlingOperationSchema, mirrorXIssueHandlingOperationCapabilitySchema)
|
|
13662
|
+
}).strict();
|
|
13622
13663
|
var mirrorXIssueHandlingProjectionSchema = external_exports.object({
|
|
13623
13664
|
schemaVersion: external_exports.literal(MIRRORX_ISSUE_HANDLING_SCHEMA_VERSION),
|
|
13624
13665
|
issueId: external_exports.string().uuid(),
|
|
@@ -13630,11 +13671,37 @@ var mirrorXIssueHandlingProjectionSchema = external_exports.object({
|
|
|
13630
13671
|
}).strict(),
|
|
13631
13672
|
currentProgress: mirrorXIssueCurrentProgressSchema,
|
|
13632
13673
|
primaryIntent: mirrorXIssueHandlingIntentSchema.nullable(),
|
|
13674
|
+
// Detail-only terminal eligibility, evaluated by the same owner as done writes.
|
|
13675
|
+
// Older/list responses omit it; clients must not infer completion eligibility.
|
|
13676
|
+
recoveryCompletion: mirrorXRecoveryCompletionSchema.nullable().optional(),
|
|
13677
|
+
operations: mirrorXIssueHandlingOperationsSchema.optional(),
|
|
13633
13678
|
relatedIntents: external_exports.array(mirrorXIssueHandlingIntentSchema).max(3),
|
|
13634
13679
|
listBucket: mirrorXIssueHandlingListBucketSchema.nullable(),
|
|
13635
13680
|
diagnostics: external_exports.array(mirrorXIssueHandlingDiagnosticSchema)
|
|
13636
13681
|
}).strict().superRefine((value, ctx) => {
|
|
13637
13682
|
const terminal = value.currentProgress.state === "terminal";
|
|
13683
|
+
if (value.operations && value.operations.intentId !== value.primaryIntent?.intentId) {
|
|
13684
|
+
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "Operations require the exact primary intent", path: ["operations"] });
|
|
13685
|
+
}
|
|
13686
|
+
if (value.operations) {
|
|
13687
|
+
const surfaceOperations = {
|
|
13688
|
+
recovery: ["recover", "retry", "review", "dismiss_to_review", "force_done"],
|
|
13689
|
+
continuation: ["continue"],
|
|
13690
|
+
task_governance: ["activate"],
|
|
13691
|
+
acceptance: ["accept"],
|
|
13692
|
+
external_wait: ["update_wait", "resolve_wait"]
|
|
13693
|
+
};
|
|
13694
|
+
const allowed = value.primaryIntent ? surfaceOperations[value.primaryIntent.target.surface] ?? [] : [];
|
|
13695
|
+
if (Object.keys(value.operations.capabilities).some((operation) => !allowed.includes(operation))) {
|
|
13696
|
+
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "Operations must belong to the primary surface", path: ["operations", "capabilities"] });
|
|
13697
|
+
}
|
|
13698
|
+
}
|
|
13699
|
+
if (value.recoveryCompletion) {
|
|
13700
|
+
const target = value.primaryIntent?.target;
|
|
13701
|
+
if (target?.surface !== "recovery" || target.actionId !== value.recoveryCompletion.actionId || target.actionRevision !== value.recoveryCompletion.actionRevision || target.executionEpoch !== value.recoveryCompletion.executionEpoch || value.basis.executionEpoch !== value.recoveryCompletion.executionEpoch) {
|
|
13702
|
+
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "Completion eligibility requires the exact primary Recovery target", path: ["recoveryCompletion"] });
|
|
13703
|
+
}
|
|
13704
|
+
}
|
|
13638
13705
|
if (terminal && value.primaryIntent !== null) {
|
|
13639
13706
|
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "Terminal handling projections cannot have a primary intent", path: ["primaryIntent"] });
|
|
13640
13707
|
}
|
|
@@ -34441,7 +34508,7 @@ function assertRequiredTaskAttachmentMaterialized(input, materialized) {
|
|
|
34441
34508
|
}
|
|
34442
34509
|
|
|
34443
34510
|
// src/amaster-runtime-daemon.mjs
|
|
34444
|
-
var CONNECTOR_VERSION = "0.1.1-beta.
|
|
34511
|
+
var CONNECTOR_VERSION = "0.1.1-beta.314";
|
|
34445
34512
|
var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
|
|
34446
34513
|
var daemonRequire = createRequire(import.meta.url);
|
|
34447
34514
|
var MAX_CHECKPOINT_BYTES = 20 * 1024 * 1024;
|
|
@@ -38708,7 +38775,13 @@ async function materializeIssueAttachments(config, command, workspace) {
|
|
|
38708
38775
|
const runtimeAuth = commandRuntimeAuth(command);
|
|
38709
38776
|
const issueId = commandIssueId(command);
|
|
38710
38777
|
if (!issueId || !readString(runtimeAuth.apiUrl) || !readString(runtimeAuth.apiKey)) return [];
|
|
38711
|
-
const
|
|
38778
|
+
const authority = asRecord(requireCommandContextEnvelope(command).dynamicContext.companyInitializationAuthority);
|
|
38779
|
+
const query = readString(authority.initializationId) ? `?initializationId=${encodeURIComponent(authority.initializationId)}&initializationRevision=${encodeURIComponent(authority.revision)}` : "";
|
|
38780
|
+
const response = await runtimeApiJson(runtimeAuth, `/api/issues/${encodeURIComponent(issueId)}/attachments${query}`);
|
|
38781
|
+
if (query && (response?.initializationId !== authority.initializationId || response?.revision !== authority.revision || !Array.isArray(response?.attachments))) {
|
|
38782
|
+
throw new Error("Server did not return the requested initialization inputs");
|
|
38783
|
+
}
|
|
38784
|
+
const attachments = query ? response.attachments : response;
|
|
38712
38785
|
if (!Array.isArray(attachments) || attachments.length === 0) return [];
|
|
38713
38786
|
const lineageCandidatesByAttachmentId = await loadIssueAttachmentLineageCandidates(
|
|
38714
38787
|
config,
|
|
@@ -38723,7 +38796,10 @@ async function materializeIssueAttachments(config, command, workspace) {
|
|
|
38723
38796
|
for (const [index, rawAttachment] of attachments.entries()) {
|
|
38724
38797
|
const attachment = asRecord(rawAttachment);
|
|
38725
38798
|
const contentPath = readString(attachment.contentPath) ?? readString(attachment.downloadPath);
|
|
38726
|
-
if (!contentPath)
|
|
38799
|
+
if (!contentPath) {
|
|
38800
|
+
if (attachment.initializationInput === true) throw new Error("Initialization input has no download path");
|
|
38801
|
+
continue;
|
|
38802
|
+
}
|
|
38727
38803
|
let filename = safeMaterializedAttachmentFilename(attachment, index);
|
|
38728
38804
|
if (usedFilenames.has(filename)) {
|
|
38729
38805
|
const ext = extname3(filename);
|
|
@@ -38733,6 +38809,9 @@ async function materializeIssueAttachments(config, command, workspace) {
|
|
|
38733
38809
|
usedFilenames.add(filename);
|
|
38734
38810
|
const targetPath = join19(targetDir, filename);
|
|
38735
38811
|
const body = await runtimeApiBuffer(runtimeAuth, contentPath);
|
|
38812
|
+
if (attachment.initializationInput === true && (body.byteLength !== attachment.byteSize || createHash19("sha256").update(body).digest("hex") !== attachment.sha256)) {
|
|
38813
|
+
throw new Error("Initialization input content does not match its preparation receipt");
|
|
38814
|
+
}
|
|
38736
38815
|
writeFileSync12(targetPath, body);
|
|
38737
38816
|
const attachmentId = readString(attachment.id);
|
|
38738
38817
|
const actualSha256 = createHash19("sha256").update(body).digest("hex");
|
|
@@ -39291,7 +39370,7 @@ async function executeRunCommand(config, command) {
|
|
|
39291
39370
|
}
|
|
39292
39371
|
materializedAttachments = [...requiredArtifactInputs, ...issueAttachments];
|
|
39293
39372
|
} catch (err) {
|
|
39294
|
-
if (issueAttachmentsAreRequired(command, commandTaskResourceInput(command))) throw err;
|
|
39373
|
+
if (issueAttachmentsAreRequired(command, commandTaskResourceInput(command)) || readString(asRecord(requireCommandContextEnvelope(command).dynamicContext.companyInitializationAuthority).initializationId)) throw err;
|
|
39295
39374
|
enqueuePreparationLog("system", "warn", `Failed to materialize issue attachments: ${err instanceof Error ? err.message : String(err)}`, {
|
|
39296
39375
|
error: err instanceof Error ? err.message : String(err)
|
|
39297
39376
|
});
|
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.314";
|
|
11
11
|
|
|
12
12
|
const CONFIG_KEY_MAP = new Map([
|
|
13
13
|
["server_url", "AMASTER_EMPLOYEE_SERVER_URL"],
|