UNPKG

@receiz/mcp-server

Version:

MCP server for agents building and verifying Receiz proof-native applications through the canonical Receiz SDK rails.

469 lines • 30.8 kB
import { RECEIZ_CURRENT_REGISTRY_DIGEST, RECEIZ_LIVING_SUBJECT_REDUCER_DIGEST, digestReceizCompositeCanonical, } from "@receiz/sdk"; import { runReceizLivingSubjectConformanceV120 } from "@receiz/sdk/testing"; const TOOL_NAMES = [ "receiz_subject_resolve", "receiz_subject_state", "receiz_subject_history", "receiz_subject_memory_query", "receiz_subject_relationships", "receiz_subject_inventory", "receiz_subject_twin_profile", "receiz_subject_twin_message", "receiz_subject_twin_mind_export", "receiz_subject_twin_mind_import_plan", "receiz_subject_mandate_get", "receiz_subject_mandate_plan", "receiz_subject_mandate_activate", "receiz_subject_mandate_pause", "receiz_subject_mandate_revoke", "receiz_world_additions", "receiz_world_command_plan", "receiz_world_command_validate", "receiz_world_command_execute", "receiz_world_transaction_plan", "receiz_world_transaction_execute", "receiz_world_receipt", "receiz_world_replay", "receiz_subject_runtime_enqueue", "receiz_subject_runtime_status", "receiz_subject_runtime_cancel", "receiz_living_subject_conformance", "receiz_subject_brain_head", "receiz_subject_brain_search", "receiz_subject_brain_resolve", "receiz_subject_brain_stream", "receiz_bearer_transfer_preview", "receiz_bearer_instrument_issue", "receiz_bearer_instrument_inspect", "receiz_bearer_instrument_claim", "receiz_bearer_transfer_cancel", "receiz_bearer_transfer_status", ]; export const RECEIZ_V120_LIVING_SUBJECT_MCP_TOOL_NAMES = Object.freeze(TOOL_NAMES); const stringSchema = (description) => ({ type: "string", description }); const integerSchema = (description) => ({ type: "integer", minimum: 1, description }); const arraySchema = (items, description) => ({ type: "array", items, description }); const objectSchema = (properties, required = []) => ({ type: "object", additionalProperties: false, properties, ...(required.length ? { required } : {}), }); const typedObject = (description) => ({ type: "object", description, additionalProperties: true, }); const SUBJECT_ID = stringSchema("Exact living-subject ID."); const DIGEST = stringSchema("Exact lowercase sha-256 digest."); const CONFIRMATION = stringSchema("Exact confirmation digest returned by the corresponding plan or preview call."); const AUTHORITY = typedObject("Typed receiz.world authority carrying the owner or active bounded mandate."); const CAPABILITY = typedObject("Typed Receiz capability; MCP does not create or enlarge it."); function schemaFor(name) { switch (name) { case "receiz_subject_resolve": case "receiz_subject_state": case "receiz_subject_relationships": case "receiz_subject_inventory": case "receiz_subject_twin_profile": case "receiz_subject_twin_mind_export": case "receiz_subject_mandate_get": case "receiz_subject_brain_head": return objectSchema({ subjectId: SUBJECT_ID }, ["subjectId"]); case "receiz_subject_history": return objectSchema({ subjectId: SUBJECT_ID, afterHead: DIGEST, limit: integerSchema("Maximum admitted events to return.") }, ["subjectId"]); case "receiz_subject_memory_query": return objectSchema({ subjectId: SUBJECT_ID, types: arraySchema(stringSchema("Memory type."), "Event-derived memory types."), visibility: { type: "string", enum: ["public", "private", "all"] }, afterKai: stringSchema("Exclusive Kai cursor."), limit: integerSchema("Maximum memories to return."), }, ["subjectId"]); case "receiz_subject_twin_message": return objectSchema({ subjectId: SUBJECT_ID, input: typedObject("Exact receiz.subject Twin message input.") }, ["subjectId", "input"]); case "receiz_subject_twin_mind_import_plan": return objectSchema({ subjectId: SUBJECT_ID, artifact: typedObject("Exact receiz.subject.mind.v1 artifact including artifact bytes.") }, ["subjectId", "artifact"]); case "receiz_subject_mandate_plan": return objectSchema({ subjectId: SUBJECT_ID, policy: typedObject("Exact bounded mandate policy.") }, ["subjectId", "policy"]); case "receiz_subject_mandate_activate": return objectSchema({ mandateDigest: DIGEST, confirmationDigest: CONFIRMATION, ownerCapability: CAPABILITY }, ["mandateDigest", "confirmationDigest", "ownerCapability"]); case "receiz_subject_mandate_pause": case "receiz_subject_mandate_revoke": return objectSchema({ subjectId: SUBJECT_ID, mandateDigest: DIGEST, confirmationDigest: CONFIRMATION }, ["subjectId", "mandateDigest"]); case "receiz_world_additions": return objectSchema({ worldId: stringSchema("Exact world ID."), afterHead: DIGEST, types: arraySchema(stringSchema("Event kind."), "Optional admitted event kinds.") }, ["worldId"]); case "receiz_world_command_plan": return objectSchema({ input: typedObject("Exact receiz.world.command.v1 planning input.") }, ["input"]); case "receiz_world_command_validate": return objectSchema({ planDigest: DIGEST }, ["planDigest"]); case "receiz_world_command_execute": case "receiz_world_transaction_execute": return objectSchema({ planDigest: DIGEST, confirmationDigest: CONFIRMATION, authority: AUTHORITY }, ["planDigest", "confirmationDigest", "authority"]); case "receiz_world_transaction_plan": return objectSchema({ participants: arraySchema(SUBJECT_ID, "Every affected subject."), expectedHeads: { type: "object", additionalProperties: { type: "string" } }, commands: arraySchema(typedObject("Typed receiz.world.command.v1."), "Commands admitted together."), }, ["participants", "expectedHeads", "commands"]); case "receiz_world_receipt": return objectSchema({ receiptId: DIGEST }, ["receiptId"]); case "receiz_world_replay": return objectSchema({ worldId: stringSchema("Exact world ID."), throughHead: DIGEST }, ["worldId"]); case "receiz_subject_runtime_enqueue": return objectSchema({ input: typedObject("Exact durable subject runtime tick input."), confirmationDigest: CONFIRMATION }, ["input"]); case "receiz_subject_runtime_status": return objectSchema({ jobId: DIGEST }, ["jobId"]); case "receiz_subject_runtime_cancel": return objectSchema({ subjectId: SUBJECT_ID, confirmationDigest: CONFIRMATION }, ["subjectId"]); case "receiz_living_subject_conformance": return objectSchema({}); case "receiz_subject_brain_search": return objectSchema({ subjectId: SUBJECT_ID, input: typedObject("Exact-head proof-index search input.") }, ["subjectId", "input"]); case "receiz_subject_brain_resolve": return objectSchema({ subjectId: SUBJECT_ID, atHead: DIGEST, references: arraySchema(typedObject("Typed proof reference."), "References returned by search.") }, ["subjectId", "atHead", "references"]); case "receiz_subject_brain_stream": return objectSchema({ subjectId: SUBJECT_ID, input: typedObject("Exact-head proof-index streaming input.") }, ["subjectId", "input"]); case "receiz_bearer_transfer_preview": return objectSchema({ subjectId: SUBJECT_ID, policy: typedObject("Exact signed transfer policy.") }, ["subjectId", "policy"]); case "receiz_bearer_instrument_issue": return objectSchema({ transferId: DIGEST, confirmationDigest: CONFIRMATION, ownerCapability: CAPABILITY }, ["transferId", "confirmationDigest", "ownerCapability"]); case "receiz_bearer_instrument_inspect": return objectSchema({ artifact: typedObject("Exact portable bearer instrument artifact.") }, ["artifact"]); case "receiz_bearer_instrument_claim": return objectSchema({ artifact: typedObject("Exact portable bearer instrument artifact."), recipientCapability: CAPABILITY, confirmationDigest: CONFIRMATION }, ["artifact", "recipientCapability"]); case "receiz_bearer_transfer_cancel": return objectSchema({ transferId: DIGEST, ownerCapability: CAPABILITY, confirmationDigest: CONFIRMATION }, ["transferId", "ownerCapability"]); case "receiz_bearer_transfer_status": return objectSchema({ transferId: DIGEST }, ["transferId"]); } } const outputSchema = objectSchema({ schema: { const: "receiz.mcp.primitive-result.v120" }, sourcePrimitive: stringSchema("Canonical SDK primitive used for this result."), registryDigest: DIGEST, reducerDigest: DIGEST, mcpAuthority: { const: false }, result: {}, }, ["schema", "sourcePrimitive", "registryDigest", "reducerDigest", "mcpAuthority", "result"]); export const RECEIZ_V120_LIVING_SUBJECT_MCP_TOOLS = Object.freeze(TOOL_NAMES.map((name) => Object.freeze({ name, description: `${name.startsWith("receiz_bearer_") ? "Historical V120 instrument compatibility: requires an explicitly configured historical HTTP host with custody coordination and authority admission. The standard local subject host does not execute cross-owner bearer transfers. The current SDK canonical sealed-artifact claim is ownership.claimBearerAsset; its protocol heads are distinct. Retired MCP aliases are not enabled by this compatibility tool. " : ""}Call the canonical Receiz v120 SDK ${name.replace(/^receiz_/, "").replaceAll("_", " ")} primitive. MCP is not authority; exact heads, bytes, capabilities, mandates, registry digest, and reducer digest remain SDK-governed.`, inputSchema: schemaFor(name), outputSchema, }))); class LivingSubjectMcpError extends Error { code; constructor(code) { super(code); this.code = code; this.name = "LivingSubjectMcpError"; } } function object(value, code = "receiz_mcp_typed_input_required") { if (typeof value !== "object" || value === null || Array.isArray(value)) throw new LivingSubjectMcpError(code); return value; } function text(value, key) { const resolved = value[key]; if (typeof resolved !== "string" || !resolved) throw new LivingSubjectMcpError(`receiz_mcp_${key}_required`); return resolved; } function confirmation(action, basis) { return digestReceizCompositeCanonical({ schema: "receiz.mcp.execution-confirmation.v120", action, basis }); } function primitiveResult(sourcePrimitive, result, metadata = {}) { return Object.freeze({ schema: "receiz.mcp.primitive-result.v120", sourcePrimitive, registryDigest: metadata.registryDigest ?? RECEIZ_CURRENT_REGISTRY_DIGEST, reducerDigest: metadata.reducerDigest ?? RECEIZ_LIVING_SUBJECT_REDUCER_DIGEST, mcpAuthority: false, result: structuredClone(result), }); } function resultMetadata(value) { if (typeof value !== "object" || value === null) return {}; const candidate = value; if (typeof candidate.registryDigest === "string" && typeof candidate.reducerDigest === "string") { return { registryDigest: candidate.registryDigest, reducerDigest: candidate.reducerDigest }; } return resultMetadata(candidate.receipt ?? candidate.head); } export function createReceizMcpLivingSubjectOperations(client, options = {}) { const commandPlans = new Map(); const transactionPlans = new Map(); const mandatePlans = new Map(); const transferPlans = new Map(); const requireConfirmation = (raw, action, basis) => { const expected = confirmation(action, basis); const supplied = typeof raw.confirmationDigest === "string" ? raw.confirmationDigest : ""; if (!supplied) return { confirmed: false, confirmationDigest: expected }; if (supplied !== expected) throw new LivingSubjectMcpError("receiz_mcp_confirmation_digest_invalid"); return { confirmed: true, confirmationDigest: expected }; }; const confirmationRequired = (sourcePrimitive, action, basis) => primitiveResult(sourcePrimitive, { status: "confirmation-required", writes: 0, confirmationDigest: confirmation(action, basis), exactDigestConfirmationRequired: true, }); return Object.freeze({ has: (name) => TOOL_NAMES.includes(name), requiresDelegated: (name) => (!options.localSubjectRuntime || name.startsWith("receiz_bearer_")) && [ "receiz_subject_twin_message", "receiz_subject_mandate_plan", "receiz_subject_mandate_activate", "receiz_subject_mandate_pause", "receiz_subject_mandate_revoke", "receiz_world_command_plan", "receiz_world_command_execute", "receiz_world_transaction_plan", "receiz_world_transaction_execute", "receiz_subject_runtime_enqueue", "receiz_subject_runtime_cancel", "receiz_bearer_transfer_preview", "receiz_bearer_instrument_issue", "receiz_bearer_instrument_claim", "receiz_bearer_transfer_cancel", ].includes(name), async call(name, raw) { const subjectId = typeof raw.subjectId === "string" ? raw.subjectId : ""; if (name === "receiz_subject_resolve") { const result = await client.subjects.resolve(text(raw, "subjectId")); return primitiveResult("receiz.subject.v1", result, resultMetadata(result)); } if (name === "receiz_subject_state") { const result = options.localSubjectRuntime ? await options.localSubjectRuntime.subjects.state(text(raw, "subjectId")) : await client.subjects.state(text(raw, "subjectId")); return primitiveResult("receiz.subject.v1", result, resultMetadata(result)); } if (name === "receiz_subject_history") { const result = await client.subjects.history(text(raw, "subjectId"), { ...(typeof raw.afterHead === "string" ? { afterHead: raw.afterHead } : {}), ...(typeof raw.limit === "number" ? { limit: raw.limit } : {}), }); return primitiveResult("receiz.world.event.v1", result); } if (name === "receiz_subject_memory_query") { const result = await client.subjects.memory.query(text(raw, "subjectId"), { ...(Array.isArray(raw.types) ? { types: raw.types.filter((entry) => typeof entry === "string") } : {}), ...(raw.visibility === "public" || raw.visibility === "private" || raw.visibility === "all" ? { visibility: raw.visibility } : {}), ...(typeof raw.afterKai === "string" ? { afterKai: raw.afterKai } : {}), ...(typeof raw.limit === "number" ? { limit: raw.limit } : {}), }); return primitiveResult("receiz.subject.memory_event.v1", result); } if (name === "receiz_subject_relationships") return primitiveResult("receiz.subject.relationship.v1", await client.subjects.relationships.list(text(raw, "subjectId"))); if (name === "receiz_subject_inventory") return primitiveResult("receiz.subject.inventory.v1", await client.subjects.inventory.list(text(raw, "subjectId"))); if (name === "receiz_subject_twin_profile") { const result = await client.subjects.twin.profile(text(raw, "subjectId")); return primitiveResult("receiz.subject.self_model.v1", result, resultMetadata(result)); } if (name === "receiz_subject_twin_message") { const result = await client.subjects.twin.message(text(raw, "subjectId"), object(raw.input)); return primitiveResult("receiz.subject.intent.v1", result, resultMetadata(result)); } if (name === "receiz_subject_twin_mind_export") { const result = await client.subjects.twin.exportMind(text(raw, "subjectId")); return primitiveResult("receiz.subject.mind.v1", result, resultMetadata(result)); } if (name === "receiz_subject_twin_mind_import_plan") { const artifact = object(raw.artifact); const exactDigest = digestReceizCompositeCanonical({ exactBytesB64u: artifact.exactBytesB64u }); if (artifact.schema !== "receiz.subject.mind.v1" || artifact.mindDigest !== exactDigest || artifact.subjectArtifact.subject.subjectId !== text(raw, "subjectId")) { throw new LivingSubjectMcpError("receiz_mcp_subject_mind_exact_artifact_invalid"); } const current = await client.subjects.resolve(subjectId); if (current.subject.identityDigest !== artifact.subjectArtifact.subject.identityDigest) { throw new LivingSubjectMcpError("receiz_mcp_subject_mind_identity_binding_invalid"); } const planDigest = digestReceizCompositeCanonical({ schema: "receiz.subject.mind_import_plan.v1", subjectId, currentHead: current.subject.head, mindDigest: artifact.mindDigest }); return primitiveResult("receiz.subject.mind.v1", { planDigest, mindDigest: artifact.mindDigest, currentHead: current.subject.head, writes: 0, exactArtifactResolved: true }); } if (name === "receiz_subject_mandate_get") return primitiveResult("receiz.subject.mandate.v1", await client.subjects.mandates.get(text(raw, "subjectId"))); if (name === "receiz_subject_mandate_plan") { const plan = await client.subjects.mandates.plan(text(raw, "subjectId"), object(raw.policy)); mandatePlans.set(plan.mandateDigest, plan); return primitiveResult("receiz.subject.mandate.v1", { plan, confirmationDigest: confirmation("mandate.activate", plan.mandateDigest), writes: 0 }); } if (name === "receiz_subject_mandate_activate") { const mandateDigest = text(raw, "mandateDigest"); const plan = mandatePlans.get(mandateDigest); if (!plan) throw new LivingSubjectMcpError("receiz_mcp_mandate_plan_not_resolved"); const confirmed = requireConfirmation(raw, "mandate.activate", mandateDigest); if (!confirmed.confirmed) return confirmationRequired("receiz.subject.mandate.v1", "mandate.activate", mandateDigest); const result = await client.subjects.mandates.activate(plan, object(raw.ownerCapability)); return primitiveResult("receiz.subject.mandate.v1", result, resultMetadata(result)); } if (name === "receiz_subject_mandate_pause" || name === "receiz_subject_mandate_revoke") { const mandateDigest = text(raw, "mandateDigest"); const action = name === "receiz_subject_mandate_pause" ? "mandate.pause" : "mandate.revoke"; const current = await client.subjects.mandates.get(text(raw, "subjectId")); if (!current.some((mandate) => mandate.mandateDigest === mandateDigest)) throw new LivingSubjectMcpError("receiz_mcp_mandate_digest_not_current"); const confirmed = requireConfirmation(raw, action, { subjectId, mandateDigest }); if (!confirmed.confirmed) return confirmationRequired("receiz.subject.mandate.v1", action, { subjectId, mandateDigest }); const result = name === "receiz_subject_mandate_pause" ? await client.subjects.mandates.pause(subjectId) : await client.subjects.mandates.revoke(subjectId); return primitiveResult("receiz.subject.mandate.v1", result); } if (name === "receiz_world_additions") { const result = await client.world.additions({ worldId: text(raw, "worldId"), ...(typeof raw.afterHead === "string" ? { afterHead: raw.afterHead } : {}), ...(Array.isArray(raw.types) ? { types: raw.types.filter((entry) => typeof entry === "string") } : {}), }); return primitiveResult("receiz.world.event.v1", result); } if (name === "receiz_world_command_plan") { const plan = await client.world.planCommand(object(raw.input)); commandPlans.set(plan.planDigest, plan); return primitiveResult("receiz.world.command.v1", { plan, confirmationDigest: confirmation("world.command.execute", plan.planDigest), writes: 0 }, resultMetadata(plan)); } if (name === "receiz_world_command_validate") { const plan = commandPlans.get(text(raw, "planDigest")); if (!plan) throw new LivingSubjectMcpError("receiz_mcp_world_command_plan_not_resolved"); const result = await client.world.validateCommand(plan); return primitiveResult("receiz.world.command.v1", result, resultMetadata(plan)); } if (name === "receiz_world_command_execute") { const planDigest = text(raw, "planDigest"); const plan = commandPlans.get(planDigest); if (!plan) throw new LivingSubjectMcpError("receiz_mcp_world_command_plan_not_resolved"); const confirmed = requireConfirmation(raw, "world.command.execute", planDigest); if (!confirmed.confirmed) return confirmationRequired("receiz.world.command.v1", "world.command.execute", planDigest); const result = await client.world.executeCommand(plan, object(raw.authority)); return primitiveResult("receiz.world.receipt.v1", result, resultMetadata(result)); } if (name === "receiz_world_transaction_plan") { const plan = await client.world.planTransaction({ participants: Array.isArray(raw.participants) ? raw.participants.filter((entry) => typeof entry === "string") : [], expectedHeads: object(raw.expectedHeads), commands: (Array.isArray(raw.commands) ? raw.commands : []), }); transactionPlans.set(plan.transactionDigest, plan); return primitiveResult("receiz.world.transaction.v1", { plan, planDigest: plan.transactionDigest, confirmationDigest: confirmation("world.transaction.execute", plan.transactionDigest), writes: 0 }, resultMetadata(plan)); } if (name === "receiz_world_transaction_execute") { const planDigest = text(raw, "planDigest"); const plan = transactionPlans.get(planDigest); if (!plan) throw new LivingSubjectMcpError("receiz_mcp_world_transaction_plan_not_resolved"); const confirmed = requireConfirmation(raw, "world.transaction.execute", planDigest); if (!confirmed.confirmed) return confirmationRequired("receiz.world.transaction.v1", "world.transaction.execute", planDigest); const result = await client.world.executeTransaction(plan, object(raw.authority)); return primitiveResult("receiz.world.receipt.v1", result, resultMetadata(result)); } if (name === "receiz_world_receipt") { const result = await client.world.receipt(text(raw, "receiptId")); return primitiveResult("receiz.world.receipt.v1", result, resultMetadata(result)); } if (name === "receiz_world_replay") { const result = await client.world.replay({ worldId: text(raw, "worldId"), ...(typeof raw.throughHead === "string" ? { throughHead: raw.throughHead } : {}) }); return primitiveResult("receiz.world.checkpoint.v1", result, resultMetadata(result)); } if (name === "receiz_subject_runtime_enqueue") { const input = object(raw.input); const confirmed = requireConfirmation(raw, "subject.runtime.enqueue", input); if (!confirmed.confirmed) return confirmationRequired("receiz.subject.runtime_job.v1", "subject.runtime.enqueue", input); const result = await client.subjects.runtime.enqueueTick(input); return primitiveResult("receiz.subject.runtime_job.v1", result, resultMetadata(result)); } if (name === "receiz_subject_runtime_status") return primitiveResult("receiz.subject.runtime_job.v1", await client.subjects.runtime.status(text(raw, "jobId"))); if (name === "receiz_subject_runtime_cancel") { const basis = { subjectId: text(raw, "subjectId") }; const confirmed = requireConfirmation(raw, "subject.runtime.cancel", basis); if (!confirmed.confirmed) return confirmationRequired("receiz.subject.runtime_job.v1", "subject.runtime.cancel", basis); return primitiveResult("receiz.subject.runtime_job.v1", await client.subjects.runtime.pause(basis.subjectId)); } if (name === "receiz_subject_brain_head") { const result = await client.subjects.brain.head(text(raw, "subjectId")); return primitiveResult("receiz.subject.proof_brain.v1", result, resultMetadata(result)); } if (name === "receiz_subject_brain_search") return primitiveResult("receiz.subject.proof_reference.v1", await client.subjects.brain.search(text(raw, "subjectId"), object(raw.input))); if (name === "receiz_subject_brain_resolve") { const result = await client.subjects.brain.resolve(text(raw, "subjectId"), { atHead: text(raw, "atHead"), references: (Array.isArray(raw.references) ? raw.references : []), }); return primitiveResult("receiz.subject.proof_context.v1", result, resultMetadata(result)); } if (name === "receiz_subject_brain_stream") { const events = []; for await (const event of client.subjects.brain.stream(text(raw, "subjectId"), object(raw.input))) events.push(event); return primitiveResult("receiz.subject.proof_context.v1", { events }); } if (name === "receiz_bearer_transfer_preview") { const plan = await client.bearer.previewTransfer({ subjectId: text(raw, "subjectId"), policy: object(raw.policy) }); transferPlans.set(plan.transferId, plan); return primitiveResult("receiz.bearer.transfer_plan.v1", { plan, confirmationDigest: confirmation("bearer.instrument.issue", plan.transferDigest), writes: 0 }, resultMetadata(plan)); } if (name === "receiz_bearer_instrument_issue") { const plan = transferPlans.get(text(raw, "transferId")); if (!plan) throw new LivingSubjectMcpError("receiz_mcp_bearer_transfer_plan_not_resolved"); const confirmed = requireConfirmation(raw, "bearer.instrument.issue", plan.transferDigest); if (!confirmed.confirmed) return confirmationRequired("receiz.bearer.instrument.v1", "bearer.instrument.issue", plan.transferDigest); const result = await client.bearer.issueTransferInstrument({ plan, ownerCapability: object(raw.ownerCapability) }); return primitiveResult("receiz.bearer.instrument.v1", result, resultMetadata(result)); } if (name === "receiz_bearer_instrument_inspect") { const result = await client.bearer.inspectInstrument(object(raw.artifact)); return primitiveResult("receiz.bearer.instrument.v1", result, resultMetadata(result)); } if (name === "receiz_bearer_instrument_claim") { const artifact = object(raw.artifact); const inspected = await client.bearer.inspectInstrument(artifact); if (!inspected.valid || !inspected.offlineVerified || inspected.instrument.artifactDigest !== artifact.artifactDigest) { throw new LivingSubjectMcpError("receiz_mcp_bearer_instrument_exact_bytes_invalid"); } const confirmed = requireConfirmation(raw, "bearer.instrument.claim", artifact.artifactDigest); if (!confirmed.confirmed) return confirmationRequired("receiz.bearer.claim.v1", "bearer.instrument.claim", artifact.artifactDigest); const result = await client.bearer.claimInstrument(artifact, object(raw.recipientCapability)); return primitiveResult("receiz.bearer.transfer_receipt.v1", result, resultMetadata(result)); } if (name === "receiz_bearer_transfer_cancel") { const transferId = text(raw, "transferId"); const current = await client.bearer.transferStatus(transferId); const confirmed = requireConfirmation(raw, "bearer.transfer.cancel", { transferId, instrumentDigest: current.instrumentDigest }); if (!confirmed.confirmed) return confirmationRequired("receiz.bearer.transfer_plan.v1", "bearer.transfer.cancel", { transferId, instrumentDigest: current.instrumentDigest }); const result = await client.bearer.cancelTransfer(transferId, object(raw.ownerCapability)); return primitiveResult("receiz.subject.ownership_transition.v1", result, resultMetadata(result)); } if (name === "receiz_bearer_transfer_status") return primitiveResult("receiz.bearer.transfer_plan.v1", await client.bearer.transferStatus(text(raw, "transferId"))); if (name === "receiz_living_subject_conformance") { const result = await runReceizLivingSubjectConformanceV120(); return primitiveResult("receiz.living-subject.conformance.v120", result, resultMetadata(result)); } throw new LivingSubjectMcpError("receiz_mcp_living_subject_tool_unknown"); }, }); } //# sourceMappingURL=livingSubjectOperations.js.map