@amaster.ai/employee-runtime-connector 0.1.1-beta.33 → 0.1.1-beta.35
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 +158 -60
- package/dist/amaster-runtime.mjs +1 -1
- package/package.json +1 -1
|
@@ -4641,6 +4641,95 @@ function continuationText(context) {
|
|
|
4641
4641
|
if (!body) return "";
|
|
4642
4642
|
return [readString(summary.title), body].filter(Boolean).join("\n");
|
|
4643
4643
|
}
|
|
4644
|
+
function taskAcceptanceContractError(code, message) {
|
|
4645
|
+
const error = new Error(message);
|
|
4646
|
+
error.code = code;
|
|
4647
|
+
return error;
|
|
4648
|
+
}
|
|
4649
|
+
function formalTaskAcceptanceContractRequired(context) {
|
|
4650
|
+
const requirements = asRecord(asRecord(context.paperclipIssue).taskRequirements);
|
|
4651
|
+
return requirements.requirementsVersion === "v2" && asRecord(requirements.taskIntent).intent === "business" && asRecord(requirements.admission).state === "active";
|
|
4652
|
+
}
|
|
4653
|
+
function sameCanonicalJson(left, right) {
|
|
4654
|
+
return JSON.stringify(canonicalJsonValue(left)) === JSON.stringify(canonicalJsonValue(right));
|
|
4655
|
+
}
|
|
4656
|
+
function taskAcceptanceContractSection(context, input) {
|
|
4657
|
+
const required = formalTaskAcceptanceContractRequired(context);
|
|
4658
|
+
const contract = asRecord(context.taskAcceptanceContract);
|
|
4659
|
+
if (Object.keys(contract).length === 0) {
|
|
4660
|
+
if (required) {
|
|
4661
|
+
throw taskAcceptanceContractError(
|
|
4662
|
+
"task_acceptance_contract_unavailable",
|
|
4663
|
+
"Formal Business Task dispatch requires a Server-owned Task Acceptance Contract"
|
|
4664
|
+
);
|
|
4665
|
+
}
|
|
4666
|
+
return null;
|
|
4667
|
+
}
|
|
4668
|
+
const companyId = readString(asRecord(context.paperclipCompany).id);
|
|
4669
|
+
const issueId = readString(input.issueId);
|
|
4670
|
+
if (companyId && readString(contract.company_id) !== companyId || issueId && readString(contract.issue_id) !== issueId) {
|
|
4671
|
+
throw taskAcceptanceContractError(
|
|
4672
|
+
"task_acceptance_contract_scope_mismatch",
|
|
4673
|
+
"Task Acceptance Contract does not match the current Company and Issue scope"
|
|
4674
|
+
);
|
|
4675
|
+
}
|
|
4676
|
+
const enrollment = asRecord(contract.enrollment);
|
|
4677
|
+
const delivery = asRecord(contract.delivery);
|
|
4678
|
+
const acceptance = asRecord(contract.acceptance);
|
|
4679
|
+
const criteria = Array.isArray(contract.acceptance_criteria) ? contract.acceptance_criteria.map(asRecord) : [];
|
|
4680
|
+
const allowedKinds = Array.isArray(delivery.allowed_kinds) ? delivery.allowed_kinds.map(readString).filter(Boolean) : [];
|
|
4681
|
+
const acceptanceContracts = Array.isArray(delivery.acceptance_contracts) ? delivery.acceptance_contracts : [];
|
|
4682
|
+
const requirementRevision = readString(enrollment.requirement_revision);
|
|
4683
|
+
const sourceRef = readString(contract.source_ref);
|
|
4684
|
+
const validCriteria = criteria.length > 0 && criteria.every((criterion) => readString(criterion.ref) && readString(criterion.text));
|
|
4685
|
+
const validIdentity = readString(contract.schema_version) === "mirrorx.task-acceptance-contract.v1" && readString(contract.company_id) && readString(contract.issue_id) && Number.isInteger(contract.execution_epoch) && readString(contract.observed_at) && readString(enrollment.id) && Number.isInteger(enrollment.revision) && requirementRevision && readString(enrollment.request_hash) && sourceRef === `business_task_enrollment:${readString(enrollment.id)}@${requirementRevision}`;
|
|
4686
|
+
const validDelivery = allowedKinds.length > 0 && new Set(allowedKinds).size === allowedKinds.length && (delivery.contract_state === "explicit_typed" || delivery.contract_state === "acceptance_refs_only") && (delivery.contract_state !== "explicit_typed" || acceptanceContracts.length > 0);
|
|
4687
|
+
const validAcceptance = readString(acceptance.owner_agent_id) && Object.keys(asRecord(acceptance.policy)).length > 0 && readString(acceptance.expected_outcome_at);
|
|
4688
|
+
if (!validIdentity || !validCriteria || !validDelivery || !validAcceptance) {
|
|
4689
|
+
throw taskAcceptanceContractError(
|
|
4690
|
+
"task_acceptance_contract_invalid",
|
|
4691
|
+
"Task Acceptance Contract is incomplete or internally inconsistent"
|
|
4692
|
+
);
|
|
4693
|
+
}
|
|
4694
|
+
const requirements = asRecord(asRecord(context.paperclipIssue).taskRequirements);
|
|
4695
|
+
if (required) {
|
|
4696
|
+
const requirementDelivery = asRecord(requirements.delivery);
|
|
4697
|
+
const requirementOutcome = asRecord(requirements.businessOutcome);
|
|
4698
|
+
const criterionRefs = criteria.map((criterion) => readString(criterion.ref));
|
|
4699
|
+
const requirementAcceptanceRefs = Array.isArray(requirementDelivery.acceptanceRefs) ? requirementDelivery.acceptanceRefs.map(readString).filter(Boolean) : [];
|
|
4700
|
+
const requirementAllowedKinds = Array.isArray(requirementDelivery.allowedKinds) ? requirementDelivery.allowedKinds.map(readString).filter(Boolean) : [];
|
|
4701
|
+
const requirementContracts = Array.isArray(requirementDelivery.acceptanceContracts) ? requirementDelivery.acceptanceContracts : [];
|
|
4702
|
+
const revisionsMatch = [
|
|
4703
|
+
asRecord(requirementDelivery.source),
|
|
4704
|
+
asRecord(requirementOutcome.source)
|
|
4705
|
+
].every((source) => readString(source.revision) === requirementRevision);
|
|
4706
|
+
if (!revisionsMatch || !sameCanonicalJson(criterionRefs, requirementAcceptanceRefs) || !sameCanonicalJson(allowedKinds, requirementAllowedKinds) || !sameCanonicalJson(acceptanceContracts, requirementContracts) || readString(requirementOutcome.acceptanceOwnerAgentId) !== readString(acceptance.owner_agent_id) || readString(requirementOutcome.expectedOutcomeAt) !== readString(acceptance.expected_outcome_at) || !sameCanonicalJson(requirementOutcome.acceptancePolicy, acceptance.policy)) {
|
|
4707
|
+
throw taskAcceptanceContractError(
|
|
4708
|
+
"task_acceptance_contract_invalid",
|
|
4709
|
+
"Task Acceptance Contract does not match the active Task requirement projection"
|
|
4710
|
+
);
|
|
4711
|
+
}
|
|
4712
|
+
}
|
|
4713
|
+
return {
|
|
4714
|
+
content: [
|
|
4715
|
+
"This is the immutable Server-owned acceptance authority for the current execution epoch. Treat every criterion ref and text as exact; do not replace it with the Issue description, a summary, a historical task, or your own interpretation.",
|
|
4716
|
+
"Plan and verify delivery against every criterion. Delivery evidence does not itself grant acceptance; follow the declared Acceptance policy and current Server-owned Outcome path.",
|
|
4717
|
+
"If this contract conflicts with another prompt section or becomes stale after a CAS conflict, re-read the same exact contract through the Governed Business State detail_read rendered for this Issue. Do not guess from an opaque ref.",
|
|
4718
|
+
jsonText(contract)
|
|
4719
|
+
].join("\n"),
|
|
4720
|
+
sourceRef,
|
|
4721
|
+
observedAt: readString(contract.observed_at),
|
|
4722
|
+
freshness: {
|
|
4723
|
+
kind: "immutable_enrollment",
|
|
4724
|
+
requirementRevision,
|
|
4725
|
+
executionEpoch: contract.execution_epoch
|
|
4726
|
+
},
|
|
4727
|
+
scope: {
|
|
4728
|
+
companyId: readString(contract.company_id),
|
|
4729
|
+
issueId: readString(contract.issue_id)
|
|
4730
|
+
}
|
|
4731
|
+
};
|
|
4732
|
+
}
|
|
4644
4733
|
function governedReadSection(context) {
|
|
4645
4734
|
const reads = Array.isArray(context.governedReadResults) ? context.governedReadResults : [];
|
|
4646
4735
|
if (reads.length === 0) return { content: "", provenance: [] };
|
|
@@ -4697,40 +4786,48 @@ function governedBusinessDetailRead(input, issueId) {
|
|
|
4697
4786
|
return { mode: "unavailable", canonical_tool: canonicalTool, reason: "not_in_run_catalog" };
|
|
4698
4787
|
}
|
|
4699
4788
|
if (input.executorKind === "pi" && managedPiMcpProxyAvailable(input)) {
|
|
4700
|
-
return {
|
|
4701
|
-
mode: "mcp_proxy",
|
|
4702
|
-
server: "amaster",
|
|
4703
|
-
tool: canonicalTool,
|
|
4704
|
-
args: JSON.stringify(argumentsValue)
|
|
4705
|
-
};
|
|
4789
|
+
return { mode: "mcp_proxy", ...managedPiMcpProxyCall(canonicalTool, argumentsValue) };
|
|
4706
4790
|
}
|
|
4707
4791
|
return { mode: "canonical", tool: canonicalTool, arguments: argumentsValue };
|
|
4708
4792
|
}
|
|
4709
4793
|
function governedBusinessDecisionProjection(state, detailRead) {
|
|
4710
4794
|
const record6 = asRecord(state);
|
|
4711
4795
|
const snapshot = asRecord(record6.governed_state_snapshot);
|
|
4712
|
-
const enrollment = asRecord(snapshot.business_task_enrollment);
|
|
4713
4796
|
const authoritativeObjectRefs = Array.isArray(record6.authoritative_object_refs) ? record6.authoritative_object_refs : [];
|
|
4714
|
-
const
|
|
4715
|
-
const
|
|
4716
|
-
const generatedAt = readString(snapshot.generated_at);
|
|
4797
|
+
const capabilities = Array.isArray(record6.capabilities) ? record6.capabilities : [];
|
|
4798
|
+
const availability = asRecord(record6.availability);
|
|
4717
4799
|
const projection = {
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4800
|
+
status: readString(availability.status) ?? null,
|
|
4801
|
+
objects: authoritativeObjectRefs.map((entry) => {
|
|
4802
|
+
const object = asRecord(entry);
|
|
4803
|
+
const compact = {
|
|
4804
|
+
kind: readString(object.object_kind) ?? null,
|
|
4805
|
+
ref: readString(object.ref) ?? null,
|
|
4806
|
+
status: readString(object.status) ?? null
|
|
4807
|
+
};
|
|
4808
|
+
if (typeof object.revision === "string" || typeof object.revision === "number") {
|
|
4809
|
+
compact.revision = object.revision;
|
|
4810
|
+
}
|
|
4811
|
+
return compact;
|
|
4812
|
+
}),
|
|
4813
|
+
missing: (Array.isArray(record6.missing_objects) ? record6.missing_objects : []).map((entry) => {
|
|
4814
|
+
const missing = asRecord(entry);
|
|
4815
|
+
return {
|
|
4816
|
+
kind: readString(missing.object_kind) ?? null,
|
|
4817
|
+
state: readString(missing.instance_state) ?? null,
|
|
4818
|
+
reason_code: readString(missing.reason_code) ?? null,
|
|
4819
|
+
next_owner: readString(missing.next_owner) ?? null
|
|
4820
|
+
};
|
|
4821
|
+
}),
|
|
4822
|
+
unsupported: capabilities.filter((entry) => readString(asRecord(entry).object_kind_support) === "unsupported").map((entry) => readString(asRecord(entry).object_kind)).filter(Boolean),
|
|
4823
|
+
observed_at: readString(snapshot.generated_at) ?? null,
|
|
4726
4824
|
detail_read: detailRead
|
|
4727
4825
|
};
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
};
|
|
4826
|
+
const reasonCode = readString(availability.reason_code);
|
|
4827
|
+
if (reasonCode) projection.reason_code = reasonCode;
|
|
4828
|
+
const unavailableReads = capabilities.filter((entry) => readString(asRecord(entry).read_capability) === "unavailable").map((entry) => readString(asRecord(entry).object_kind)).filter(Boolean);
|
|
4829
|
+
if (unavailableReads.length > 0) {
|
|
4830
|
+
projection.unavailable_reads = unavailableReads;
|
|
4734
4831
|
}
|
|
4735
4832
|
const continuationId = readString(record6.continuation_id);
|
|
4736
4833
|
if (continuationId) projection.continuation_id = continuationId;
|
|
@@ -4747,9 +4844,10 @@ function governedBusinessModelView(state, input) {
|
|
|
4747
4844
|
readString(snapshot.issue_id) ?? readString(input.issueId)
|
|
4748
4845
|
);
|
|
4749
4846
|
if (detailRead.mode === "unavailable") {
|
|
4847
|
+
const { task_acceptance_contract: _TaskAcceptanceContract, ...stateWithoutAcceptanceContract } = record6;
|
|
4750
4848
|
return {
|
|
4751
4849
|
mode: "full_snapshot",
|
|
4752
|
-
content:
|
|
4850
|
+
content: stateWithoutAcceptanceContract,
|
|
4753
4851
|
unavailableReason: detailRead.reason
|
|
4754
4852
|
};
|
|
4755
4853
|
}
|
|
@@ -4776,17 +4874,22 @@ function governedBusinessStateSection(context, input) {
|
|
|
4776
4874
|
const currentView = Object.keys(current).length > 0 ? governedBusinessModelView(current, input) : null;
|
|
4777
4875
|
const resumeView = Object.keys(resume).length > 0 ? governedBusinessModelView(resume, input) : null;
|
|
4778
4876
|
const retainsFullSnapshot = [currentView, resumeView].some((view) => view?.mode === "full_snapshot");
|
|
4877
|
+
const governedStates = [current, resume].filter((state) => Object.keys(state).length > 0);
|
|
4878
|
+
const hasUnsupportedObjects = governedStates.some((state) => Array.isArray(state.capabilities) && state.capabilities.some((entry) => readString(asRecord(entry).object_kind_support) === "unsupported"));
|
|
4879
|
+
const hasUnavailableRead = governedStates.some((state) => readString(asRecord(state.availability).status) === "unavailable" || Array.isArray(state.capabilities) && state.capabilities.some((entry) => readString(asRecord(entry).read_capability) === "unavailable"));
|
|
4880
|
+
const hasMissingObjects = governedStates.some((state) => Array.isArray(state.missing_objects) && state.missing_objects.length > 0);
|
|
4881
|
+
const hasFreeTextReason = governedStates.some((state) => Boolean(readString(state.free_text_reason)));
|
|
4882
|
+
const hasChildIssues = Array.isArray(context.childIssueSummaries) && context.childIssueSummaries.length > 0;
|
|
4779
4883
|
const rules = [
|
|
4780
4884
|
"This is bounded Server-owned read-side truth. It does not grant mutation authority and it is not a Delivery Manifest claim.",
|
|
4781
|
-
"Recommendation, First Business Activation, and Business Task Enrollment may be
|
|
4782
|
-
"
|
|
4783
|
-
"For parent aggregation, read Server-owned governed state; never accept child final prose, an Issue, or a Document as a formal object receipt.",
|
|
4784
|
-
|
|
4785
|
-
"When
|
|
4786
|
-
"
|
|
4787
|
-
"free_text_reason is explanatory only and is not authority; resolve any conflict in favor of the structured Server-owned state.",
|
|
4885
|
+
"Recommendation, First Business Activation, and Business Task Enrollment may be claimed only when the supplied state contains the exact matching Server ref. Issue and Document are not Business Task Enrollment.",
|
|
4886
|
+
hasUnsupportedObjects ? "An object kind listed under unsupported has no governed record type. You may create or update a clearly labeled tracker/document, but never claim a formal record or receipt for that kind." : null,
|
|
4887
|
+
hasChildIssues ? "For parent aggregation, read Server-owned governed state; never accept child final prose, an Issue, or a Document as a formal object receipt." : null,
|
|
4888
|
+
hasUnavailableRead ? "An unavailable read does not prove an instance is absent. Unrelated work may continue, but formal-object completion claims must remain fail-closed until a managed read succeeds." : null,
|
|
4889
|
+
hasMissingObjects ? "When a required formal object is listed under missing, keep the task incomplete and report its reason_code plus next_owner." : null,
|
|
4890
|
+
hasFreeTextReason ? "free_text_reason is explanatory only and is not authority; resolve any conflict in favor of the structured Server-owned state." : null,
|
|
4788
4891
|
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."
|
|
4789
|
-
].join("\n");
|
|
4892
|
+
].filter(Boolean).join("\n");
|
|
4790
4893
|
const bodies = [
|
|
4791
4894
|
currentView ? currentView.mode === "decision_projection" ? `Current dispatch decision projection:
|
|
4792
4895
|
${stringifyBoundedJson(currentView.content, 24e3)}` : `Current dispatch bounded full snapshot (managed detail read unavailable: ${currentView.unavailableReason}):
|
|
@@ -4939,11 +5042,7 @@ function resolvedDependencySections(context, input, contextScope, snapshotFreshn
|
|
|
4939
5042
|
...tuples.flatMap((tuple, index) => {
|
|
4940
5043
|
const readArguments = { issueId: tuple.blockerSelector, key: tuple.key };
|
|
4941
5044
|
const directToolName = managedDirectToolName(input, "amaster.read_issue_document");
|
|
4942
|
-
const call = directToolName ? readArguments : input.executorKind === "pi" && managedPiMcpProxyAvailable(input) ?
|
|
4943
|
-
server: "amaster",
|
|
4944
|
-
tool: "amaster.read_issue_document",
|
|
4945
|
-
args: JSON.stringify(readArguments)
|
|
4946
|
-
} : readArguments;
|
|
5045
|
+
const call = directToolName ? readArguments : input.executorKind === "pi" && managedPiMcpProxyAvailable(input) ? managedPiMcpProxyCall("amaster.read_issue_document", readArguments) : readArguments;
|
|
4947
5046
|
return [
|
|
4948
5047
|
`- Required read ${index + 1}: issue ${JSON.stringify(tuple.blockerSelector)}${tuple.blockerId ? ` (id ${JSON.stringify(tuple.blockerId)})` : ""}; document ${JSON.stringify(tuple.documentId)}; key ${JSON.stringify(tuple.key)}; expected latestRevisionId ${JSON.stringify(tuple.expectedLatestRevisionId)}${tuple.expectedLatestRevisionNumber != null ? `; revisionNumber ${tuple.expectedLatestRevisionNumber}` : ""}.`,
|
|
4949
5048
|
directToolName ? ` Call \`${directToolName}\` with these exact object arguments: ${JSON.stringify(call)}` : input.executorKind === "pi" && managedPiMcpProxyAvailable(input) ? ` Exact Pi \`mcp\` arguments: ${JSON.stringify(call)}` : ` Call amaster.read_issue_document with these exact arguments: ${JSON.stringify(call)}`
|
|
@@ -5270,6 +5369,18 @@ function managedDirectToolName(input, canonicalName) {
|
|
|
5270
5369
|
function managedPiMcpProxyAvailable(input) {
|
|
5271
5370
|
return input.managedMcpToolMode === "proxy_only" || input.managedMcpToolMode === "hybrid";
|
|
5272
5371
|
}
|
|
5372
|
+
function managedPiMcpProxyToolName(canonicalName) {
|
|
5373
|
+
const name = readString(canonicalName);
|
|
5374
|
+
if (!name) throw new TypeError("canonical MCP tool name is required");
|
|
5375
|
+
return name.replaceAll(".", "_");
|
|
5376
|
+
}
|
|
5377
|
+
function managedPiMcpProxyCall(canonicalName, args) {
|
|
5378
|
+
return {
|
|
5379
|
+
server: "amaster",
|
|
5380
|
+
tool: managedPiMcpProxyToolName(canonicalName),
|
|
5381
|
+
args: JSON.stringify(args)
|
|
5382
|
+
};
|
|
5383
|
+
}
|
|
5273
5384
|
function runtimeActionContinuationOptionText(input) {
|
|
5274
5385
|
if (!isRecoveryWakeReason(input.wakeReason)) return "";
|
|
5275
5386
|
const heading = "### Runtime Action Continuation Option";
|
|
@@ -5310,11 +5421,7 @@ Runtime Action continuation is unavailable: the run catalog does not advertise t
|
|
|
5310
5421
|
return `${heading}
|
|
5311
5422
|
Runtime Action continuation is unavailable: managed Pi MCP tool mode is not proxy_only. Do not guess a proxy or direct-tool call.`;
|
|
5312
5423
|
}
|
|
5313
|
-
const proxyCall =
|
|
5314
|
-
server: "amaster",
|
|
5315
|
-
tool: "runtime_action.submit",
|
|
5316
|
-
args: JSON.stringify(envelope)
|
|
5317
|
-
};
|
|
5424
|
+
const proxyCall = managedPiMcpProxyCall("runtime_action.submit", envelope);
|
|
5318
5425
|
return [
|
|
5319
5426
|
heading,
|
|
5320
5427
|
"Only after selecting continuation/todo from the disposition menu, emit an actual `mcp` tool call with the exact proxy arguments below. Do not print this JSON as prose and do not add an outer `action` field.",
|
|
@@ -5416,11 +5523,7 @@ function runtimeDecompositionRequirementText(context) {
|
|
|
5416
5523
|
function deliveryReadCallText(input) {
|
|
5417
5524
|
const args = { issueId: input.issueId };
|
|
5418
5525
|
if (input.executorKind === "pi" && managedPiMcpProxyAvailable(input)) {
|
|
5419
|
-
return `emit an mcp proxy call: ${JSON.stringify(
|
|
5420
|
-
server: "amaster",
|
|
5421
|
-
tool: "amaster.read_issue_delivery",
|
|
5422
|
-
args: JSON.stringify(args)
|
|
5423
|
-
})}`;
|
|
5526
|
+
return `emit an mcp proxy call: ${JSON.stringify(managedPiMcpProxyCall("amaster.read_issue_delivery", args))}`;
|
|
5424
5527
|
}
|
|
5425
5528
|
return `call amaster.read_issue_delivery with these exact arguments: ${JSON.stringify(args)}`;
|
|
5426
5529
|
}
|
|
@@ -5509,7 +5612,7 @@ function readIssueEvidenceCommentsCallText(issueId, commentIds, options) {
|
|
|
5509
5612
|
return `call \`${directToolName}\`${batchLabel} with these exact object arguments: ${JSON.stringify(readArguments)}`;
|
|
5510
5613
|
}
|
|
5511
5614
|
if (options?.executorKind === "pi" && managedPiMcpProxyAvailable(options)) {
|
|
5512
|
-
return `emit an mcp proxy call${batchLabel}: ${JSON.stringify(
|
|
5615
|
+
return `emit an mcp proxy call${batchLabel}: ${JSON.stringify(managedPiMcpProxyCall("amaster.read_issue_evidence", readArguments))}`;
|
|
5513
5616
|
}
|
|
5514
5617
|
return `call amaster.read_issue_evidence${batchLabel} with these exact arguments: ${JSON.stringify(readArguments)}`;
|
|
5515
5618
|
}).join("; then ");
|
|
@@ -5521,11 +5624,7 @@ function overflowDependencyRefsText(overflowRefs, input) {
|
|
|
5521
5624
|
...overflowRefs.flatMap((ref, index) => {
|
|
5522
5625
|
const readArguments = { issueId: ref.blockerSelector, key: ref.key };
|
|
5523
5626
|
const directToolName = managedDirectToolName(input, "amaster.read_issue_document");
|
|
5524
|
-
const call = directToolName ? readArguments : input.executorKind === "pi" && managedPiMcpProxyAvailable(input) ?
|
|
5525
|
-
server: "amaster",
|
|
5526
|
-
tool: "amaster.read_issue_document",
|
|
5527
|
-
args: JSON.stringify(readArguments)
|
|
5528
|
-
} : readArguments;
|
|
5627
|
+
const call = directToolName ? readArguments : input.executorKind === "pi" && managedPiMcpProxyAvailable(input) ? managedPiMcpProxyCall("amaster.read_issue_document", readArguments) : readArguments;
|
|
5529
5628
|
return [
|
|
5530
5629
|
`- On-demand read ${index + 1}: issue ${JSON.stringify(ref.blockerSelector)}${ref.blockerId ? ` (id ${JSON.stringify(ref.blockerId)})` : ""}; document ${JSON.stringify(ref.documentId)}; key ${JSON.stringify(ref.key)}; expected latestRevisionId ${JSON.stringify(ref.expectedLatestRevisionId)}${ref.expectedLatestRevisionNumber != null ? `; revisionNumber ${ref.expectedLatestRevisionNumber}` : ""}.`,
|
|
5531
5630
|
directToolName ? ` Call \`${directToolName}\` with these exact object arguments: ${JSON.stringify(call)}` : input.executorKind === "pi" && managedPiMcpProxyAvailable(input) ? ` Exact Pi \`mcp\` arguments: ${JSON.stringify(call)}` : input.managedMcpToolMode === "direct_typed" ? " Exact read unavailable: amaster.read_issue_document is absent from the attested direct tool catalog. Do not guess a tool name or bypass the managed transport." : ` Call amaster.read_issue_document with these exact arguments: ${JSON.stringify(call)}`
|
|
@@ -5561,11 +5660,7 @@ function taskCommentRefGuidance(input, taskText) {
|
|
|
5561
5660
|
}
|
|
5562
5661
|
function piMcpUsageText(input) {
|
|
5563
5662
|
if (!input.hasGovernedMcp || input.executorKind !== "pi" || !managedPiMcpProxyAvailable(input) || isRecoveryWakeReason(input.wakeReason)) return "";
|
|
5564
|
-
const proxy = (tool, args) => JSON.stringify(
|
|
5565
|
-
server: "amaster",
|
|
5566
|
-
tool,
|
|
5567
|
-
args: JSON.stringify(args)
|
|
5568
|
-
});
|
|
5663
|
+
const proxy = (tool, args) => JSON.stringify(managedPiMcpProxyCall(tool, args));
|
|
5569
5664
|
return [
|
|
5570
5665
|
"This run uses the outer `mcp` proxy for Governed MCP calls. Emit actual tool calls; `args` is the stringified inner canonical object. Pi validates this string schema before extension hooks, so never send object-valued `args`.",
|
|
5571
5666
|
"Before the first write, describe that exact canonical action and use the returned schema; do not infer write arguments from this example.",
|
|
@@ -5631,6 +5726,7 @@ var CONTEXT_AVAILABILITY_SECTION_TITLES = Object.freeze({
|
|
|
5631
5726
|
wake_comments: "Wake Delta",
|
|
5632
5727
|
task: "Task Context",
|
|
5633
5728
|
governed_business_state: "Governed Business State",
|
|
5729
|
+
task_acceptance_contract: "Task Acceptance Contract",
|
|
5634
5730
|
continuation_summary: "Continuation Summary",
|
|
5635
5731
|
resolved_dependencies: "Resolved Dependency Outputs",
|
|
5636
5732
|
runtime_delivery_readiness: "Current Delivery Readiness",
|
|
@@ -5725,6 +5821,7 @@ function compileCommandPromptWithManifest(input, options = {}) {
|
|
|
5725
5821
|
const suppressOrdinaryCompletionContract = completeRecoveryInstruction.length > 0;
|
|
5726
5822
|
const governedReads = governedReadSection(context);
|
|
5727
5823
|
const governedBusinessState = governedBusinessStateSection(context, input);
|
|
5824
|
+
const taskAcceptanceContract = taskAcceptanceContractSection(context, input);
|
|
5728
5825
|
const verifiedCompanyContext = verifiedCompanyContextSection(context);
|
|
5729
5826
|
const hasTask = Boolean(readString(input.taskMarkdown));
|
|
5730
5827
|
const taskText = readString(input.taskMarkdown) ?? "";
|
|
@@ -5777,6 +5874,7 @@ ${resolvedDependencies.details.content}` : ""
|
|
|
5777
5874
|
{ name: "approval_continuation", title: "Approved Runtime Action Continuation", priority: 99, sourceRef: `run:${input.runId ?? "unknown"}`, content: approvalContinuationText(input), truncationReason: mode === "continuation" ? null : "mode_selection" },
|
|
5778
5875
|
{ name: "wake_comments", title: wakeDeltaTitle, priority: interactionResolution ? 99 : 95, sourceRef: wakeDeltaSourceRefs, originalContent: wakeDeltaOriginal, content: wakeDeltaContent, truncationReason: commentsSelected ? null : "duplicate_task_context" },
|
|
5779
5876
|
{ 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" },
|
|
5877
|
+
...taskAcceptanceContract ? [{ name: "task_acceptance_contract", title: "Task Acceptance Contract", priority: 100, ...taskAcceptanceContract }] : [],
|
|
5780
5878
|
...governedBusinessState ? [{ name: "governed_business_state", title: "Governed Business State", priority: 99, ...governedBusinessState }] : [],
|
|
5781
5879
|
{ name: "continuation_summary", title: "Continuation Summary", priority: 97, sourceRef: readString(asRecord(context.paperclipContinuationSummary).key) ?? `issue:${input.issueId ?? "unknown"}`, observedAt: readString(asRecord(context.paperclipContinuationSummary).updatedAt), originalContent: continuationSummary, content: mode === "cold" ? "" : continuationSummary, truncationReason: mode === "cold" ? "mode_selection" : null },
|
|
5782
5880
|
...resolvedDependencyContent ? [{
|
|
@@ -9528,7 +9626,7 @@ function assertSourceAcquisitionRuntimeAuthority({
|
|
|
9528
9626
|
}
|
|
9529
9627
|
|
|
9530
9628
|
// src/amaster-runtime-daemon.mjs
|
|
9531
|
-
var CONNECTOR_VERSION = "0.1.1-beta.
|
|
9629
|
+
var CONNECTOR_VERSION = "0.1.1-beta.35";
|
|
9532
9630
|
var CONNECTOR_CONTRACT_VERSION = "2026-06-04.v1";
|
|
9533
9631
|
var SOURCE_ACQUISITION_CAPABILITY = "source_acquisition_v1";
|
|
9534
9632
|
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.35";
|
|
10
10
|
|
|
11
11
|
const CAPABILITIES = [
|
|
12
12
|
"remote_registration",
|