agent-passport-system-mcp 3.4.0 → 5.0.0
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/README.md +7 -7
- package/build/index.d.ts +2 -1
- package/build/index.js +1090 -983
- package/build/setup.js +2 -1
- package/build/toolManifest.d.ts +14 -0
- package/build/toolManifest.js +38 -0
- package/package.json +9 -8
- package/tools-manifest.json +158 -0
package/build/index.js
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
// Start: AGENT_KEY=<pubkey> npx agent-passport-system-mcp
|
|
12
12
|
// or: call the identify tool first
|
|
13
13
|
// ══════════════════════════════════════════════════════════════
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
14
|
+
import { serveStdio } from "@modelcontextprotocol/server/stdio";
|
|
15
|
+
import { McpServer } from "@modelcontextprotocol/server";
|
|
16
16
|
import { z } from "zod";
|
|
17
17
|
import { readFileSync, writeFileSync, existsSync } from "node:fs";
|
|
18
18
|
import { join, resolve } from "node:path";
|
|
@@ -55,7 +55,7 @@ import { registerSelfAttestedSource, } from "agent-passport-system";
|
|
|
55
55
|
// Data Lifecycle Governance (Modules 43+)
|
|
56
56
|
import { createDerivationReceipt, resolveExtendedLineage, evaluateRevocationImpact, createDecisionLineageReceipt, isPurposePermitted, purposeCategory, isRetentionExpired, checkAggregateConstraints, isTransferPermitted, computeGovernanceTaint, fileDispute, checkCombinationPermitted, createAccessSnapshot, resolveRightsPropagation, DEFAULT_RIGHTS_PROPAGATION, detectPurposeDrift, declareReidentificationRisk, verifyGovernanceBlock, parseGovernanceBlockFromHTML, isUsagePermitted, embedGovernance, generateApsTxt, verifyApsTxt, resolveTermsForPath, createChainedGovernanceBlock, createAccessReceipt, governanceLoop360, } from "agent-passport-system";
|
|
57
57
|
// Rome-Complete: Charter, Approval, Time, Reserve, Federation
|
|
58
|
-
import { createCharter, signCharter, verifyCharter,
|
|
58
|
+
import { createCharter, signCharter, verifyCharter, createAmendment, signAmendment, verifyAmendment, createApprovalRequest, addApprovalSignature, createHybridTimestamp, compareTimestamps, validateTemporalRights, createReserveAttestation, vouchReputation, applyReputationDowngrade,
|
|
59
59
|
// v2 boundary primitives (AttributionConsent, ProvisionalStatement, HumanEscalationFlag)
|
|
60
60
|
createAttributionReceipt, signAttributionConsent, verifyAttributionConsent, checkArtifactCitations, receiptCore, createProvisional, promoteStatement, verifyPromotion, withdrawProvisional, withdrawalPayload, isBinding, checkEscalationRequired, requestOwnerConfirmation, recordOwnerConfirmation,
|
|
61
61
|
// Attribution Primitive (unified four-axis signed Merkle receipt)
|
|
@@ -68,6 +68,7 @@ aggregateAttributionPrimitives, buildContributorQueryResponse, signSettlementRec
|
|
|
68
68
|
// Mutual Authentication v1 (SDK v2.2.0)
|
|
69
69
|
// ═══════════════════════════════════════
|
|
70
70
|
import { buildCertificate, signCertificate, certificateId, verifyBundle, verifyAttest, deriveSession, } from "agent-passport-system";
|
|
71
|
+
import { toolCount } from "./toolManifest.js";
|
|
71
72
|
// ═══════════════════════════════════════
|
|
72
73
|
// Capability Token v0.1 (reference implementation)
|
|
73
74
|
// Spec: agent-passport-system/docs/CAPABILITY-TOKEN-SPEC-DRAFT.md
|
|
@@ -160,6 +161,7 @@ const state = {
|
|
|
160
161
|
derivationStore: new Map(),
|
|
161
162
|
sessionAgent: null,
|
|
162
163
|
charters: new Map(),
|
|
164
|
+
amendments: new Map(),
|
|
163
165
|
approvalRequests: new Map(),
|
|
164
166
|
// Agent Attestation Architecture (Phase 1)
|
|
165
167
|
issuanceContexts: new Map(),
|
|
@@ -397,7 +399,8 @@ const TOOL_PROFILES = {
|
|
|
397
399
|
'create_agent_context', 'execute_with_context', 'complete_action',
|
|
398
400
|
'create_delegation', 'verify_delegation', 'revoke_delegation',
|
|
399
401
|
'create_charter', 'sign_charter', 'verify_charter',
|
|
400
|
-
'
|
|
402
|
+
'propose_amendment', 'sign_amendment', 'verify_amendment',
|
|
403
|
+
'create_approval_request', 'add_approval_signature',
|
|
401
404
|
'create_outcome_record', 'add_principal_report',
|
|
402
405
|
'activate_emergency', 'define_emergency_pathway',
|
|
403
406
|
'create_artifact_provenance', 'create_policy_context',
|
|
@@ -437,7 +440,6 @@ const TOOL_PROFILES = {
|
|
|
437
440
|
'gateway_stats', 'create_delegation', 'load_values_floor', 'attest_to_floor',
|
|
438
441
|
'create_hybrid_timestamp', 'compare_timestamps', 'validate_temporal_rights',
|
|
439
442
|
'create_reserve_attestation', 'vouch_reputation', 'apply_reputation_downgrade',
|
|
440
|
-
'evaluate_threshold',
|
|
441
443
|
]),
|
|
442
444
|
comms: new Set([
|
|
443
445
|
'identify', 'generate_keys',
|
|
@@ -473,9 +475,32 @@ const TOOL_PROFILES = {
|
|
|
473
475
|
};
|
|
474
476
|
const activeProfile = (process.env.APS_PROFILE || 'full').toLowerCase();
|
|
475
477
|
const profileFilter = TOOL_PROFILES[activeProfile];
|
|
476
|
-
// Wrap server.
|
|
477
|
-
|
|
478
|
-
|
|
478
|
+
// Wrap server.registerTool: profile filtering + try/catch on all handlers.
|
|
479
|
+
// Retargeted from the v1 `.tool` during the 2026-07-28 migration: the codemod
|
|
480
|
+
// rewrote the 150 call sites to registerTool but left this wrapper on `.tool`,
|
|
481
|
+
// which would have silently disabled both profile filtering and the handler
|
|
482
|
+
// try/catch. The wrapper body is unchanged: registerTool(name, config, cb)
|
|
483
|
+
// still carries the handler as its last argument.
|
|
484
|
+
// Every tool name that reaches the wrapper, in registration order.
|
|
485
|
+
//
|
|
486
|
+
// This is the single structural source of truth for the tool inventory. The build
|
|
487
|
+
// step writes tools-manifest.json from this array, the boundary test asserts the
|
|
488
|
+
// live registry equals that manifest, and list_profiles and setup read its count.
|
|
489
|
+
// Nothing counts `server.registerTool(` call sites in source text: that is source
|
|
490
|
+
// scraping, and it is the coupling that let a downstream consumer silently report
|
|
491
|
+
// zero once the registration API was renamed.
|
|
492
|
+
//
|
|
493
|
+
// RECORDED BEFORE THE PROFILE FILTER ON PURPOSE. The wrapper below RETURNS EARLY
|
|
494
|
+
// when APS_PROFILE filters a tool out. Pushing after that early return would make
|
|
495
|
+
// the manifest a function of whichever profile happened to be set when the build
|
|
496
|
+
// ran, which is the same defect one layer up. The inventory is a property of the
|
|
497
|
+
// source, not of the environment, so the push happens first and unconditionally.
|
|
498
|
+
// tests/v2-boundary-tools.test.mjs asserts the manifest is identical under
|
|
499
|
+
// APS_PROFILE=full and APS_PROFILE=governance.
|
|
500
|
+
export const REGISTERED_TOOL_NAMES = [];
|
|
501
|
+
const _origTool = server.registerTool.bind(server);
|
|
502
|
+
server.registerTool = function (name, ...rest) {
|
|
503
|
+
REGISTERED_TOOL_NAMES.push(name);
|
|
479
504
|
if (name !== 'list_profiles' && activeProfile !== 'full' && profileFilter && !profileFilter.has(name)) {
|
|
480
505
|
return; // filtered out by profile
|
|
481
506
|
}
|
|
@@ -581,7 +606,9 @@ const TOOL_SCOPE_MAP = {
|
|
|
581
606
|
'create_charter': 'governance',
|
|
582
607
|
'verify_charter': 'governance',
|
|
583
608
|
'sign_charter': 'governance',
|
|
584
|
-
'
|
|
609
|
+
'propose_amendment': 'governance',
|
|
610
|
+
'sign_amendment': 'governance',
|
|
611
|
+
'verify_amendment': 'governance',
|
|
585
612
|
'create_approval_request': 'governance',
|
|
586
613
|
'add_approval_signature': 'governance',
|
|
587
614
|
'generate_governance_block': 'governance',
|
|
@@ -677,17 +704,19 @@ const TOOL_SCOPE_MAP = {
|
|
|
677
704
|
// ═══════════════════════════════════════
|
|
678
705
|
// TOOL: list_profiles
|
|
679
706
|
// ═══════════════════════════════════════
|
|
680
|
-
server.
|
|
707
|
+
server.registerTool("list_profiles", { description: "Show available tool profiles. Set APS_PROFILE env var to limit exposed tools (e.g. APS_PROFILE=data).", inputSchema: z.object({}) }, async () => {
|
|
681
708
|
const lines = Object.entries(TOOL_PROFILES).map(([name, tools]) => `• ${name} (${tools.size} tools): ${Array.from(tools).slice(0, 6).join(', ')}${tools.size > 6 ? '...' : ''}`);
|
|
682
709
|
const essentialSize = TOOL_PROFILES.essential.size;
|
|
683
|
-
|
|
710
|
+
// Generated count, never a literal. See src/toolManifest.ts.
|
|
711
|
+
const total = toolCount(REGISTERED_TOOL_NAMES.length);
|
|
712
|
+
return { content: [{ type: "text", text: `📋 Tool Profiles (set APS_PROFILE env var):\n\nActive: ${activeProfile} (${activeProfile === 'full' ? total : profileFilter?.size || total} tools)\n\nRecommended: essential (${essentialSize} tools) - identity, delegation, enforcement, commerce, reputation.\n\n${lines.join('\n')}\n\n• full (${total} tools): All tools exposed (default)` }] };
|
|
684
713
|
});
|
|
685
714
|
// ═══════════════════════════════════════
|
|
686
715
|
// TOOL: list_tools_for_scope (Primitive #9: Tool Pool Assembly)
|
|
687
716
|
// ═══════════════════════════════════════
|
|
688
|
-
server.
|
|
689
|
-
|
|
690
|
-
}, async ({ scopes }) => {
|
|
717
|
+
server.registerTool("list_tools_for_scope", { description: "List available MCP tools filtered by delegation scope. Pass your delegation scopes to see which tools you can use. Scopes: identity, delegation, principal, reputation, coordination, communication, governance, commerce, data, gateway, network, temporal, attribution, settlement, capability, mutual-auth. Use ['*'] for all tools.", inputSchema: z.object({
|
|
718
|
+
scopes: z.array(z.string()).describe("Your delegation scopes, e.g. ['identity', 'delegation', 'commerce']"),
|
|
719
|
+
}) }, async ({ scopes }) => {
|
|
691
720
|
const allTools = Object.entries(TOOL_SCOPE_MAP);
|
|
692
721
|
const scopeSet = new Set(scopes);
|
|
693
722
|
const filtered = allTools.filter(([_, scope]) => scope === '*' || scopeSet.has(scope) || scopeSet.has('*'));
|
|
@@ -712,11 +741,11 @@ server.tool("list_tools_for_scope", "List available MCP tools filtered by delega
|
|
|
712
741
|
// ═══════════════════════════════════════
|
|
713
742
|
// TOOL: identify
|
|
714
743
|
// ═══════════════════════════════════════
|
|
715
|
-
server.
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
}, async (args) => {
|
|
744
|
+
server.registerTool("identify", { description: "Identify yourself to the coordination server. Sets your role and scopes tools accordingly.", inputSchema: z.object({
|
|
745
|
+
public_key: z.string().describe("Your Ed25519 public key"),
|
|
746
|
+
private_key: z.string().describe("Your Ed25519 private key (for signing)"),
|
|
747
|
+
agent_id: z.string().optional().describe("Your agent ID"),
|
|
748
|
+
}) }, async (args) => {
|
|
720
749
|
recordBehavior('identify');
|
|
721
750
|
state.agentKey = args.public_key;
|
|
722
751
|
state.privateKey = args.private_key;
|
|
@@ -757,7 +786,7 @@ server.tool("identify", "Identify yourself to the coordination server. Sets your
|
|
|
757
786
|
// ═══════════════════════════════════════
|
|
758
787
|
// TOOL: generate_keys
|
|
759
788
|
// ═══════════════════════════════════════
|
|
760
|
-
server.
|
|
789
|
+
server.registerTool("generate_keys", { description: "Generate an Ed25519 keypair for agent identity.", inputSchema: z.object({}) }, async () => {
|
|
761
790
|
const keys = generateKeyPair();
|
|
762
791
|
const isRemote = process.env.MCP_TRANSPORT === 'sse' || process.env.MCP_REMOTE === '1';
|
|
763
792
|
return {
|
|
@@ -777,13 +806,13 @@ server.tool("generate_keys", "Generate an Ed25519 keypair for agent identity.",
|
|
|
777
806
|
// ═══════════════════════════════════════
|
|
778
807
|
// TOOL: issue_passport
|
|
779
808
|
// ═══════════════════════════════════════
|
|
780
|
-
server.
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
}, async (args) => {
|
|
809
|
+
server.registerTool("issue_passport", { description: "Issue a complete agent passport with keys, signed passport, attestation summary, and optional values floor in a single call. The server silently captures Tier 0 observed signals and computes a passport grade (0-3). Use this to onboard any agent — no npm install required.", inputSchema: z.object({
|
|
810
|
+
name: z.string().describe("Agent name (human-readable)"),
|
|
811
|
+
owner: z.string().describe("Owner/principal identifier"),
|
|
812
|
+
mission: z.string().optional().describe("Agent mission description"),
|
|
813
|
+
capabilities: z.array(z.string()).optional().describe("Agent capabilities (e.g., ['research', 'writing'])"),
|
|
814
|
+
attest_to_floor: z.boolean().optional().describe("If true, attests to the default values floor (F-001 through F-008)"),
|
|
815
|
+
}) }, async (args) => {
|
|
787
816
|
const issuanceStart = Date.now();
|
|
788
817
|
// Phase 0: Silent Observation — capture Tier 0 signals before processing
|
|
789
818
|
state.issuanceCount++;
|
|
@@ -884,19 +913,19 @@ server.tool("issue_passport", "Issue a complete agent passport with keys, signed
|
|
|
884
913
|
// ═══════════════════════════════════════
|
|
885
914
|
// TOOL: verify_issuer
|
|
886
915
|
// ═══════════════════════════════════════
|
|
887
|
-
server.
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
signature: z.string(),
|
|
891
|
-
signedAt: z.string(),
|
|
892
|
-
issuerSignature: z.object({
|
|
893
|
-
issuerId: z.string(),
|
|
894
|
-
issuerPublicKey: z.string(),
|
|
916
|
+
server.registerTool("verify_issuer", { description: "Verify that a passport was officially issued by AEOESS. Checks the issuer countersignature against the published AEOESS public key. Returns false for self-signed passports.", inputSchema: z.object({
|
|
917
|
+
passport: z.object({
|
|
918
|
+
passport: z.any(),
|
|
895
919
|
signature: z.string(),
|
|
896
920
|
signedAt: z.string(),
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
921
|
+
issuerSignature: z.object({
|
|
922
|
+
issuerId: z.string(),
|
|
923
|
+
issuerPublicKey: z.string(),
|
|
924
|
+
signature: z.string(),
|
|
925
|
+
signedAt: z.string(),
|
|
926
|
+
}).optional(),
|
|
927
|
+
}).describe("The signed passport object to verify"),
|
|
928
|
+
}) }, async (args) => {
|
|
900
929
|
const sp = args.passport;
|
|
901
930
|
const hasIssuerSig = isIssuerVerified(sp);
|
|
902
931
|
const isValid = hasIssuerSig ? verifyIssuerSignature(sp, AEOESS_ISSUER_PUBLIC_KEY) : false;
|
|
@@ -921,9 +950,9 @@ server.tool("verify_issuer", "Verify that a passport was officially issued by AE
|
|
|
921
950
|
// ═══════════════════════════════════════
|
|
922
951
|
// TOOL: get_passport_grade
|
|
923
952
|
// ═══════════════════════════════════════
|
|
924
|
-
server.
|
|
925
|
-
|
|
926
|
-
}, async (args) => {
|
|
953
|
+
server.registerTool("get_passport_grade", { description: "Query the attestation grade and issuance context for a passport. Returns the passport grade (0-3), flags, and evidence summary. Grade 0 = self-signed, 1 = issuer countersigned, 2 = runtime-bound, 3 = principal-bound. This is the partner-facing trust query.", inputSchema: z.object({
|
|
954
|
+
agent_id: z.string().describe("The agent ID of the passport to query"),
|
|
955
|
+
}) }, async (args) => {
|
|
927
956
|
const context = state.issuanceContexts.get(args.agent_id);
|
|
928
957
|
if (!context) {
|
|
929
958
|
return {
|
|
@@ -966,7 +995,7 @@ server.tool("get_passport_grade", "Query the attestation grade and issuance cont
|
|
|
966
995
|
// ═══════════════════════════════════════
|
|
967
996
|
// TOOL: list_issuance_records
|
|
968
997
|
// ═══════════════════════════════════════
|
|
969
|
-
server.
|
|
998
|
+
server.registerTool("list_issuance_records", { description: "List all stored issuance records with their passport grades. Shows how many passports have been issued in this session and their trust posture. Useful for monitoring issuance patterns.", inputSchema: z.object({}) }, async () => {
|
|
970
999
|
const records = Array.from(state.issuanceContexts.entries()).map(([agentId, ctx]) => ({
|
|
971
1000
|
agentId,
|
|
972
1001
|
grade: ctx.assessment.passportGrade,
|
|
@@ -994,9 +1023,9 @@ server.tool("list_issuance_records", "List all stored issuance records with thei
|
|
|
994
1023
|
// ═══════════════════════════════════════
|
|
995
1024
|
// TOOL: get_behavioral_sequence
|
|
996
1025
|
// ═══════════════════════════════════════
|
|
997
|
-
server.
|
|
998
|
-
|
|
999
|
-
}, async (args) => {
|
|
1026
|
+
server.registerTool("get_behavioral_sequence", { description: "Get the post-issuance behavioral sequence for an agent. Shows the first 10 tool calls after passport issuance. Real agents do work. Farming agents extract. This is consilium signal #2.", inputSchema: z.object({
|
|
1027
|
+
agent_id: z.string().describe("The agent ID to query"),
|
|
1028
|
+
}) }, async (args) => {
|
|
1000
1029
|
const sequence = state.postIssuanceBehavior.get(args.agent_id);
|
|
1001
1030
|
if (!sequence || sequence.length === 0) {
|
|
1002
1031
|
return {
|
|
@@ -1038,7 +1067,7 @@ server.tool("get_behavioral_sequence", "Get the post-issuance behavioral sequenc
|
|
|
1038
1067
|
// ═══════════════════════════════════════
|
|
1039
1068
|
// TOOL: get_my_role
|
|
1040
1069
|
// ═══════════════════════════════════════
|
|
1041
|
-
server.
|
|
1070
|
+
server.registerTool("get_my_role", { description: "Get your current role, assigned tasks, and role-specific instructions.", inputSchema: z.object({}) }, async () => {
|
|
1042
1071
|
if (!state.agentRole) {
|
|
1043
1072
|
return {
|
|
1044
1073
|
content: [{
|
|
@@ -1148,25 +1177,25 @@ YOU MUST NOT: Modify deliverables directly. Report issues to the operator.`,
|
|
|
1148
1177
|
// ═══════════════════════════════════════
|
|
1149
1178
|
// OPERATOR TOOLS
|
|
1150
1179
|
// ═══════════════════════════════════════
|
|
1151
|
-
server.
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
}, async (args) => {
|
|
1180
|
+
server.registerTool("create_task_brief", { description: "[OPERATOR] Create a new task with roles, deliverables, and acceptance criteria.", inputSchema: z.object({
|
|
1181
|
+
title: z.string().describe("Task title"),
|
|
1182
|
+
description: z.string().describe("What needs to be done"),
|
|
1183
|
+
roles: z.array(z.object({
|
|
1184
|
+
role: z.string().describe("Role name (researcher, analyst, builder, reviewer, or custom)"),
|
|
1185
|
+
description: z.string().describe("What this role does"),
|
|
1186
|
+
allowed_scopes: z.array(z.string()).describe("What this role CAN do"),
|
|
1187
|
+
forbidden_scopes: z.array(z.string()).describe("What this role CANNOT do"),
|
|
1188
|
+
required_capabilities: z.array(z.string()).optional().describe("Agent must have these capabilities"),
|
|
1189
|
+
})).describe("Roles needed for this task"),
|
|
1190
|
+
deliverables: z.array(z.object({
|
|
1191
|
+
name: z.string(),
|
|
1192
|
+
description: z.string(),
|
|
1193
|
+
format: z.string(),
|
|
1194
|
+
produced_by: z.string().describe("Which role produces this"),
|
|
1195
|
+
})).describe("Expected outputs"),
|
|
1196
|
+
acceptance_criteria: z.array(z.string()).describe("What 'done' looks like"),
|
|
1197
|
+
deadline: z.string().optional().describe("ISO 8601 deadline"),
|
|
1198
|
+
}) }, async (args) => {
|
|
1170
1199
|
const keyErr = requireKey();
|
|
1171
1200
|
if (keyErr)
|
|
1172
1201
|
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
@@ -1212,14 +1241,14 @@ server.tool("create_task_brief", "[OPERATOR] Create a new task with roles, deliv
|
|
|
1212
1241
|
}],
|
|
1213
1242
|
};
|
|
1214
1243
|
});
|
|
1215
|
-
server.
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
}, async (args) => {
|
|
1244
|
+
server.registerTool("assign_agent", { description: "[OPERATOR] Assign an agent to a role in a task. Creates a delegation automatically.", inputSchema: z.object({
|
|
1245
|
+
task_id: z.string().describe("Task ID"),
|
|
1246
|
+
role: z.string().describe("Role to assign"),
|
|
1247
|
+
agent_id: z.string().describe("Agent ID"),
|
|
1248
|
+
agent_public_key: z.string().describe("Agent's Ed25519 public key"),
|
|
1249
|
+
scope: z.array(z.string()).describe("Delegation scopes"),
|
|
1250
|
+
spend_limit: z.number().default(500).describe("Max spend"),
|
|
1251
|
+
}) }, async (args) => {
|
|
1223
1252
|
const keyErr = requireKey();
|
|
1224
1253
|
if (keyErr)
|
|
1225
1254
|
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
@@ -1264,19 +1293,19 @@ server.tool("assign_agent", "[OPERATOR] Assign an agent to a role in a task. Cre
|
|
|
1264
1293
|
}],
|
|
1265
1294
|
};
|
|
1266
1295
|
});
|
|
1267
|
-
server.
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
}, async (args) => {
|
|
1296
|
+
server.registerTool("review_evidence", { description: "[OPERATOR] Review an evidence packet. Score it and approve, rework, or reject.", inputSchema: z.object({
|
|
1297
|
+
task_id: z.string().describe("Task ID"),
|
|
1298
|
+
packet_id: z.string().describe("Evidence packet ID to review"),
|
|
1299
|
+
verdict: z.enum(["approve", "rework", "reject"]).describe("Your verdict"),
|
|
1300
|
+
score: z.number().min(0).max(100).describe("Quality score 0-100"),
|
|
1301
|
+
threshold: z.number().default(70).describe("Minimum passing score"),
|
|
1302
|
+
rationale: z.string().describe("Why this verdict"),
|
|
1303
|
+
issues: z.array(z.object({
|
|
1304
|
+
claim_id: z.string(),
|
|
1305
|
+
issue: z.string(),
|
|
1306
|
+
severity: z.enum(["critical", "major", "minor"]),
|
|
1307
|
+
})).optional().describe("Specific issues found"),
|
|
1308
|
+
}) }, async (args) => {
|
|
1280
1309
|
const keyErr = requireKey();
|
|
1281
1310
|
if (keyErr)
|
|
1282
1311
|
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
@@ -1322,13 +1351,13 @@ server.tool("review_evidence", "[OPERATOR] Review an evidence packet. Score it a
|
|
|
1322
1351
|
return { content: [{ type: "text", text: safeError("Error", e) }], isError: true };
|
|
1323
1352
|
}
|
|
1324
1353
|
});
|
|
1325
|
-
server.
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
}, async (args) => {
|
|
1354
|
+
server.registerTool("handoff_evidence", { description: "[OPERATOR] Transfer approved evidence from researcher to analyst.", inputSchema: z.object({
|
|
1355
|
+
task_id: z.string().describe("Task ID"),
|
|
1356
|
+
packet_id: z.string().describe("Approved evidence packet ID"),
|
|
1357
|
+
review_id: z.string().describe("Review ID that approved it"),
|
|
1358
|
+
to_role: z.string().describe("Destination role (e.g. analyst)"),
|
|
1359
|
+
to_agent_key: z.string().describe("Destination agent's public key"),
|
|
1360
|
+
}) }, async (args) => {
|
|
1332
1361
|
const keyErr = requireKey();
|
|
1333
1362
|
if (keyErr)
|
|
1334
1363
|
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
@@ -1370,11 +1399,11 @@ server.tool("handoff_evidence", "[OPERATOR] Transfer approved evidence from rese
|
|
|
1370
1399
|
return { content: [{ type: "text", text: safeError("Error", e) }], isError: true };
|
|
1371
1400
|
}
|
|
1372
1401
|
});
|
|
1373
|
-
server.
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
}, async (args) => {
|
|
1402
|
+
server.registerTool("complete_task", { description: "[OPERATOR] Close the task unit with final status and retrospective.", inputSchema: z.object({
|
|
1403
|
+
task_id: z.string().describe("Task ID"),
|
|
1404
|
+
status: z.enum(["completed", "failed", "partial"]).describe("Final status"),
|
|
1405
|
+
retrospective: z.string().optional().describe("What went well, what didn't"),
|
|
1406
|
+
}) }, async (args) => {
|
|
1378
1407
|
const keyErr = requireKey();
|
|
1379
1408
|
if (keyErr)
|
|
1380
1409
|
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
@@ -1411,9 +1440,9 @@ server.tool("complete_task", "[OPERATOR] Close the task unit with final status a
|
|
|
1411
1440
|
// ═══════════════════════════════════════
|
|
1412
1441
|
// WORKER TOOLS (any assigned role)
|
|
1413
1442
|
// ═══════════════════════════════════════
|
|
1414
|
-
server.
|
|
1415
|
-
|
|
1416
|
-
}, async (args) => {
|
|
1443
|
+
server.registerTool("accept_assignment", { description: "[ANY ROLE] Accept your task assignment. Confirms you're ready to work.", inputSchema: z.object({
|
|
1444
|
+
task_id: z.string().describe("Task ID to accept"),
|
|
1445
|
+
}) }, async (args) => {
|
|
1417
1446
|
const keyErr = requireKey();
|
|
1418
1447
|
if (keyErr)
|
|
1419
1448
|
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
@@ -1442,18 +1471,18 @@ server.tool("accept_assignment", "[ANY ROLE] Accept your task assignment. Confir
|
|
|
1442
1471
|
}],
|
|
1443
1472
|
};
|
|
1444
1473
|
});
|
|
1445
|
-
server.
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
}, async (args) => {
|
|
1474
|
+
server.registerTool("submit_evidence", { description: "[RESEARCHER] Submit research evidence as a signed packet with citations.", inputSchema: z.object({
|
|
1475
|
+
task_id: z.string().describe("Task ID"),
|
|
1476
|
+
claims: z.array(z.object({
|
|
1477
|
+
dimension: z.string().describe("Evaluation dimension"),
|
|
1478
|
+
subject: z.string().describe("What's being evaluated"),
|
|
1479
|
+
claim: z.string().describe("The factual claim"),
|
|
1480
|
+
quote: z.string().describe("Supporting quote from source (10+ words)"),
|
|
1481
|
+
source_url: z.string().describe("Verifiable source URL"),
|
|
1482
|
+
confidence: z.enum(["high", "medium", "low", "not_found"]).describe("Confidence level"),
|
|
1483
|
+
})).describe("Evidence claims with citations"),
|
|
1484
|
+
methodology: z.string().describe("How you gathered this evidence"),
|
|
1485
|
+
}) }, async (args) => {
|
|
1457
1486
|
recordBehavior('submit_evidence');
|
|
1458
1487
|
const keyErr = requireKey();
|
|
1459
1488
|
if (keyErr)
|
|
@@ -1495,9 +1524,9 @@ server.tool("submit_evidence", "[RESEARCHER] Submit research evidence as a signe
|
|
|
1495
1524
|
}],
|
|
1496
1525
|
};
|
|
1497
1526
|
});
|
|
1498
|
-
server.
|
|
1499
|
-
|
|
1500
|
-
}, async (args) => {
|
|
1527
|
+
server.registerTool("get_evidence", { description: "[ANALYST/BUILDER/REVIEWER] Get evidence that was handed off to you.", inputSchema: z.object({
|
|
1528
|
+
task_id: z.string().describe("Task ID"),
|
|
1529
|
+
}) }, async (args) => {
|
|
1501
1530
|
const unit = state.taskUnits.get(args.task_id);
|
|
1502
1531
|
if (!unit)
|
|
1503
1532
|
return { content: [{ type: "text", text: `Task ${args.task_id} not found.` }], isError: true };
|
|
@@ -1536,14 +1565,14 @@ server.tool("get_evidence", "[ANALYST/BUILDER/REVIEWER] Get evidence that was ha
|
|
|
1536
1565
|
}],
|
|
1537
1566
|
};
|
|
1538
1567
|
});
|
|
1539
|
-
server.
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
}, async (args) => {
|
|
1568
|
+
server.registerTool("submit_deliverable", { description: "[ANALYST/BUILDER] Submit your final output tied to evidence.", inputSchema: z.object({
|
|
1569
|
+
task_id: z.string().describe("Task ID"),
|
|
1570
|
+
spec_id: z.string().describe("Deliverable spec ID from the brief"),
|
|
1571
|
+
content: z.string().describe("The deliverable content"),
|
|
1572
|
+
evidence_packet_ids: z.array(z.string()).describe("Evidence packet IDs used"),
|
|
1573
|
+
citation_count: z.number().describe("Number of citations in output"),
|
|
1574
|
+
gaps_flagged: z.number().describe("Number of gaps explicitly flagged"),
|
|
1575
|
+
}) }, async (args) => {
|
|
1547
1576
|
const keyErr = requireKey();
|
|
1548
1577
|
if (keyErr)
|
|
1549
1578
|
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
@@ -1582,7 +1611,7 @@ server.tool("submit_deliverable", "[ANALYST/BUILDER] Submit your final output ti
|
|
|
1582
1611
|
// ═══════════════════════════════════════
|
|
1583
1612
|
// SHARED TOOLS (any agent)
|
|
1584
1613
|
// ═══════════════════════════════════════
|
|
1585
|
-
server.
|
|
1614
|
+
server.registerTool("list_tasks", { description: "List all tasks in the coordination store.", inputSchema: z.object({}) }, async () => {
|
|
1586
1615
|
const tasks = Array.from(state.taskUnits.entries()).map(([id, unit]) => ({
|
|
1587
1616
|
taskId: id,
|
|
1588
1617
|
title: unit.brief.title,
|
|
@@ -1604,9 +1633,9 @@ server.tool("list_tasks", "List all tasks in the coordination store.", {}, async
|
|
|
1604
1633
|
}],
|
|
1605
1634
|
};
|
|
1606
1635
|
});
|
|
1607
|
-
server.
|
|
1608
|
-
|
|
1609
|
-
}, async (args) => {
|
|
1636
|
+
server.registerTool("get_task_detail", { description: "Get full details of a specific task including all evidence, reviews, and deliverables.", inputSchema: z.object({
|
|
1637
|
+
task_id: z.string().describe("Task ID"),
|
|
1638
|
+
}) }, async (args) => {
|
|
1610
1639
|
const unit = state.taskUnits.get(args.task_id);
|
|
1611
1640
|
if (!unit)
|
|
1612
1641
|
return { content: [{ type: "text", text: `Task ${args.task_id} not found.` }], isError: true };
|
|
@@ -1664,13 +1693,13 @@ server.tool("get_task_detail", "Get full details of a specific task including al
|
|
|
1664
1693
|
// ═══════════════════════════════════════
|
|
1665
1694
|
// DELEGATION TOOLS (Layer 1)
|
|
1666
1695
|
// ═══════════════════════════════════════
|
|
1667
|
-
server.
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
}, async (args) => {
|
|
1696
|
+
server.registerTool("create_delegation", { description: "[OPERATOR] Create a scoped delegation from one agent to another.", inputSchema: z.object({
|
|
1697
|
+
delegated_to: z.string().describe("Public key of the agent receiving delegation"),
|
|
1698
|
+
scope: z.array(z.string()).describe("Scopes to grant (e.g. ['web_search', 'code_execution'])"),
|
|
1699
|
+
spend_limit: z.number().default(500).describe("Maximum spend allowed"),
|
|
1700
|
+
max_depth: z.number().default(1).describe("How many levels of sub-delegation"),
|
|
1701
|
+
expires_in_hours: z.number().default(24).describe("Delegation validity in hours"),
|
|
1702
|
+
}) }, async (args) => {
|
|
1674
1703
|
recordBehavior('create_delegation');
|
|
1675
1704
|
const keyErr = requireKey();
|
|
1676
1705
|
if (keyErr)
|
|
@@ -1715,9 +1744,9 @@ server.tool("create_delegation", "[OPERATOR] Create a scoped delegation from one
|
|
|
1715
1744
|
}],
|
|
1716
1745
|
};
|
|
1717
1746
|
});
|
|
1718
|
-
server.
|
|
1719
|
-
|
|
1720
|
-
}, async (args) => {
|
|
1747
|
+
server.registerTool("verify_delegation", { description: "Verify a delegation's cryptographic signature and validity.", inputSchema: z.object({
|
|
1748
|
+
delegation_id: z.string().describe("Delegation ID to verify"),
|
|
1749
|
+
}) }, async (args) => {
|
|
1721
1750
|
const delegation = state.delegations.get(args.delegation_id);
|
|
1722
1751
|
if (!delegation)
|
|
1723
1752
|
return { content: [{ type: "text", text: `Delegation ${args.delegation_id} not found in session.` }], isError: true };
|
|
@@ -1735,11 +1764,11 @@ server.tool("verify_delegation", "Verify a delegation's cryptographic signature
|
|
|
1735
1764
|
}],
|
|
1736
1765
|
};
|
|
1737
1766
|
});
|
|
1738
|
-
server.
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
}, async (args) => {
|
|
1767
|
+
server.registerTool("revoke_delegation", { description: "[OPERATOR] Revoke a delegation. Optionally cascade to all sub-delegations.", inputSchema: z.object({
|
|
1768
|
+
delegation_id: z.string().describe("Delegation ID to revoke"),
|
|
1769
|
+
reason: z.string().describe("Why the delegation is being revoked"),
|
|
1770
|
+
cascade: z.boolean().default(true).describe("Also revoke all sub-delegations"),
|
|
1771
|
+
}) }, async (args) => {
|
|
1743
1772
|
recordBehavior('revoke_delegation');
|
|
1744
1773
|
const keyErr = requireKey();
|
|
1745
1774
|
if (keyErr)
|
|
@@ -1772,12 +1801,12 @@ server.tool("revoke_delegation", "[OPERATOR] Revoke a delegation. Optionally cas
|
|
|
1772
1801
|
};
|
|
1773
1802
|
}
|
|
1774
1803
|
});
|
|
1775
|
-
server.
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
}, async (args) => {
|
|
1804
|
+
server.registerTool("sub_delegate", { description: "Sub-delegate authority to another agent (must be within your delegation scope and depth).", inputSchema: z.object({
|
|
1805
|
+
parent_delegation_id: z.string().describe("Your delegation ID"),
|
|
1806
|
+
delegated_to: z.string().describe("Public key of the agent receiving sub-delegation"),
|
|
1807
|
+
scope: z.array(z.string()).describe("Scopes to grant (must be subset of parent)"),
|
|
1808
|
+
spend_limit: z.number().describe("Maximum spend (must be <= parent)"),
|
|
1809
|
+
}) }, async (args) => {
|
|
1781
1810
|
const keyErr = requireKey();
|
|
1782
1811
|
if (keyErr)
|
|
1783
1812
|
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
@@ -1818,13 +1847,13 @@ server.tool("sub_delegate", "Sub-delegate authority to another agent (must be wi
|
|
|
1818
1847
|
// ═══════════════════════════════════════
|
|
1819
1848
|
// AGORA TOOLS (Layer 4)
|
|
1820
1849
|
// ═══════════════════════════════════════
|
|
1821
|
-
server.
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
}, async (args) => {
|
|
1850
|
+
server.registerTool("post_agora_message", { description: "Post a signed message to the Agora feed. Anyone can read, everything is signed.", inputSchema: z.object({
|
|
1851
|
+
topic: z.string().describe("Topic channel (e.g. 'coordination', 'governance', 'general')"),
|
|
1852
|
+
type: z.enum(["announcement", "proposal", "discussion", "request", "ack", "vote"]).describe("Message type"),
|
|
1853
|
+
subject: z.string().describe("One-line summary"),
|
|
1854
|
+
content: z.string().describe("Message body (markdown)"),
|
|
1855
|
+
reply_to: z.string().optional().describe("Message ID to reply to (for threading)"),
|
|
1856
|
+
}) }, async (args) => {
|
|
1828
1857
|
const keyErr = requireKey();
|
|
1829
1858
|
if (keyErr)
|
|
1830
1859
|
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
@@ -1854,7 +1883,7 @@ server.tool("post_agora_message", "Post a signed message to the Agora feed. Anyo
|
|
|
1854
1883
|
}],
|
|
1855
1884
|
};
|
|
1856
1885
|
});
|
|
1857
|
-
server.
|
|
1886
|
+
server.registerTool("get_agora_topics", { description: "List all topics in the Agora feed with message counts.", inputSchema: z.object({}) }, async () => {
|
|
1858
1887
|
const topics = getTopics(state.agoraFeed);
|
|
1859
1888
|
return {
|
|
1860
1889
|
content: [{
|
|
@@ -1866,9 +1895,9 @@ server.tool("get_agora_topics", "List all topics in the Agora feed with message
|
|
|
1866
1895
|
}],
|
|
1867
1896
|
};
|
|
1868
1897
|
});
|
|
1869
|
-
server.
|
|
1870
|
-
|
|
1871
|
-
}, async (args) => {
|
|
1898
|
+
server.registerTool("get_agora_thread", { description: "Get a message thread from the Agora feed.", inputSchema: z.object({
|
|
1899
|
+
message_id: z.string().describe("Root message ID to get thread for"),
|
|
1900
|
+
}) }, async (args) => {
|
|
1872
1901
|
const thread = getThread(state.agoraFeed, args.message_id);
|
|
1873
1902
|
return {
|
|
1874
1903
|
content: [{
|
|
@@ -1886,9 +1915,9 @@ server.tool("get_agora_thread", "Get a message thread from the Agora feed.", {
|
|
|
1886
1915
|
}],
|
|
1887
1916
|
};
|
|
1888
1917
|
});
|
|
1889
|
-
server.
|
|
1890
|
-
|
|
1891
|
-
}, async (args) => {
|
|
1918
|
+
server.registerTool("get_agora_by_topic", { description: "Get all messages in a topic.", inputSchema: z.object({
|
|
1919
|
+
topic: z.string().describe("Topic to filter by"),
|
|
1920
|
+
}) }, async (args) => {
|
|
1892
1921
|
const messages = getByTopic(state.agoraFeed, args.topic);
|
|
1893
1922
|
return {
|
|
1894
1923
|
content: [{
|
|
@@ -1908,11 +1937,11 @@ server.tool("get_agora_by_topic", "Get all messages in a topic.", {
|
|
|
1908
1937
|
}],
|
|
1909
1938
|
};
|
|
1910
1939
|
});
|
|
1911
|
-
server.
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
}, async (args) => {
|
|
1940
|
+
server.registerTool("register_agora_agent", { description: "Register an agent in the Agora so their messages can be verified.", inputSchema: z.object({
|
|
1941
|
+
agent_id: z.string().describe("Agent ID"),
|
|
1942
|
+
agent_name: z.string().describe("Display name"),
|
|
1943
|
+
public_key: z.string().describe("Ed25519 public key"),
|
|
1944
|
+
}) }, async (args) => {
|
|
1916
1945
|
registerAgent(state.agoraRegistry, {
|
|
1917
1946
|
agentId: args.agent_id,
|
|
1918
1947
|
agentName: args.agent_name,
|
|
@@ -1931,12 +1960,12 @@ server.tool("register_agora_agent", "Register an agent in the Agora so their mes
|
|
|
1931
1960
|
}],
|
|
1932
1961
|
};
|
|
1933
1962
|
});
|
|
1934
|
-
server.
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
}, async (args) => {
|
|
1963
|
+
server.registerTool("register_agora_public", { description: "Register your agent in the PUBLIC Agora registry at aeoess.com. Creates a GitHub issue that is auto-processed by a GitHub Action in ~30 seconds. Requires GITHUB_TOKEN env var or pass token directly. After registration, your agent can post signed messages visible at aeoess.com/agora.", inputSchema: z.object({
|
|
1964
|
+
token: z.string().optional().describe("GitHub personal access token (or set GITHUB_TOKEN env var)"),
|
|
1965
|
+
runtime: z.string().optional().describe("Agent runtime platform (e.g., 'claude', 'gpt-telegram', 'openclaw-github')"),
|
|
1966
|
+
capabilities: z.array(z.string()).optional().describe("Agent capabilities"),
|
|
1967
|
+
owner: z.string().optional().describe("Who operates this agent"),
|
|
1968
|
+
}) }, async (args) => {
|
|
1940
1969
|
const keyErr = requireKey();
|
|
1941
1970
|
if (keyErr)
|
|
1942
1971
|
return { content: [{ type: "text", text: keyErr }] };
|
|
@@ -2007,14 +2036,14 @@ server.tool("register_agora_public", "Register your agent in the PUBLIC Agora re
|
|
|
2007
2036
|
// ═══════════════════════════════════════
|
|
2008
2037
|
// COMMS TOOLS (Agent-to-Agent Communication)
|
|
2009
2038
|
// ═══════════════════════════════════════
|
|
2010
|
-
server.
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
}, async (args) => {
|
|
2039
|
+
server.registerTool("send_message", { description: "Send a signed message to another agent. Message is written to comms/to-{agent}.json.", inputSchema: z.object({
|
|
2040
|
+
to: z.string().describe("Recipient agent name (e.g., 'aeoess', 'portalx2', 'claude')"),
|
|
2041
|
+
subject: z.string().describe("Message subject"),
|
|
2042
|
+
message: z.string().describe("Message body"),
|
|
2043
|
+
type: z.string().optional().describe("Message type (default: 'message')"),
|
|
2044
|
+
priority: z.string().optional().describe("Priority: low, normal, high, critical"),
|
|
2045
|
+
data: z.record(z.string(), z.unknown()).optional().describe("Structured data payload"),
|
|
2046
|
+
}) }, async (args) => {
|
|
2018
2047
|
const keyErr = requireKey();
|
|
2019
2048
|
if (keyErr)
|
|
2020
2049
|
return { content: [{ type: "text", text: keyErr }] };
|
|
@@ -2053,10 +2082,10 @@ server.tool("send_message", "Send a signed message to another agent. Message is
|
|
|
2053
2082
|
}, null, 2) }],
|
|
2054
2083
|
};
|
|
2055
2084
|
});
|
|
2056
|
-
server.
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
}, async (args) => {
|
|
2085
|
+
server.registerTool("check_messages", { description: "Check messages addressed to you. Reads from comms/to-{your-agent-name}.json.", inputSchema: z.object({
|
|
2086
|
+
unprocessed_only: z.boolean().optional().describe("Only show unprocessed messages (default: true)"),
|
|
2087
|
+
mark_read: z.boolean().optional().describe("Mark returned messages as processed (default: false)"),
|
|
2088
|
+
}) }, async (args) => {
|
|
2060
2089
|
const name = getAgentName();
|
|
2061
2090
|
const filePath = join(COMMS_PATH, `to-${name}.json`);
|
|
2062
2091
|
if (!isPathWithin(filePath, COMMS_PATH)) {
|
|
@@ -2087,13 +2116,13 @@ server.tool("check_messages", "Check messages addressed to you. Reads from comms
|
|
|
2087
2116
|
}, null, 2) }],
|
|
2088
2117
|
};
|
|
2089
2118
|
});
|
|
2090
|
-
server.
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
}, async (args) => {
|
|
2119
|
+
server.registerTool("broadcast", { description: "Send a signed message to all agents via comms/broadcast.json.", inputSchema: z.object({
|
|
2120
|
+
subject: z.string().describe("Message subject"),
|
|
2121
|
+
message: z.string().describe("Message body"),
|
|
2122
|
+
type: z.string().optional().describe("Message type (default: 'broadcast')"),
|
|
2123
|
+
priority: z.string().optional().describe("Priority: low, normal, high, critical"),
|
|
2124
|
+
data: z.record(z.string(), z.unknown()).optional().describe("Structured data payload"),
|
|
2125
|
+
}) }, async (args) => {
|
|
2097
2126
|
const keyErr = requireKey();
|
|
2098
2127
|
if (keyErr)
|
|
2099
2128
|
return { content: [{ type: "text", text: keyErr }] };
|
|
@@ -2120,9 +2149,9 @@ server.tool("broadcast", "Send a signed message to all agents via comms/broadcas
|
|
|
2120
2149
|
}, null, 2) }],
|
|
2121
2150
|
};
|
|
2122
2151
|
});
|
|
2123
|
-
server.
|
|
2124
|
-
|
|
2125
|
-
}, async (args) => {
|
|
2152
|
+
server.registerTool("list_agents", { description: "List registered agents from the agent registry (agora/agents.json).", inputSchema: z.object({
|
|
2153
|
+
status_filter: z.string().optional().describe("Filter by status: active, pending, retired (default: all)"),
|
|
2154
|
+
}) }, async (args) => {
|
|
2126
2155
|
let agents = loadAgentsRegistry();
|
|
2127
2156
|
if (args.status_filter) {
|
|
2128
2157
|
agents = agents.filter(a => a.status === args.status_filter);
|
|
@@ -2141,9 +2170,9 @@ server.tool("list_agents", "List registered agents from the agent registry (agor
|
|
|
2141
2170
|
// ═══════════════════════════════════════
|
|
2142
2171
|
// VALUES / POLICY TOOLS (Layer 2 + 5)
|
|
2143
2172
|
// ═══════════════════════════════════════
|
|
2144
|
-
server.
|
|
2145
|
-
|
|
2146
|
-
}, async (args) => {
|
|
2173
|
+
server.registerTool("load_values_floor", { description: "Load a Values Floor from YAML. Sets the floor principles for policy evaluation.", inputSchema: z.object({
|
|
2174
|
+
yaml: z.string().describe("Values Floor YAML content"),
|
|
2175
|
+
}) }, async (args) => {
|
|
2147
2176
|
try {
|
|
2148
2177
|
const floor = loadFloor(args.yaml);
|
|
2149
2178
|
state.floorYaml = args.yaml;
|
|
@@ -2163,10 +2192,10 @@ server.tool("load_values_floor", "Load a Values Floor from YAML. Sets the floor
|
|
|
2163
2192
|
return { content: [{ type: "text", text: safeError("Failed to load floor", e) }], isError: true };
|
|
2164
2193
|
}
|
|
2165
2194
|
});
|
|
2166
|
-
server.
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
}, async (args) => {
|
|
2195
|
+
server.registerTool("attest_to_floor", { description: "Attest that your agent agrees to abide by the loaded Values Floor.", inputSchema: z.object({
|
|
2196
|
+
floor_version: z.string().describe("Version of the floor to attest to"),
|
|
2197
|
+
extensions: z.array(z.string()).optional().describe("Optional additional extensions"),
|
|
2198
|
+
}) }, async (args) => {
|
|
2170
2199
|
const keyErr = requireKey();
|
|
2171
2200
|
if (keyErr)
|
|
2172
2201
|
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
@@ -2187,15 +2216,15 @@ server.tool("attest_to_floor", "Attest that your agent agrees to abide by the lo
|
|
|
2187
2216
|
}],
|
|
2188
2217
|
};
|
|
2189
2218
|
});
|
|
2190
|
-
server.
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
}, async (args) => {
|
|
2219
|
+
server.registerTool("create_intent", { description: "Declare an intent to perform an action. First step of the 3-signature chain.", inputSchema: z.object({
|
|
2220
|
+
action_type: z.string().describe("What type of action (e.g. 'web_search', 'commerce:checkout')"),
|
|
2221
|
+
target: z.string().describe("What the action operates on"),
|
|
2222
|
+
scope_required: z.string().describe("Which delegation scope is needed"),
|
|
2223
|
+
spend_amount: z.number().optional().describe("Expected spend amount"),
|
|
2224
|
+
spend_currency: z.string().optional().describe("Spend currency (e.g. 'usd')"),
|
|
2225
|
+
context: z.string().optional().describe("Why the agent wants to do this"),
|
|
2226
|
+
delegation_id: z.string().describe("Delegation ID authorizing this action"),
|
|
2227
|
+
}) }, async (args) => {
|
|
2199
2228
|
const keyErr = requireKey();
|
|
2200
2229
|
if (keyErr)
|
|
2201
2230
|
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
@@ -2225,12 +2254,12 @@ server.tool("create_intent", "Declare an intent to perform an action. First step
|
|
|
2225
2254
|
}],
|
|
2226
2255
|
};
|
|
2227
2256
|
});
|
|
2228
|
-
server.
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
}, async (args) => {
|
|
2257
|
+
server.registerTool("evaluate_intent", { description: "[OPERATOR] Evaluate an intent against the Values Floor policy engine. Returns real pass/fail verdict.", inputSchema: z.object({
|
|
2258
|
+
intent_id: z.string().describe("Intent ID from create_intent"),
|
|
2259
|
+
delegation_scope: z.array(z.string()).describe("Delegation scope for context"),
|
|
2260
|
+
delegation_spend_limit: z.number().describe("Delegation spend limit"),
|
|
2261
|
+
delegation_spent: z.number().default(0).describe("Amount already spent"),
|
|
2262
|
+
}) }, async (args) => {
|
|
2234
2263
|
const keyErr = requireKey();
|
|
2235
2264
|
if (keyErr)
|
|
2236
2265
|
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
@@ -2292,13 +2321,13 @@ server.tool("evaluate_intent", "[OPERATOR] Evaluate an intent against the Values
|
|
|
2292
2321
|
// ═══════════════════════════════════════
|
|
2293
2322
|
// COMMERCE TOOLS (Layer 8)
|
|
2294
2323
|
// ═══════════════════════════════════════
|
|
2295
|
-
server.
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
}, async (_args) => {
|
|
2324
|
+
server.registerTool("commerce_preflight", { description: "[moved to gateway in SDK 3.3.0] The 6-gate commerce preflight orchestration moved out of the SDK and MCP into the AEOESS gateway. This tool no longer runs the pipeline locally; it returns a machine-readable deprecation notice pointing to the gateway commerce endpoint. Compose the pure gate predicates from the SDK yourself, or call the gateway.", inputSchema: z.object({
|
|
2325
|
+
merchant_name: z.string().describe("Merchant to purchase from"),
|
|
2326
|
+
amount: z.number().describe("Purchase amount"),
|
|
2327
|
+
currency: z.string().default("usd").describe("Currency code"),
|
|
2328
|
+
delegation_id: z.string().describe("Commerce delegation ID"),
|
|
2329
|
+
agent_id: z.string().describe("Agent making the purchase"),
|
|
2330
|
+
}) }, async (_args) => {
|
|
2302
2331
|
recordBehavior('commerce_preflight');
|
|
2303
2332
|
// commercePreflight() became a throw-only migration stub in agent-passport-system 3.3.0
|
|
2304
2333
|
// (the orchestrator moved to the gateway). Rather than let that stub throw, return a clean,
|
|
@@ -2317,11 +2346,11 @@ server.tool("commerce_preflight", "[moved to gateway in SDK 3.3.0] The 6-gate co
|
|
|
2317
2346
|
isError: true,
|
|
2318
2347
|
};
|
|
2319
2348
|
});
|
|
2320
|
-
server.
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
}, async (args) => {
|
|
2349
|
+
server.registerTool("get_commerce_spend", { description: "Get spend analytics for a commerce delegation.", inputSchema: z.object({
|
|
2350
|
+
agent_id: z.string().describe("Agent ID"),
|
|
2351
|
+
delegation_id: z.string().describe("Commerce delegation ID"),
|
|
2352
|
+
spend_limit: z.number().describe("Total allowed spend"),
|
|
2353
|
+
}) }, async (args) => {
|
|
2325
2354
|
// Report spend recorded on the session delegation instead of always reporting 0. Caveat:
|
|
2326
2355
|
// nothing in the MCP yet increments sessionDel.spentAmount (a metering record path is a
|
|
2327
2356
|
// decision flagged for Tima), so this reflects whatever the session state holds.
|
|
@@ -2342,14 +2371,14 @@ server.tool("get_commerce_spend", "Get spend analytics for a commerce delegation
|
|
|
2342
2371
|
}],
|
|
2343
2372
|
};
|
|
2344
2373
|
});
|
|
2345
|
-
server.
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
}, async (args) => {
|
|
2374
|
+
server.registerTool("request_human_approval", { description: "Request human approval for a high-value purchase.", inputSchema: z.object({
|
|
2375
|
+
agent_id: z.string().describe("Agent requesting approval"),
|
|
2376
|
+
merchant: z.string().describe("Merchant name"),
|
|
2377
|
+
amount: z.number().describe("Purchase amount"),
|
|
2378
|
+
currency: z.string().default("usd").describe("Currency"),
|
|
2379
|
+
reason: z.string().describe("Why this purchase is needed"),
|
|
2380
|
+
expires_minutes: z.number().default(30).describe("Minutes until approval expires"),
|
|
2381
|
+
}) }, async (args) => {
|
|
2353
2382
|
const approval = requestHumanApproval({
|
|
2354
2383
|
agentId: args.agent_id,
|
|
2355
2384
|
delegationId: 'pending',
|
|
@@ -2374,34 +2403,34 @@ server.tool("request_human_approval", "Request human approval for a high-value p
|
|
|
2374
2403
|
// ═══════════════════════════════════════
|
|
2375
2404
|
// AGENT CONTEXT — Enforcement Middleware
|
|
2376
2405
|
// ═══════════════════════════════════════
|
|
2377
|
-
server.
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
}, async (_args) => movedToGateway("create_agent_context"));
|
|
2384
|
-
server.
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
}, async (_args) => movedToGateway("execute_with_context"));
|
|
2390
|
-
server.
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
}, async (_args) => movedToGateway("complete_action"));
|
|
2406
|
+
server.registerTool("create_agent_context", { description: "[deprecated in v3.0.0 — use gateway.aeoess.com REST API] Create an enforcement context that automatically runs every action through the 3-signature policy chain.", inputSchema: z.object({
|
|
2407
|
+
name: z.string().describe("Agent name"),
|
|
2408
|
+
mission: z.string().describe("Agent mission statement"),
|
|
2409
|
+
enforcement: z.enum(["auto", "manual", "strict"]).default("auto").describe("Enforcement level"),
|
|
2410
|
+
delegated_scopes: z.array(z.string()).default([]).describe("Scopes to delegate"),
|
|
2411
|
+
spend_limit: z.number().default(1000).describe("Maximum spend allowed"),
|
|
2412
|
+
}) }, async (_args) => movedToGateway("create_agent_context"));
|
|
2413
|
+
server.registerTool("execute_with_context", { description: "[deprecated in v3.0.0 — use gateway.aeoess.com REST API] Execute an action through the enforcement context.", inputSchema: z.object({
|
|
2414
|
+
action_type: z.string().describe("Action type (e.g. 'api:fetch', 'data:write', 'commerce:checkout')"),
|
|
2415
|
+
target: z.string().describe("Target of the action (e.g. URL, file path, resource ID)"),
|
|
2416
|
+
scope: z.string().describe("Required scope for this action (must match a delegated scope)"),
|
|
2417
|
+
estimated_spend: z.number().optional().describe("Estimated spend for commerce actions"),
|
|
2418
|
+
}) }, async (_args) => movedToGateway("execute_with_context"));
|
|
2419
|
+
server.registerTool("complete_action", { description: "[deprecated in v3.0.0 — use gateway.aeoess.com REST API] Complete a permitted action and get the full 3-signature proof chain.", inputSchema: z.object({
|
|
2420
|
+
intent_id: z.string().describe("Intent ID from execute_with_context result"),
|
|
2421
|
+
status: z.enum(["success", "failure", "partial"]).describe("Outcome of the action"),
|
|
2422
|
+
summary: z.string().describe("Brief description of what was accomplished"),
|
|
2423
|
+
}) }, async (_args) => movedToGateway("complete_action"));
|
|
2395
2424
|
// ═══════════════════════════════════════
|
|
2396
2425
|
// PRINCIPAL IDENTITY TOOLS
|
|
2397
2426
|
// ═══════════════════════════════════════
|
|
2398
|
-
server.
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
}, async (args) => {
|
|
2427
|
+
server.registerTool("create_principal", { description: "Create a principal identity (human or org behind agents). Gets its own Ed25519 keypair.", inputSchema: z.object({
|
|
2428
|
+
display_name: z.string().describe("Human-readable name (e.g. 'Tima', 'Acme Corp')"),
|
|
2429
|
+
domain: z.string().optional().describe("Verifiable domain (e.g. 'aeoess.com')"),
|
|
2430
|
+
jurisdiction: z.string().optional().describe("Legal jurisdiction (e.g. 'US', 'EU')"),
|
|
2431
|
+
contact_channel: z.string().optional().describe("Contact method (e.g. 'telegram:@aeoess')"),
|
|
2432
|
+
disclosure_level: z.enum(["public", "verified-only", "minimal"]).default("public").describe("How much identity to reveal"),
|
|
2433
|
+
}) }, async (args) => {
|
|
2405
2434
|
const { principal, keyPair } = createPrincipalIdentity({
|
|
2406
2435
|
displayName: args.display_name,
|
|
2407
2436
|
domain: args.domain,
|
|
@@ -2427,13 +2456,13 @@ server.tool("create_principal", "Create a principal identity (human or org behin
|
|
|
2427
2456
|
}],
|
|
2428
2457
|
};
|
|
2429
2458
|
});
|
|
2430
|
-
server.
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
}, async (args) => {
|
|
2459
|
+
server.registerTool("endorse_agent", { description: "Endorse an agent as a principal. Creates a cryptographic chain: principal → agent.", inputSchema: z.object({
|
|
2460
|
+
agent_id: z.string().describe("Agent ID to endorse"),
|
|
2461
|
+
agent_public_key: z.string().describe("Agent's Ed25519 public key"),
|
|
2462
|
+
scope: z.array(z.string()).describe("What the agent can do on principal's behalf"),
|
|
2463
|
+
relationship: z.enum(["creator", "operator", "employer", "sponsor"]).describe("How principal relates to agent"),
|
|
2464
|
+
expires_in_days: z.number().default(365).describe("Days until endorsement expires"),
|
|
2465
|
+
}) }, async (args) => {
|
|
2437
2466
|
recordBehavior('endorse_agent');
|
|
2438
2467
|
// Consilium signal #5: endorsement latency. T+200ms = automation. T+3h = human.
|
|
2439
2468
|
const issuedAt = state.issuanceTimestamps.get(args.agent_id);
|
|
@@ -2471,9 +2500,9 @@ server.tool("endorse_agent", "Endorse an agent as a principal. Creates a cryptog
|
|
|
2471
2500
|
}],
|
|
2472
2501
|
};
|
|
2473
2502
|
});
|
|
2474
|
-
server.
|
|
2475
|
-
|
|
2476
|
-
}, async (args) => {
|
|
2503
|
+
server.registerTool("verify_endorsement", { description: "Verify a principal's endorsement of an agent. Checks cryptographic signature.", inputSchema: z.object({
|
|
2504
|
+
endorsement_id: z.string().describe("Endorsement ID to verify"),
|
|
2505
|
+
}) }, async (args) => {
|
|
2477
2506
|
const endorsement = state.endorsements.get(args.endorsement_id);
|
|
2478
2507
|
if (!endorsement) {
|
|
2479
2508
|
return { content: [{ type: "text", text: `Endorsement ${args.endorsement_id} not found in session.` }], isError: true };
|
|
@@ -2493,10 +2522,10 @@ server.tool("verify_endorsement", "Verify a principal's endorsement of an agent.
|
|
|
2493
2522
|
}],
|
|
2494
2523
|
};
|
|
2495
2524
|
});
|
|
2496
|
-
server.
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
}, async (args) => {
|
|
2525
|
+
server.registerTool("revoke_endorsement", { description: "Revoke a principal's endorsement of an agent. 'I no longer authorize this agent.'", inputSchema: z.object({
|
|
2526
|
+
endorsement_id: z.string().describe("Endorsement ID to revoke"),
|
|
2527
|
+
reason: z.string().describe("Why the endorsement is being revoked"),
|
|
2528
|
+
}) }, async (args) => {
|
|
2500
2529
|
const endorsement = state.endorsements.get(args.endorsement_id);
|
|
2501
2530
|
if (!endorsement) {
|
|
2502
2531
|
return { content: [{ type: "text", text: `Endorsement ${args.endorsement_id} not found.` }], isError: true };
|
|
@@ -2519,9 +2548,9 @@ server.tool("revoke_endorsement", "Revoke a principal's endorsement of an agent.
|
|
|
2519
2548
|
}],
|
|
2520
2549
|
};
|
|
2521
2550
|
});
|
|
2522
|
-
server.
|
|
2523
|
-
|
|
2524
|
-
}, async (args) => {
|
|
2551
|
+
server.registerTool("create_disclosure", { description: "Create a selective disclosure of principal identity. Controls how much info is revealed.", inputSchema: z.object({
|
|
2552
|
+
level: z.enum(["public", "verified-only", "minimal"]).describe("Disclosure level: public (everything), verified-only (id+key+domain), minimal (hash+DID only)"),
|
|
2553
|
+
}) }, async (args) => {
|
|
2525
2554
|
if (!state.principal || !state.principalPrivateKey) {
|
|
2526
2555
|
return { content: [{ type: "text", text: 'No principal identity. Call create_principal first.' }], isError: true };
|
|
2527
2556
|
}
|
|
@@ -2539,7 +2568,7 @@ server.tool("create_disclosure", "Create a selective disclosure of principal ide
|
|
|
2539
2568
|
}],
|
|
2540
2569
|
};
|
|
2541
2570
|
});
|
|
2542
|
-
server.
|
|
2571
|
+
server.registerTool("get_fleet_status", { description: "Get status of all agents endorsed by the current principal.", inputSchema: z.object({}) }, async () => {
|
|
2543
2572
|
if (!state.fleet) {
|
|
2544
2573
|
return { content: [{ type: "text", text: 'No fleet. Call create_principal first.' }], isError: true };
|
|
2545
2574
|
}
|
|
@@ -2559,11 +2588,11 @@ function resolveTier(score, demotionCount = 0) {
|
|
|
2559
2588
|
const def = resolveAuthorityTier(score, demotionCount, DEFAULT_TIERS);
|
|
2560
2589
|
return { ...def, origin: 'earned', demotionCount };
|
|
2561
2590
|
}
|
|
2562
|
-
server.
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
}, async ({ agentId, principalId, scope }) => {
|
|
2591
|
+
server.registerTool("resolve_authority", { description: "Compute effective reputation score and authority tier for an agent in a given scope. Returns tier name, autonomy level, spend limit, and effective score.", inputSchema: z.object({
|
|
2592
|
+
agentId: z.string().describe("Agent ID to check"),
|
|
2593
|
+
principalId: z.string().describe("Principal who delegated authority"),
|
|
2594
|
+
scope: z.string().describe("Scope to check reputation in (e.g. 'code_execution', 'commerce')"),
|
|
2595
|
+
}) }, async ({ agentId, principalId, scope }) => {
|
|
2567
2596
|
const key = `${principalId}:${agentId}:${scope}`;
|
|
2568
2597
|
let rep = state.reputations.get(key);
|
|
2569
2598
|
if (!rep) {
|
|
@@ -2588,14 +2617,14 @@ server.tool("resolve_authority", "Compute effective reputation score and authori
|
|
|
2588
2617
|
}],
|
|
2589
2618
|
};
|
|
2590
2619
|
});
|
|
2591
|
-
server.
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
}, async ({ agentId, principalId, scope, requestedAutonomy, requestedSpend, requestedDepth }) => {
|
|
2620
|
+
server.registerTool("check_tier", { description: "Check if an agent's earned tier permits an action at a given autonomy level and spend amount. Returns null if permitted, or escalation details if tier is insufficient.", inputSchema: z.object({
|
|
2621
|
+
agentId: z.string().describe("Agent ID"),
|
|
2622
|
+
principalId: z.string().describe("Principal ID"),
|
|
2623
|
+
scope: z.string().describe("Reputation scope"),
|
|
2624
|
+
requestedAutonomy: z.number().optional().describe("Requested autonomy level (1-5)"),
|
|
2625
|
+
requestedSpend: z.number().optional().describe("Requested spend amount in dollars"),
|
|
2626
|
+
requestedDepth: z.number().optional().describe("Requested delegation depth"),
|
|
2627
|
+
}) }, async ({ agentId, principalId, scope, requestedAutonomy, requestedSpend, requestedDepth }) => {
|
|
2599
2628
|
const key = `${principalId}:${agentId}:${scope}`;
|
|
2600
2629
|
let rep = state.reputations.get(key);
|
|
2601
2630
|
if (!rep) {
|
|
@@ -2630,15 +2659,15 @@ server.tool("check_tier", "Check if an agent's earned tier permits an action at
|
|
|
2630
2659
|
}],
|
|
2631
2660
|
};
|
|
2632
2661
|
});
|
|
2633
|
-
server.
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
}, async ({ agentId, principalId, scope, toTier, verdict, reasoning, probationDays }) => {
|
|
2662
|
+
server.registerTool("review_promotion", { description: "Create a signed promotion review for another agent. Reviewer must have 'earned' origin and tier above target. Returns signed review artifact.", inputSchema: z.object({
|
|
2663
|
+
agentId: z.string().describe("Agent being reviewed for promotion"),
|
|
2664
|
+
principalId: z.string().describe("Principal who delegated to the agent"),
|
|
2665
|
+
scope: z.string().describe("Scope of the promotion"),
|
|
2666
|
+
toTier: z.number().describe("Target tier level (0-4)"),
|
|
2667
|
+
verdict: z.enum(['promoted', 'denied']).describe("Promotion verdict"),
|
|
2668
|
+
reasoning: z.string().describe("Explanation for the verdict"),
|
|
2669
|
+
probationDays: z.number().optional().describe("Probation period in days (default: 7)"),
|
|
2670
|
+
}) }, async ({ agentId, principalId, scope, toTier, verdict, reasoning, probationDays }) => {
|
|
2642
2671
|
if (!state.privateKey || !state.agentId) {
|
|
2643
2672
|
return { content: [{ type: "text", text: 'Identity required. Call identify or set AGENT_KEY first.' }], isError: true };
|
|
2644
2673
|
}
|
|
@@ -2697,13 +2726,13 @@ server.tool("review_promotion", "Create a signed promotion review for another ag
|
|
|
2697
2726
|
return { content: [{ type: "text", text: safeError("Promotion review failed", err) }], isError: true };
|
|
2698
2727
|
}
|
|
2699
2728
|
});
|
|
2700
|
-
server.
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
}, async ({ agentId, principalId, scope, success, evidenceClass }) => {
|
|
2729
|
+
server.registerTool("update_reputation", { description: "Update an agent's reputation after a task result. Success increases mu and decreases sigma; failure does the opposite. Higher evidence class = larger effect.", inputSchema: z.object({
|
|
2730
|
+
agentId: z.string().describe("Agent whose reputation to update"),
|
|
2731
|
+
principalId: z.string().describe("Principal ID"),
|
|
2732
|
+
scope: z.string().describe("Reputation scope"),
|
|
2733
|
+
success: z.boolean().describe("Whether the task succeeded"),
|
|
2734
|
+
evidenceClass: z.enum(['trivial', 'standard', 'complex', 'critical']).describe("Complexity of the task"),
|
|
2735
|
+
}) }, async ({ agentId, principalId, scope, success, evidenceClass }) => {
|
|
2707
2736
|
const key = `${principalId}:${agentId}:${scope}`;
|
|
2708
2737
|
let rep = state.reputations.get(key);
|
|
2709
2738
|
if (!rep) {
|
|
@@ -2728,7 +2757,7 @@ server.tool("update_reputation", "Update an agent's reputation after a task resu
|
|
|
2728
2757
|
}],
|
|
2729
2758
|
};
|
|
2730
2759
|
});
|
|
2731
|
-
server.
|
|
2760
|
+
server.registerTool("get_promotion_history", { description: "Get the promotion review history for this session.", inputSchema: z.object({}) }, async () => {
|
|
2732
2761
|
return {
|
|
2733
2762
|
content: [{
|
|
2734
2763
|
type: "text",
|
|
@@ -2746,28 +2775,28 @@ server.tool("get_promotion_history", "Get the promotion review history for this
|
|
|
2746
2775
|
// was built on (delegation verification, policy evaluation, replay nonces)
|
|
2747
2776
|
// remain in the SDK — rebuild a gateway locally from those, or use the
|
|
2748
2777
|
// hosted gateway at gateway.aeoess.com.
|
|
2749
|
-
server.
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
}, async (_args) => movedToGateway("create_gateway"));
|
|
2754
|
-
server.
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
}, async (_args) => movedToGateway("gateway_process_tool_call"));
|
|
2763
|
-
server.
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
}, async (_args) => movedToGateway("gateway_approve"));
|
|
2770
|
-
server.
|
|
2778
|
+
server.registerTool("create_gateway", { description: "[deprecated in v3.0.0 — use gateway.aeoess.com REST API] Create a ProxyGateway enforcement boundary.", inputSchema: z.object({
|
|
2779
|
+
gatewayId: z.string().optional().describe("Custom gateway ID"),
|
|
2780
|
+
approvalTTLSeconds: z.number().optional().describe("Two-phase approval timeout"),
|
|
2781
|
+
maxPendingPerAgent: z.number().optional().describe("Max pending approvals per agent"),
|
|
2782
|
+
}) }, async (_args) => movedToGateway("create_gateway"));
|
|
2783
|
+
server.registerTool("gateway_process_tool_call", { description: "[deprecated in v3.0.0 — use gateway.aeoess.com REST API] Process a tool call through the gateway enforcement boundary.", inputSchema: z.object({
|
|
2784
|
+
agentId: z.string(),
|
|
2785
|
+
tool: z.string(),
|
|
2786
|
+
params: z.record(z.string(), z.unknown()).optional(),
|
|
2787
|
+
scopeRequired: z.string(),
|
|
2788
|
+
spendAmount: z.number().optional(),
|
|
2789
|
+
spendCurrency: z.string().optional(),
|
|
2790
|
+
context: z.string().optional(),
|
|
2791
|
+
}) }, async (_args) => movedToGateway("gateway_process_tool_call"));
|
|
2792
|
+
server.registerTool("gateway_approve", { description: "[deprecated in v3.0.0 — use gateway.aeoess.com REST API] Two-phase execution: approve a tool call without executing it.", inputSchema: z.object({
|
|
2793
|
+
agentId: z.string(),
|
|
2794
|
+
tool: z.string(),
|
|
2795
|
+
params: z.record(z.string(), z.unknown()).optional(),
|
|
2796
|
+
scopeRequired: z.string(),
|
|
2797
|
+
context: z.string().optional(),
|
|
2798
|
+
}) }, async (_args) => movedToGateway("gateway_approve"));
|
|
2799
|
+
server.registerTool("gateway_stats", { description: "[deprecated in v3.0.0 — use gateway.aeoess.com REST API] Get gateway statistics.", inputSchema: z.object({}) }, async (_args) => movedToGateway("gateway_stats"));
|
|
2771
2800
|
// ═══════════════════════════════════════
|
|
2772
2801
|
// Intent Network (Agent-Mediated Matching)
|
|
2773
2802
|
// Calls the hosted API at api.aeoess.com
|
|
@@ -2783,11 +2812,11 @@ async function intentApiFetch(path, opts) {
|
|
|
2783
2812
|
// publish_intent_card removed in v3.0.0: createIntentCard was gateway-side
|
|
2784
2813
|
// signing glue. Cards are still publishable directly via the Intent Network
|
|
2785
2814
|
// REST API at api.aeoess.com/api/cards — sign with your agent private key.
|
|
2786
|
-
server.
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
}, async (args) => {
|
|
2815
|
+
server.registerTool("search_matches", { description: "Search the Intent Network for people relevant to you. Returns ranked matches from all agents worldwide based on need/offer overlap, tag similarity, and budget compatibility.", inputSchema: z.object({
|
|
2816
|
+
min_score: z.number().optional().describe("Minimum relevance score 0-1 (default: 0.1)"),
|
|
2817
|
+
max_results: z.number().optional().describe("Maximum results to return (default: 10)"),
|
|
2818
|
+
category_filter: z.string().optional().describe("Only match within this category"),
|
|
2819
|
+
}) }, async (args) => {
|
|
2791
2820
|
const keyErr = requireKey();
|
|
2792
2821
|
if (keyErr)
|
|
2793
2822
|
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
@@ -2828,7 +2857,7 @@ server.tool("search_matches", "Search the Intent Network for people relevant to
|
|
|
2828
2857
|
return { content: [{ type: "text", text: safeError("API error", e) }], isError: true };
|
|
2829
2858
|
}
|
|
2830
2859
|
});
|
|
2831
|
-
server.
|
|
2860
|
+
server.registerTool("get_digest", { description: "Get a personalized digest from the Intent Network: relevant matches, pending intro requests, and incoming intros. The killer feature — 'what matters to me right now?'", inputSchema: z.object({}) }, async () => {
|
|
2832
2861
|
const agentId = state.agentId || 'anonymous';
|
|
2833
2862
|
try {
|
|
2834
2863
|
const digest = await intentApiFetch(`/api/digest/${agentId}`);
|
|
@@ -2867,12 +2896,12 @@ server.tool("get_digest", "Get a personalized digest from the Intent Network: re
|
|
|
2867
2896
|
return { content: [{ type: "text", text: safeError("API error", e) }], isError: true };
|
|
2868
2897
|
}
|
|
2869
2898
|
});
|
|
2870
|
-
server.
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
}, async (args) => {
|
|
2899
|
+
server.registerTool("request_intro", { description: "Request an introduction to another agent's human based on a match. Both sides must approve before real information crosses.", inputSchema: z.object({
|
|
2900
|
+
match_id: z.string().describe("Match ID from search_matches"),
|
|
2901
|
+
target_card_id: z.string().describe("Card ID of the agent you want an intro to"),
|
|
2902
|
+
message: z.string().describe("Brief message explaining why this intro would be valuable"),
|
|
2903
|
+
disclose_fields: z.array(z.string()).optional().describe("Fields you're willing to share (e.g. ['needs', 'offers', 'openTo'])"),
|
|
2904
|
+
}) }, async (args) => {
|
|
2876
2905
|
const keyErr = requireKey();
|
|
2877
2906
|
if (keyErr)
|
|
2878
2907
|
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
@@ -2908,12 +2937,12 @@ server.tool("request_intro", "Request an introduction to another agent's human b
|
|
|
2908
2937
|
return { content: [{ type: "text", text: safeError("Intro request failed", e) }], isError: true };
|
|
2909
2938
|
}
|
|
2910
2939
|
});
|
|
2911
|
-
server.
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
}, async (args) => {
|
|
2940
|
+
server.registerTool("respond_to_intro", { description: "Respond to an introduction request. Approve to share your disclosed information, or decline.", inputSchema: z.object({
|
|
2941
|
+
intro_id: z.string().describe("Intro request ID"),
|
|
2942
|
+
approved: z.boolean().describe("Whether to approve the introduction"),
|
|
2943
|
+
message: z.string().optional().describe("Optional response message"),
|
|
2944
|
+
disclose_fields: z.array(z.string()).optional().describe("Fields you're willing to share back"),
|
|
2945
|
+
}) }, async (args) => {
|
|
2917
2946
|
const keyErr = requireKey();
|
|
2918
2947
|
if (keyErr)
|
|
2919
2948
|
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
@@ -2950,9 +2979,9 @@ server.tool("respond_to_intro", "Respond to an introduction request. Approve to
|
|
|
2950
2979
|
return { content: [{ type: "text", text: safeError("Intro response failed", e) }], isError: true };
|
|
2951
2980
|
}
|
|
2952
2981
|
});
|
|
2953
|
-
server.
|
|
2954
|
-
|
|
2955
|
-
}, async (args) => {
|
|
2982
|
+
server.registerTool("remove_intent_card", { description: "Remove your IntentCard from the Intent Network. Use when your needs or offers have changed.", inputSchema: z.object({
|
|
2983
|
+
card_id: z.string().describe("Card ID to remove"),
|
|
2984
|
+
}) }, async (args) => {
|
|
2956
2985
|
const keyErr = requireKey();
|
|
2957
2986
|
if (keyErr)
|
|
2958
2987
|
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
@@ -2983,12 +3012,12 @@ server.tool("remove_intent_card", "Remove your IntentCard from the Intent Networ
|
|
|
2983
3012
|
// ═══════════════════════════════════════
|
|
2984
3013
|
// v2: Constitutional Governance Tools
|
|
2985
3014
|
// ═══════════════════════════════════════
|
|
2986
|
-
server.
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
}, async (args) => {
|
|
3015
|
+
server.registerTool("create_policy_context", { description: "Create a v2 PolicyContext with mandatory sunset. Every v2 object requires one.", inputSchema: z.object({
|
|
3016
|
+
policy_version: z.string().default("2.0.0"),
|
|
3017
|
+
values_floor_version: z.string().default("1.0.0"),
|
|
3018
|
+
trust_epoch: z.number().default(1),
|
|
3019
|
+
valid_until: z.string().describe("ISO 8601 expiration (mandatory, max 180 days)"),
|
|
3020
|
+
}) }, async (args) => {
|
|
2992
3021
|
const keyErr = requireKey();
|
|
2993
3022
|
if (keyErr)
|
|
2994
3023
|
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
@@ -3006,12 +3035,12 @@ server.tool("create_policy_context", "Create a v2 PolicyContext with mandatory s
|
|
|
3006
3035
|
return { content: [{ type: "text", text: safeError("PolicyContext creation failed", e) }], isError: true };
|
|
3007
3036
|
}
|
|
3008
3037
|
});
|
|
3009
|
-
server.
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
}, async (args) => {
|
|
3038
|
+
server.registerTool("create_v2_delegation", { description: "Create a v2 delegation with versioning, mandatory sunset, and PolicyContext binding.", inputSchema: z.object({
|
|
3039
|
+
delegatee: z.string().describe("Public key of the agent receiving authority"),
|
|
3040
|
+
scope_categories: z.array(z.string()).describe("Action categories (e.g., ['analysis', 'communication'])"),
|
|
3041
|
+
valid_until: z.string().describe("ISO 8601 expiration"),
|
|
3042
|
+
trust_epoch: z.number().default(1),
|
|
3043
|
+
}) }, async (args) => {
|
|
3015
3044
|
const keyErr = requireKey();
|
|
3016
3045
|
if (keyErr)
|
|
3017
3046
|
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
@@ -3032,15 +3061,15 @@ server.tool("create_v2_delegation", "Create a v2 delegation with versioning, man
|
|
|
3032
3061
|
return { content: [{ type: "text", text: safeError("v2 delegation failed", e) }], isError: true };
|
|
3033
3062
|
}
|
|
3034
3063
|
});
|
|
3035
|
-
server.
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
}, async (args) => {
|
|
3064
|
+
server.registerTool("supersede_v2_delegation", { description: "Supersede a v2 delegation. Scope narrowing needs justification. Scope expansion also needs independent reviewer.", inputSchema: z.object({
|
|
3065
|
+
original_delegation_id: z.string(),
|
|
3066
|
+
new_scope_categories: z.array(z.string()),
|
|
3067
|
+
justification: z.string(),
|
|
3068
|
+
valid_until: z.string(),
|
|
3069
|
+
trust_epoch: z.number().default(1),
|
|
3070
|
+
expansion_reviewer: z.string().optional().describe("Required if scope expands"),
|
|
3071
|
+
expansion_reviewer_private_key: z.string().optional(),
|
|
3072
|
+
}) }, async (args) => {
|
|
3044
3073
|
const keyErr = requireKey();
|
|
3045
3074
|
if (keyErr)
|
|
3046
3075
|
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
@@ -3064,15 +3093,15 @@ server.tool("supersede_v2_delegation", "Supersede a v2 delegation. Scope narrowi
|
|
|
3064
3093
|
return { content: [{ type: "text", text: safeError("Supersession failed", e) }], isError: true };
|
|
3065
3094
|
}
|
|
3066
3095
|
});
|
|
3067
|
-
server.
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
}, async (args) => {
|
|
3096
|
+
server.registerTool("create_outcome_record", { description: "Register an action outcome (agent perspective). Part of three-way reporting.", inputSchema: z.object({
|
|
3097
|
+
action_id: z.string(), declared_intent: z.string(),
|
|
3098
|
+
semantic_uncertainty: z.enum(["low", "medium", "high", "critical"]),
|
|
3099
|
+
observed_outcome: z.string(),
|
|
3100
|
+
outcome_class: z.enum(["success", "partial_success", "failure", "unintended_effect", "unknown"]),
|
|
3101
|
+
divergence_score: z.number().min(0).max(1),
|
|
3102
|
+
valid_until: z.string(),
|
|
3103
|
+
trust_epoch: z.number().default(1),
|
|
3104
|
+
}) }, async (args) => {
|
|
3076
3105
|
const keyErr = requireKey();
|
|
3077
3106
|
if (keyErr)
|
|
3078
3107
|
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
@@ -3098,11 +3127,11 @@ server.tool("create_outcome_record", "Register an action outcome (agent perspect
|
|
|
3098
3127
|
return { content: [{ type: "text", text: safeError("Outcome registration failed", e) }], isError: true };
|
|
3099
3128
|
}
|
|
3100
3129
|
});
|
|
3101
|
-
server.
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
}, async (args) => {
|
|
3130
|
+
server.registerTool("add_principal_report", { description: "Add principal's perspective to an outcome record. Enables three-way divergence reporting.", inputSchema: z.object({
|
|
3131
|
+
outcome_id: z.string(), observed_outcome: z.string(),
|
|
3132
|
+
outcome_class: z.enum(["success", "partial_success", "failure", "unintended_effect", "unknown"]),
|
|
3133
|
+
divergence_score: z.number().min(0).max(1),
|
|
3134
|
+
}) }, async (args) => {
|
|
3106
3135
|
const keyErr = requireKey();
|
|
3107
3136
|
if (keyErr)
|
|
3108
3137
|
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
@@ -3120,16 +3149,16 @@ server.tool("add_principal_report", "Add principal's perspective to an outcome r
|
|
|
3120
3149
|
return { content: [{ type: "text", text: safeError("Principal report failed", e) }], isError: true };
|
|
3121
3150
|
}
|
|
3122
3151
|
});
|
|
3123
|
-
server.
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
}, async (args) => {
|
|
3152
|
+
server.registerTool("define_emergency_pathway", { description: "Define a pre-authorized emergency pathway at delegation time. Only the delegator can define these.", inputSchema: z.object({
|
|
3153
|
+
delegation_ref: z.string(), description: z.string(),
|
|
3154
|
+
trigger_field: z.string(), trigger_operator: z.enum(["eq", "neq", "gt", "lt", "gte", "lte"]),
|
|
3155
|
+
trigger_value: z.union([z.string(), z.number(), z.boolean()]),
|
|
3156
|
+
expanded_scope_categories: z.array(z.string()),
|
|
3157
|
+
max_duration: z.string().default("PT1H"),
|
|
3158
|
+
review_deadline: z.string().default("PT24H"),
|
|
3159
|
+
review_authority: z.string(),
|
|
3160
|
+
valid_until: z.string(), trust_epoch: z.number().default(1),
|
|
3161
|
+
}) }, async (args) => {
|
|
3133
3162
|
const keyErr = requireKey();
|
|
3134
3163
|
if (keyErr)
|
|
3135
3164
|
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
@@ -3153,11 +3182,11 @@ server.tool("define_emergency_pathway", "Define a pre-authorized emergency pathw
|
|
|
3153
3182
|
return { content: [{ type: "text", text: safeError("Emergency pathway failed", e) }], isError: true };
|
|
3154
3183
|
}
|
|
3155
3184
|
});
|
|
3156
|
-
server.
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
}, async (args) => {
|
|
3185
|
+
server.registerTool("activate_emergency", { description: "Activate a pre-authorized emergency pathway with evidence.", inputSchema: z.object({
|
|
3186
|
+
pathway_id: z.string(),
|
|
3187
|
+
trigger_evidence: z.string().describe("Evidence that trigger conditions are met"),
|
|
3188
|
+
valid_until: z.string(), trust_epoch: z.number().default(1),
|
|
3189
|
+
}) }, async (args) => {
|
|
3161
3190
|
const keyErr = requireKey();
|
|
3162
3191
|
if (keyErr)
|
|
3163
3192
|
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
@@ -3184,14 +3213,14 @@ server.tool("activate_emergency", "Activate a pre-authorized emergency pathway w
|
|
|
3184
3213
|
// remains in the SDK for direct use.
|
|
3185
3214
|
// request_migration removed in v3.0.0: requestV2Migration / approveV2Migration /
|
|
3186
3215
|
// executeV2Migration were gateway-side migration orchestration.
|
|
3187
|
-
server.
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
}, async (args) => {
|
|
3216
|
+
server.registerTool("create_artifact_provenance", { description: "Tag an agent-generated artifact with provenance metadata (content hash, risk class, authoring agent).", inputSchema: z.object({
|
|
3217
|
+
delegation_ref: z.string(), intended_use: z.string(),
|
|
3218
|
+
risk_class: z.enum(["low", "medium", "high", "critical"]),
|
|
3219
|
+
requires_human_execution: z.boolean().default(false),
|
|
3220
|
+
content: z.string().describe("The artifact content (used for hash, not stored)"),
|
|
3221
|
+
artifact_type: z.string().describe("e.g. email_draft, code_script, database_query"),
|
|
3222
|
+
valid_until: z.string(), trust_epoch: z.number().default(1),
|
|
3223
|
+
}) }, async (args) => {
|
|
3195
3224
|
const keyErr = requireKey();
|
|
3196
3225
|
if (keyErr)
|
|
3197
3226
|
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
@@ -3223,18 +3252,18 @@ server.tool("create_artifact_provenance", "Tag an agent-generated artifact with
|
|
|
3223
3252
|
// ═══════════════════════════════════════
|
|
3224
3253
|
// Data Governance Tools (Modules 36A, 38, 39)
|
|
3225
3254
|
// ═══════════════════════════════════════
|
|
3226
|
-
server.
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
}, async (p) => {
|
|
3255
|
+
server.registerTool("register_data_source", { description: "Register a data source with terms for agent access. Returns a signed SourceReceipt.", inputSchema: z.object({
|
|
3256
|
+
contentDescriptor: z.string().describe("Human-readable description of the data"),
|
|
3257
|
+
contentCommitment: z.string().describe("SHA-256 hash of the data content"),
|
|
3258
|
+
contentType: z.enum(["document", "structured_data", "media", "user_input", "model_context"]).describe("Type of data"),
|
|
3259
|
+
allowedPurposes: z.array(z.string()).describe("Allowed purposes: read, analyze, summarize, generate, recommend, train, embed, redistribute, commercial"),
|
|
3260
|
+
requireAttribution: z.boolean().default(true),
|
|
3261
|
+
compensationType: z.enum(["none", "attribution_only", "per_access", "negotiate"]).default("none"),
|
|
3262
|
+
compensationAmount: z.number().optional().describe("Amount per access (for per_access type)"),
|
|
3263
|
+
compensationCurrency: z.string().default("usd"),
|
|
3264
|
+
maxAccessCount: z.number().optional().describe("Max total accesses allowed"),
|
|
3265
|
+
derivativePolicy: z.enum(["unrestricted", "same_terms", "attribution_required", "no_derivatives"]).default("attribution_required"),
|
|
3266
|
+
}) }, async (p) => {
|
|
3238
3267
|
if (!state.agentKey || !state.privateKey)
|
|
3239
3268
|
return { content: [{ type: "text", text: "❌ Not identified. Call identify first." }] };
|
|
3240
3269
|
const comp = p.compensationType === 'per_access'
|
|
@@ -3264,21 +3293,21 @@ server.tool("register_data_source", "Register a data source with terms for agent
|
|
|
3264
3293
|
state.sourceReceipts.set(receipt.sourceReceiptId, receipt);
|
|
3265
3294
|
return { content: [{ type: "text", text: `✅ Data source registered.\n\nSource Receipt ID: ${receipt.sourceReceiptId}\nDescriptor: ${p.contentDescriptor}\nAllowed purposes: ${p.allowedPurposes.join(', ')}\nCompensation: ${p.compensationType}${p.compensationAmount ? ' $' + p.compensationAmount : ''}\nMax accesses: ${p.maxAccessCount || 'unlimited'}\nDerivative policy: ${p.derivativePolicy}` }] };
|
|
3266
3295
|
});
|
|
3267
|
-
server.
|
|
3268
|
-
|
|
3269
|
-
}, async (_args) => movedToGateway("create_data_enforcement_gate"));
|
|
3270
|
-
server.
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
}, async (_args) => movedToGateway("query_contributions"));
|
|
3277
|
-
server.
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
}, async (_args) => movedToGateway("generate_settlement"));
|
|
3296
|
+
server.registerTool("create_data_enforcement_gate", { description: "[deprecated in v3.0.0 — use gateway.aeoess.com REST API] Create a data enforcement gate that checks terms before allowing data access.", inputSchema: z.object({
|
|
3297
|
+
mode: z.enum(["enforce", "audit", "off"]).default("enforce").describe("Enforcement mode"),
|
|
3298
|
+
}) }, async (_args) => movedToGateway("create_data_enforcement_gate"));
|
|
3299
|
+
server.registerTool("query_contributions", { description: "[deprecated in v3.0.0 — use gateway.aeoess.com REST API] Query the data contribution ledger.", inputSchema: z.object({
|
|
3300
|
+
sourceReceiptId: z.string().optional(),
|
|
3301
|
+
agentId: z.string().optional(),
|
|
3302
|
+
principalId: z.string().optional(),
|
|
3303
|
+
purpose: z.string().optional(),
|
|
3304
|
+
minAccessCount: z.number().optional(),
|
|
3305
|
+
}) }, async (_args) => movedToGateway("query_contributions"));
|
|
3306
|
+
server.registerTool("generate_settlement", { description: "[deprecated in v3.0.0 — use gateway.aeoess.com REST API] Generate a Merkle-committed, signed settlement record for a period.", inputSchema: z.object({
|
|
3307
|
+
startDate: z.string().describe("Period start (YYYY-MM-DD)"),
|
|
3308
|
+
endDate: z.string().describe("Period end (YYYY-MM-DD)"),
|
|
3309
|
+
periodLabel: z.string().describe("Label (e.g. '2026-Q1', '2026-03')"),
|
|
3310
|
+
}) }, async (_args) => movedToGateway("generate_settlement"));
|
|
3282
3311
|
// Removed in v3.0.0 (moved to gateway product — no stub to keep tool count bounded):
|
|
3283
3312
|
// check_data_access (DataEnforcementGate.checkAccess)
|
|
3284
3313
|
// get_source_metrics (cross-agent ledger aggregation)
|
|
@@ -3292,22 +3321,22 @@ server.tool("generate_settlement", "[deprecated in v3.0.0 — use gateway.aeoess
|
|
|
3292
3321
|
// ═══════════════════════════════════════
|
|
3293
3322
|
// Data Lifecycle Governance Tools
|
|
3294
3323
|
// ═══════════════════════════════════════
|
|
3295
|
-
server.
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
}, async (p) => {
|
|
3324
|
+
server.registerTool("create_derivation_receipt", { description: "Create a signed derivation receipt tracking how data was transformed. Multi-hop lineage with break markers.", inputSchema: z.object({
|
|
3325
|
+
derivativeId: z.string().describe("Unique ID for the derivative artifact"),
|
|
3326
|
+
derivativeType: z.string().describe("Type: rag_chunk, embedding, summary, model_weights, synthetic_derivative, etc."),
|
|
3327
|
+
parentArtifacts: z.array(z.object({
|
|
3328
|
+
artifactId: z.string(),
|
|
3329
|
+
artifactType: z.string(),
|
|
3330
|
+
sourceId: z.string().optional(),
|
|
3331
|
+
transformFromParent: z.string().optional(),
|
|
3332
|
+
})).describe("Parent artifacts this was derived from"),
|
|
3333
|
+
transformClass: z.string().describe("Transform type: copy, subset, summary, embedding, aggregation, synthetic, model_training"),
|
|
3334
|
+
lineageConfidence: z.enum(["complete", "partial", "asserted", "inferred", "broken_external", "unverifiable"]),
|
|
3335
|
+
externalBoundaryBreak: z.boolean().optional().describe("True if data left the system and returned"),
|
|
3336
|
+
breakReason: z.string().optional(),
|
|
3337
|
+
isSyntheticDerivative: z.boolean().optional(),
|
|
3338
|
+
upstreamObligationsRetained: z.boolean().optional(),
|
|
3339
|
+
}) }, async (p) => {
|
|
3311
3340
|
const receipt = createDerivationReceipt({
|
|
3312
3341
|
...p,
|
|
3313
3342
|
agentId: state.agentId || 'unknown',
|
|
@@ -3316,17 +3345,17 @@ server.tool("create_derivation_receipt", "Create a signed derivation receipt tra
|
|
|
3316
3345
|
state.derivationStore.set(receipt.derivativeId, receipt);
|
|
3317
3346
|
return { content: [{ type: "text", text: `✅ Derivation receipt created.\n\nID: ${receipt.receiptId}\nDerivative: ${receipt.derivativeId}\nType: ${receipt.derivativeType}\nTransform: ${receipt.transformClass}\nConfidence: ${receipt.lineageConfidence}\nBoundary break: ${receipt.externalBoundaryBreak}\nSynthetic: ${receipt.isSyntheticDerivative || false}\nParents: ${receipt.parentArtifacts.length}` }] };
|
|
3318
3347
|
});
|
|
3319
|
-
server.
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
}, async (p) => {
|
|
3348
|
+
server.registerTool("resolve_lineage", { description: "Resolve the full derivation chain for an artifact. Multi-hop with cycle detection.", inputSchema: z.object({
|
|
3349
|
+
derivativeId: z.string().describe("ID of the derivative to trace"),
|
|
3350
|
+
maxDepth: z.number().optional().describe("Max chain depth (default: 10)"),
|
|
3351
|
+
}) }, async (p) => {
|
|
3323
3352
|
const result = resolveExtendedLineage(p.derivativeId, state.derivationStore, p.maxDepth);
|
|
3324
3353
|
const chainStr = result.chain.map((r, i) => ` ${i + 1}. ${r.derivativeId} (${r.transformClass}, ${r.lineageConfidence})`).join('\n');
|
|
3325
3354
|
return { content: [{ type: "text", text: `🔗 Lineage for: ${p.derivativeId}\n\nDepth: ${result.depth}\nConfidence: ${result.confidence}\nHas breaks: ${result.hasBreaks}\n\nChain:\n${chainStr || ' (empty)'}` }] };
|
|
3326
3355
|
});
|
|
3327
|
-
server.
|
|
3328
|
-
|
|
3329
|
-
}, async (p) => {
|
|
3356
|
+
server.registerTool("evaluate_revocation_impact", { description: "Evaluate what happens when a data source revokes consent. Propagates obligations through derivation chains.", inputSchema: z.object({
|
|
3357
|
+
sourceId: z.string().describe("Source ID that is revoking consent"),
|
|
3358
|
+
}) }, async (p) => {
|
|
3330
3359
|
const result = evaluateRevocationImpact({
|
|
3331
3360
|
sourceId: p.sourceId,
|
|
3332
3361
|
receiptStore: state.derivationStore,
|
|
@@ -3335,57 +3364,57 @@ server.tool("evaluate_revocation_impact", "Evaluate what happens when a data sou
|
|
|
3335
3364
|
const lines = result.affectedArtifacts.map(a => ` • ${a.artifactId} (${a.artifactType}): ${a.obligation} — ${a.reason}`);
|
|
3336
3365
|
return { content: [{ type: "text", text: `⚠️ Revocation Impact: ${p.sourceId}\n\nObligation ID: ${result.obligationId}\nTotal affected: ${result.totalAffected}\n\nAffected artifacts:\n${lines.join('\n') || ' (none)'}` }] };
|
|
3337
3366
|
});
|
|
3338
|
-
server.
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
}, async (p) => {
|
|
3367
|
+
server.registerTool("create_decision_lineage_receipt", { description: "Create a Decision Lineage Receipt — traces which data sources influenced a decision. Right-to-explanation primitive.", inputSchema: z.object({
|
|
3368
|
+
decisionArtifactId: z.string(),
|
|
3369
|
+
decisionType: z.string().describe("E.g. loan_approval, content_moderation, risk_assessment"),
|
|
3370
|
+
contributingSources: z.array(z.object({
|
|
3371
|
+
sourceId: z.string(),
|
|
3372
|
+
accessReceiptId: z.string(),
|
|
3373
|
+
derivationDepth: z.number(),
|
|
3374
|
+
transformPath: z.array(z.string()),
|
|
3375
|
+
termsVersionAtAccess: z.string(),
|
|
3376
|
+
lineageConfidence: z.enum(["complete", "partial", "asserted", "inferred", "broken_external", "unverifiable"]),
|
|
3377
|
+
compensationStatus: z.enum(["settled", "pending", "disputed", "revoked"]),
|
|
3378
|
+
})),
|
|
3379
|
+
lineageCompleteness: z.enum(["complete", "partial", "asserted", "broken_external"]),
|
|
3380
|
+
transformChain: z.array(z.string()).optional(),
|
|
3381
|
+
governingPurpose: z.string().optional(),
|
|
3382
|
+
explanation: z.string().optional(),
|
|
3383
|
+
}) }, async (p) => {
|
|
3355
3384
|
const receipt = createDecisionLineageReceipt({
|
|
3356
3385
|
...p,
|
|
3357
3386
|
privateKey: state.privateKey,
|
|
3358
3387
|
});
|
|
3359
3388
|
return { content: [{ type: "text", text: `✅ Decision Lineage Receipt created.\n\nID: ${receipt.receiptId}\nDecision: ${receipt.decisionArtifactId}\nType: ${p.decisionType}\nSources: ${receipt.contributingSources.length}\nCompleteness: ${receipt.lineageCompleteness}\nPurpose: ${receipt.governingPurpose || 'N/A'}\nExplanation: ${receipt.explanation || 'N/A'}` }] };
|
|
3360
3389
|
});
|
|
3361
|
-
server.
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
}, async (p) => {
|
|
3390
|
+
server.registerTool("check_purpose_permitted", { description: "Check if a purpose is permitted under source terms. Supports wildcards (research:*) and hierarchical matching.", inputSchema: z.object({
|
|
3391
|
+
purpose: z.string().describe("Purpose to check (e.g. research:academic, training:model)"),
|
|
3392
|
+
allowedPurposes: z.array(z.string()).describe("Purposes allowed by the source terms"),
|
|
3393
|
+
}) }, async (p) => {
|
|
3365
3394
|
const permitted = isPurposePermitted(p.purpose, p.allowedPurposes);
|
|
3366
3395
|
const category = purposeCategory(p.purpose);
|
|
3367
3396
|
return { content: [{ type: "text", text: `${permitted ? '✅' : '❌'} Purpose "${p.purpose}" (category: ${category}) is ${permitted ? 'PERMITTED' : 'NOT PERMITTED'}\n\nAllowed: [${p.allowedPurposes.join(', ')}]` }] };
|
|
3368
3397
|
});
|
|
3369
|
-
server.
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
}, async (p) => {
|
|
3398
|
+
server.registerTool("check_retention_expired", { description: "Check if data retention has expired based on TTL policy.", inputSchema: z.object({
|
|
3399
|
+
accessedAt: z.string().describe("ISO timestamp of when data was accessed"),
|
|
3400
|
+
maxRetentionMs: z.number().nullable().describe("Max retention in ms (null = no limit)"),
|
|
3401
|
+
accessType: z.enum(["ephemeral", "persistent"]).optional(),
|
|
3402
|
+
}) }, async (p) => {
|
|
3374
3403
|
const policy = { maxRetentionMs: p.maxRetentionMs, onExpiry: 'delete' };
|
|
3375
3404
|
const expired = isRetentionExpired(p.accessedAt, policy, p.accessType);
|
|
3376
3405
|
return { content: [{ type: "text", text: `${expired ? '⚠️ EXPIRED' : '✅ VALID'} — Retention check for access at ${p.accessedAt}\n\nMax retention: ${p.maxRetentionMs ? `${p.maxRetentionMs / 3600000}h` : 'unlimited'}\nAccess type: ${p.accessType || 'default'}` }] };
|
|
3377
3406
|
});
|
|
3378
|
-
server.
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
}, async (p) => {
|
|
3407
|
+
server.registerTool("check_aggregate_constraints", { description: "Check if a data access would violate aggregate rate limits.", inputSchema: z.object({
|
|
3408
|
+
maxAccessesPerWindow: z.number().optional(),
|
|
3409
|
+
windowMs: z.number().optional(),
|
|
3410
|
+
burstLimit: z.number().optional(),
|
|
3411
|
+
currentAccessCount: z.number(),
|
|
3412
|
+
currentRecordCount: z.number(),
|
|
3413
|
+
windowStartMs: z.number(),
|
|
3414
|
+
lastAccessMs: z.number(),
|
|
3415
|
+
sourceId: z.string(),
|
|
3416
|
+
agentId: z.string(),
|
|
3417
|
+
}) }, async (p) => {
|
|
3389
3418
|
const constraint = {
|
|
3390
3419
|
maxAccessesPerWindow: p.maxAccessesPerWindow,
|
|
3391
3420
|
windowMs: p.windowMs,
|
|
@@ -3401,13 +3430,13 @@ server.tool("check_aggregate_constraints", "Check if a data access would violate
|
|
|
3401
3430
|
const result = checkAggregateConstraints(constraint, log);
|
|
3402
3431
|
return { content: [{ type: "text", text: `${result.permitted ? '✅ PERMITTED' : '❌ BLOCKED'} — Aggregate check\n\n${result.reason || 'Within limits'}` }] };
|
|
3403
3432
|
});
|
|
3404
|
-
server.
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
}, async (p) => {
|
|
3433
|
+
server.registerTool("check_jurisdiction_transfer", { description: "Check if a data transfer is permitted under jurisdiction constraints (EU_ONLY, GDPR_ADEQUATE_ONLY, NO_CROSS_BORDER).", inputSchema: z.object({
|
|
3434
|
+
sourceJurisdiction: z.string().describe("ISO 3166-1 alpha-2 code"),
|
|
3435
|
+
targetJurisdiction: z.string().describe("ISO 3166-1 alpha-2 code"),
|
|
3436
|
+
processingRestrictions: z.array(z.string()).optional(),
|
|
3437
|
+
transferConstraints: z.array(z.string()).optional(),
|
|
3438
|
+
purpose: z.string(),
|
|
3439
|
+
}) }, async (p) => {
|
|
3411
3440
|
const envelope = {
|
|
3412
3441
|
sourceJurisdiction: p.sourceJurisdiction,
|
|
3413
3442
|
processingRestrictions: p.processingRestrictions,
|
|
@@ -3416,34 +3445,34 @@ server.tool("check_jurisdiction_transfer", "Check if a data transfer is permitte
|
|
|
3416
3445
|
const result = isTransferPermitted(envelope, p.targetJurisdiction, p.purpose);
|
|
3417
3446
|
return { content: [{ type: "text", text: `${result.permitted ? '✅ PERMITTED' : '❌ BLOCKED'} — Transfer ${p.sourceJurisdiction} → ${p.targetJurisdiction}\n\n${result.reason || 'No restrictions apply'}` }] };
|
|
3418
3447
|
});
|
|
3419
|
-
server.
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
}, async (p) => {
|
|
3448
|
+
server.registerTool("compute_governance_taint", { description: "Compute governance taint level for an artifact based on its derivation chain and revoked sources.", inputSchema: z.object({
|
|
3449
|
+
artifactId: z.string(),
|
|
3450
|
+
revokedSources: z.array(z.string()).optional().describe("Source IDs that have been revoked"),
|
|
3451
|
+
}) }, async (p) => {
|
|
3423
3452
|
const revokedSet = new Set(p.revokedSources || []);
|
|
3424
3453
|
const taint = computeGovernanceTaint(p.artifactId, state.derivationStore, revokedSet);
|
|
3425
3454
|
return { content: [{ type: "text", text: `🏷️ Governance Taint: ${p.artifactId}\n\nLevel: ${taint.taintLevel}\nSources: [${taint.sources.join(', ')}]\nReason: ${taint.reason}\nClearable: ${taint.clearable}\n${taint.clearCondition ? `Condition: ${taint.clearCondition}` : ''}` }] };
|
|
3426
3455
|
});
|
|
3427
|
-
server.
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
}, async (p) => {
|
|
3456
|
+
server.registerTool("file_data_dispute", { description: "File a dispute against a data artifact. The protocol records disputes — resolution is external.", inputSchema: z.object({
|
|
3457
|
+
artifactId: z.string(),
|
|
3458
|
+
disputeType: z.enum(["unauthorized_access", "terms_violation", "compensation_dispute", "revocation_dispute", "lineage_dispute"]),
|
|
3459
|
+
filedBy: z.string(),
|
|
3460
|
+
evidence: z.array(z.string()).describe("Evidence artifact IDs"),
|
|
3461
|
+
}) }, async (p) => {
|
|
3433
3462
|
const dispute = fileDispute({
|
|
3434
3463
|
...p,
|
|
3435
3464
|
privateKey: state.privateKey,
|
|
3436
3465
|
});
|
|
3437
3466
|
return { content: [{ type: "text", text: `⚖️ Dispute filed.\n\nID: ${dispute.disputeId}\nType: ${dispute.disputeType}\nStatus: ${dispute.status}\nArtifact: ${dispute.artifactId}\nEvidence: ${dispute.evidence.length} items` }] };
|
|
3438
3467
|
});
|
|
3439
|
-
server.
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
}, async (p) => {
|
|
3468
|
+
server.registerTool("check_combination_permitted", { description: "Check if combining data from two sources is permitted. Prevents prohibited inferences (HIPAA, COPPA, GDPR Art 9).", inputSchema: z.object({
|
|
3469
|
+
forbiddenSourceClasses: z.array(z.string()).optional(),
|
|
3470
|
+
forbiddenSourceIds: z.array(z.string()).optional(),
|
|
3471
|
+
reason: z.string(),
|
|
3472
|
+
regulatoryBasis: z.string().optional(),
|
|
3473
|
+
otherSourceId: z.string(),
|
|
3474
|
+
otherSourceClasses: z.array(z.string()).optional(),
|
|
3475
|
+
}) }, async (p) => {
|
|
3447
3476
|
const constraints = [{
|
|
3448
3477
|
forbiddenSourceClasses: p.forbiddenSourceClasses,
|
|
3449
3478
|
forbiddenSourceIds: p.forbiddenSourceIds,
|
|
@@ -3453,15 +3482,15 @@ server.tool("check_combination_permitted", "Check if combining data from two sou
|
|
|
3453
3482
|
const result = checkCombinationPermitted(constraints, p.otherSourceId, p.otherSourceClasses);
|
|
3454
3483
|
return { content: [{ type: "text", text: `${result.permitted ? '✅ PERMITTED' : '❌ BLOCKED'} — Combination check\n\n${result.violations.length ? result.violations.join('\n') : 'No violations'}` }] };
|
|
3455
3484
|
});
|
|
3456
|
-
server.
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
}, async (p) => {
|
|
3485
|
+
server.registerTool("create_access_snapshot", { description: "Create an immutable access snapshot — freezes terms, jurisdiction, and constraints at moment of access. Anti-rug-pull.", inputSchema: z.object({
|
|
3486
|
+
accessReceiptId: z.string(),
|
|
3487
|
+
sourceId: z.string(),
|
|
3488
|
+
termsVersion: z.string(),
|
|
3489
|
+
compensationRate: z.number(),
|
|
3490
|
+
currency: z.string(),
|
|
3491
|
+
allowedPurposes: z.array(z.string()),
|
|
3492
|
+
sourceJurisdiction: z.string().optional(),
|
|
3493
|
+
}) }, async (p) => {
|
|
3465
3494
|
const pinnedTerms = {
|
|
3466
3495
|
termsVersion: p.termsVersion,
|
|
3467
3496
|
pinnedAt: new Date().toISOString(),
|
|
@@ -3478,49 +3507,49 @@ server.tool("create_access_snapshot", "Create an immutable access snapshot — f
|
|
|
3478
3507
|
});
|
|
3479
3508
|
return { content: [{ type: "text", text: `📸 Access snapshot created.\n\nID: ${snap.snapshotId}\nSource: ${snap.sourceId}\nTerms hash: ${snap.termsHash}\nRate: ${snap.pinnedTerms.compensationRate} ${snap.pinnedTerms.currency}\nPurposes: [${snap.pinnedTerms.allowedPurposes.join(', ')}]` }] };
|
|
3480
3509
|
});
|
|
3481
|
-
server.
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
}, async (p) => {
|
|
3510
|
+
server.registerTool("detect_purpose_drift", { description: "Detect when data purpose drifts through a workflow (e.g. research → commercial).", inputSchema: z.object({
|
|
3511
|
+
originalPurpose: z.string(),
|
|
3512
|
+
currentPurpose: z.string(),
|
|
3513
|
+
intermediateSteps: z.array(z.string()).optional(),
|
|
3514
|
+
allowedPurposes: z.array(z.string()),
|
|
3515
|
+
}) }, async (p) => {
|
|
3487
3516
|
const result = detectPurposeDrift(p);
|
|
3488
3517
|
return { content: [{ type: "text", text: `${result.severity === 'none' ? '✅' : result.severity === 'violation' ? '❌' : '⚠️'} Purpose Drift: ${result.severity}\n\nOriginal: ${result.originalPurpose}\nCurrent: ${result.currentPurpose}\nDrift: ${result.driftDetected}\nPath: ${result.driftPath.join(' → ')}\n${result.explanation}` }] };
|
|
3489
3518
|
});
|
|
3490
|
-
server.
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
}, async (p) => {
|
|
3519
|
+
server.registerTool("resolve_rights_propagation", { description: "Resolve what rights propagate when data is transformed.", inputSchema: z.object({
|
|
3520
|
+
transformClass: z.string(),
|
|
3521
|
+
sourceDefaultPropagation: z.string().optional().describe("Source-defined default: inherit_full, compensation_only, etc."),
|
|
3522
|
+
}) }, async (p) => {
|
|
3494
3523
|
const sourceRule = p.sourceDefaultPropagation
|
|
3495
3524
|
? { defaultPropagation: p.sourceDefaultPropagation }
|
|
3496
3525
|
: undefined;
|
|
3497
3526
|
const result = resolveRightsPropagation(p.transformClass, sourceRule);
|
|
3498
3527
|
return { content: [{ type: "text", text: `📋 Rights Propagation: ${p.transformClass} → ${result}\n\n${p.sourceDefaultPropagation ? `Source override: ${p.sourceDefaultPropagation}` : `Default: ${DEFAULT_RIGHTS_PROPAGATION[p.transformClass] || 'inherit_partial'}`}` }] };
|
|
3499
3528
|
});
|
|
3500
|
-
server.
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
}, async (p) => {
|
|
3529
|
+
server.registerTool("declare_reidentification_risk", { description: "Declare re-identification risk for transformed or synthetic data.", inputSchema: z.object({
|
|
3530
|
+
risk: z.enum(["none_declared", "low", "medium", "high", "unknown", "mitigated"]),
|
|
3531
|
+
assessmentMethod: z.string().optional(),
|
|
3532
|
+
mitigationsApplied: z.array(z.string()).optional(),
|
|
3533
|
+
assessedBy: z.string(),
|
|
3534
|
+
}) }, async (p) => {
|
|
3506
3535
|
const decl = declareReidentificationRisk(p);
|
|
3507
3536
|
return { content: [{ type: "text", text: `🔒 Re-identification Risk Declaration\n\nRisk: ${decl.risk}\nMethod: ${decl.assessmentMethod || 'N/A'}\nMitigations: ${decl.mitigationsApplied?.join(', ') || 'none'}\nAssessed by: ${decl.assessedBy}\nAt: ${decl.assessedAt}` }] };
|
|
3508
3537
|
});
|
|
3509
3538
|
// ═══════════════════════════════════════
|
|
3510
3539
|
// Governance Block (HTML-embedded governance)
|
|
3511
3540
|
// ═══════════════════════════════════════
|
|
3512
|
-
server.
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
}, async (p) => {
|
|
3541
|
+
server.registerTool("generate_governance_block", { description: "Generate a cryptographically signed governance block for embedding in HTML pages. Includes terms, revocation policy, and content hash.", inputSchema: z.object({
|
|
3542
|
+
content: z.string().describe("Article/page content to hash and govern"),
|
|
3543
|
+
publicKey: z.string().describe("Publisher's Ed25519 public key (hex)"),
|
|
3544
|
+
privateKey: z.string().describe("Publisher's Ed25519 private key (hex)"),
|
|
3545
|
+
inference: z.enum(["permitted", "prohibited", "compensation_required", "attribution_required"]).optional(),
|
|
3546
|
+
training: z.enum(["permitted", "prohibited", "compensation_required", "attribution_required"]).optional(),
|
|
3547
|
+
redistribution: z.enum(["permitted", "prohibited", "compensation_required", "attribution_required"]).optional(),
|
|
3548
|
+
derivative: z.enum(["permitted", "prohibited", "compensation_required", "attribution_required"]).optional(),
|
|
3549
|
+
caching: z.enum(["permitted", "prohibited", "compensation_required", "attribution_required"]).optional(),
|
|
3550
|
+
license_url: z.string().optional(),
|
|
3551
|
+
terms_version: z.string().optional(),
|
|
3552
|
+
}) }, async (p) => {
|
|
3524
3553
|
const { block, html, meta } = embedGovernance({
|
|
3525
3554
|
content: p.content,
|
|
3526
3555
|
publicKey: p.publicKey,
|
|
@@ -3533,28 +3562,28 @@ server.tool("generate_governance_block", "Generate a cryptographically signed go
|
|
|
3533
3562
|
});
|
|
3534
3563
|
return { content: [{ type: "text", text: `📋 Governance Block Generated\n\nDID: ${block.source_did}\nContent Hash: ${block.content_hash}\nTerms: inference=${p.inference || 'not set'}, training=${p.training || 'not set'}\n\n--- HTML EMBED (script tag) ---\n${html}\n\n--- META EMBED (base64) ---\n${meta}` }] };
|
|
3535
3564
|
});
|
|
3536
|
-
server.
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
}, async (p) => {
|
|
3565
|
+
server.registerTool("verify_governance_block", { description: "Verify a governance block's signature, content hash, and DID consistency against the original content.", inputSchema: z.object({
|
|
3566
|
+
block: z.string().describe("Governance block JSON string"),
|
|
3567
|
+
content: z.string().describe("Original content to verify against"),
|
|
3568
|
+
publicKey: z.string().describe("Publisher's Ed25519 public key (hex)"),
|
|
3569
|
+
}) }, async (p) => {
|
|
3541
3570
|
const parsed = JSON.parse(p.block);
|
|
3542
3571
|
const result = verifyGovernanceBlock(parsed, p.content, p.publicKey);
|
|
3543
3572
|
return { content: [{ type: "text", text: `🔍 Governance Block Verification\n\nValid: ${result.valid ? '✅' : '❌'}\nSignature: ${result.signatureValid ? '✅' : '❌'}\nContent Hash: ${result.contentHashValid ? '✅' : '❌'}\nDID Consistent: ${result.didConsistent ? '✅' : '❌'}${result.errors.length > 0 ? '\n\nErrors:\n' + result.errors.join('\n') : ''}` }] };
|
|
3544
3573
|
});
|
|
3545
|
-
server.
|
|
3546
|
-
|
|
3547
|
-
}, async (p) => {
|
|
3574
|
+
server.registerTool("parse_governance_block_html", { description: "Extract a governance block from an HTML page. Looks for APS governance script tags or meta tags.", inputSchema: z.object({
|
|
3575
|
+
html: z.string().describe("HTML content to parse"),
|
|
3576
|
+
}) }, async (p) => {
|
|
3548
3577
|
const block = parseGovernanceBlockFromHTML(p.html);
|
|
3549
3578
|
if (!block) {
|
|
3550
3579
|
return { content: [{ type: "text", text: "No governance block found in HTML." }] };
|
|
3551
3580
|
}
|
|
3552
3581
|
return { content: [{ type: "text", text: `📋 Governance Block Found\n\nDID: ${block.source_did}\nContent Hash: ${block.content_hash}\nPublished: ${block.published_at}\nTerms: ${JSON.stringify(block.terms, null, 2)}\nRevocation Policy: ${JSON.stringify(block.revocation_policy, null, 2)}` }] };
|
|
3553
3582
|
});
|
|
3554
|
-
server.
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
}, async (p) => {
|
|
3583
|
+
server.registerTool("check_usage_permitted", { description: "Check if a specific usage type is permitted under a governance block's terms.", inputSchema: z.object({
|
|
3584
|
+
block: z.string().describe("Governance block JSON string"),
|
|
3585
|
+
usage: z.enum(["inference", "training", "redistribution", "derivative", "caching"]),
|
|
3586
|
+
}) }, async (p) => {
|
|
3558
3587
|
const parsed = JSON.parse(p.block);
|
|
3559
3588
|
const result = isUsagePermitted(parsed, p.usage);
|
|
3560
3589
|
return { content: [{ type: "text", text: `${result.permitted ? '✅' : '❌'} Usage "${p.usage}": ${result.condition}` }] };
|
|
@@ -3562,17 +3591,17 @@ server.tool("check_usage_permitted", "Check if a specific usage type is permitte
|
|
|
3562
3591
|
// ═══════════════════════════════════════
|
|
3563
3592
|
// aps.txt + HTTP Headers + Chained Blocks
|
|
3564
3593
|
// ═══════════════════════════════════════
|
|
3565
|
-
server.
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
}, async (p) => {
|
|
3594
|
+
server.registerTool("generate_aps_txt", { description: "Generate a signed aps.txt file for site-wide governance. Like robots.txt but cryptographically signed with terms, revocation endpoint, and MCP upgrade path.", inputSchema: z.object({
|
|
3595
|
+
domain: z.string().describe("Domain this declaration covers (e.g. theagenttimes.com)"),
|
|
3596
|
+
publisherName: z.string().describe("Human-readable publisher name"),
|
|
3597
|
+
publicKey: z.string().describe("Publisher's Ed25519 public key (hex)"),
|
|
3598
|
+
privateKey: z.string().describe("Publisher's Ed25519 private key (hex)"),
|
|
3599
|
+
inference: z.enum(["permitted", "prohibited", "compensation_required", "attribution_required"]).optional(),
|
|
3600
|
+
training: z.enum(["permitted", "prohibited", "compensation_required", "attribution_required"]).optional(),
|
|
3601
|
+
redistribution: z.enum(["permitted", "prohibited", "compensation_required", "attribution_required"]).optional(),
|
|
3602
|
+
mcpEndpoint: z.string().optional(),
|
|
3603
|
+
revocationEndpoint: z.string().optional(),
|
|
3604
|
+
}) }, async (p) => {
|
|
3576
3605
|
const doc = generateApsTxt({
|
|
3577
3606
|
domain: p.domain, publisherName: p.publisherName,
|
|
3578
3607
|
publicKey: p.publicKey, privateKey: p.privateKey,
|
|
@@ -3582,31 +3611,31 @@ server.tool("generate_aps_txt", "Generate a signed aps.txt file for site-wide go
|
|
|
3582
3611
|
const serialized = JSON.stringify(doc, null, 2);
|
|
3583
3612
|
return { content: [{ type: "text", text: `📄 aps.txt Generated\n\nDomain: ${doc.domain}\nDID: ${doc.publisher_did}\nMCP: ${doc.mcp_endpoint || 'none'}\n\nServe at: ${p.domain}/.well-known/aps.txt\n\n${serialized}` }] };
|
|
3584
3613
|
});
|
|
3585
|
-
server.
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
}, async (p) => {
|
|
3614
|
+
server.registerTool("verify_aps_txt", { description: "Verify a signed aps.txt file — checks signature and DID consistency.", inputSchema: z.object({
|
|
3615
|
+
content: z.string().describe("aps.txt JSON content"),
|
|
3616
|
+
publicKey: z.string().describe("Publisher's Ed25519 public key (hex)"),
|
|
3617
|
+
}) }, async (p) => {
|
|
3589
3618
|
const doc = JSON.parse(p.content);
|
|
3590
3619
|
const result = verifyApsTxt(doc, p.publicKey);
|
|
3591
3620
|
return { content: [{ type: "text", text: `${result.valid ? '✅' : '❌'} aps.txt Verification: ${result.valid ? 'VALID' : 'INVALID'}${result.errors.length ? '\nErrors: ' + result.errors.join('; ') : ''}` }] };
|
|
3592
3621
|
});
|
|
3593
|
-
server.
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
}, async (p) => {
|
|
3622
|
+
server.registerTool("resolve_path_terms", { description: "Resolve governance terms for a specific URL path using aps.txt path overrides.", inputSchema: z.object({
|
|
3623
|
+
apsTxt: z.string().describe("aps.txt JSON content"),
|
|
3624
|
+
path: z.string().describe("URL path to resolve (e.g. /blog/my-article)"),
|
|
3625
|
+
}) }, async (p) => {
|
|
3597
3626
|
const doc = JSON.parse(p.apsTxt);
|
|
3598
3627
|
const terms = resolveTermsForPath(doc, p.path);
|
|
3599
3628
|
return { content: [{ type: "text", text: `📋 Terms for "${p.path}":\n${JSON.stringify(terms, null, 2)}` }] };
|
|
3600
3629
|
});
|
|
3601
|
-
server.
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
}, async (p) => {
|
|
3630
|
+
server.registerTool("create_chained_governance_block", { description: "Create a governance block for derivative content that references the original publisher's block. Preserves the chain of provenance.", inputSchema: z.object({
|
|
3631
|
+
content: z.string().describe("Derivative content"),
|
|
3632
|
+
publicKey: z.string().describe("Derivative agent's Ed25519 public key (hex)"),
|
|
3633
|
+
privateKey: z.string().describe("Derivative agent's Ed25519 private key (hex)"),
|
|
3634
|
+
parentBlock: z.string().describe("Original governance block JSON string"),
|
|
3635
|
+
derivationType: z.string().describe("Type: summary, embedding, rag_chunk, translation, etc."),
|
|
3636
|
+
inference: z.enum(["permitted", "prohibited", "compensation_required", "attribution_required"]).optional(),
|
|
3637
|
+
training: z.enum(["permitted", "prohibited", "compensation_required", "attribution_required"]).optional(),
|
|
3638
|
+
}) }, async (p) => {
|
|
3610
3639
|
const parent = JSON.parse(p.parentBlock);
|
|
3611
3640
|
const chained = createChainedGovernanceBlock({
|
|
3612
3641
|
content: p.content, publicKey: p.publicKey, privateKey: p.privateKey,
|
|
@@ -3618,15 +3647,15 @@ server.tool("create_chained_governance_block", "Create a governance block for de
|
|
|
3618
3647
|
// ═══════════════════════════════════════
|
|
3619
3648
|
// Governance Consumer (agent-side 360 loop)
|
|
3620
3649
|
// ═══════════════════════════════════════
|
|
3621
|
-
server.
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
}, async (p) => {
|
|
3650
|
+
server.registerTool("governance_360", { description: "Execute the full governance 360 loop on HTML content: extract governance block → verify signature + content hash → check usage terms → create signed access receipt. This is what an agent calls on every page it reads.", inputSchema: z.object({
|
|
3651
|
+
html: z.string().describe("Full HTML of the page"),
|
|
3652
|
+
contentBody: z.string().describe("Article text content (for hash verification)"),
|
|
3653
|
+
publisherPublicKey: z.string().describe("Publisher's Ed25519 public key (hex)"),
|
|
3654
|
+
agentPublicKey: z.string().describe("Your agent's Ed25519 public key (hex)"),
|
|
3655
|
+
agentPrivateKey: z.string().describe("Your agent's Ed25519 private key (hex)"),
|
|
3656
|
+
intendedUsage: z.enum(["inference", "training", "redistribution", "derivative", "caching"]),
|
|
3657
|
+
sourceUrl: z.string().describe("URL of the page"),
|
|
3658
|
+
}) }, async (p) => {
|
|
3630
3659
|
const result = governanceLoop360({
|
|
3631
3660
|
html: p.html, contentBody: p.contentBody,
|
|
3632
3661
|
publisherPublicKey: p.publisherPublicKey,
|
|
@@ -3635,13 +3664,13 @@ server.tool("governance_360", "Execute the full governance 360 loop on HTML cont
|
|
|
3635
3664
|
});
|
|
3636
3665
|
return { content: [{ type: "text", text: `🔄 Governance 360 Loop\n\n${result.summary}\n\n${result.receipt ? `Receipt ID: ${result.receipt.receiptId}\nAccessed: ${result.receipt.accessed_at}` : 'No receipt (ungoverned content)'}` }] };
|
|
3637
3666
|
});
|
|
3638
|
-
server.
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
}, async (p) => {
|
|
3667
|
+
server.registerTool("create_access_receipt", { description: "Create a signed access receipt — cryptographic proof that your agent consumed content under specific terms. The receipt captures terms and revocation policy at access time.", inputSchema: z.object({
|
|
3668
|
+
agentPublicKey: z.string().describe("Your agent's Ed25519 public key (hex)"),
|
|
3669
|
+
agentPrivateKey: z.string().describe("Your agent's Ed25519 private key (hex)"),
|
|
3670
|
+
block: z.string().describe("Governance block JSON string"),
|
|
3671
|
+
sourceUrl: z.string().describe("URL where content was accessed"),
|
|
3672
|
+
intendedUsage: z.string().describe("How you intend to use this content"),
|
|
3673
|
+
}) }, async (p) => {
|
|
3645
3674
|
const parsed = JSON.parse(p.block);
|
|
3646
3675
|
const receipt = createAccessReceipt({
|
|
3647
3676
|
agentPublicKey: p.agentPublicKey, agentPrivateKey: p.agentPrivateKey,
|
|
@@ -3653,25 +3682,25 @@ server.tool("create_access_receipt", "Create a signed access receipt — cryptog
|
|
|
3653
3682
|
// ═══════════════════════════════════════
|
|
3654
3683
|
// Rome-Complete: Charter & Institutional Governance
|
|
3655
3684
|
// ═══════════════════════════════════════
|
|
3656
|
-
server.
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
}, async (args) => {
|
|
3685
|
+
server.registerTool("create_charter", { description: "Create a new institutional charter — the constitutional root of an organization. Defines offices, amendment rules, dissolution policy.", inputSchema: z.object({
|
|
3686
|
+
name: z.string().describe("Institution name"),
|
|
3687
|
+
offices: z.array(z.object({
|
|
3688
|
+
officeId: z.string(),
|
|
3689
|
+
name: z.string(),
|
|
3690
|
+
holderPublicKey: z.string().describe("Ed25519 public key of initial holder"),
|
|
3691
|
+
allowedScopes: z.array(z.string()).default(["*"]),
|
|
3692
|
+
maxSpendPerAction: z.number().default(1000),
|
|
3693
|
+
maxDelegationDepth: z.number().default(3),
|
|
3694
|
+
successionOrder: z.array(z.string()).default([]),
|
|
3695
|
+
incompatibleOffices: z.array(z.string()).optional(),
|
|
3696
|
+
})).describe("Offices to create"),
|
|
3697
|
+
amendment_board_keys: z.array(z.string()).describe("Ed25519 public keys eligible for amendment voting"),
|
|
3698
|
+
amendment_required_sigs: z.number().describe("Signatures required for amendment"),
|
|
3699
|
+
dissolution_grace_seconds: z.number().default(86400),
|
|
3700
|
+
founder_private_key: z.string().describe("Founder's Ed25519 private key"),
|
|
3701
|
+
founder_public_key: z.string().describe("Founder's Ed25519 public key"),
|
|
3702
|
+
founder_role: z.string().default("board"),
|
|
3703
|
+
}) }, async (args) => {
|
|
3675
3704
|
const offices = args.offices.map(o => ({
|
|
3676
3705
|
officeId: o.officeId,
|
|
3677
3706
|
name: o.name,
|
|
@@ -3707,7 +3736,7 @@ server.tool("create_charter", "Create a new institutional charter — the consti
|
|
|
3707
3736
|
state.charters.set(charter.charterId, charter);
|
|
3708
3737
|
return { content: [{ type: "text", text: `🏛️ Charter Created\n\nID: ${charter.charterId}\nName: ${charter.name}\nVersion: ${charter.version}\nOffices: ${charter.offices.map(o => o.name).join(', ')}\nSignatures: ${charter.foundingSignatures.length}` }] };
|
|
3709
3738
|
});
|
|
3710
|
-
server.
|
|
3739
|
+
server.registerTool("verify_charter", { description: "Verify a charter's integrity: content hash, signatures, office consistency, incompatibility.", inputSchema: z.object({ charter_id: z.string().describe("Charter ID to verify") }) }, async (args) => {
|
|
3711
3740
|
const charter = state.charters.get(args.charter_id);
|
|
3712
3741
|
if (!charter)
|
|
3713
3742
|
return { content: [{ type: "text", text: `❌ Charter ${args.charter_id} not found` }] };
|
|
@@ -3715,13 +3744,13 @@ server.tool("verify_charter", "Verify a charter's integrity: content hash, signa
|
|
|
3715
3744
|
const status = result.valid ? '✅ VALID' : '❌ INVALID';
|
|
3716
3745
|
return { content: [{ type: "text", text: `${status}\n\nContent integrity: ${result.contentIntegrity}\nSignatures valid: ${result.signaturesValid}\nQuorum met: ${result.quorumMet}\nNot dissolved: ${result.notDissolved}\nOffices valid: ${result.officesValid}\nIncompatibility clean: ${result.incompatibilityClean}${result.errors.length ? '\n\nErrors:\n' + result.errors.join('\n') : ''}` }] };
|
|
3717
3746
|
});
|
|
3718
|
-
server.
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
}, async (args) => {
|
|
3747
|
+
server.registerTool("sign_charter", { description: "Add a founding signature to a charter.", inputSchema: z.object({
|
|
3748
|
+
charter_id: z.string(),
|
|
3749
|
+
signer_private_key: z.string(),
|
|
3750
|
+
signer_public_key: z.string(),
|
|
3751
|
+
signer_role: z.string().default("board"),
|
|
3752
|
+
resigner_private_key: z.string().describe("Key to re-sign the outer charter envelope"),
|
|
3753
|
+
}) }, async (args) => {
|
|
3725
3754
|
const charter = state.charters.get(args.charter_id);
|
|
3726
3755
|
if (!charter)
|
|
3727
3756
|
return { content: [{ type: "text", text: `❌ Charter ${args.charter_id} not found` }] };
|
|
@@ -3729,40 +3758,109 @@ server.tool("sign_charter", "Add a founding signature to a charter.", {
|
|
|
3729
3758
|
state.charters.set(signed.charterId, signed);
|
|
3730
3759
|
return { content: [{ type: "text", text: `✅ Signature added to ${signed.charterId}\n\nTotal signatures: ${signed.foundingSignatures.length}\nNew signer role: ${args.signer_role}` }] };
|
|
3731
3760
|
});
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3761
|
+
// ═══════════════════════════════════════
|
|
3762
|
+
// TOOLS: charter amendment lifecycle
|
|
3763
|
+
// ═══════════════════════════════════════
|
|
3764
|
+
//
|
|
3765
|
+
// These three replace the removed `evaluate_threshold`, which counted declared
|
|
3766
|
+
// signers without verifying anything and still printed a threshold verdict.
|
|
3767
|
+
//
|
|
3768
|
+
// Boundary rule for this path: MCP never constructs a signing preimage, never
|
|
3769
|
+
// canonicalizes governance content, and never accepts signed bytes from a caller.
|
|
3770
|
+
// Every cryptographic meaning comes from an SDK call. `amendmentSignContent` stays
|
|
3771
|
+
// private to the SDK; a copy here would be a second preimage on a second release
|
|
3772
|
+
// cadence.
|
|
3773
|
+
//
|
|
3774
|
+
// WHY THESE SCHEMAS TAKE PRIVATE KEYS. The private-key parameters below are
|
|
3775
|
+
// preserved deliberately, not overlooked. The existing MCP signing tools already
|
|
3776
|
+
// use this model, `sign_charter` immediately above among them, and MCP accepts
|
|
3777
|
+
// private keys at roughly 50 call sites. Externalizing signing for these three
|
|
3778
|
+
// while their neighbours keep in-process keys would convert an inconsistency into
|
|
3779
|
+
// a fix. This preserves consistency for this release and does NOT decide the
|
|
3780
|
+
// broader MCP key custody question, which is open as its own decision across the
|
|
3781
|
+
// whole server. Do not read `propose_amendment(private_key)` as settled
|
|
3782
|
+
// architecture.
|
|
3783
|
+
server.registerTool("propose_amendment", { description: "Propose an amendment to a charter. Supplies a full replacement CharterCore, not a patch. The SDK derives the signing preimage and produces the proposer signature. Session state is not an authoritative registry: amendments live only in this process, are lost on restart, and carry no external trust.", inputSchema: z.object({
|
|
3784
|
+
charter_id: z.string().describe("Charter being amended"),
|
|
3785
|
+
proposed_charter: z.record(z.string(), z.any()).describe("Full CharterCore replacement, not a patch"),
|
|
3786
|
+
description: z.string().describe("Human-readable description of the change"),
|
|
3787
|
+
proposer_private_key: z.string(),
|
|
3788
|
+
proposer_public_key: z.string(),
|
|
3789
|
+
effective_at: z.string().optional().describe("ISO 8601, when the amendment takes effect if approved"),
|
|
3790
|
+
}) }, async (args) => {
|
|
3791
|
+
const charter = state.charters.get(args.charter_id);
|
|
3792
|
+
if (!charter)
|
|
3793
|
+
return { content: [{ type: "text", text: `❌ Charter ${args.charter_id} not found` }] };
|
|
3794
|
+
const amendment = createAmendment({
|
|
3795
|
+
charter,
|
|
3796
|
+
proposedCharter: args.proposed_charter,
|
|
3797
|
+
description: args.description,
|
|
3798
|
+
proposerPrivateKey: args.proposer_private_key,
|
|
3799
|
+
proposerPublicKey: args.proposer_public_key,
|
|
3800
|
+
...(args.effective_at ? { effectiveAt: args.effective_at } : {}),
|
|
3801
|
+
});
|
|
3802
|
+
state.amendments.set(amendment.amendmentId, amendment);
|
|
3803
|
+
return { content: [{ type: "text", text: `✅ Amendment proposed\n\namendment_id: ${amendment.amendmentId}\ncharter_id: ${amendment.charterId}\nfrom_version: ${amendment.fromVersion}\nto_version: ${amendment.toVersion}\nsignatures: ${amendment.signatures.length}\nstatus: ${amendment.status}\n\nNext: sign_amendment to collect signatures, then verify_amendment.` }] };
|
|
3804
|
+
});
|
|
3805
|
+
server.registerTool("sign_amendment", { description: "Add a signature to a proposed amendment. The SDK derives the preimage and signs it; MCP never sees or builds the signed bytes. Session state is not an authoritative registry: amendments live only in this process, are lost on restart, and carry no external trust.", inputSchema: z.object({
|
|
3806
|
+
amendment_id: z.string(),
|
|
3807
|
+
signer_private_key: z.string(),
|
|
3808
|
+
signer_public_key: z.string(),
|
|
3809
|
+
signer_role: z.string().describe("The key class the charter's amendment policy counts this signature against"),
|
|
3810
|
+
}) }, async (args) => {
|
|
3811
|
+
const amendment = state.amendments.get(args.amendment_id);
|
|
3812
|
+
if (!amendment)
|
|
3813
|
+
return { content: [{ type: "text", text: `❌ Amendment ${args.amendment_id} not found` }] };
|
|
3814
|
+
const signed = signAmendment(amendment, args.signer_private_key, args.signer_public_key, args.signer_role);
|
|
3815
|
+
state.amendments.set(signed.amendmentId, signed);
|
|
3816
|
+
const roles = signed.signatures.map(sig => sig.role).join(', ');
|
|
3817
|
+
return { content: [{ type: "text", text: `✅ Signature added to ${signed.amendmentId}\n\nsignatures: ${signed.signatures.length}\nroles collected: ${roles || '(none)'}\nstatus: ${signed.status}\n\nSignature counting and threshold evaluation happen in verify_amendment.` }] };
|
|
3818
|
+
});
|
|
3819
|
+
server.registerTool("verify_amendment", { description: "Verify an amendment against its charter's amendment policy. Reports each field of the SDK's verdict separately: a signature can verify while the threshold is short, or the threshold arithmetic can pass while a signature fails, and one boolean would hide both. Session state is not an authoritative registry: amendments live only in this process, are lost on restart, and carry no external trust.", inputSchema: z.object({
|
|
3820
|
+
charter_id: z.string(),
|
|
3821
|
+
amendment_id: z.string(),
|
|
3822
|
+
}) }, async (args) => {
|
|
3741
3823
|
const charter = state.charters.get(args.charter_id);
|
|
3742
3824
|
if (!charter)
|
|
3743
3825
|
return { content: [{ type: "text", text: `❌ Charter ${args.charter_id} not found` }] };
|
|
3744
|
-
const
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3826
|
+
const amendment = state.amendments.get(args.amendment_id);
|
|
3827
|
+
if (!amendment)
|
|
3828
|
+
return { content: [{ type: "text", text: `❌ Amendment ${args.amendment_id} not found` }] };
|
|
3829
|
+
const v = verifyAmendment(amendment, charter);
|
|
3830
|
+
const mark = (b) => b ? '✅' : '❌';
|
|
3831
|
+
// Field order is deliberate: `valid` is rendered LAST and labelled as the
|
|
3832
|
+
// conjunction of the fields above it, never as a headline verdict. A bare
|
|
3833
|
+
// `valid: false` answers nothing on its own; the field that flipped, plus
|
|
3834
|
+
// `errors`, is the answer.
|
|
3835
|
+
const lines = [
|
|
3836
|
+
`charter_exists: ${mark(v.charterExists)} ${v.charterExists}`,
|
|
3837
|
+
`version_match: ${mark(v.versionMatch)} ${v.versionMatch}`,
|
|
3838
|
+
`signatures_valid: ${mark(v.signaturesValid)} ${v.signaturesValid}`,
|
|
3839
|
+
`proposed_charter_valid: ${mark(v.proposedCharterValid)} ${v.proposedCharterValid}`,
|
|
3840
|
+
`threshold_met: ${mark(v.thresholdMet)} ${v.thresholdMet}`,
|
|
3841
|
+
];
|
|
3842
|
+
const errs = v.errors.length ? `\n\nerrors:\n${v.errors.map(e => ` - ${e}`).join('\n')}` : '\n\nerrors: (none)';
|
|
3843
|
+
const conj = `\n\nvalid: ${v.valid} (the conjunction of the five fields above, not a standalone verdict)`;
|
|
3844
|
+
return { content: [{ type: "text", text: `Amendment ${amendment.amendmentId} against charter ${charter.charterId}\n\n${lines.join('\n')}${errs}${conj}` }] };
|
|
3845
|
+
});
|
|
3846
|
+
server.registerTool("create_approval_request", { description: "Create a multi-party approval request for charter amendments, office transfers, etc.", inputSchema: z.object({
|
|
3847
|
+
policy_id: z.string(),
|
|
3848
|
+
subject: z.string().describe("What is being approved (e.g. amendment ID)"),
|
|
3849
|
+
subject_type: z.enum(['charter_amendment', 'delegation', 'office_transfer', 'dissolution', 'escrow_release', 'dispute_resolution']),
|
|
3850
|
+
requested_by: z.string(),
|
|
3851
|
+
timeout_seconds: z.number().default(86400),
|
|
3852
|
+
}) }, async (args) => {
|
|
3755
3853
|
const req = createApprovalRequest(args.policy_id, args.subject, args.subject_type, args.requested_by, args.timeout_seconds);
|
|
3756
3854
|
state.approvalRequests.set(req.requestId, req);
|
|
3757
3855
|
return { content: [{ type: "text", text: `📋 Approval Request Created\n\nID: ${req.requestId}\nSubject: ${req.subject} (${req.subjectType})\nStatus: ${req.status}\nExpires: ${req.expiresAt}` }] };
|
|
3758
3856
|
});
|
|
3759
|
-
server.
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
}, async (args) => {
|
|
3857
|
+
server.registerTool("add_approval_signature", { description: "Add a signature to an approval request.", inputSchema: z.object({
|
|
3858
|
+
request_id: z.string(),
|
|
3859
|
+
signer_private_key: z.string(),
|
|
3860
|
+
signer_public_key: z.string(),
|
|
3861
|
+
key_class: z.string().default("board"),
|
|
3862
|
+
office_id: z.string().optional(),
|
|
3863
|
+
}) }, async (args) => {
|
|
3766
3864
|
const req = state.approvalRequests.get(args.request_id);
|
|
3767
3865
|
if (!req)
|
|
3768
3866
|
return { content: [{ type: "text", text: `❌ Request ${args.request_id} not found` }] };
|
|
@@ -3770,28 +3868,28 @@ server.tool("add_approval_signature", "Add a signature to an approval request.",
|
|
|
3770
3868
|
state.approvalRequests.set(updated.requestId, updated);
|
|
3771
3869
|
return { content: [{ type: "text", text: `✅ Signature added\n\nRequest: ${updated.requestId}\nTotal signatures: ${updated.signatures.length}\nStatus: ${updated.status}` }] };
|
|
3772
3870
|
});
|
|
3773
|
-
server.
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
}, async (args) => {
|
|
3871
|
+
server.registerTool("create_hybrid_timestamp", { description: "Create a gateway-issued hybrid timestamp (Consilium Q1: HLC + NTP uncertainty).", inputSchema: z.object({
|
|
3872
|
+
gateway_id: z.string().describe("Gateway issuing the timestamp"),
|
|
3873
|
+
drift_ms: z.number().default(50).describe("NTP drift bound in milliseconds"),
|
|
3874
|
+
}) }, async (args) => {
|
|
3777
3875
|
const ts = createHybridTimestamp(args.gateway_id, args.drift_ms);
|
|
3778
3876
|
return { content: [{ type: "text", text: `⏱️ Hybrid Timestamp\n\nLogical time: ${ts.logicalTime}\nWall clock earliest: ${new Date(ts.wallClockEarliest).toISOString()}\nWall clock latest: ${new Date(ts.wallClockLatest).toISOString()}\nGateway: ${ts.gatewayId}\nUncertainty: ±${args.drift_ms}ms` }] };
|
|
3779
3877
|
});
|
|
3780
|
-
server.
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
}, async (args) => {
|
|
3878
|
+
server.registerTool("compare_timestamps", { description: "Compare two hybrid timestamps to determine ordering.", inputSchema: z.object({
|
|
3879
|
+
a: z.object({ logicalTime: z.number(), wallClockEarliest: z.number(), wallClockLatest: z.number(), gatewayId: z.string() }),
|
|
3880
|
+
b: z.object({ logicalTime: z.number(), wallClockEarliest: z.number(), wallClockLatest: z.number(), gatewayId: z.string() }),
|
|
3881
|
+
}) }, async (args) => {
|
|
3784
3882
|
const order = compareTimestamps(args.a, args.b);
|
|
3785
3883
|
return { content: [{ type: "text", text: `⏱️ Temporal Ordering: ${order}\n\nA: logical=${args.a.logicalTime} wall=[${args.a.wallClockEarliest},${args.a.wallClockLatest}] gw=${args.a.gatewayId}\nB: logical=${args.b.logicalTime} wall=[${args.b.wallClockEarliest},${args.b.wallClockLatest}] gw=${args.b.gatewayId}` }] };
|
|
3786
3884
|
});
|
|
3787
|
-
server.
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
}, async (args) => {
|
|
3885
|
+
server.registerTool("validate_temporal_rights", { description: "Validate a TemporalRights object — check validity window, grace period, supersession, challenge window.", inputSchema: z.object({
|
|
3886
|
+
valid_from: z.string().describe("ISO datetime"),
|
|
3887
|
+
valid_until: z.string().describe("ISO datetime"),
|
|
3888
|
+
challenge_until: z.string().optional(),
|
|
3889
|
+
grace_until: z.string().optional(),
|
|
3890
|
+
superseded_at: z.string().optional(),
|
|
3891
|
+
effective_at: z.string().optional(),
|
|
3892
|
+
}) }, async (args) => {
|
|
3795
3893
|
const result = validateTemporalRights({
|
|
3796
3894
|
validFrom: args.valid_from, validUntil: args.valid_until,
|
|
3797
3895
|
challengeUntil: args.challenge_until, graceUntil: args.grace_until,
|
|
@@ -3799,19 +3897,19 @@ server.tool("validate_temporal_rights", "Validate a TemporalRights object — ch
|
|
|
3799
3897
|
});
|
|
3800
3898
|
return { content: [{ type: "text", text: `⏱️ Temporal Validation\n\nValid: ${result.valid}\nIn grace: ${result.inGracePeriod}\nSuperseded: ${result.superseded}\nChallenge open: ${result.challengeWindowOpen}\nEffective: ${result.effective}${result.errors.length ? '\n\nIssues:\n' + result.errors.join('\n') : ''}` }] };
|
|
3801
3899
|
});
|
|
3802
|
-
server.
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
}, async (args) => {
|
|
3900
|
+
server.registerTool("create_reserve_attestation", { description: "Create a signed reserve attestation proving a delegation has actual funds (GPT #15).", inputSchema: z.object({
|
|
3901
|
+
delegation_id: z.string(),
|
|
3902
|
+
assurance_class: z.enum(['unbacked', 'self_attested', 'gateway_attested', 'escrow_backed', 'externally_attested']),
|
|
3903
|
+
amount: z.number(),
|
|
3904
|
+
currency: z.string().default("USD"),
|
|
3905
|
+
attestation_basis: z.enum(['api_balance_check', 'bank_statement', 'escrow_lock', 'self_declaration']),
|
|
3906
|
+
false_attestation_penalty: z.enum(['reputation_slash', 'bond_forfeit', 'dispute_eligible', 'none']).default('reputation_slash'),
|
|
3907
|
+
attester_private_key: z.string(),
|
|
3908
|
+
attester_public_key: z.string(),
|
|
3909
|
+
charter_anchor: z.string().optional(),
|
|
3910
|
+
office_id: z.string().optional(),
|
|
3911
|
+
ttl_seconds: z.number().default(86400),
|
|
3912
|
+
}) }, async (args) => {
|
|
3815
3913
|
const att = createReserveAttestation({
|
|
3816
3914
|
delegationId: args.delegation_id, assuranceClass: args.assurance_class,
|
|
3817
3915
|
amount: args.amount, currency: args.currency,
|
|
@@ -3821,29 +3919,29 @@ server.tool("create_reserve_attestation", "Create a signed reserve attestation p
|
|
|
3821
3919
|
});
|
|
3822
3920
|
return { content: [{ type: "text", text: `💰 Reserve Attestation Created\n\nID: ${att.attestationId}\nDelegation: ${att.delegationId}\nAssurance: ${att.assuranceClass}\nAmount: ${att.attestedAmount.value} ${att.attestedAmount.currency}\nExpires: ${att.expiresAt}` }] };
|
|
3823
3921
|
});
|
|
3824
|
-
server.
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
}, async (args) => {
|
|
3922
|
+
server.registerTool("vouch_reputation", { description: "Create a vouched reputation for cross-gateway portability (WS-3). Signed summary — no receipt history exposed.", inputSchema: z.object({
|
|
3923
|
+
agent_id: z.string(),
|
|
3924
|
+
tier: z.number(),
|
|
3925
|
+
diversity_score: z.number(),
|
|
3926
|
+
gateway_private_key: z.string(),
|
|
3927
|
+
gateway_id: z.string(),
|
|
3928
|
+
ttl_seconds: z.number().default(2592000).describe("Default 30 days"),
|
|
3929
|
+
}) }, async (args) => {
|
|
3832
3930
|
const rep = vouchReputation({
|
|
3833
3931
|
agentId: args.agent_id, tier: args.tier, diversityScore: args.diversity_score,
|
|
3834
3932
|
gatewayPrivateKey: args.gateway_private_key, gatewayId: args.gateway_id, ttlSeconds: args.ttl_seconds,
|
|
3835
3933
|
});
|
|
3836
3934
|
return { content: [{ type: "text", text: `🌐 Vouched Reputation Created\n\nAgent: ${rep.agentId}\nTier: ${rep.attestedTier}\nDiversity: ${rep.attestedDiversityScore}\nGateway: ${rep.originGatewayId}\nExpires: ${rep.expiresAt}` }] };
|
|
3837
3935
|
});
|
|
3838
|
-
server.
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
}, async (args) => {
|
|
3936
|
+
server.registerTool("apply_reputation_downgrade", { description: "Apply import policy downgrade to a foreign vouched reputation.", inputSchema: z.object({
|
|
3937
|
+
agent_id: z.string(),
|
|
3938
|
+
origin_gateway_id: z.string(),
|
|
3939
|
+
attested_tier: z.number(),
|
|
3940
|
+
attested_diversity_score: z.number(),
|
|
3941
|
+
accept_from: z.array(z.string()).describe("Gateway IDs accepted by import policy"),
|
|
3942
|
+
downgrade_ratio: z.number().default(0.5),
|
|
3943
|
+
foreign_default_tier: z.number().default(0),
|
|
3944
|
+
}) }, async (args) => {
|
|
3847
3945
|
const rep = { agentId: args.agent_id, originGatewayId: args.origin_gateway_id, attestedTier: args.attested_tier, attestedDiversityScore: args.attested_diversity_score, attestedAt: new Date().toISOString(), expiresAt: new Date(Date.now() + 86400000).toISOString(), originGatewaySignature: '' };
|
|
3848
3946
|
const policy = {
|
|
3849
3947
|
receipts: { acceptFrom: args.accept_from, requireWitness: true },
|
|
@@ -3859,12 +3957,12 @@ server.tool("apply_reputation_downgrade", "Apply import policy downgrade to a fo
|
|
|
3859
3957
|
// ═══════════════════════════════════════
|
|
3860
3958
|
// v1.33.0 — action_ref + freshness + evidence-based grade
|
|
3861
3959
|
// ═══════════════════════════════════════
|
|
3862
|
-
server.
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
}, async (args) => {
|
|
3960
|
+
server.registerTool("compute_action_ref", { description: "Compute content-addressed request identity (SHA-256 of agentId + actionType + scope + normalized timestamp). Two receipts with the same action_ref describe the same request.", inputSchema: z.object({
|
|
3961
|
+
agent_id: z.string(),
|
|
3962
|
+
action_type: z.string(),
|
|
3963
|
+
scope_required: z.array(z.string()),
|
|
3964
|
+
timestamp: z.string().optional().describe("ISO 8601 timestamp; defaults to now"),
|
|
3965
|
+
}) }, async (args) => {
|
|
3868
3966
|
const intent = {
|
|
3869
3967
|
agentId: args.agent_id,
|
|
3870
3968
|
action: { type: args.action_type, scopeRequired: args.scope_required },
|
|
@@ -3873,13 +3971,13 @@ server.tool("compute_action_ref", "Compute content-addressed request identity (S
|
|
|
3873
3971
|
const ref = computeActionRef(intent);
|
|
3874
3972
|
return { content: [{ type: "text", text: `🔗 action_ref: ${ref}\n\nAgent: ${args.agent_id}\nType: ${args.action_type}\nScope: ${args.scope_required.join(', ')}\nTimestamp: ${intent.createdAt}` }] };
|
|
3875
3973
|
});
|
|
3876
|
-
server.
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
}, async (args) => {
|
|
3974
|
+
server.registerTool("is_evidence_fresh", { description: "Check whether typed attestation evidence is still fresh. rotating: ttl required; snapshot: maxAge optional; static: always fresh.", inputSchema: z.object({
|
|
3975
|
+
type: z.enum(['rotating', 'snapshot', 'static']),
|
|
3976
|
+
valid_at: z.string().describe("ISO 8601 timestamp evidence was produced"),
|
|
3977
|
+
ttl: z.number().optional().describe("Seconds (required for rotating)"),
|
|
3978
|
+
max_age: z.number().optional().describe("Seconds (optional for snapshot)"),
|
|
3979
|
+
now: z.string().optional().describe("ISO 8601 override for current time"),
|
|
3980
|
+
}) }, async (args) => {
|
|
3883
3981
|
const freshness = { type: args.type, validAt: args.valid_at };
|
|
3884
3982
|
if (args.ttl !== undefined)
|
|
3885
3983
|
freshness.ttl = args.ttl;
|
|
@@ -3890,12 +3988,12 @@ server.tool("is_evidence_fresh", "Check whether typed attestation evidence is st
|
|
|
3890
3988
|
const ageSec = computeEvidenceAge(freshness, nowDate);
|
|
3891
3989
|
return { content: [{ type: "text", text: `${fresh ? '✅' : '❌'} Evidence fresh: ${fresh}\n\nType: ${args.type}\nValid at: ${args.valid_at}\nAge: ${ageSec}s${args.ttl !== undefined ? `\nTTL: ${args.ttl}s` : ''}${args.max_age !== undefined ? `\nMax age: ${args.max_age}s` : ''}` }] };
|
|
3892
3990
|
});
|
|
3893
|
-
server.
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
}, async (args) => {
|
|
3991
|
+
server.registerTool("classify_evidence_quality", { description: "Classify attestation evidence quality (none / issuer_vouched / infrastructure / principal_bound) and return the corresponding grade (0-3).", inputSchema: z.object({
|
|
3992
|
+
method: z.string().optional().describe("Attestation method (e.g. 'spiffe')"),
|
|
3993
|
+
has_issuer_signature: z.boolean().optional(),
|
|
3994
|
+
has_principal_binding: z.boolean().optional(),
|
|
3995
|
+
evidence: z.record(z.string(), z.any()).optional().describe("Evidence object (checked for known infrastructure keys)"),
|
|
3996
|
+
}) }, async (args) => {
|
|
3899
3997
|
const quality = classifyEvidenceQuality({
|
|
3900
3998
|
method: args.method,
|
|
3901
3999
|
hasIssuerSignature: args.has_issuer_signature,
|
|
@@ -3908,13 +4006,13 @@ server.tool("classify_evidence_quality", "Classify attestation evidence quality
|
|
|
3908
4006
|
// ═══════════════════════════════════════
|
|
3909
4007
|
// Key Rotation — DID Document + Identity Continuity
|
|
3910
4008
|
// ═══════════════════════════════════════
|
|
3911
|
-
server.
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
}, async (args) => {
|
|
4009
|
+
server.registerTool("rotate_key", { description: "Rotate an agent's Ed25519 key. Planned mode: configurable overlap (default 24h). Emergency mode: immediate old-key retirement. Returns updated DID document, rotation state, and revocation results.", inputSchema: z.object({
|
|
4010
|
+
mode: z.enum(['planned', 'emergency']),
|
|
4011
|
+
old_private_key: z.string().describe("Hex-encoded private key being rotated FROM"),
|
|
4012
|
+
agent_name: z.string().optional().describe("Agent name for the passport (default: current session)"),
|
|
4013
|
+
activation_delay_hours: z.number().optional().describe("Planned mode overlap hours (default: 24)"),
|
|
4014
|
+
delegation_ids_to_revoke: z.array(z.string()).optional().describe("Delegation IDs to cascade-revoke during rotation"),
|
|
4015
|
+
}) }, async (args) => {
|
|
3918
4016
|
const { generateKeyPair } = await import("agent-passport-system");
|
|
3919
4017
|
const oldPublicKey = (await import("agent-passport-system")).publicKeyFromPrivate(args.old_private_key);
|
|
3920
4018
|
const newKeyPair = generateKeyPair();
|
|
@@ -3931,9 +4029,9 @@ server.tool("rotate_key", "Rotate an agent's Ed25519 key. Planned mode: configur
|
|
|
3931
4029
|
const result = rotateAndInvalidate(doc, args.old_private_key, newKeyPair, args.delegation_ids_to_revoke || [], { mode: args.mode, activationDelayMs: delayMs });
|
|
3932
4030
|
return { content: [{ type: "text", text: `🔑 Key Rotation (${args.mode})\n\nState: ${result.rotationState}\nOld key: ${oldPublicKey.slice(0, 16)}...\nNew key: ${newKeyPair.publicKey.slice(0, 16)}...\nNew private key: ${newKeyPair.privateKey}\nDID: ${result.didDocument.id}\nRotation log entries: ${result.didDocument.rotationLog.length}\nRevocations: ${result.revocationResults.length} (${result.revocationResults.filter(r => !r.error).length} succeeded)\n\nActivation time: ${result.didDocument.pendingRotation?.activationTime || 'immediate'}` }] };
|
|
3933
4031
|
});
|
|
3934
|
-
server.
|
|
3935
|
-
|
|
3936
|
-
}, async (args) => {
|
|
4032
|
+
server.registerTool("verify_rotation_chain", { description: "Verify all rotation signatures in a DID document's rotation log. Returns true if the full chain is cryptographically valid.", inputSchema: z.object({
|
|
4033
|
+
did_document: z.any().describe("RotatableDIDDocument JSON object with rotationLog"),
|
|
4034
|
+
}) }, async (args) => {
|
|
3937
4035
|
const doc = args.did_document;
|
|
3938
4036
|
if (!doc || !Array.isArray(doc.rotationLog)) {
|
|
3939
4037
|
return { content: [{ type: "text", text: `❌ Invalid DID document: missing rotationLog array` }] };
|
|
@@ -3941,10 +4039,10 @@ server.tool("verify_rotation_chain", "Verify all rotation signatures in a DID do
|
|
|
3941
4039
|
const valid = verifyRotationChain(doc);
|
|
3942
4040
|
return { content: [{ type: "text", text: `${valid ? '✅' : '❌'} Rotation chain valid: ${valid}\n\nEntries verified: ${doc.rotationLog.length}\nDID: ${doc.id || 'unknown'}` }] };
|
|
3943
4041
|
});
|
|
3944
|
-
server.
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
}, async (args) => {
|
|
4042
|
+
server.registerTool("is_key_active", { description: "Check if a public key is currently authorized for active operations in a DID document. SDK convenience check; gateway enforcement is authoritative.", inputSchema: z.object({
|
|
4043
|
+
did_document: z.any().describe("RotatableDIDDocument JSON object"),
|
|
4044
|
+
public_key: z.string().describe("Hex-encoded Ed25519 public key to check"),
|
|
4045
|
+
}) }, async (args) => {
|
|
3948
4046
|
const doc = args.did_document;
|
|
3949
4047
|
if (!doc || !Array.isArray(doc.verificationMethod)) {
|
|
3950
4048
|
return { content: [{ type: "text", text: `❌ Invalid DID document: missing verificationMethod` }] };
|
|
@@ -3957,17 +4055,17 @@ server.tool("is_key_active", "Check if a public key is currently authorized for
|
|
|
3957
4055
|
// HumanEscalationFlag. Representation, commitment, escalation boundaries.
|
|
3958
4056
|
// ═══════════════════════════════════════════════════════════════
|
|
3959
4057
|
// ── AttributionConsent (representation boundary) ────────────────
|
|
3960
|
-
server.
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
}, async (args) => {
|
|
4058
|
+
server.registerTool("aps_create_attribution_receipt", { description: "Representation boundary: build a citer-signed AttributionReceipt attributing a claim to a third-party principal. The receipt is not yet valid — the cited principal must sign consent via aps_sign_attribution_consent before checkArtifactCitations accepts it.", inputSchema: z.object({
|
|
4059
|
+
citer: z.string().describe("DID/public key of the citing agent"),
|
|
4060
|
+
citer_public_key: z.string().describe("Hex public key of citer"),
|
|
4061
|
+
citer_private_key: z.string().describe("Hex private key of citer"),
|
|
4062
|
+
cited_principal: z.string().describe("DID/public key of the cited principal"),
|
|
4063
|
+
cited_principal_public_key: z.string().describe("Hex public key of cited principal"),
|
|
4064
|
+
citation_content: z.string().describe("The quoted or paraphrased claim"),
|
|
4065
|
+
binding_context: z.string().describe("ID of the binding artifact this citation is scoped to"),
|
|
4066
|
+
gateway_id: z.string().optional().describe("Gateway id for timestamping (default: 'mcp')"),
|
|
4067
|
+
ttl_ms: z.number().optional().describe("Receipt TTL in ms (default: 24h)"),
|
|
4068
|
+
}) }, async (args) => {
|
|
3971
4069
|
try {
|
|
3972
4070
|
const gw = args.gateway_id ?? 'mcp';
|
|
3973
4071
|
const ttl = args.ttl_ms ?? 24 * 3600_000;
|
|
@@ -3991,10 +4089,10 @@ server.tool("aps_create_attribution_receipt", "Representation boundary: build a
|
|
|
3991
4089
|
return { content: [{ type: "text", text: safeError("createAttributionReceipt failed", e) }], isError: true };
|
|
3992
4090
|
}
|
|
3993
4091
|
});
|
|
3994
|
-
server.
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
}, async (args) => {
|
|
4092
|
+
server.registerTool("aps_sign_attribution_consent", { description: "Representation boundary: the cited principal adds their consent signature to an AttributionReceipt. Without this signature, verifyAttributionConsent and checkArtifactCitations reject the receipt.", inputSchema: z.object({
|
|
4093
|
+
receipt: z.any().describe("AttributionReceipt JSON from aps_create_attribution_receipt"),
|
|
4094
|
+
cited_principal_private_key: z.string().describe("Hex private key of cited principal"),
|
|
4095
|
+
}) }, async (args) => {
|
|
3998
4096
|
try {
|
|
3999
4097
|
const signed = signAttributionConsent(args.receipt, args.cited_principal_private_key);
|
|
4000
4098
|
return { content: [{ type: "text", text: JSON.stringify(signed, null, 2) }] };
|
|
@@ -4003,41 +4101,41 @@ server.tool("aps_sign_attribution_consent", "Representation boundary: the cited
|
|
|
4003
4101
|
return { content: [{ type: "text", text: safeError("signAttributionConsent failed", e) }], isError: true };
|
|
4004
4102
|
}
|
|
4005
4103
|
});
|
|
4006
|
-
server.
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
}, async (args) => {
|
|
4104
|
+
server.registerTool("aps_verify_attribution_consent", { description: "Representation boundary: verify an AttributionReceipt end-to-end (id, citer signature, consent signature, expiry). Returns {valid, reason?}.", inputSchema: z.object({
|
|
4105
|
+
receipt: z.any().describe("AttributionReceipt JSON"),
|
|
4106
|
+
now: z.any().optional().describe("Optional HybridTimestamp to pin the evaluation moment"),
|
|
4107
|
+
}) }, async (args) => {
|
|
4010
4108
|
const result = verifyAttributionConsent(args.receipt, args.now);
|
|
4011
4109
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
4012
4110
|
});
|
|
4013
|
-
server.
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
}, async (args) => {
|
|
4111
|
+
server.registerTool("aps_check_artifact_citations", { description: "Representation boundary: gate a binding artifact's citations. Each citation must resolve to a provided, signed, unexpired receipt whose content + principal match, with per-artifact replay protection.", inputSchema: z.object({
|
|
4112
|
+
artifact: z.any().describe("CitingArtifact with optional citations[] array"),
|
|
4113
|
+
receipts: z.array(z.any()).describe("AttributionReceipts backing each citation"),
|
|
4114
|
+
binding_context: z.string().optional().describe("Require receipts to be scoped to this binding context"),
|
|
4115
|
+
}) }, async (args) => {
|
|
4018
4116
|
const opts = {};
|
|
4019
4117
|
if (args.binding_context)
|
|
4020
4118
|
opts.binding_context = args.binding_context;
|
|
4021
4119
|
const result = checkArtifactCitations(args.artifact, args.receipts, opts);
|
|
4022
4120
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
4023
4121
|
});
|
|
4024
|
-
server.
|
|
4025
|
-
|
|
4026
|
-
}, async (args) => {
|
|
4122
|
+
server.registerTool("aps_attribution_receipt_id", { description: "Representation boundary helper: compute the canonical sha256 id of an AttributionReceipt's unsigned core. Verifiers use this to detect id tampering.", inputSchema: z.object({
|
|
4123
|
+
receipt: z.any().describe("AttributionReceipt JSON (signatures ignored)"),
|
|
4124
|
+
}) }, async (args) => {
|
|
4027
4125
|
const { createHash } = await import('crypto');
|
|
4028
4126
|
const core = receiptCore(args.receipt);
|
|
4029
4127
|
const id = createHash('sha256').update(core).digest('hex');
|
|
4030
4128
|
return { content: [{ type: "text", text: JSON.stringify({ id, core_bytes: core.length }, null, 2) }] };
|
|
4031
4129
|
});
|
|
4032
4130
|
// ── ProvisionalStatement (commitment boundary) ──────────────────
|
|
4033
|
-
server.
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
}, async (args) => {
|
|
4131
|
+
server.registerTool("aps_create_provisional", { description: "Commitment boundary: emit a provisional statement for agent-to-agent negotiation. Default is non-binding until a PromotionEvent satisfies a PromotionPolicy. Dead-man expiry auto-withdraws.", inputSchema: z.object({
|
|
4132
|
+
author: z.string().describe("AgentDID/public key of the emitting agent"),
|
|
4133
|
+
author_principal: z.string().describe("PrincipalDID behind the author"),
|
|
4134
|
+
content: z.string().describe("Statement content (offer, position, claim)"),
|
|
4135
|
+
author_private_key: z.string().describe("Hex private key of author for signing"),
|
|
4136
|
+
gateway_id: z.string().optional().describe("Gateway id for timestamping (default: 'mcp')"),
|
|
4137
|
+
dead_man_ms: z.number().optional().describe("Dead-man expiry relative to now (ms). If elapsed without promotion/withdrawal, statement auto-withdraws."),
|
|
4138
|
+
}) }, async (args) => {
|
|
4041
4139
|
try {
|
|
4042
4140
|
const gw = args.gateway_id ?? 'mcp';
|
|
4043
4141
|
let dead_man_expires_at;
|
|
@@ -4061,11 +4159,11 @@ server.tool("aps_create_provisional", "Commitment boundary: emit a provisional s
|
|
|
4061
4159
|
return { content: [{ type: "text", text: safeError("createProvisional failed", e) }], isError: true };
|
|
4062
4160
|
}
|
|
4063
4161
|
});
|
|
4064
|
-
server.
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
}, async (args) => {
|
|
4162
|
+
server.registerTool("aps_promote_statement", { description: "Commitment boundary: promote a provisional statement to binding by attaching a PromotionEvent that satisfies the PromotionPolicy (m-of-n principal signatures). dead_man_elapsed cannot promote — it auto-withdraws via the dead-man path.", inputSchema: z.object({
|
|
4163
|
+
statement: z.any().describe("ProvisionalStatement from aps_create_provisional"),
|
|
4164
|
+
promotion_event: z.any().describe("PromotionEvent with kind, promoted_at, promoter, promoter_signature, policy_reference"),
|
|
4165
|
+
policy: z.any().describe("PromotionPolicy {id, required_signers, threshold, max_time_to_promote}"),
|
|
4166
|
+
}) }, async (args) => {
|
|
4069
4167
|
try {
|
|
4070
4168
|
const promoted = promoteStatement(args.statement, args.promotion_event, args.policy);
|
|
4071
4169
|
return { content: [{ type: "text", text: JSON.stringify({ promoted, is_binding: isBinding(promoted) }, null, 2) }] };
|
|
@@ -4074,18 +4172,18 @@ server.tool("aps_promote_statement", "Commitment boundary: promote a provisional
|
|
|
4074
4172
|
return { content: [{ type: "text", text: safeError("promoteStatement failed", e) }], isError: true };
|
|
4075
4173
|
}
|
|
4076
4174
|
});
|
|
4077
|
-
server.
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
}, async (args) => {
|
|
4175
|
+
server.registerTool("aps_verify_promotion", { description: "Commitment boundary: verify that a promoted statement's PromotionEvent cryptographically satisfies the PromotionPolicy (policy_reference match, promoter in required_signers, threshold, signature, max_time_to_promote, author-signature tamper check).", inputSchema: z.object({
|
|
4176
|
+
statement: z.any().describe("Promoted ProvisionalStatement"),
|
|
4177
|
+
policy: z.any().describe("PromotionPolicy to check against"),
|
|
4178
|
+
}) }, async (args) => {
|
|
4081
4179
|
const result = verifyPromotion(args.statement, args.policy);
|
|
4082
4180
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
4083
4181
|
});
|
|
4084
|
-
server.
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
}, async (args) => {
|
|
4182
|
+
server.registerTool("aps_withdraw_provisional", { description: "Commitment boundary: author withdraws their own provisional statement. Already-promoted statements cannot be withdrawn. Caller must supply the author's signature over the withdrawal payload (canonicalize({action:'withdraw', statement_id})).", inputSchema: z.object({
|
|
4183
|
+
statement: z.any().describe("ProvisionalStatement to withdraw"),
|
|
4184
|
+
author_signature: z.string().optional().describe("Hex Ed25519 signature. If omitted, provide author_private_key and the tool will sign for you."),
|
|
4185
|
+
author_private_key: z.string().optional().describe("If provided, tool signs the withdrawal payload with this key."),
|
|
4186
|
+
}) }, async (args) => {
|
|
4089
4187
|
try {
|
|
4090
4188
|
let sig = args.author_signature;
|
|
4091
4189
|
if (!sig) {
|
|
@@ -4103,12 +4201,12 @@ server.tool("aps_withdraw_provisional", "Commitment boundary: author withdraws t
|
|
|
4103
4201
|
}
|
|
4104
4202
|
});
|
|
4105
4203
|
// ── HumanEscalationFlag (escalation boundary) ───────────────────
|
|
4106
|
-
server.
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
}, async (args) => {
|
|
4204
|
+
server.registerTool("aps_check_escalation_required", { description: "Escalation boundary: check whether an action on a v2 delegation requires owner confirmation before execution. Returns {required, requirement?, reason?}. Use aps_record_owner_confirmation to clear the flag when required.", inputSchema: z.object({
|
|
4205
|
+
delegation: z.any().describe("V2Delegation with optional scope.escalation_requirements"),
|
|
4206
|
+
action_class: z.string().describe("Action class (e.g. 'org_creation', 'spend_above_threshold')"),
|
|
4207
|
+
action_details: z.any().optional().describe("Structured details; hashed for audit"),
|
|
4208
|
+
session_id: z.string().optional().describe("Session id (required for per_session scope)"),
|
|
4209
|
+
}) }, async (args) => {
|
|
4112
4210
|
const check = checkEscalationRequired(args.delegation, {
|
|
4113
4211
|
action_class: args.action_class,
|
|
4114
4212
|
action_details: args.action_details ?? {},
|
|
@@ -4116,13 +4214,13 @@ server.tool("aps_check_escalation_required", "Escalation boundary: check whether
|
|
|
4116
4214
|
});
|
|
4117
4215
|
return { content: [{ type: "text", text: JSON.stringify(check, null, 2) }] };
|
|
4118
4216
|
});
|
|
4119
|
-
server.
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
}, async (args) => {
|
|
4217
|
+
server.registerTool("aps_record_owner_confirmation", { description: "Escalation boundary: owner signs an OwnerConfirmation authorizing a flagged action. Builds the ConfirmationRequest and signs it in a single call. The confirmation is bound to action_details via hash and scoped (per_action / per_session / time_window).", inputSchema: z.object({
|
|
4218
|
+
delegation: z.any().describe("V2Delegation with escalation_requirements for this action class"),
|
|
4219
|
+
action_class: z.string().describe("Action class being confirmed"),
|
|
4220
|
+
action_details: z.any().describe("Structured action details — hashed and bound to the confirmation"),
|
|
4221
|
+
session_id: z.string().optional().describe("Session id (required for per_session scope)"),
|
|
4222
|
+
owner_private_key: z.string().describe("Hex private key of the delegation's owner (delegator)"),
|
|
4223
|
+
}) }, async (args) => {
|
|
4126
4224
|
try {
|
|
4127
4225
|
const request = requestOwnerConfirmation(args.delegation, {
|
|
4128
4226
|
action_class: args.action_class,
|
|
@@ -4145,23 +4243,23 @@ server.tool("aps_record_owner_confirmation", "Escalation boundary: owner signs a
|
|
|
4145
4243
|
// Spec: ATTRIBUTION-PRIMITIVE-v1.1.md. One signed object per action with
|
|
4146
4244
|
// four axis projections (D, P, G, C) that verify independently.
|
|
4147
4245
|
// ═══════════════════════════════════════
|
|
4148
|
-
server.
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
}, async (args) => {
|
|
4246
|
+
server.registerTool("aps_construct_attribution_primitive", { description: "Build and sign a four-axis AttributionPrimitive for an action. Axes: D (data sources), P (protocol modules), G (delegation chain), C (compute providers). Returns the complete signed object.", inputSchema: z.object({
|
|
4247
|
+
action: z.object({
|
|
4248
|
+
agentId: z.string(),
|
|
4249
|
+
actionType: z.string(),
|
|
4250
|
+
params: z.record(z.string(), z.any()),
|
|
4251
|
+
nonce: z.string(),
|
|
4252
|
+
}).describe("Action identity tuple; the action_ref is derived as sha256(canonical(this))"),
|
|
4253
|
+
axes: z.object({
|
|
4254
|
+
D: z.array(z.any()),
|
|
4255
|
+
P: z.array(z.any()),
|
|
4256
|
+
G: z.array(z.any()),
|
|
4257
|
+
C: z.array(z.any()),
|
|
4258
|
+
}).describe("Four-axis content. See spec §1.2 for entry shapes per axis."),
|
|
4259
|
+
issuer: z.string().describe("Issuer DID (gateway or agent producing the receipt)"),
|
|
4260
|
+
issuer_private_key: z.string().describe("Ed25519 private key hex that signs the envelope"),
|
|
4261
|
+
timestamp: z.string().optional().describe("ISO-8601 UTC with ms precision + Z (§2.5). Defaults to now()."),
|
|
4262
|
+
}) }, async (args) => {
|
|
4165
4263
|
try {
|
|
4166
4264
|
const primitive = constructAttributionPrimitive({
|
|
4167
4265
|
action: args.action,
|
|
@@ -4176,10 +4274,10 @@ server.tool("aps_construct_attribution_primitive", "Build and sign a four-axis A
|
|
|
4176
4274
|
return { content: [{ type: "text", text: safeError("constructAttributionPrimitive failed", e) }], isError: true };
|
|
4177
4275
|
}
|
|
4178
4276
|
});
|
|
4179
|
-
server.
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
}, async (args) => {
|
|
4277
|
+
server.registerTool("aps_project_attribution", { description: "Extract a single-axis projection from an AttributionPrimitive. The projection carries the axis content plus a two-hop Merkle path that lets a downstream verifier reconstruct the signed root without seeing the other three axes. axis: 'D' | 'P' | 'G' | 'C'.", inputSchema: z.object({
|
|
4278
|
+
primitive: z.any().describe("An AttributionPrimitive (from aps_construct_attribution_primitive)"),
|
|
4279
|
+
axis: z.enum(["D", "P", "G", "C"]).describe("Axis to project"),
|
|
4280
|
+
}) }, async (args) => {
|
|
4183
4281
|
try {
|
|
4184
4282
|
const projection = projectAttribution(args.primitive, args.axis);
|
|
4185
4283
|
return { content: [{ type: "text", text: JSON.stringify(projection, null, 2) }] };
|
|
@@ -4188,10 +4286,10 @@ server.tool("aps_project_attribution", "Extract a single-axis projection from an
|
|
|
4188
4286
|
return { content: [{ type: "text", text: safeError("projectAttribution failed", e) }], isError: true };
|
|
4189
4287
|
}
|
|
4190
4288
|
});
|
|
4191
|
-
server.
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
}, async (args) => {
|
|
4289
|
+
server.registerTool("aps_verify_attribution_projection", { description: "Verify a single-axis AttributionProjection under the issuer's Ed25519 public key. Returns {valid: true} or {valid: false, reason: 'INVALID_AXIS_TAG'|'MERKLE_MISMATCH'|'SIGNATURE_INVALID'|'MALFORMED'}. Verification is purely local — no other axes required.", inputSchema: z.object({
|
|
4290
|
+
projection: z.any().describe("An AttributionProjection (from aps_project_attribution)"),
|
|
4291
|
+
issuer_public_key: z.string().describe("Issuer Ed25519 public key hex"),
|
|
4292
|
+
}) }, async (args) => {
|
|
4195
4293
|
try {
|
|
4196
4294
|
const result = verifyAttributionProjection(args.projection, args.issuer_public_key);
|
|
4197
4295
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
@@ -4200,10 +4298,10 @@ server.tool("aps_verify_attribution_projection", "Verify a single-axis Attributi
|
|
|
4200
4298
|
return { content: [{ type: "text", text: safeError("verifyAttributionProjection failed", e) }], isError: true };
|
|
4201
4299
|
}
|
|
4202
4300
|
});
|
|
4203
|
-
server.
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
}, async (args) => {
|
|
4301
|
+
server.registerTool("aps_verify_attribution_primitive", { description: "End-to-end verify of a full AttributionPrimitive: constructs projections for all four axes and verifies each one. Useful as a post-construction sanity check or for verifying a primitive received from a peer.", inputSchema: z.object({
|
|
4302
|
+
primitive: z.any().describe("An AttributionPrimitive"),
|
|
4303
|
+
issuer_public_key: z.string().describe("Issuer Ed25519 public key hex"),
|
|
4304
|
+
}) }, async (args) => {
|
|
4207
4305
|
try {
|
|
4208
4306
|
const result = verifyAttributionPrimitive(args.primitive, args.issuer_public_key);
|
|
4209
4307
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
@@ -4212,10 +4310,10 @@ server.tool("aps_verify_attribution_primitive", "End-to-end verify of a full Att
|
|
|
4212
4310
|
return { content: [{ type: "text", text: safeError("verifyAttributionPrimitive failed", e) }], isError: true };
|
|
4213
4311
|
}
|
|
4214
4312
|
});
|
|
4215
|
-
server.
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
}, async (args) => {
|
|
4313
|
+
server.registerTool("aps_check_projection_consistency", { description: "Cross-projection consistency check (§2.4): given two projections, confirm they originate from the same signed receipt. Returns {same_receipt: true} or {same_receipt: false, reason: 'DIFFERENT_ACTIONS'|'DIFFERENT_RECEIPTS'|'DIFFERENT_SIGNATURES'|'METADATA_MISMATCH'}.", inputSchema: z.object({
|
|
4314
|
+
projection_a: z.any().describe("First AttributionProjection"),
|
|
4315
|
+
projection_b: z.any().describe("Second AttributionProjection"),
|
|
4316
|
+
}) }, async (args) => {
|
|
4219
4317
|
try {
|
|
4220
4318
|
const result = checkProjectionConsistency(args.projection_a, args.projection_b);
|
|
4221
4319
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
@@ -4224,12 +4322,12 @@ server.tool("aps_check_projection_consistency", "Cross-projection consistency ch
|
|
|
4224
4322
|
return { content: [{ type: "text", text: safeError("checkProjectionConsistency failed", e) }], isError: true };
|
|
4225
4323
|
}
|
|
4226
4324
|
});
|
|
4227
|
-
server.
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
}, async (args) => {
|
|
4325
|
+
server.registerTool("aps_compute_attribution_action_ref", { description: "Derive the action_ref (hex sha256) for an action tuple. action_ref is the content-addressed anchor that all four axis projections bind to. Useful for indexing primitives by action without constructing the full primitive.", inputSchema: z.object({
|
|
4326
|
+
agentId: z.string(),
|
|
4327
|
+
actionType: z.string(),
|
|
4328
|
+
params: z.record(z.string(), z.any()),
|
|
4329
|
+
nonce: z.string(),
|
|
4330
|
+
}) }, async (args) => {
|
|
4233
4331
|
try {
|
|
4234
4332
|
const action_ref = computeAttributionActionRef({
|
|
4235
4333
|
agentId: args.agentId,
|
|
@@ -4249,19 +4347,19 @@ server.tool("aps_compute_attribution_action_ref", "Derive the action_ref (hex sh
|
|
|
4249
4347
|
// compute canonical D/C axis weights from raw per-source / per-provider records,
|
|
4250
4348
|
// then hand the resulting axis entries to aps_construct_attribution_primitive.
|
|
4251
4349
|
// ═══════════════════════════════════════
|
|
4252
|
-
server.
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
}, async (args) => {
|
|
4350
|
+
server.registerTool("aps_compute_data_axis_weights", { description: "Compute the D-axis fractional weight vector from a list of AccessReceipt records with role, timestamp, and content length. Returns canonical DataAxisEntry[] with 6-digit decimal contribution_weight strings that sum to ~1.0 and feed directly into aps_construct_attribution_primitive. Empty input → empty array; all-zero raw weights → error. Weights = role × recency_decay × length_weight, normalized per spec BUILD-B §'The D-axis formula'. Parameter names match the SDK: `sources`, `action_timestamp`, optional `profile`.", inputSchema: z.object({
|
|
4351
|
+
sources: z.array(z.object({
|
|
4352
|
+
source_did: z.string(),
|
|
4353
|
+
access_receipt_hash: z.string(),
|
|
4354
|
+
role: z.enum([
|
|
4355
|
+
'primary_source', 'supporting_evidence', 'context_only', 'background_retrieval',
|
|
4356
|
+
]),
|
|
4357
|
+
timestamp: z.string().describe("ISO-8601 UTC with millisecond precision + Z (t_source)"),
|
|
4358
|
+
content_length: z.number().nonnegative().describe("Tokens"),
|
|
4359
|
+
})).describe("Per-source records with retrieval metadata"),
|
|
4360
|
+
action_timestamp: z.string().describe("ISO-8601 UTC ms when the action ran (t_action)"),
|
|
4361
|
+
profile: z.any().optional().describe("Optional WeightProfile override; defaults to DEFAULT_WEIGHT_PROFILE"),
|
|
4362
|
+
}) }, async (args) => {
|
|
4265
4363
|
try {
|
|
4266
4364
|
const entries = computeDataAxisWeights(args.sources, {
|
|
4267
4365
|
action_timestamp: args.action_timestamp,
|
|
@@ -4273,15 +4371,15 @@ server.tool("aps_compute_data_axis_weights", "Compute the D-axis fractional weig
|
|
|
4273
4371
|
return { content: [{ type: "text", text: safeError("computeDataAxisWeights failed", e) }], isError: true };
|
|
4274
4372
|
}
|
|
4275
4373
|
});
|
|
4276
|
-
server.
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
}, async (args) => {
|
|
4374
|
+
server.registerTool("aps_compute_compute_axis_weights", { description: "Compute the C-axis fractional weight vector from a list of inference billing records (prompt_tokens, completion_tokens). Returns canonical ComputeAxisEntry[] with 6-digit decimal compute_share strings that sum to ~1.0 and feed directly into aps_construct_attribution_primitive. Weights = prompt_tokens + completion_tokens × COMPLETION_MULTIPLIER (default 3.0), normalized per spec BUILD-B §'The C-axis formula'. Parameter names match the SDK: `providers`, optional `profile`.", inputSchema: z.object({
|
|
4375
|
+
providers: z.array(z.object({
|
|
4376
|
+
provider_did: z.string(),
|
|
4377
|
+
hardware_attestation_hash: z.string(),
|
|
4378
|
+
prompt_tokens: z.number().nonnegative(),
|
|
4379
|
+
completion_tokens: z.number().nonnegative(),
|
|
4380
|
+
})).describe("Per-provider billing records"),
|
|
4381
|
+
profile: z.any().optional().describe("Optional WeightProfile override; defaults to DEFAULT_WEIGHT_PROFILE"),
|
|
4382
|
+
}) }, async (args) => {
|
|
4285
4383
|
try {
|
|
4286
4384
|
const entries = computeComputeAxisWeights(args.providers, { profile: args.profile });
|
|
4287
4385
|
return { content: [{ type: "text", text: JSON.stringify(entries, null, 2) }] };
|
|
@@ -4306,13 +4404,13 @@ const SettlementPeriodSchema = z.object({
|
|
|
4306
4404
|
t1: z.string().describe("Period end (canonical ISO-8601 UTC ms + Z). Exclusive."),
|
|
4307
4405
|
period_id: z.string().describe("Gateway-scoped period identifier"),
|
|
4308
4406
|
});
|
|
4309
|
-
server.
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
}, async (args) => {
|
|
4407
|
+
server.registerTool("aps_aggregate_settlement", { description: "Aggregate a batch of Attribution Primitives over a half-open settlement period [t0, t1) into a signed SettlementRecord. Each axis (D, P, G, C) produces a per-contributor total with a balanced-Merkle commitment. Residual buckets pool sub-threshold contributors per Build A §4.1. Output is a fully signed record ready for third-party verification. Spec: BUILD-C-SETTLEMENT-PIPELINE.md.", inputSchema: z.object({
|
|
4408
|
+
receipts: z.array(z.any()).describe("Array of AttributionPrimitives to aggregate"),
|
|
4409
|
+
period: SettlementPeriodSchema,
|
|
4410
|
+
gateway_did: z.string().describe("Gateway DID that signs the record"),
|
|
4411
|
+
gateway_private_key: z.string().describe("Ed25519 gateway private key (hex)"),
|
|
4412
|
+
issued_at: z.string().optional().describe("Override issued_at (canonical ISO-8601 UTC ms + Z); defaults to now"),
|
|
4413
|
+
}) }, async (args) => {
|
|
4316
4414
|
try {
|
|
4317
4415
|
const unsigned = aggregateAttributionPrimitives(args.receipts, args.period, {
|
|
4318
4416
|
gateway_did: args.gateway_did,
|
|
@@ -4326,11 +4424,11 @@ server.tool("aps_aggregate_settlement", "Aggregate a batch of Attribution Primit
|
|
|
4326
4424
|
return { content: [{ type: "text", text: safeError("aggregateSettlement failed", e) }], isError: true };
|
|
4327
4425
|
}
|
|
4328
4426
|
});
|
|
4329
|
-
server.
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
}, async (args) => {
|
|
4427
|
+
server.registerTool("aps_verify_settlement", { description: "Verify a signed SettlementRecord under S1-S5 (signature, Merkle roots, conservation, residual shape, optional input-receipts cross-check). S3 conservation is the strongest invariant: a gateway cannot inflate or suppress any contributor's share without breaking it. Returns {valid: true} or {valid: false, reason, detail}. Pass inputReceipts to also recompute input_receipts_hash.", inputSchema: z.object({
|
|
4428
|
+
record: z.any().describe("A signed SettlementRecord"),
|
|
4429
|
+
gateway_public_key: z.string().describe("Gateway Ed25519 public key hex"),
|
|
4430
|
+
input_receipts: z.array(z.any()).optional().describe("Optional — the input Attribution Primitives that fed the settlement. When supplied, S5 cross-checks input_receipts_hash and verifies each receipt individually."),
|
|
4431
|
+
}) }, async (args) => {
|
|
4334
4432
|
try {
|
|
4335
4433
|
const result = verifySettlementRecord(args.record, {
|
|
4336
4434
|
gatewayPublicKeyHex: args.gateway_public_key,
|
|
@@ -4342,11 +4440,11 @@ server.tool("aps_verify_settlement", "Verify a signed SettlementRecord under S1-
|
|
|
4342
4440
|
return { content: [{ type: "text", text: safeError("verifySettlement failed", e) }], isError: true };
|
|
4343
4441
|
}
|
|
4344
4442
|
});
|
|
4345
|
-
server.
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
}, async (args) => {
|
|
4443
|
+
server.registerTool("aps_build_contributor_query", { description: "Build a contributor-query response: given a signed SettlementRecord and a contributor DID, return per-axis (total_weight, contribution_count, merkle_path, axis_root) plus the full signed record so a third party can verify the contributor's share end-to-end without trusting the gateway beyond its public key. Returns null if the contributor has no share in the period.", inputSchema: z.object({
|
|
4444
|
+
record: z.any().describe("A signed SettlementRecord"),
|
|
4445
|
+
contributor_did: z.string().describe("Contributor DID (data source, compute provider, governance signer, or protocol module identifier)"),
|
|
4446
|
+
gateway_jwks: z.string().optional().describe("Advisory JWKS URL; not part of the signed material"),
|
|
4447
|
+
}) }, async (args) => {
|
|
4350
4448
|
try {
|
|
4351
4449
|
const response = buildContributorQueryResponse(args.record, args.contributor_did, {
|
|
4352
4450
|
gateway_jwks: args.gateway_jwks,
|
|
@@ -4362,21 +4460,21 @@ server.tool("aps_build_contributor_query", "Build a contributor-query response:
|
|
|
4362
4460
|
// ═══════════════════════════════════════
|
|
4363
4461
|
// Mutual Authentication v1 tools (SDK v2.2.0)
|
|
4364
4462
|
// ═══════════════════════════════════════
|
|
4365
|
-
server.
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
}, async (args) => {
|
|
4463
|
+
server.registerTool("mutualAuthBuildCertificate", { description: "Build and sign a mutual-auth certificate identifying an agent or information system. Returns the signed MutualAuthCertificate object ready to carry into a handshake. The issuer's Ed25519 private key (hex) signs over the canonical (JCS) form.", inputSchema: z.object({
|
|
4464
|
+
role: z.enum(["agent", "information_system"]).describe("Role of the subject this cert identifies"),
|
|
4465
|
+
subject_id: z.string().describe("Stable subject identifier (e.g., agent DID, IS endpoint URL)"),
|
|
4466
|
+
subject_pubkey_hex: z.string().describe("Ed25519 public key (hex) of the subject"),
|
|
4467
|
+
issuer_id: z.string().describe("Issuer identifier"),
|
|
4468
|
+
issuer_role: z.enum(["agent", "information_system", "trust_anchor"]).describe("Role of the issuer"),
|
|
4469
|
+
issuer_pubkey_hex: z.string().describe("Ed25519 public key (hex) of the issuer"),
|
|
4470
|
+
issuer_privkey_hex: z.string().describe("Ed25519 private key (hex) of the issuer — used to sign"),
|
|
4471
|
+
binding: z.string().describe("For an agent: the APS agent_id. For an IS: the resource domain (e.g., mcp://api.bank.com)"),
|
|
4472
|
+
not_before: z.number().describe("Earliest valid time (unix ms)"),
|
|
4473
|
+
not_after: z.number().describe("Latest valid time (unix ms)"),
|
|
4474
|
+
supported_versions: z.array(z.string()).describe("Protocol versions supported, highest first (e.g., ['1.0'])"),
|
|
4475
|
+
attestation_grade: z.union([z.literal(0), z.literal(1), z.literal(2), z.literal(3)]).optional().describe("For agents: APS attestation grade 0-3"),
|
|
4476
|
+
capabilities: z.array(z.string()).optional().describe("Optional capability tags"),
|
|
4477
|
+
}) }, async (args) => {
|
|
4380
4478
|
try {
|
|
4381
4479
|
const unsigned = buildCertificate({
|
|
4382
4480
|
role: args.role,
|
|
@@ -4403,15 +4501,15 @@ server.tool("mutualAuthBuildCertificate", "Build and sign a mutual-auth certific
|
|
|
4403
4501
|
return { content: [{ type: "text", text: safeError("mutualAuthBuildCertificate failed", e) }], isError: true };
|
|
4404
4502
|
}
|
|
4405
4503
|
});
|
|
4406
|
-
server.
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
}, async (args) => {
|
|
4504
|
+
server.registerTool("mutualAuthVerifyAttest", { description: "Verify a MutualAuthAttest against policy and trust anchors. Runs all 10 verification checks: signature, version negotiation, nonce match, timestamp freshness, certificate validity, issuer anchor check, binding constraints, downgrade detection, attestation grade policy, capability policy. Returns ok:true on success or a failure reason on rejection.", inputSchema: z.object({
|
|
4505
|
+
attest: z.any().describe("MutualAuthAttest to verify"),
|
|
4506
|
+
expected_peer_nonce_b64: z.string().describe("The nonce the peer sent in their prior hello or attest"),
|
|
4507
|
+
expected_own_nonce_b64: z.string().describe("The nonce we sent in our own prior hello or attest"),
|
|
4508
|
+
policy: z.any().describe("MutualAuthPolicy (accepted_versions, min_agent_grade, required_capabilities, max_clock_skew_ms, max_session_ms)"),
|
|
4509
|
+
trust_anchors: z.array(z.any()).describe("TrustAnchor[] — local trusted roots"),
|
|
4510
|
+
revoked_anchor_ids: z.array(z.string()).optional().describe("IDs of anchors revoked since the bundle was issued"),
|
|
4511
|
+
now_ms: z.number().optional().describe("Current unix ms — defaults to Date.now()"),
|
|
4512
|
+
}) }, async (args) => {
|
|
4415
4513
|
try {
|
|
4416
4514
|
const res = verifyAttest({
|
|
4417
4515
|
attest: args.attest,
|
|
@@ -4430,12 +4528,12 @@ server.tool("mutualAuthVerifyAttest", "Verify a MutualAuthAttest against policy
|
|
|
4430
4528
|
return { content: [{ type: "text", text: safeError("mutualAuthVerifyAttest failed", e) }], isError: true };
|
|
4431
4529
|
}
|
|
4432
4530
|
});
|
|
4433
|
-
server.
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
}, async (args) => {
|
|
4531
|
+
server.registerTool("mutualAuthDeriveSession", { description: "Derive the shared mutual-auth session record from both sides' Attests. Both parties MUST compute identical session_id given identical inputs (canonical JCS + sha256 of chosen_version, both cert ids, both nonces). Returns a MutualAuthSession with session_id + both certificates + expiry bounds, or failure reason.", inputSchema: z.object({
|
|
4532
|
+
agent_attest: z.any().describe("The agent's MutualAuthAttest"),
|
|
4533
|
+
is_attest: z.any().describe("The information system's MutualAuthAttest"),
|
|
4534
|
+
policy: z.any().describe("MutualAuthPolicy"),
|
|
4535
|
+
now_ms: z.number().optional().describe("Current unix ms — defaults to Date.now()"),
|
|
4536
|
+
}) }, async (args) => {
|
|
4439
4537
|
try {
|
|
4440
4538
|
const res = deriveSession(args.agent_attest, args.is_attest, args.policy, args.now_ms ?? Date.now());
|
|
4441
4539
|
return {
|
|
@@ -4446,11 +4544,11 @@ server.tool("mutualAuthDeriveSession", "Derive the shared mutual-auth session re
|
|
|
4446
4544
|
return { content: [{ type: "text", text: safeError("mutualAuthDeriveSession failed", e) }], isError: true };
|
|
4447
4545
|
}
|
|
4448
4546
|
});
|
|
4449
|
-
server.
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
}, async (args) => {
|
|
4547
|
+
server.registerTool("mutualAuthVerifyTrustBundle", { description: "Verify a TrustAnchorBundle signature and freshness. Caller supplies the list of trusted publisher public keys (root configuration). Returns ok:true on success or failure reason (untrusted_publisher, signature_invalid, bundle_expired, not_yet_valid).", inputSchema: z.object({
|
|
4548
|
+
bundle: z.any().describe("TrustAnchorBundle to verify"),
|
|
4549
|
+
trusted_publisher_pubkeys_hex: z.array(z.string()).describe("List of Ed25519 pubkeys (hex) authorized to publish bundles"),
|
|
4550
|
+
now_ms: z.number().optional().describe("Current unix ms — defaults to Date.now()"),
|
|
4551
|
+
}) }, async (args) => {
|
|
4454
4552
|
try {
|
|
4455
4553
|
const res = verifyBundle(args.bundle, args.trusted_publisher_pubkeys_hex, args.now_ms ?? Date.now());
|
|
4456
4554
|
return {
|
|
@@ -4471,23 +4569,23 @@ server.tool("mutualAuthVerifyTrustBundle", "Verify a TrustAnchorBundle signature
|
|
|
4471
4569
|
// expose the four protocol roles (sink, subject, gateway) so any caller
|
|
4472
4570
|
// can drive the cycle end-to-end against this single process.
|
|
4473
4571
|
// ═══════════════════════════════════════════════════════════════
|
|
4474
|
-
server.
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
}, async (args) => {
|
|
4572
|
+
server.registerTool("aps_capability_issue_challenge", { description: "v0.1 capability-token sink challenge (M1). Sink issues a signed canonical action statement. Returns the SinkChallenge and its challenge_hash. Used to bind the gateway's later policy evaluation to a specific action the sink authored. Search keywords: capability token, sink challenge, M1.", inputSchema: z.object({
|
|
4573
|
+
sink_id: z.string().describe("DID of the sink issuing the challenge"),
|
|
4574
|
+
subject_id: z.string().describe("DID of the subject the challenge is addressed to"),
|
|
4575
|
+
action: z.object({
|
|
4576
|
+
kind: z.string(),
|
|
4577
|
+
target: z.string(),
|
|
4578
|
+
parameters: z.record(z.string(), z.any()),
|
|
4579
|
+
resource_version: z.string(),
|
|
4580
|
+
}).describe("Canonical action statement"),
|
|
4581
|
+
sink_private_key: z.string().describe("Sink Ed25519 private key (hex)"),
|
|
4582
|
+
sink_public_key: z.string().describe("Sink Ed25519 public key (hex)"),
|
|
4583
|
+
validity_seconds: z.number().int().positive().optional(),
|
|
4584
|
+
required_policy_freshness: z.object({
|
|
4585
|
+
max_age_seconds: z.number().int().nonnegative(),
|
|
4586
|
+
beacon_hash_required: z.boolean(),
|
|
4587
|
+
}).optional(),
|
|
4588
|
+
}) }, async (args) => {
|
|
4491
4589
|
try {
|
|
4492
4590
|
const sinkKey = {
|
|
4493
4591
|
publicKey: args.sink_public_key,
|
|
@@ -4513,23 +4611,23 @@ server.tool("aps_capability_issue_challenge", "v0.1 capability-token sink challe
|
|
|
4513
4611
|
return { content: [{ type: "text", text: safeError("aps_capability_issue_challenge failed", e) }], isError: true };
|
|
4514
4612
|
}
|
|
4515
4613
|
});
|
|
4516
|
-
server.
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
}, async (args) => {
|
|
4614
|
+
server.registerTool("aps_capability_evaluate_authority", { description: "v0.1 capability-token authority evaluation request (M2). Subject signs a request carrying the sink's M1, the delegation chain, and a revealed authority-token preimage. The gateway consumes this to decide permit/deny. Search keywords: capability token, authority evaluation, M2.", inputSchema: z.object({
|
|
4615
|
+
challenge: z.any().describe("SinkChallenge object from M1"),
|
|
4616
|
+
delegation_chain: z.array(z.any()).describe("v2.x delegation envelopes"),
|
|
4617
|
+
authority_token: z.object({
|
|
4618
|
+
token_preimage: z.string(),
|
|
4619
|
+
merkle_proof: z.array(z.string()),
|
|
4620
|
+
scope_class: z.string(),
|
|
4621
|
+
}),
|
|
4622
|
+
freshness_beacon: z.object({
|
|
4623
|
+
delegator_id: z.string(),
|
|
4624
|
+
beacon_timestamp: z.string(),
|
|
4625
|
+
beacon_signature: z.string(),
|
|
4626
|
+
}),
|
|
4627
|
+
subject_private_key: z.string().describe("Subject Ed25519 private key (hex)"),
|
|
4628
|
+
subject_public_key: z.string().describe("Subject Ed25519 public key (hex)"),
|
|
4629
|
+
delegation_chain_root: z.string().optional().describe("Override; otherwise computed from chain"),
|
|
4630
|
+
}) }, async (args) => {
|
|
4533
4631
|
try {
|
|
4534
4632
|
const subjectKey = {
|
|
4535
4633
|
publicKey: args.subject_public_key,
|
|
@@ -4551,14 +4649,14 @@ server.tool("aps_capability_evaluate_authority", "v0.1 capability-token authorit
|
|
|
4551
4649
|
return { content: [{ type: "text", text: safeError("aps_capability_evaluate_authority failed", e) }], isError: true };
|
|
4552
4650
|
}
|
|
4553
4651
|
});
|
|
4554
|
-
server.
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
}, async (args) => {
|
|
4652
|
+
server.registerTool("aps_capability_mint_receipt", { description: "v0.1 capability-token gateway receipt (M3). Gateway signs a permit or deny over the sink's exact challenge_hash. Echoes the M2 delegation_chain_root so the sink can verify the gateway saw the same chain the subject committed to. Search keywords: capability token, challenge receipt, gateway receipt, M3.", inputSchema: z.object({
|
|
4653
|
+
request: z.any().describe("AuthorityEvaluationRequest from M2"),
|
|
4654
|
+
decision: z.enum(["permit", "deny"]),
|
|
4655
|
+
deny_reason: z.string().optional(),
|
|
4656
|
+
policy_digest: z.string().describe("SHA-256 of the policy bundle used in evaluation"),
|
|
4657
|
+
gateway_private_key: z.string(),
|
|
4658
|
+
gateway_public_key: z.string(),
|
|
4659
|
+
}) }, async (args) => {
|
|
4562
4660
|
try {
|
|
4563
4661
|
const gatewayKey = {
|
|
4564
4662
|
publicKey: args.gateway_public_key,
|
|
@@ -4579,19 +4677,19 @@ server.tool("aps_capability_mint_receipt", "v0.1 capability-token gateway receip
|
|
|
4579
4677
|
return { content: [{ type: "text", text: safeError("aps_capability_mint_receipt failed", e) }], isError: true };
|
|
4580
4678
|
}
|
|
4581
4679
|
});
|
|
4582
|
-
server.
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
}, async (args) => {
|
|
4680
|
+
server.registerTool("aps_capability_sign_effect", { description: "v0.1 capability-token sink effect receipt (M4). Sink consumes the token preimage from the gateway's M3 (rejecting on nullifier replay), executes the action, and signs an EffectReceipt binding the consumed token to the result. The (M1, M3, M4) tuple is the full attestation record. Search keywords: capability token, effect receipt, M4, sink attestation.", inputSchema: z.object({
|
|
4681
|
+
challenge: z.any().describe("Original SinkChallenge from M1 (for binding verification)"),
|
|
4682
|
+
challenge_receipt: z.any().describe("ChallengeReceipt from M3"),
|
|
4683
|
+
effect: z.object({
|
|
4684
|
+
executed_at: z.string(),
|
|
4685
|
+
outcome: z.enum(["success", "failure", "partial"]),
|
|
4686
|
+
result_digest: z.string(),
|
|
4687
|
+
}),
|
|
4688
|
+
sink_private_key: z.string(),
|
|
4689
|
+
sink_public_key: z.string(),
|
|
4690
|
+
gateway_public_key: z.string().describe("Used to verify M3 before consuming the token"),
|
|
4691
|
+
expected_delegation_chain_root: z.string().optional().describe("If omitted, falls back to the receipt's own root"),
|
|
4692
|
+
}) }, async (args) => {
|
|
4595
4693
|
try {
|
|
4596
4694
|
const sinkKey = {
|
|
4597
4695
|
publicKey: args.sink_public_key,
|
|
@@ -4649,7 +4747,7 @@ server.tool("aps_capability_sign_effect", "v0.1 capability-token sink effect rec
|
|
|
4649
4747
|
return { content: [{ type: "text", text: safeError("aps_capability_sign_effect failed", e) }], isError: true };
|
|
4650
4748
|
}
|
|
4651
4749
|
});
|
|
4652
|
-
server.
|
|
4750
|
+
server.registerPrompt("coordination_role", { description: "Get instructions for your assigned coordination role", argsSchema: z.object({}) }, async () => {
|
|
4653
4751
|
const role = state.agentRole || 'default';
|
|
4654
4752
|
const instructions = ROLE_PROMPTS[role] || ROLE_PROMPTS['default'];
|
|
4655
4753
|
return {
|
|
@@ -4681,8 +4779,17 @@ async function main() {
|
|
|
4681
4779
|
const roleInfo = state.agentRole
|
|
4682
4780
|
? ` | Role: ${state.agentRole}`
|
|
4683
4781
|
: ' | No role (call identify or set AGENT_KEY)';
|
|
4684
|
-
|
|
4685
|
-
|
|
4782
|
+
// serveStdio serves both the 2025 and 2026-07-28 eras from one entry. The
|
|
4783
|
+
// default legacy posture on stdio is 'serve': the connection is pinned to an
|
|
4784
|
+
// instance from this factory on its opening request.
|
|
4785
|
+
//
|
|
4786
|
+
// The factory returns the module's single `server`. Every registration in
|
|
4787
|
+
// this file is a module-scope call against that instance, so there is no
|
|
4788
|
+
// second instance to hand out. That is safe here because one stdio process
|
|
4789
|
+
// serves exactly one connection: the factory was measured being invoked once
|
|
4790
|
+
// per process for a 2025 initialize, a modern server/discover opening, and a
|
|
4791
|
+
// modern tools/call opening alike.
|
|
4792
|
+
serveStdio(() => server);
|
|
4686
4793
|
console.error(`Agent Passport MCP Server v2.0 running${roleInfo}`);
|
|
4687
4794
|
console.error(`Tasks loaded: ${state.taskUnits.size} | Agora messages: ${state.agoraFeed.messages.length}`);
|
|
4688
4795
|
}
|