@amaster.ai/employee-runtime-connector 0.1.1-beta.30 → 0.1.1-beta.32
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.
|
@@ -4556,6 +4556,11 @@ var RECOVERY_WAKE_REASONS = /* @__PURE__ */ new Set([
|
|
|
4556
4556
|
"finish_successful_run_handoff",
|
|
4557
4557
|
"source_scoped_recovery_action"
|
|
4558
4558
|
]);
|
|
4559
|
+
var EVIDENCE_AUTO_VALIDATOR_IDS = /* @__PURE__ */ new Set([
|
|
4560
|
+
"current_delivery_manifest",
|
|
4561
|
+
"terminal_run_and_command",
|
|
4562
|
+
"durable_effect_evidence"
|
|
4563
|
+
]);
|
|
4559
4564
|
function isRecoveryWakeReason(wakeReason) {
|
|
4560
4565
|
return RECOVERY_WAKE_REASONS.has(wakeReason);
|
|
4561
4566
|
}
|
|
@@ -4657,6 +4662,86 @@ function governedReadSection(context) {
|
|
|
4657
4662
|
}))
|
|
4658
4663
|
};
|
|
4659
4664
|
}
|
|
4665
|
+
function governedBusinessDetailRead(input, issueId) {
|
|
4666
|
+
const canonicalTool = "amaster.read_governed_business_state";
|
|
4667
|
+
const exactIssueId = readString(issueId);
|
|
4668
|
+
if (!exactIssueId) {
|
|
4669
|
+
return { mode: "unavailable", canonical_tool: canonicalTool, reason: "issue_scope_unavailable" };
|
|
4670
|
+
}
|
|
4671
|
+
if (!input.hasGovernedMcp) {
|
|
4672
|
+
return { mode: "unavailable", canonical_tool: canonicalTool, reason: "governed_mcp_unavailable" };
|
|
4673
|
+
}
|
|
4674
|
+
const argumentsValue = { issueId: exactIssueId };
|
|
4675
|
+
const exposedTool = managedDirectToolName(input, canonicalTool);
|
|
4676
|
+
if (exposedTool) {
|
|
4677
|
+
return { mode: "direct_typed", tool: exposedTool, arguments: argumentsValue };
|
|
4678
|
+
}
|
|
4679
|
+
if (input.managedMcpToolMode === "direct_typed") {
|
|
4680
|
+
return { mode: "unavailable", canonical_tool: canonicalTool, reason: "not_in_run_catalog" };
|
|
4681
|
+
}
|
|
4682
|
+
if (input.executorKind === "pi" && managedPiMcpProxyAvailable(input)) {
|
|
4683
|
+
return {
|
|
4684
|
+
mode: "mcp_proxy",
|
|
4685
|
+
server: "amaster",
|
|
4686
|
+
tool: canonicalTool,
|
|
4687
|
+
args: JSON.stringify(argumentsValue)
|
|
4688
|
+
};
|
|
4689
|
+
}
|
|
4690
|
+
return { mode: "canonical", tool: canonicalTool, arguments: argumentsValue };
|
|
4691
|
+
}
|
|
4692
|
+
function governedBusinessDecisionProjection(state, detailRead) {
|
|
4693
|
+
const record6 = asRecord(state);
|
|
4694
|
+
const snapshot = asRecord(record6.governed_state_snapshot);
|
|
4695
|
+
const enrollment = asRecord(snapshot.business_task_enrollment);
|
|
4696
|
+
const authoritativeObjectRefs = Array.isArray(record6.authoritative_object_refs) ? record6.authoritative_object_refs : [];
|
|
4697
|
+
const enrollmentRef = authoritativeObjectRefs.find((entry) => readString(asRecord(entry).object_kind) === "business_task_enrollment");
|
|
4698
|
+
const snapshotId = readString(snapshot.snapshot_id);
|
|
4699
|
+
const generatedAt = readString(snapshot.generated_at);
|
|
4700
|
+
const projection = {
|
|
4701
|
+
availability: record6.availability,
|
|
4702
|
+
capabilities: Array.isArray(record6.capabilities) ? record6.capabilities : [],
|
|
4703
|
+
missing_objects: Array.isArray(record6.missing_objects) ? record6.missing_objects : [],
|
|
4704
|
+
authoritative_object_refs: authoritativeObjectRefs,
|
|
4705
|
+
snapshot: {
|
|
4706
|
+
ref: snapshotId ? `governed_state:${snapshotId}` : null,
|
|
4707
|
+
observed_at: generatedAt ?? null
|
|
4708
|
+
},
|
|
4709
|
+
detail_read: detailRead
|
|
4710
|
+
};
|
|
4711
|
+
if (Object.keys(enrollment).length > 0) {
|
|
4712
|
+
projection.business_task_enrollment = {
|
|
4713
|
+
state: readString(enrollment.state) ?? null,
|
|
4714
|
+
authoritative_ref: readString(asRecord(enrollmentRef).ref) ?? null,
|
|
4715
|
+
finding: enrollment.finding ?? null
|
|
4716
|
+
};
|
|
4717
|
+
}
|
|
4718
|
+
const continuationId = readString(record6.continuation_id);
|
|
4719
|
+
if (continuationId) projection.continuation_id = continuationId;
|
|
4720
|
+
if (Number.isInteger(record6.outcome_revision)) projection.outcome_revision = record6.outcome_revision;
|
|
4721
|
+
const freeTextReason = readString(record6.free_text_reason);
|
|
4722
|
+
if (freeTextReason) projection.free_text_reason = freeTextReason;
|
|
4723
|
+
return projection;
|
|
4724
|
+
}
|
|
4725
|
+
function governedBusinessModelView(state, input) {
|
|
4726
|
+
const record6 = asRecord(state);
|
|
4727
|
+
const snapshot = asRecord(record6.governed_state_snapshot);
|
|
4728
|
+
const detailRead = governedBusinessDetailRead(
|
|
4729
|
+
input,
|
|
4730
|
+
readString(snapshot.issue_id) ?? readString(input.issueId)
|
|
4731
|
+
);
|
|
4732
|
+
if (detailRead.mode === "unavailable") {
|
|
4733
|
+
return {
|
|
4734
|
+
mode: "full_snapshot",
|
|
4735
|
+
content: record6,
|
|
4736
|
+
unavailableReason: detailRead.reason
|
|
4737
|
+
};
|
|
4738
|
+
}
|
|
4739
|
+
return {
|
|
4740
|
+
mode: "decision_projection",
|
|
4741
|
+
content: governedBusinessDecisionProjection(record6, detailRead),
|
|
4742
|
+
unavailableReason: null
|
|
4743
|
+
};
|
|
4744
|
+
}
|
|
4660
4745
|
function governedBusinessStateSection(context, input) {
|
|
4661
4746
|
const current = asRecord(context.governedBusinessState);
|
|
4662
4747
|
const resume = asRecord(context.governedBusinessResume);
|
|
@@ -4671,6 +4756,9 @@ function governedBusinessStateSection(context, input) {
|
|
|
4671
4756
|
throw new Error(`governed_business_state_scope_mismatch:${label}`);
|
|
4672
4757
|
}
|
|
4673
4758
|
}
|
|
4759
|
+
const currentView = Object.keys(current).length > 0 ? governedBusinessModelView(current, input) : null;
|
|
4760
|
+
const resumeView = Object.keys(resume).length > 0 ? governedBusinessModelView(resume, input) : null;
|
|
4761
|
+
const retainsFullSnapshot = [currentView, resumeView].some((view) => view?.mode === "full_snapshot");
|
|
4674
4762
|
const rules = [
|
|
4675
4763
|
"This is bounded Server-owned read-side truth. It does not grant mutation authority and it is not a Delivery Manifest claim.",
|
|
4676
4764
|
"Recommendation, First Business Activation, and Business Task Enrollment may be described as created/submitted/activated/enrolled only when authoritative_object_refs contains the exact matching Server ref. Issue and Document are not Business Task Enrollment.",
|
|
@@ -4679,13 +4767,16 @@ function governedBusinessStateSection(context, input) {
|
|
|
4679
4767
|
"A read capability marked unavailable does not prove an instance is absent. A write capability marked unavailable does not prove the object kind is unsupported.",
|
|
4680
4768
|
"When availability.status or a required read capability is unavailable, unrelated work may continue, but formal-object completion claims must remain fail-closed until a managed read succeeds.",
|
|
4681
4769
|
"When a required formal object is missing or the current Runtime lacks its legal producer, keep the task incomplete and name missing_objects.reason_code plus next_owner. Board review remains independent final acceptance.",
|
|
4682
|
-
"free_text_reason is explanatory only and is not authority; resolve any conflict in favor of the structured Server-owned state."
|
|
4770
|
+
"free_text_reason is explanatory only and is not authority; resolve any conflict in favor of the structured Server-owned state.",
|
|
4771
|
+
retainsFullSnapshot ? "No executable managed detail read is available for at least one state below, so its bounded full snapshot remains inline. Do not guess a tool name or claim that omitted state can be fetched." : "The default body is a decision projection, not the complete process ledger. Use detail_read only when the current task needs omitted diagnosis, recommendation, activation, enrollment, or dispatch details."
|
|
4683
4772
|
].join("\n");
|
|
4684
4773
|
const bodies = [
|
|
4685
|
-
|
|
4686
|
-
${stringifyBoundedJson(
|
|
4687
|
-
|
|
4688
|
-
|
|
4774
|
+
currentView ? currentView.mode === "decision_projection" ? `Current dispatch decision projection:
|
|
4775
|
+
${stringifyBoundedJson(currentView.content, 24e3)}` : `Current dispatch bounded full snapshot (managed detail read unavailable: ${currentView.unavailableReason}):
|
|
4776
|
+
${stringifyBoundedJson(currentView.content, 24e3)}` : "",
|
|
4777
|
+
resumeView ? resumeView.mode === "decision_projection" ? `Changes-requested resume decision projection:
|
|
4778
|
+
${stringifyBoundedJson(resumeView.content, 24e3)}` : `Changes-requested resume bounded full snapshot (managed detail read unavailable: ${resumeView.unavailableReason}):
|
|
4779
|
+
${stringifyBoundedJson(resumeView.content, 24e3)}` : ""
|
|
4689
4780
|
].filter(Boolean).join("\n\n");
|
|
4690
4781
|
return {
|
|
4691
4782
|
content: `${rules}
|
|
@@ -5242,6 +5333,9 @@ function runtimeAuthorizationText(context, mode, { suppressOrdinaryCompletionCon
|
|
|
5242
5333
|
const completion = asRecord(requirements.completion);
|
|
5243
5334
|
const delivery = asRecord(requirements.delivery);
|
|
5244
5335
|
const businessOutcome = asRecord(requirements.businessOutcome);
|
|
5336
|
+
const acceptancePolicy = asRecord(businessOutcome.acceptancePolicy);
|
|
5337
|
+
const acceptanceValidatorIds = Array.isArray(acceptancePolicy.validatorIds) ? acceptancePolicy.validatorIds.filter((value) => typeof value === "string") : [];
|
|
5338
|
+
const evidenceAutoAcceptance = acceptancePolicy.mode === "evidence_auto" && acceptancePolicy.verdictAuthority === "none" && acceptancePolicy.acceptanceAuthority === null && acceptanceValidatorIds.length === EVIDENCE_AUTO_VALIDATOR_IDS.size && acceptanceValidatorIds.every((value) => EVIDENCE_AUTO_VALIDATOR_IDS.has(value));
|
|
5245
5339
|
const completionRole = readString(completion.role);
|
|
5246
5340
|
const completionDeliverable = readString(completion.deliverable);
|
|
5247
5341
|
const manifestRefreshOnly = legacyManifestRefreshOnly(context);
|
|
@@ -5251,13 +5345,16 @@ function runtimeAuthorizationText(context, mode, { suppressOrdinaryCompletionCon
|
|
|
5251
5345
|
firstDocumentCheckpoint,
|
|
5252
5346
|
"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."
|
|
5253
5347
|
].filter(Boolean).join(" ") : "";
|
|
5254
|
-
const businessOutcomeOwnershipContract = businessOutcome.mode === "required" ? [
|
|
5348
|
+
const businessOutcomeOwnershipContract = businessOutcome.mode === "required" ? evidenceAutoAcceptance ? [
|
|
5349
|
+
"Evidence-auto Business Outcome closure is owned by the Server terminal reconciler.",
|
|
5350
|
+
"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."
|
|
5351
|
+
].join(" ") : [
|
|
5255
5352
|
"Business Outcome review is owned by the Server terminal reconciler.",
|
|
5256
5353
|
"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."
|
|
5257
5354
|
].join(" ") : "";
|
|
5258
5355
|
const businessOutcomeTerminalContract = !suppressOrdinaryCompletionContract && businessOutcome.mode === "required" ? [
|
|
5259
5356
|
delivery.mode === "required" ? "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.",
|
|
5260
|
-
delivery.mode === "required" ? "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."
|
|
5357
|
+
evidenceAutoAcceptance ? delivery.mode === "required" ? "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" ? "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."
|
|
5261
5358
|
].join(" ") : "";
|
|
5262
5359
|
const authorizationContract = missing.length > 0 ? [
|
|
5263
5360
|
`Current allowed action classes: ${[...allowed].join(", ") || "task_governance"}.`,
|
|
@@ -9414,7 +9511,7 @@ function assertSourceAcquisitionRuntimeAuthority({
|
|
|
9414
9511
|
}
|
|
9415
9512
|
|
|
9416
9513
|
// src/amaster-runtime-daemon.mjs
|
|
9417
|
-
var CONNECTOR_VERSION = "0.1.1-beta.
|
|
9514
|
+
var CONNECTOR_VERSION = "0.1.1-beta.32";
|
|
9418
9515
|
var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
|
|
9419
9516
|
var SOURCE_ACQUISITION_CAPABILITY = "source_acquisition_v1";
|
|
9420
9517
|
var SOURCE_ACQUISITION_PROFILE_VERSION = "source_acquisition_v1";
|
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.32";
|
|
10
10
|
|
|
11
11
|
const CAPABILITIES = [
|
|
12
12
|
"remote_registration",
|