@amaster.ai/employee-runtime-connector 0.1.1-beta.31 → 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.
|
@@ -4662,6 +4662,86 @@ function governedReadSection(context) {
|
|
|
4662
4662
|
}))
|
|
4663
4663
|
};
|
|
4664
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
|
+
}
|
|
4665
4745
|
function governedBusinessStateSection(context, input) {
|
|
4666
4746
|
const current = asRecord(context.governedBusinessState);
|
|
4667
4747
|
const resume = asRecord(context.governedBusinessResume);
|
|
@@ -4676,6 +4756,9 @@ function governedBusinessStateSection(context, input) {
|
|
|
4676
4756
|
throw new Error(`governed_business_state_scope_mismatch:${label}`);
|
|
4677
4757
|
}
|
|
4678
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");
|
|
4679
4762
|
const rules = [
|
|
4680
4763
|
"This is bounded Server-owned read-side truth. It does not grant mutation authority and it is not a Delivery Manifest claim.",
|
|
4681
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.",
|
|
@@ -4684,13 +4767,16 @@ function governedBusinessStateSection(context, input) {
|
|
|
4684
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.",
|
|
4685
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.",
|
|
4686
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.",
|
|
4687
|
-
"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."
|
|
4688
4772
|
].join("\n");
|
|
4689
4773
|
const bodies = [
|
|
4690
|
-
|
|
4691
|
-
${stringifyBoundedJson(
|
|
4692
|
-
|
|
4693
|
-
|
|
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)}` : ""
|
|
4694
4780
|
].filter(Boolean).join("\n\n");
|
|
4695
4781
|
return {
|
|
4696
4782
|
content: `${rules}
|
|
@@ -9425,7 +9511,7 @@ function assertSourceAcquisitionRuntimeAuthority({
|
|
|
9425
9511
|
}
|
|
9426
9512
|
|
|
9427
9513
|
// src/amaster-runtime-daemon.mjs
|
|
9428
|
-
var CONNECTOR_VERSION = "0.1.1-beta.
|
|
9514
|
+
var CONNECTOR_VERSION = "0.1.1-beta.32";
|
|
9429
9515
|
var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
|
|
9430
9516
|
var SOURCE_ACQUISITION_CAPABILITY = "source_acquisition_v1";
|
|
9431
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",
|