agent-passport-system-mcp 2.12.2 → 2.12.3

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 CHANGED
@@ -206,7 +206,7 @@ Layer 1 — Agent Passport Protocol (Ed25959 identity)
206
206
 
207
207
  ## Links
208
208
 
209
- - npm SDK: [agent-passport-system](https://www.npmjs.com/package/agent-passport-system) (v1.21.4, 1183 tests)
209
+ - npm SDK: [agent-passport-system](https://www.npmjs.com/package/agent-passport-system) (v1.21.7, 1358 tests)
210
210
  - Python SDK: [agent-passport-system](https://pypi.org/project/agent-passport-system/) (v0.5.1)
211
211
  - Paper: [doi.org/10.5281/zenodo.18749779](https://doi.org/10.5281/zenodo.18749779)
212
212
  - Docs: [aeoess.com/llms-full.txt](https://aeoess.com/llms-full.txt)
package/build/index.js CHANGED
@@ -52,6 +52,8 @@ requestV2Migration,
52
52
  createV2Attestation, assessV2AttestationQuality, } from "agent-passport-system";
53
53
  // Data Governance (Modules 36A, 38, 39 + Enforcement Gate + Training Attribution)
54
54
  import { registerSelfAttestedSource, createContributionLedger, queryContributions, getSourceMetrics, getAgentDataFootprint, generateSettlement, verifySettlement, generateDataComplianceReport, DataEnforcementGate, createTrainingAttribution, verifyTrainingAttribution, createTrainingLedger, recordTrainingAttribution, getModelDataSources, } from "agent-passport-system";
55
+ // Data Lifecycle Governance (Modules 43+)
56
+ import { createDerivationReceipt, resolveExtendedLineage, evaluateRevocationImpact, createDecisionLineageReceipt, isPurposePermitted, purposeCategory, isRetentionExpired, checkAggregateConstraints, isTransferPermitted, computeGovernanceTaint, fileDispute, checkCombinationPermitted, createAccessSnapshot, resolveRightsPropagation, DEFAULT_RIGHTS_PROPAGATION, detectPurposeDrift, declareReidentificationRisk, } from "agent-passport-system";
55
57
  // ═══════════════════════════════════════
56
58
  // State Management
57
59
  // ═══════════════════════════════════════
@@ -88,6 +90,7 @@ const state = {
88
90
  contributionLedger: createContributionLedger(),
89
91
  sourceReceipts: new Map(),
90
92
  trainingLedger: createTrainingLedger(),
93
+ derivationStore: new Map(),
91
94
  sessionAgent: null,
92
95
  };
93
96
  // Load persisted task state
@@ -3274,6 +3277,223 @@ server.tool("get_model_data_sources", "Show which data sources contributed to a
3274
3277
  return { content: [{ type: "text", text: `🧠 Model Training Sources: ${p.modelId}\n\n${sources.length} data sources contributed:\n${lines.join('\n')}` }] };
3275
3278
  });
3276
3279
  // ═══════════════════════════════════════
3280
+ // Data Lifecycle Governance Tools
3281
+ // ═══════════════════════════════════════
3282
+ server.tool("create_derivation_receipt", "Create a signed derivation receipt tracking how data was transformed. Multi-hop lineage with break markers.", {
3283
+ derivativeId: z.string().describe("Unique ID for the derivative artifact"),
3284
+ derivativeType: z.string().describe("Type: rag_chunk, embedding, summary, model_weights, synthetic_derivative, etc."),
3285
+ parentArtifacts: z.array(z.object({
3286
+ artifactId: z.string(),
3287
+ artifactType: z.string(),
3288
+ sourceId: z.string().optional(),
3289
+ transformFromParent: z.string().optional(),
3290
+ })).describe("Parent artifacts this was derived from"),
3291
+ transformClass: z.string().describe("Transform type: copy, subset, summary, embedding, aggregation, synthetic, model_training"),
3292
+ lineageConfidence: z.enum(["complete", "partial", "asserted", "inferred", "broken_external", "unverifiable"]),
3293
+ externalBoundaryBreak: z.boolean().optional().describe("True if data left the system and returned"),
3294
+ breakReason: z.string().optional(),
3295
+ isSyntheticDerivative: z.boolean().optional(),
3296
+ upstreamObligationsRetained: z.boolean().optional(),
3297
+ }, async (p) => {
3298
+ const receipt = createDerivationReceipt({
3299
+ ...p,
3300
+ agentId: state.agentId || 'unknown',
3301
+ privateKey: state.privateKey,
3302
+ });
3303
+ state.derivationStore.set(receipt.derivativeId, receipt);
3304
+ 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}` }] };
3305
+ });
3306
+ server.tool("resolve_lineage", "Resolve the full derivation chain for an artifact. Multi-hop with cycle detection.", {
3307
+ derivativeId: z.string().describe("ID of the derivative to trace"),
3308
+ maxDepth: z.number().optional().describe("Max chain depth (default: 10)"),
3309
+ }, async (p) => {
3310
+ const result = resolveExtendedLineage(p.derivativeId, state.derivationStore, p.maxDepth);
3311
+ const chainStr = result.chain.map((r, i) => ` ${i + 1}. ${r.derivativeId} (${r.transformClass}, ${r.lineageConfidence})`).join('\n');
3312
+ 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)'}` }] };
3313
+ });
3314
+ server.tool("evaluate_revocation_impact", "Evaluate what happens when a data source revokes consent. Propagates obligations through derivation chains.", {
3315
+ sourceId: z.string().describe("Source ID that is revoking consent"),
3316
+ }, async (p) => {
3317
+ const result = evaluateRevocationImpact({
3318
+ sourceId: p.sourceId,
3319
+ receiptStore: state.derivationStore,
3320
+ privateKey: state.privateKey,
3321
+ });
3322
+ const lines = result.affectedArtifacts.map(a => ` • ${a.artifactId} (${a.artifactType}): ${a.obligation} — ${a.reason}`);
3323
+ 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)'}` }] };
3324
+ });
3325
+ server.tool("create_decision_lineage_receipt", "Create a Decision Lineage Receipt — traces which data sources influenced a decision. Right-to-explanation primitive.", {
3326
+ decisionArtifactId: z.string(),
3327
+ decisionType: z.string().describe("E.g. loan_approval, content_moderation, risk_assessment"),
3328
+ contributingSources: z.array(z.object({
3329
+ sourceId: z.string(),
3330
+ accessReceiptId: z.string(),
3331
+ derivationDepth: z.number(),
3332
+ transformPath: z.array(z.string()),
3333
+ termsVersionAtAccess: z.string(),
3334
+ lineageConfidence: z.enum(["complete", "partial", "asserted", "inferred", "broken_external", "unverifiable"]),
3335
+ compensationStatus: z.enum(["settled", "pending", "disputed", "revoked"]),
3336
+ })),
3337
+ lineageCompleteness: z.enum(["complete", "partial", "asserted", "broken_external"]),
3338
+ transformChain: z.array(z.string()).optional(),
3339
+ governingPurpose: z.string().optional(),
3340
+ explanation: z.string().optional(),
3341
+ }, async (p) => {
3342
+ const receipt = createDecisionLineageReceipt({
3343
+ ...p,
3344
+ privateKey: state.privateKey,
3345
+ });
3346
+ 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'}` }] };
3347
+ });
3348
+ server.tool("check_purpose_permitted", "Check if a purpose is permitted under source terms. Supports wildcards (research:*) and hierarchical matching.", {
3349
+ purpose: z.string().describe("Purpose to check (e.g. research:academic, training:model)"),
3350
+ allowedPurposes: z.array(z.string()).describe("Purposes allowed by the source terms"),
3351
+ }, async (p) => {
3352
+ const permitted = isPurposePermitted(p.purpose, p.allowedPurposes);
3353
+ const category = purposeCategory(p.purpose);
3354
+ return { content: [{ type: "text", text: `${permitted ? '✅' : '❌'} Purpose "${p.purpose}" (category: ${category}) is ${permitted ? 'PERMITTED' : 'NOT PERMITTED'}\n\nAllowed: [${p.allowedPurposes.join(', ')}]` }] };
3355
+ });
3356
+ server.tool("check_retention_expired", "Check if data retention has expired based on TTL policy.", {
3357
+ accessedAt: z.string().describe("ISO timestamp of when data was accessed"),
3358
+ maxRetentionMs: z.number().nullable().describe("Max retention in ms (null = no limit)"),
3359
+ accessType: z.enum(["ephemeral", "persistent"]).optional(),
3360
+ }, async (p) => {
3361
+ const policy = { maxRetentionMs: p.maxRetentionMs, onExpiry: 'delete' };
3362
+ const expired = isRetentionExpired(p.accessedAt, policy, p.accessType);
3363
+ 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'}` }] };
3364
+ });
3365
+ server.tool("check_aggregate_constraints", "Check if a data access would violate aggregate rate limits.", {
3366
+ maxAccessesPerWindow: z.number().optional(),
3367
+ windowMs: z.number().optional(),
3368
+ burstLimit: z.number().optional(),
3369
+ currentAccessCount: z.number(),
3370
+ currentRecordCount: z.number(),
3371
+ windowStartMs: z.number(),
3372
+ lastAccessMs: z.number(),
3373
+ sourceId: z.string(),
3374
+ agentId: z.string(),
3375
+ }, async (p) => {
3376
+ const constraint = {
3377
+ maxAccessesPerWindow: p.maxAccessesPerWindow,
3378
+ windowMs: p.windowMs,
3379
+ burstLimit: p.burstLimit,
3380
+ };
3381
+ const log = {
3382
+ sourceId: p.sourceId, agentId: p.agentId,
3383
+ windowStartMs: p.windowStartMs,
3384
+ accessCount: p.currentAccessCount,
3385
+ recordCount: p.currentRecordCount,
3386
+ lastAccessMs: p.lastAccessMs,
3387
+ };
3388
+ const result = checkAggregateConstraints(constraint, log);
3389
+ return { content: [{ type: "text", text: `${result.permitted ? '✅ PERMITTED' : '❌ BLOCKED'} — Aggregate check\n\n${result.reason || 'Within limits'}` }] };
3390
+ });
3391
+ server.tool("check_jurisdiction_transfer", "Check if a data transfer is permitted under jurisdiction constraints (EU_ONLY, GDPR_ADEQUATE_ONLY, NO_CROSS_BORDER).", {
3392
+ sourceJurisdiction: z.string().describe("ISO 3166-1 alpha-2 code"),
3393
+ targetJurisdiction: z.string().describe("ISO 3166-1 alpha-2 code"),
3394
+ processingRestrictions: z.array(z.string()).optional(),
3395
+ transferConstraints: z.array(z.string()).optional(),
3396
+ purpose: z.string(),
3397
+ }, async (p) => {
3398
+ const envelope = {
3399
+ sourceJurisdiction: p.sourceJurisdiction,
3400
+ processingRestrictions: p.processingRestrictions,
3401
+ transferConstraints: p.transferConstraints,
3402
+ };
3403
+ const result = isTransferPermitted(envelope, p.targetJurisdiction, p.purpose);
3404
+ return { content: [{ type: "text", text: `${result.permitted ? '✅ PERMITTED' : '❌ BLOCKED'} — Transfer ${p.sourceJurisdiction} → ${p.targetJurisdiction}\n\n${result.reason || 'No restrictions apply'}` }] };
3405
+ });
3406
+ server.tool("compute_governance_taint", "Compute governance taint level for an artifact based on its derivation chain and revoked sources.", {
3407
+ artifactId: z.string(),
3408
+ revokedSources: z.array(z.string()).optional().describe("Source IDs that have been revoked"),
3409
+ }, async (p) => {
3410
+ const revokedSet = new Set(p.revokedSources || []);
3411
+ const taint = computeGovernanceTaint(p.artifactId, state.derivationStore, revokedSet);
3412
+ 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}` : ''}` }] };
3413
+ });
3414
+ server.tool("file_data_dispute", "File a dispute against a data artifact. The protocol records disputes — resolution is external.", {
3415
+ artifactId: z.string(),
3416
+ disputeType: z.enum(["unauthorized_access", "terms_violation", "compensation_dispute", "revocation_dispute", "lineage_dispute"]),
3417
+ filedBy: z.string(),
3418
+ evidence: z.array(z.string()).describe("Evidence artifact IDs"),
3419
+ }, async (p) => {
3420
+ const dispute = fileDispute({
3421
+ ...p,
3422
+ privateKey: state.privateKey,
3423
+ });
3424
+ 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` }] };
3425
+ });
3426
+ server.tool("check_combination_permitted", "Check if combining data from two sources is permitted. Prevents prohibited inferences (HIPAA, COPPA, GDPR Art 9).", {
3427
+ forbiddenSourceClasses: z.array(z.string()).optional(),
3428
+ forbiddenSourceIds: z.array(z.string()).optional(),
3429
+ reason: z.string(),
3430
+ regulatoryBasis: z.string().optional(),
3431
+ otherSourceId: z.string(),
3432
+ otherSourceClasses: z.array(z.string()).optional(),
3433
+ }, async (p) => {
3434
+ const constraints = [{
3435
+ forbiddenSourceClasses: p.forbiddenSourceClasses,
3436
+ forbiddenSourceIds: p.forbiddenSourceIds,
3437
+ reason: p.reason,
3438
+ regulatoryBasis: p.regulatoryBasis,
3439
+ }];
3440
+ const result = checkCombinationPermitted(constraints, p.otherSourceId, p.otherSourceClasses);
3441
+ return { content: [{ type: "text", text: `${result.permitted ? '✅ PERMITTED' : '❌ BLOCKED'} — Combination check\n\n${result.violations.length ? result.violations.join('\n') : 'No violations'}` }] };
3442
+ });
3443
+ server.tool("create_access_snapshot", "Create an immutable access snapshot — freezes terms, jurisdiction, and constraints at moment of access. Anti-rug-pull.", {
3444
+ accessReceiptId: z.string(),
3445
+ sourceId: z.string(),
3446
+ termsVersion: z.string(),
3447
+ compensationRate: z.number(),
3448
+ currency: z.string(),
3449
+ allowedPurposes: z.array(z.string()),
3450
+ sourceJurisdiction: z.string().optional(),
3451
+ }, async (p) => {
3452
+ const pinnedTerms = {
3453
+ termsVersion: p.termsVersion,
3454
+ pinnedAt: new Date().toISOString(),
3455
+ compensationRate: p.compensationRate,
3456
+ currency: p.currency,
3457
+ allowedPurposes: p.allowedPurposes,
3458
+ };
3459
+ const snap = createAccessSnapshot({
3460
+ accessReceiptId: p.accessReceiptId,
3461
+ sourceId: p.sourceId,
3462
+ pinnedTerms,
3463
+ jurisdiction: p.sourceJurisdiction ? { sourceJurisdiction: p.sourceJurisdiction } : undefined,
3464
+ privateKey: state.privateKey,
3465
+ });
3466
+ 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(', ')}]` }] };
3467
+ });
3468
+ server.tool("detect_purpose_drift", "Detect when data purpose drifts through a workflow (e.g. research → commercial).", {
3469
+ originalPurpose: z.string(),
3470
+ currentPurpose: z.string(),
3471
+ intermediateSteps: z.array(z.string()).optional(),
3472
+ allowedPurposes: z.array(z.string()),
3473
+ }, async (p) => {
3474
+ const result = detectPurposeDrift(p);
3475
+ 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}` }] };
3476
+ });
3477
+ server.tool("resolve_rights_propagation", "Resolve what rights propagate when data is transformed.", {
3478
+ transformClass: z.string(),
3479
+ sourceDefaultPropagation: z.string().optional().describe("Source-defined default: inherit_full, compensation_only, etc."),
3480
+ }, async (p) => {
3481
+ const sourceRule = p.sourceDefaultPropagation
3482
+ ? { defaultPropagation: p.sourceDefaultPropagation }
3483
+ : undefined;
3484
+ const result = resolveRightsPropagation(p.transformClass, sourceRule);
3485
+ 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'}`}` }] };
3486
+ });
3487
+ server.tool("declare_reidentification_risk", "Declare re-identification risk for transformed or synthetic data.", {
3488
+ risk: z.enum(["none_declared", "low", "medium", "high", "unknown", "mitigated"]),
3489
+ assessmentMethod: z.string().optional(),
3490
+ mitigationsApplied: z.array(z.string()).optional(),
3491
+ assessedBy: z.string(),
3492
+ }, async (p) => {
3493
+ const decl = declareReidentificationRisk(p);
3494
+ 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}` }] };
3495
+ });
3496
+ // ═══════════════════════════════════════
3277
3497
  // MCP Prompts — Role-Specific
3278
3498
  // ═══════════════════════════════════════
3279
3499
  server.prompt("coordination_role", "Get instructions for your assigned coordination role", {}, async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-passport-system-mcp",
3
- "version": "2.12.2",
3
+ "version": "2.12.3",
4
4
  "mcpName": "io.github.aeoess/agent-passport-mcp",
5
5
  "description": "MCP server for Agent Passport System — cryptographic identity, delegation, governance, and deliberation for AI agents",
6
6
  "type": "module",
@@ -49,11 +49,11 @@
49
49
  "homepage": "https://github.com/aeoess/agent-passport-mcp",
50
50
  "dependencies": {
51
51
  "@modelcontextprotocol/sdk": "^1.27.1",
52
- "agent-passport-system": "^1.21.4",
52
+ "agent-passport-system": "^1.21.7",
53
53
  "zod": "^3.25.76"
54
54
  },
55
55
  "devDependencies": {
56
- "@types/node": "^22.19.15",
56
+ "@types/node": "22.19.15",
57
57
  "typescript": "^5.9.3"
58
58
  }
59
59
  }