@amaster.ai/employee-runtime-connector 0.1.1-beta.245 → 0.1.1-beta.247

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.
@@ -13909,6 +13909,10 @@ var restoreInitialRoutineSeedsSchema = external_exports.object({
13909
13909
  "Routine seed keys must be unique"
13910
13910
  )
13911
13911
  }).strict();
13912
+ var routineTemplateAdoptionBatchSchema = external_exports.object({
13913
+ afterCompanyId: external_exports.string().uuid().optional().nullable(),
13914
+ limit: external_exports.number().int().min(1).max(25).optional()
13915
+ }).strict();
13912
13916
  var routineRevisionSnapshotRoutineV1Schema = external_exports.object({
13913
13917
  id: external_exports.string().uuid(),
13914
13918
  companyId: external_exports.string().uuid(),
@@ -25159,7 +25163,7 @@ function taskContextAuthoritySection(context) {
25159
25163
  scope: sourceRefs.map((ref) => ref.scope)
25160
25164
  };
25161
25165
  }
25162
- function fixedRules(input, includeIssueLine) {
25166
+ function fixedRules(input, includeIssueLine, runContract = "producer") {
25163
25167
  const issue = asRecord(asRecord(input.context).paperclipIssue);
25164
25168
  const businessOutcome = asRecord(asRecord(issue.taskRequirements).businessOutcome);
25165
25169
  const serverOwnedBusinessOutcomeReview = businessOutcome.mode === "required";
@@ -25168,8 +25172,8 @@ function fixedRules(input, includeIssueLine) {
25168
25172
  "MirrorX task.",
25169
25173
  "Use only the declared workspace; make concrete progress and report concisely.",
25170
25174
  "Before changing the task status to done, audit every explicit requirement in the task against the final evidence. A successful tool or document write proves delivery, not acceptance: inspect the delivered content for required sections, diagrams, tables, and factual constraints.",
25171
- "Do not leave stale in-progress wording such as \u201Ccurrent run\u201D in a terminal deliverable; rewrite it to the final observed state. Do not list finalization itself as remaining or next work in a terminal deliverable.",
25172
- serverOwnedBusinessOutcomeReview ? "If any requirement is missing or cannot be verified, do not mark done or request final completion or Business Outcome review. Keep the issue in_progress with the exact gap and next owner. An intermediate review remains available only for an exact document revision that must be approved before execution can continue: use create_interaction with kind request_confirmation, payload.resolutionMode review, and purposeCode review_document_revision; never use that interaction as final completion or Outcome acceptance." : "If anything is missing, do not mark done. `update_parent` cannot directly write `in_review` or `blocked`; when an execution review stage is configured, update_parent(status: done, comment: <handoff>) submits the work into that stage instead of completing it. Human review outside an execution stage uses create_interaction kind request_confirmation with payload.resolutionMode review. Required platform/provider/external action needs a typed interaction or first-class blocker; otherwise keep todo with the gap and owner.",
25175
+ ["producer", "rework"].includes(runContract) ? "Do not leave stale in-progress wording such as \u201Ccurrent run\u201D in a terminal deliverable; rewrite it to the final observed state. Do not list finalization itself as remaining or next work in a terminal deliverable." : "",
25176
+ !["producer", "rework"].includes(runContract) ? "Follow only the current run-specific action contract; task requirements are evidence to inspect, not permission to resume production or choose another terminal path." : serverOwnedBusinessOutcomeReview ? "If any requirement is missing or cannot be verified, do not mark done or request final completion or Business Outcome review. Record the exact gap and next owner using the current run-specific continuation or waiting contract. An intermediate review remains available only for an exact document revision that must be approved before execution can continue: use create_interaction with kind request_confirmation, payload.resolutionMode review, and purposeCode review_document_revision; never use that interaction as final completion or Outcome acceptance." : "If anything is missing, do not mark done. `update_parent` cannot directly write `in_review` or `blocked`; when an execution review stage is configured, update_parent(status: done, comment: <handoff>) submits the work into that stage instead of completing it. Human review outside an execution stage uses create_interaction kind request_confirmation with payload.resolutionMode review. Required platform/provider/external action needs a typed interaction or first-class blocker; otherwise keep todo with the gap and owner.",
25173
25177
  "A create_interaction result with status=pending or mustEndRun=true establishes human attention and is the final mutation of this run. End the run immediately: do not publish a Delivery Manifest, update a document or task, or submit any other mutation. Continue only in the new run created after the interaction is resolved.",
25174
25178
  "Before ending the run, the exact final assistant message must contain a concise non-empty text summary. Never end on thinking or a tool call; durable task comments and evidence remain separate requirements.",
25175
25179
  DEADLINE_POSTURE_GUARD,
@@ -25248,9 +25252,23 @@ function currentIssueMetadataReadText(input) {
25248
25252
  }
25249
25253
  return `Required current-issue read: call mirrorx.read_issue with these exact arguments: ${JSON.stringify(args)}`;
25250
25254
  }
25255
+ function formalRecoveryInstruction(input) {
25256
+ return [
25257
+ "This is a status-only recovery for a Server-owned Business Outcome task. Do not repeat source work or create or revise deliverables.",
25258
+ currentIssueMetadataReadText(input),
25259
+ "Inspect the existing task and source-run evidence. Do not mark done or create a final request_confirmation / document review to replace configured execution stages or Business Outcome acceptance.",
25260
+ asRecord(input.context).workDispositionRepairRequired === true ? "If production or a configured resubmission remains, first persist the required truthful work disposition, then place update_parent status todo after it in the same governed plan. Do not keep or write `in_progress`; do not use a standalone continuation action before the disposition receipt." : "If production or a configured resubmission is still required, use only the Runtime Action Continuation Option below to queue a normal run with todo. Do not keep or write `in_progress`; its no-effect rejection does not repair this recovery path.",
25261
+ "For a genuine external dependency use the governed external-wait or monitor contract; request human input only for a concrete missing decision or authorization, not final acceptance.",
25262
+ "If evidence appears complete but no permitted recovery action applies, report the unresolved Server reconciliation gap and stop; do not invent a status transition or manufacture another review interaction."
25263
+ ].join("\n");
25264
+ }
25251
25265
  function recoveryInstructionText(input) {
25252
25266
  const context = asRecord(input.context);
25267
+ const formal = asRecord(asRecord(asRecord(context.paperclipIssue).taskRequirements).businessOutcome).mode === "required";
25253
25268
  if (input.wakeReason === "finish_successful_run_handoff" && context.handoffRequired === true) {
25269
+ if (formal) {
25270
+ return context.workDispositionRepairRequired === true ? recoveryInstructionText({ ...input, wakeReason: "source_scoped_recovery_action" }) : formalRecoveryInstruction(input);
25271
+ }
25254
25272
  return readString(context.instruction) ?? [
25255
25273
  "The prior successful run did not leave a terminal task disposition.",
25256
25274
  "Do not repeat the original source work or create or revise deliverables.",
@@ -25289,9 +25307,11 @@ function recoveryInstructionText(input) {
25289
25307
  "Record exactly one truthful disposition. For already completed inline work, use execute_inline with concrete existing evidence refs. For create_children, request_inputs, or escalate_staffing, persist one immutable Runtime Action plan whose first action is the matching record_work_disposition and whose remaining actions satisfy its exact bindings.",
25290
25308
  "Only after the disposition receipt succeeds may the same governed plan perform an allowed matching task-state mutation. If evidence is insufficient, use request_inputs with its bound typed interaction instead of inventing a decision.",
25291
25309
  `Current gate reasons: ${reasons.join(", ") || "missing"}. Previous disposition: ${readString(context.priorWorkDispositionId) ?? "none"}.`,
25292
- "The single-action Runtime Action Continuation Option is intentionally unavailable because update_parent cannot precede the required disposition receipt."
25310
+ "The single-action Runtime Action Continuation Option is intentionally unavailable because update_parent cannot precede the required disposition receipt.",
25311
+ formal ? formalRecoveryInstruction(input) : ""
25293
25312
  ].join("\n");
25294
25313
  }
25314
+ if (formal) return formalRecoveryInstruction(input);
25295
25315
  const wake = asRecord(context.paperclipWake);
25296
25316
  const unresolvedBlockerIssueIds = Array.isArray(wake.unresolvedBlockerIssueIds) ? wake.unresolvedBlockerIssueIds.map(readString).filter(Boolean) : [];
25297
25317
  const blockedDisposition = unresolvedBlockerIssueIds.length > 0 ? [
@@ -25378,6 +25398,8 @@ Runtime Action continuation is unavailable: executor kind does not support a gov
25378
25398
  }
25379
25399
  function runtimeAuthorizationText(context, mode, {
25380
25400
  replayAlreadyInTask = false,
25401
+ runContract = "producer",
25402
+ pendingExecutionStages = [],
25381
25403
  suppressOrdinaryCompletionContract = false,
25382
25404
  continueTaskEnabled = false
25383
25405
  } = {}) {
@@ -25410,7 +25432,7 @@ function runtimeAuthorizationText(context, mode, {
25410
25432
  firstDocumentCheckpoint,
25411
25433
  continueTaskEnabled ? "Treat one Run as one bounded, durable checkpoint. Once that checkpoint is persisted and another independent research, build, or revision phase remains, call continue_task immediately with a concrete nextAction and stable idempotencyKey instead of keeping the current Run open, then end the run. If the nextAction depends on files created in this run, include their exact workspace-relative POSIX paths in checkpointPaths; only those files are integrity-checked and carried into the successor workspace. A run-local file omitted from checkpointPaths is not durable continuation state. Do not split an unfinished atomic mutation or claim progress that is not durable. For a future time recheck use schedule_monitor; for an external person or system action use upsert_external_wait. These are mutually exclusive final live paths. Do not call update_parent with status: in_progress." : "If work remains in an ordinary productive run, call update_parent with status: in_progress and a concrete next action so bounded continuation recovery can preserve a live path. Status: todo does not queue a normal continuation from an ordinary productive run. Only a server-issued successful-run handoff recovery may use status: todo, and only according to its exact Recovery Instruction. Otherwise use a supported terminal or waiting disposition."
25412
25434
  ].filter(Boolean).join(" ") : "";
25413
- const businessOutcomeOwnershipContract = businessOutcome.mode === "required" ? evidenceAutoAcceptance ? [
25435
+ const businessOutcomeOwnershipContract = businessOutcome.mode === "required" ? runContract === "rework" ? "Business Outcome acceptance remains Server-owned. The producer may use status done only as the configured changes-requested resubmission described in Producer Execution Handoff; it is not acceptance or a terminal completion claim." : evidenceAutoAcceptance ? [
25414
25436
  "Evidence-auto Business Outcome closure is owned by the Server terminal reconciler.",
25415
25437
  "Do not create a generic review-mode request_confirmation or claim a Board handoff for final completion, and do not mark the issue done yourself. This does not prohibit an explicit intermediate review of an exact document revision before execution continues."
25416
25438
  ].join(" ") : [
@@ -25418,10 +25440,10 @@ function runtimeAuthorizationText(context, mode, {
25418
25440
  "Do not create a generic review-mode request_confirmation to ask the Board to accept final completion or the Outcome, and do not mark the issue done yourself. This does not prohibit an explicit intermediate review of an exact document revision before execution continues."
25419
25441
  ].join(" ") : "";
25420
25442
  const businessOutcomeTerminalContract = !suppressOrdinaryCompletionContract && businessOutcome.mode === "required" ? [
25421
- delivery.mode === "required" ? delegatedDelivery ? "When every acceptance criterion is satisfied and the exact delegated final-child Manifest and package review remain current, record only the root execution disposition with update_parent status in_progress and a concise evidence summary, then end the run successfully without creating or publishing another package." : "When every acceptance criterion is satisfied and the exact current Delivery Manifest is ready, record the final execution disposition with update_parent status in_progress and a concise evidence summary, then end the run successfully without creating a final review interaction." : "When every acceptance criterion is satisfied, record the final execution disposition with update_parent status in_progress and a concise evidence summary, then end the run successfully without creating a final review interaction.",
25443
+ pendingExecutionStages.length > 0 ? "When producer-owned deliverable requirements are satisfied and the exact current Delivery Manifest is ready when required, record final production evidence with update_parent status in_progress and end the run successfully. Independent review and approval requirements belong to the subsequent configured stages." : delivery.mode === "required" ? delegatedDelivery ? "When every acceptance criterion is satisfied and the exact delegated final-child Manifest and package review remain current, record only the root execution disposition with update_parent status in_progress and a concise evidence summary, then end the run successfully without creating or publishing another package." : "When every acceptance criterion is satisfied and the exact current Delivery Manifest is ready, record the final execution disposition with update_parent status in_progress and a concise evidence summary, then end the run successfully without creating a final review interaction." : "When every acceptance criterion is satisfied, record the final execution disposition with update_parent status in_progress and a concise evidence summary, then end the run successfully without creating a final review interaction.",
25422
25444
  "The exact runtime_action_in_progress_server_owned rejection is the expected fail-before-effect receipt for this Server-owned handoff. After receiving it, do not retry update_parent with done or another status; end the run successfully so the Server terminal reconciler can take over.",
25423
25445
  "A ready Delivery Manifest proves only that delivery evidence was registered; it is not Acceptance or an accepted Business Outcome. The expected runtime_action_in_progress_server_owned receipt likewise does not prove finalization. Unless an authoritative Server receipt already confirms acceptance and task completion, state that evidence was submitted and Server terminal validation is pending; do not claim the task is accepted or done. A pre-terminal outcome_not_clean result may reflect a still-running producer; preserve that result without declaring either final success or permanent failure, and do not poll or retry mutations to force closure.",
25424
- evidenceAutoAcceptance ? delivery.mode === "required" ? delegatedDelivery ? "Only after the run and command succeed does the Server validate the exact delegated final-child Manifest, accepted package review, and terminal Outcome evidence, auto-accept the Outcome, and finalize the issue as done atomically. This evidence-auto path does not create a Board review; report the actual Server-owned terminal disposition without implying a handoff." : "Only after the run and command succeed does the Server validate the exact current Delivery Manifest and terminal Outcome evidence, auto-accept the Outcome, and finalize the issue as done atomically. This evidence-auto path does not create a Board review; report the actual Server-owned terminal disposition without implying a handoff." : "Only after the run and command succeed does the Server validate the terminal Outcome evidence, auto-accept the Outcome, and finalize the issue as done atomically. This evidence-auto path does not create a Board review; report the actual Server-owned terminal disposition without implying a handoff." : delivery.mode === "required" ? delegatedDelivery ? "Only after the run and command succeed does the Server bind the exact delegated final-child Manifest, accepted package review, and terminal Outcome evidence, create the formal Board review before generic continuation handoff is evaluated, and move the issue to in_review. Board acceptance then finalizes the issue as done atomically." : "Only after the run and command succeed does the Server bind the exact current Delivery Manifest and terminal Outcome evidence, create the formal Board review before generic continuation handoff is evaluated, and move the issue to in_review. Board acceptance then finalizes the issue as done atomically." : "Only after the run and command succeed does the Server bind the terminal Outcome evidence, create the formal Board review before generic continuation handoff is evaluated, and move the issue to in_review. Board acceptance then finalizes the issue as done atomically."
25446
+ pendingExecutionStages.length > 0 ? "After successful production and terminal evidence validation, the Server must complete the remaining configured execution stages before applying the Business Outcome acceptance policy. Evidence-auto acceptance does not skip independent Review or Approval. Do not create a duplicate final confirmation interaction." : evidenceAutoAcceptance ? delivery.mode === "required" ? delegatedDelivery ? "Only after the run and command succeed does the Server validate the exact delegated final-child Manifest, accepted package review, and terminal Outcome evidence, auto-accept the Outcome, and finalize the issue as done atomically. This evidence-auto path does not create a Board review; report the actual Server-owned terminal disposition without implying a handoff." : "Only after the run and command succeed does the Server validate the exact current Delivery Manifest and terminal Outcome evidence, auto-accept the Outcome, and finalize the issue as done atomically. This evidence-auto path does not create a Board review; report the actual Server-owned terminal disposition without implying a handoff." : "Only after the run and command succeed does the Server validate the terminal Outcome evidence, auto-accept the Outcome, and finalize the issue as done atomically. This evidence-auto path does not create a Board review; report the actual Server-owned terminal disposition without implying a handoff." : delivery.mode === "required" ? delegatedDelivery ? "Only after the run and command succeed does the Server bind the exact delegated final-child Manifest, accepted package review, and terminal Outcome evidence, create the formal Board review before generic continuation handoff is evaluated, and move the issue to in_review. Board acceptance then finalizes the issue as done atomically." : "Only after the run and command succeed does the Server bind the exact current Delivery Manifest and terminal Outcome evidence, create the formal Board review before generic continuation handoff is evaluated, and move the issue to in_review. Board acceptance then finalizes the issue as done atomically." : "Only after the run and command succeed does the Server bind the terminal Outcome evidence, create the formal Board review before generic continuation handoff is evaluated, and move the issue to in_review. Board acceptance then finalizes the issue as done atomically."
25425
25447
  ].join(" ") : "";
25426
25448
  const organizationCapabilityAllowed = asRecord(envelope.organizationCapability).allowed === true;
25427
25449
  const organizationMutationAuthorized = allowed.has("organization_mutation");
@@ -25564,11 +25586,86 @@ function runtimeDeliveryReadinessText(context, input) {
25564
25586
  "```"
25565
25587
  ].join("\n");
25566
25588
  }
25589
+ function executionStageRunContract(context) {
25590
+ const executionStage = asRecord(asRecord(context.paperclipWake).executionStage);
25591
+ const state = asRecord(asRecord(context.paperclipIssue).executionState);
25592
+ const wakeRole = readString(executionStage.wakeRole);
25593
+ const stageType = readString(executionStage.stageType);
25594
+ const principalRef = (value) => {
25595
+ const principal = asRecord(value);
25596
+ const id = readString(principal.type === "agent" ? principal.agentId : principal.type === "user" ? principal.userId : null);
25597
+ return id ? `${principal.type}:${id}` : null;
25598
+ };
25599
+ if (Object.keys(executionStage).length === 0) {
25600
+ return state.status === "pending" ? "invalid_execution_stage" : null;
25601
+ }
25602
+ const participant = principalRef(executionStage.currentParticipant);
25603
+ if (!readString(executionStage.stageId) || !participant) return "invalid_execution_stage";
25604
+ if (Object.keys(state).length > 0 && (state.status !== (wakeRole === "executor" ? "changes_requested" : "pending") || state.currentStageId !== executionStage.stageId || state.currentStageType !== stageType || principalRef(state.currentParticipant) !== participant || (state.producerRunId ?? null) !== (executionStage.producerRunId ?? null) || (state.lastDecisionId ?? null) !== (executionStage.lastDecisionId ?? null))) return "invalid_execution_stage";
25605
+ if (asRecord(executionStage.currentParticipant).type === "agent") {
25606
+ if (wakeRole === "reviewer" && stageType === "review") return "reviewer";
25607
+ if (wakeRole === "approver" && stageType === "approval") return "approver";
25608
+ }
25609
+ if (wakeRole === "executor" && (stageType === "review" || stageType === "approval") && state.status === "changes_requested") return "rework";
25610
+ return "invalid_execution_stage";
25611
+ }
25612
+ function resolveRunContract(input, recoveryInstruction) {
25613
+ if (recoveryInstruction) return "recovery";
25614
+ const context = asRecord(input.context);
25615
+ const executionStageContract = executionStageRunContract(context);
25616
+ if (executionStageContract) return executionStageContract;
25617
+ return asRecord(asRecord(context.paperclipIssue).executionState).status === "changes_requested" ? "rework" : "producer";
25618
+ }
25619
+ function producerExecutionStages(context) {
25620
+ const issue = asRecord(context.paperclipIssue);
25621
+ if (asRecord(asRecord(issue.taskRequirements).businessOutcome).mode !== "required") return [];
25622
+ const array = (value) => Array.isArray(value) ? value : [];
25623
+ const completed = new Set(array(asRecord(issue.executionState).completedStageIds));
25624
+ return array(asRecord(issue.executionPolicy).stages).map(asRecord).filter((stage) => (stage.type === "review" || stage.type === "approval") && !completed.has(stage.id)).map((stage) => ({
25625
+ id: readString(stage.id),
25626
+ type: stage.type,
25627
+ participants: array(stage.participants).map((value) => {
25628
+ const participant = asRecord(value);
25629
+ return participant.type === "agent" ? { type: "agent", agentId: readString(participant.agentId) } : { type: "user", userId: readString(participant.userId) };
25630
+ })
25631
+ }));
25632
+ }
25633
+ function producerExecutionHandoffSection(input, runContract, stages) {
25634
+ if (!["producer", "rework"].includes(runContract)) return null;
25635
+ if (stages.length === 0) return null;
25636
+ const content = [
25637
+ `Remaining configured execution stages: ${JSON.stringify(stages)}`,
25638
+ "You are the producer. Finish and self-check the deliverable requirements; independent reviewer approval is a subsequent Server-owned stage, not missing producer work. Do not fabricate that approval or wait for it inside this run.",
25639
+ runContract === "rework" ? "This task was returned for changes. Address the review findings and publish current governed delivery evidence. Resubmit through runtime_action_describe and runtime_action_submit for update_parent with status done and a non-empty handoff comment. This re-enters the configured stage; it does not declare Business Outcome acceptance. Do not use executionDecision as the producer or wait for the first-delivery automatic handoff." : "Ensure the exact governed Delivery Manifest is ready when required (for delegated delivery, preserve the final-child Manifest and package review; do not publish a duplicate root package), record the final production evidence with update_parent status in_progress, and end the run successfully. The runtime_action_in_progress_server_owned receipt is the expected handoff receipt, not permission to retry with done.",
25640
+ "The Server verifies terminal Outcome evidence, Manifest readiness, and blocking work before starting the configured stages in order. Agent participants receive a fresh independent run (even if the same employee produced the work); user participants follow the configured human stage. Business Outcome acceptance remains a later gate.",
25641
+ "Do not create a request_confirmation / review_document_revision interaction as a substitute for these configured final review or approval stages. Preserve genuine intermediate questions, user decisions, and authorization needs; an existing pending interaction must still follow its authoritative continuation policy.",
25642
+ "Report delivery submitted and configured review pending until a Server receipt proves otherwise; do not claim the task is accepted or done."
25643
+ ].join("\n");
25644
+ return {
25645
+ sourceRef: `issue:${input.issueId ?? "unknown"}:producer-execution-handoff`,
25646
+ freshness: { kind: "run_snapshot" },
25647
+ content,
25648
+ mandatoryContent: content
25649
+ };
25650
+ }
25567
25651
  function executionReviewContractSection(context, input) {
25568
25652
  const wake = asRecord(context.paperclipWake);
25569
25653
  const executionStage = asRecord(wake.executionStage);
25570
25654
  const wakeRole = readString(executionStage.wakeRole);
25571
25655
  const stageType = readString(executionStage.stageType);
25656
+ if (executionStageRunContract(context) === "invalid_execution_stage") {
25657
+ const content2 = [
25658
+ `Invalid execution-stage wake: ${JSON.stringify({ wakeRole, stageType, stageId: readString(executionStage.stageId) })}.`,
25659
+ "The stage id and participant must be present and match the projected execution state when available. The execution-stage role and type must match reviewer+review, approver+approval, or executor+(review|approval) for a changes-requested state. Do not execute producer work, submit an execution decision, or perform another task mutation from this malformed wake.",
25660
+ "If an exact governed-action approval replay is present, perform only that exact approved replay first, then stop and report the invalid execution-stage metadata. Otherwise stop immediately and report the invalid metadata for Server recovery."
25661
+ ].join("\n");
25662
+ return {
25663
+ sourceRef: `issue:${input.issueId ?? "unknown"}:invalid-execution-stage:${readString(executionStage.stageId) ?? "unknown"}`,
25664
+ freshness: { kind: "run_snapshot" },
25665
+ content: content2,
25666
+ mandatoryContent: content2
25667
+ };
25668
+ }
25572
25669
  if (wakeRole === "approver" && stageType === "approval") {
25573
25670
  const content2 = [
25574
25671
  "You are the active Approver in a fresh execution run. Do not execute or continue the producer's task.",
@@ -25753,6 +25850,7 @@ var COMPANY_INITIALIZATION_PRE_AUTHORITY_SECTIONS = /* @__PURE__ */ new Set([
25753
25850
  "task",
25754
25851
  "task_acceptance_contract",
25755
25852
  "execution_review_contract",
25853
+ "producer_execution_handoff",
25756
25854
  "governed_business_state",
25757
25855
  "continuation_postcondition_gap",
25758
25856
  "continuation_next_action",
@@ -25926,6 +26024,7 @@ var CONTEXT_AVAILABILITY_SECTION_TITLES = Object.freeze({
25926
26024
  governed_business_state: "Governed Business State",
25927
26025
  task_acceptance_contract: "Task Acceptance Contract",
25928
26026
  execution_review_contract: "Execution Review Contract",
26027
+ producer_execution_handoff: "Producer Execution Handoff",
25929
26028
  continuation_summary: "Continuation Summary",
25930
26029
  resolved_dependencies: "Resolved Dependency Outputs",
25931
26030
  runtime_delivery_readiness: "Current Delivery Readiness",
@@ -26083,7 +26182,9 @@ function compileCommandPromptWithManifest(input, options = {}) {
26083
26182
  const recoveryInstruction = recoveryInstructionText(input);
26084
26183
  const recoveryContinuationOption = recoveryInstruction ? runtimeActionContinuationOptionText(input) : "";
26085
26184
  const completeRecoveryInstruction = [recoveryInstruction, recoveryContinuationOption].filter(Boolean).join("\n\n");
26086
- const suppressOrdinaryCompletionContract = completeRecoveryInstruction.length > 0;
26185
+ const runContract = resolveRunContract(input, completeRecoveryInstruction);
26186
+ const suppressOrdinaryCompletionContract = runContract !== "producer";
26187
+ const pendingExecutionStages = ["producer", "rework"].includes(runContract) ? producerExecutionStages(context) : [];
26087
26188
  const governedReads = governedReadSection(context);
26088
26189
  const governedBusinessState = governedBusinessStateSection(context, input);
26089
26190
  const taskAcceptanceContract = taskAcceptanceContractSection(context, input);
@@ -26143,7 +26244,8 @@ ${resolvedDependencies.details.content}` : resolvedDependencies.details.content
26143
26244
  } : null;
26144
26245
  const piGovernedTools = piDirectTypedToolsText(input);
26145
26246
  const deliveryReadinessContent = runtimeDeliveryReadinessText(context, input);
26146
- const executionReviewContract = executionReviewContractSection(context, input);
26247
+ const executionReviewContract = ["reviewer", "approver", "invalid_execution_stage"].includes(runContract) ? executionReviewContractSection(context, input) : null;
26248
+ const producerExecutionHandoff = producerExecutionHandoffSection(input, runContract, pendingExecutionStages);
26147
26249
  const optionalTaskWikiContext = optionalTaskWikiContextSection(context);
26148
26250
  const taskContextAuthority = taskContextAuthoritySection(context);
26149
26251
  const continuationPostconditionGap = continuationPostconditionGapSection(context, input);
@@ -26151,11 +26253,12 @@ ${resolvedDependencies.details.content}` : resolvedDependencies.details.content
26151
26253
  const runtimeTemplateCatalog = runtimeTemplateCatalogSection(input);
26152
26254
  const rawSections = [
26153
26255
  { name: "recovery_instruction", title: "Recovery Instruction", priority: 100, sourceRef: `run:${input.runId ?? "unknown"}`, content: completeRecoveryInstruction, truncationReason: completeRecoveryInstruction ? null : "mode_selection" },
26154
- { name: "approval_continuation", title: "Approved Runtime Action Continuation", priority: 99, sourceRef: `run:${input.runId ?? "unknown"}`, content: approvalContinuationText(input), truncationReason: mode === "continuation" ? null : "mode_selection" },
26256
+ { name: "approval_continuation", title: "Approved Runtime Action Continuation", priority: 100, sourceRef: `run:${input.runId ?? "unknown"}`, content: approvalContinuationText(input), truncationReason: mode === "continuation" ? null : "mode_selection" },
26155
26257
  ...continuationNextAction ? [{ name: "continuation_next_action", title: "Authoritative Continuation Next Action", priority: 100, ...continuationNextAction }] : [],
26156
26258
  { name: "wake_comments", title: wakeDeltaTitle, priority: interactionResolution ? 99 : 95, sourceRef: wakeDeltaSourceRefs, originalContent: wakeDeltaOriginal, content: wakeDeltaContent, truncationReason: commentsSelected ? null : "duplicate_task_context" },
26157
26259
  { name: "task", title: "Task Context", priority: 90, sourceRef: taskSourceRefs, originalContent: [taskText, taskCommentRefGuidance(input, taskText)].filter(Boolean).join("\n"), content: includeTask ? [taskText, taskCommentRefGuidance(input, taskText)].filter(Boolean).join("\n") : "", truncationReason: includeTask ? null : "mode_selection" },
26158
26260
  ...taskAcceptanceContract ? [{ name: "task_acceptance_contract", title: "Task Acceptance Contract", priority: 100, ...taskAcceptanceContract }] : [],
26261
+ ...producerExecutionHandoff ? [{ name: "producer_execution_handoff", title: "Producer Execution Handoff", priority: 100, ...producerExecutionHandoff }] : [],
26159
26262
  ...executionReviewContract ? [{ name: "execution_review_contract", title: "Execution Review Contract", priority: 100, ...executionReviewContract }] : [],
26160
26263
  ...governedBusinessState ? [{ name: "governed_business_state", title: "Governed Business State", priority: 99, ...governedBusinessState }] : [],
26161
26264
  ...continuationPostconditionGap ? [{ name: "continuation_postcondition_gap", title: "Continuation Postcondition Gap", priority: 100, ...continuationPostconditionGap }] : [],
@@ -26168,9 +26271,11 @@ ${resolvedDependencies.details.content}` : resolvedDependencies.details.content
26168
26271
  }] : [],
26169
26272
  ...deliveryReadinessContent ? [{ name: "runtime_delivery_readiness", title: "Current Delivery Readiness", priority: 99, sourceRef: `issue:${input.issueId ?? "unknown"}:delivery`, content: deliveryReadinessContent }] : [],
26170
26273
  ...companyInitializationAuthority && !includeTask ? [companyInitializationAuthority] : [],
26171
- { name: "runtime_rules", title: "", priority: 100, sourceRef: `command:${input.commandId}`, content: fixedRules(input, !hasTask) },
26274
+ { name: "runtime_rules", title: "", priority: 100, sourceRef: `command:${input.commandId}`, content: fixedRules(input, !hasTask, runContract) },
26172
26275
  { name: "runtime_authorization", title: "Runtime Action Contract", priority: 98, sourceRef: `run:${input.runId ?? "unknown"}`, content: runtimeAuthorizationText(context, mode, {
26173
26276
  replayAlreadyInTask: includeTask && taskText.includes(EXACT_ORGANIZATION_INTENT_REPLAY_MARKER),
26277
+ runContract,
26278
+ pendingExecutionStages,
26174
26279
  suppressOrdinaryCompletionContract,
26175
26280
  continueTaskEnabled
26176
26281
  }) },
@@ -26226,6 +26331,7 @@ ${resolvedDependencies.details.content}` : resolvedDependencies.details.content
26226
26331
  governedReadProvenance: governedReads.provenance,
26227
26332
  resolvedDependencyTupleCount: resolvedDependencies.required.tupleCount
26228
26333
  });
26334
+ compiled.manifest.runContract = runContract;
26229
26335
  compiled.manifest.continuationPromptContract = continueTaskEnabled ? { capability: "continue_task_v1", mode: "continue_task" } : { capability: null, mode: "legacy_server_owned_in_progress" };
26230
26336
  return compiled;
26231
26337
  }
@@ -30717,7 +30823,7 @@ function assertRequiredTaskAttachmentMaterialized(input, materialized) {
30717
30823
  }
30718
30824
 
30719
30825
  // src/amaster-runtime-daemon.mjs
30720
- var CONNECTOR_VERSION = "0.1.1-beta.245";
30826
+ var CONNECTOR_VERSION = "0.1.1-beta.247";
30721
30827
  var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
30722
30828
  var daemonRequire = createRequire(import.meta.url);
30723
30829
  var MAX_CHECKPOINT_BYTES = 20 * 1024 * 1024;
@@ -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.245";
10
+ const CONNECTOR_VERSION = "0.1.1-beta.247";
11
11
 
12
12
  const CONFIG_KEY_MAP = new Map([
13
13
  ["server_url", "AMASTER_EMPLOYEE_SERVER_URL"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amaster.ai/employee-runtime-connector",
3
- "version": "0.1.1-beta.245",
3
+ "version": "0.1.1-beta.247",
4
4
  "description": "MirrorX runtime connector CLI and daemon",
5
5
  "license": "MIT",
6
6
  "type": "module",