@attested-intelligence/aga-mcp-server 0.1.1 → 2.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/PATENTS.md +28 -0
- package/README.md +84 -23
- package/dist/context.d.ts +39 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +113 -0
- package/dist/context.js.map +1 -0
- package/dist/core/identity.d.ts +14 -0
- package/dist/core/identity.d.ts.map +1 -0
- package/dist/core/identity.js +16 -0
- package/dist/core/identity.js.map +1 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +3 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/measurement.d.ts +16 -0
- package/dist/core/measurement.d.ts.map +1 -0
- package/dist/core/measurement.js +18 -0
- package/dist/core/measurement.js.map +1 -0
- package/dist/core/portal.d.ts +1 -1
- package/dist/core/portal.d.ts.map +1 -1
- package/dist/core/portal.js +10 -5
- package/dist/core/portal.js.map +1 -1
- package/dist/core/types.d.ts +2 -2
- package/dist/core/types.d.ts.map +1 -1
- package/dist/crypto/canonicalize.d.ts +7 -0
- package/dist/crypto/canonicalize.d.ts.map +1 -0
- package/dist/crypto/canonicalize.js +21 -0
- package/dist/crypto/canonicalize.js.map +1 -0
- package/dist/crypto/index.d.ts +6 -5
- package/dist/crypto/index.d.ts.map +1 -1
- package/dist/crypto/index.js +6 -5
- package/dist/crypto/index.js.map +1 -1
- package/dist/crypto/keys.d.ts +10 -0
- package/dist/crypto/keys.d.ts.map +1 -0
- package/dist/crypto/keys.js +19 -0
- package/dist/crypto/keys.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/middleware/governance.d.ts +1 -7
- package/dist/middleware/governance.d.ts.map +1 -1
- package/dist/middleware/governance.js +11 -18
- package/dist/middleware/governance.js.map +1 -1
- package/dist/prompts/drift-analysis.d.ts +13 -0
- package/dist/prompts/drift-analysis.d.ts.map +1 -0
- package/dist/prompts/drift-analysis.js +43 -0
- package/dist/prompts/drift-analysis.js.map +1 -0
- package/dist/prompts/governance-report.d.ts +7 -0
- package/dist/prompts/governance-report.d.ts.map +1 -0
- package/dist/prompts/governance-report.js +26 -0
- package/dist/prompts/governance-report.js.map +1 -0
- package/dist/prompts/nccoe-demo.d.ts +14 -0
- package/dist/prompts/nccoe-demo.d.ts.map +1 -0
- package/dist/prompts/nccoe-demo.js +48 -0
- package/dist/prompts/nccoe-demo.js.map +1 -0
- package/dist/resources/crypto-primitives.d.ts +3 -0
- package/dist/resources/crypto-primitives.d.ts.map +1 -0
- package/dist/resources/crypto-primitives.js +52 -0
- package/dist/resources/crypto-primitives.js.map +1 -0
- package/dist/resources/patent-claims.d.ts +3 -0
- package/dist/resources/patent-claims.d.ts.map +1 -0
- package/dist/resources/patent-claims.js +67 -0
- package/dist/resources/patent-claims.js.map +1 -0
- package/dist/resources/sample-bundle.d.ts +6 -0
- package/dist/resources/sample-bundle.d.ts.map +1 -0
- package/dist/resources/sample-bundle.js +58 -0
- package/dist/resources/sample-bundle.js.map +1 -0
- package/dist/resources/specification.d.ts +3 -0
- package/dist/resources/specification.d.ts.map +1 -0
- package/dist/resources/specification.js +107 -0
- package/dist/resources/specification.js.map +1 -0
- package/dist/server.d.ts +4 -7
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +217 -343
- package/dist/server.js.map +1 -1
- package/dist/storage/sqlite.js +1 -1
- package/dist/tools/create-artifact.d.ts +25 -0
- package/dist/tools/create-artifact.d.ts.map +1 -0
- package/dist/tools/create-artifact.js +85 -0
- package/dist/tools/create-artifact.js.map +1 -0
- package/dist/tools/delegate-subagent.d.ts +18 -0
- package/dist/tools/delegate-subagent.d.ts.map +1 -0
- package/dist/tools/delegate-subagent.js +50 -0
- package/dist/tools/delegate-subagent.js.map +1 -0
- package/dist/tools/disclose-claim.d.ts +14 -0
- package/dist/tools/disclose-claim.d.ts.map +1 -0
- package/dist/tools/disclose-claim.js +23 -0
- package/dist/tools/disclose-claim.js.map +1 -0
- package/dist/tools/export-bundle.d.ts +8 -0
- package/dist/tools/export-bundle.d.ts.map +1 -0
- package/dist/tools/export-bundle.js +25 -0
- package/dist/tools/export-bundle.js.map +1 -0
- package/dist/tools/full-lifecycle.d.ts +16 -0
- package/dist/tools/full-lifecycle.d.ts.map +1 -0
- package/dist/tools/full-lifecycle.js +121 -0
- package/dist/tools/full-lifecycle.js.map +1 -0
- package/dist/tools/generate-receipt.d.ts +16 -0
- package/dist/tools/generate-receipt.d.ts.map +1 -0
- package/dist/tools/generate-receipt.js +31 -0
- package/dist/tools/generate-receipt.js.map +1 -0
- package/dist/tools/get-chain.d.ts +14 -0
- package/dist/tools/get-chain.d.ts.map +1 -0
- package/dist/tools/get-chain.js +45 -0
- package/dist/tools/get-chain.js.map +1 -0
- package/dist/tools/get-portal-state.d.ts +8 -0
- package/dist/tools/get-portal-state.d.ts.map +1 -0
- package/dist/tools/get-portal-state.js +15 -0
- package/dist/tools/get-portal-state.js.map +1 -0
- package/dist/tools/init-chain.d.ts +10 -0
- package/dist/tools/init-chain.d.ts.map +1 -0
- package/dist/tools/init-chain.js +13 -0
- package/dist/tools/init-chain.js.map +1 -0
- package/dist/tools/measure-behavior.d.ts +12 -0
- package/dist/tools/measure-behavior.d.ts.map +1 -0
- package/dist/tools/measure-behavior.js +29 -0
- package/dist/tools/measure-behavior.js.map +1 -0
- package/dist/tools/measure-subject.d.ts +15 -0
- package/dist/tools/measure-subject.d.ts.map +1 -0
- package/dist/tools/measure-subject.js +106 -0
- package/dist/tools/measure-subject.js.map +1 -0
- package/dist/tools/quarantine-status.d.ts +8 -0
- package/dist/tools/quarantine-status.d.ts.map +1 -0
- package/dist/tools/quarantine-status.js +16 -0
- package/dist/tools/quarantine-status.js.map +1 -0
- package/dist/tools/revoke-artifact.d.ts +13 -0
- package/dist/tools/revoke-artifact.d.ts.map +1 -0
- package/dist/tools/revoke-artifact.js +24 -0
- package/dist/tools/revoke-artifact.js.map +1 -0
- package/dist/tools/rotate-keys.d.ts +13 -0
- package/dist/tools/rotate-keys.d.ts.map +1 -0
- package/dist/tools/rotate-keys.js +39 -0
- package/dist/tools/rotate-keys.js.map +1 -0
- package/dist/tools/server-info.d.ts +8 -0
- package/dist/tools/server-info.d.ts.map +1 -0
- package/dist/tools/server-info.js +24 -0
- package/dist/tools/server-info.js.map +1 -0
- package/dist/tools/set-verification-tier.d.ts +11 -0
- package/dist/tools/set-verification-tier.d.ts.map +1 -0
- package/dist/tools/set-verification-tier.js +31 -0
- package/dist/tools/set-verification-tier.js.map +1 -0
- package/dist/tools/start-monitoring.d.ts +12 -0
- package/dist/tools/start-monitoring.d.ts.map +1 -0
- package/dist/tools/start-monitoring.js +17 -0
- package/dist/tools/start-monitoring.js.map +1 -0
- package/dist/tools/trigger-measurement.d.ts +15 -0
- package/dist/tools/trigger-measurement.d.ts.map +1 -0
- package/dist/tools/trigger-measurement.js +86 -0
- package/dist/tools/trigger-measurement.js.map +1 -0
- package/dist/tools/verify-artifact.d.ts +13 -0
- package/dist/tools/verify-artifact.d.ts.map +1 -0
- package/dist/tools/verify-artifact.js +6 -0
- package/dist/tools/verify-artifact.js.map +1 -0
- package/dist/tools/verify-bundle.d.ts +13 -0
- package/dist/tools/verify-bundle.d.ts.map +1 -0
- package/dist/tools/verify-bundle.js +6 -0
- package/dist/tools/verify-bundle.js.map +1 -0
- package/dist/types.d.ts +262 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/package.json +19 -3
- package/AGA_MCP_SERVER_SPEC.md +0 -632
- package/src/core/artifact.ts +0 -45
- package/src/core/attestation.ts +0 -33
- package/src/core/behavioral.ts +0 -132
- package/src/core/bundle.ts +0 -31
- package/src/core/chain.ts +0 -72
- package/src/core/checkpoint.ts +0 -22
- package/src/core/delegation.ts +0 -146
- package/src/core/disclosure.ts +0 -32
- package/src/core/index.ts +0 -11
- package/src/core/portal.ts +0 -96
- package/src/core/quarantine.ts +0 -16
- package/src/core/receipt.ts +0 -33
- package/src/core/subject.ts +0 -11
- package/src/core/types.ts +0 -244
- package/src/crypto/hash.ts +0 -33
- package/src/crypto/index.ts +0 -5
- package/src/crypto/merkle.ts +0 -43
- package/src/crypto/salt.ts +0 -18
- package/src/crypto/sign.ts +0 -35
- package/src/crypto/types.ts +0 -19
- package/src/index.ts +0 -12
- package/src/middleware/governance.ts +0 -95
- package/src/middleware/index.ts +0 -1
- package/src/server.ts +0 -436
- package/src/storage/index.ts +0 -3
- package/src/storage/interface.ts +0 -21
- package/src/storage/memory.ts +0 -27
- package/src/storage/sqlite.ts +0 -45
- package/src/tools/README.md +0 -13
- package/src/utils/canonical.ts +0 -14
- package/src/utils/constants.ts +0 -3
- package/src/utils/timestamp.ts +0 -12
- package/src/utils/uuid.ts +0 -2
package/dist/server.js
CHANGED
|
@@ -1,137 +1,79 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* AGA MCP Server. The Portal (ref 150) as an MCP service.
|
|
2
|
+
* AGA MCP Server V2.0.0 - The Portal (ref 150) as an MCP service.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* 3. Mid-session revocation via revoke_artifact tool
|
|
8
|
-
* 4. Governance middleware: portal state checked before tool execution
|
|
9
|
-
* 5. Auto-chaining: every operation writes to continuity chain
|
|
4
|
+
* 20 tools, 4 resources, 3 prompts.
|
|
5
|
+
* USPTO Application No. 19/433,835
|
|
6
|
+
* NIST-2025-0035, NCCoE AI Agent Identity and Authorization
|
|
10
7
|
*/
|
|
11
8
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
12
9
|
import { z } from 'zod';
|
|
13
|
-
import {
|
|
14
|
-
import { sha256Str } from './crypto/hash.js';
|
|
15
|
-
import { computeSubjectIdFromString } from './core/subject.js';
|
|
16
|
-
import { performAttestation } from './core/attestation.js';
|
|
17
|
-
import { generateArtifact, hashArtifact } from './core/artifact.js';
|
|
18
|
-
import { Portal } from './core/portal.js';
|
|
19
|
-
import { generateReceipt } from './core/receipt.js';
|
|
20
|
-
import { createGenesisEvent, appendEvent, verifyChainIntegrity } from './core/chain.js';
|
|
21
|
-
import { createCheckpoint, eventInclusionProof } from './core/checkpoint.js';
|
|
22
|
-
import { generateBundle, verifyBundleOffline } from './core/bundle.js';
|
|
23
|
-
import { processDisclosure } from './core/disclosure.js';
|
|
24
|
-
import { initQuarantine } from './core/quarantine.js';
|
|
25
|
-
import { MemoryStorage } from './storage/index.js';
|
|
26
|
-
import { utcNow } from './utils/timestamp.js';
|
|
27
|
-
import { deriveArtifact } from './core/delegation.js';
|
|
10
|
+
import { createContext } from './context.js';
|
|
28
11
|
import { createGovernanceWrapper } from './middleware/governance.js';
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
};
|
|
12
|
+
// ── Tool handlers ────────────────────────────────────────────────
|
|
13
|
+
import { handleServerInfo } from './tools/server-info.js';
|
|
14
|
+
import { handleInitChain } from './tools/init-chain.js';
|
|
15
|
+
import { handleCreateArtifact } from './tools/create-artifact.js';
|
|
16
|
+
import { handleMeasureSubject } from './tools/measure-subject.js';
|
|
17
|
+
import { handleVerifyArtifact } from './tools/verify-artifact.js';
|
|
18
|
+
import { handleStartMonitoring } from './tools/start-monitoring.js';
|
|
19
|
+
import { handleGetPortalState } from './tools/get-portal-state.js';
|
|
20
|
+
import { handleTriggerMeasurement } from './tools/trigger-measurement.js';
|
|
21
|
+
import { handleGenerateReceipt } from './tools/generate-receipt.js';
|
|
22
|
+
import { handleExportBundle } from './tools/export-bundle.js';
|
|
23
|
+
import { handleVerifyBundle } from './tools/verify-bundle.js';
|
|
24
|
+
import { handleDiscloseClaim } from './tools/disclose-claim.js';
|
|
25
|
+
import { handleGetChain } from './tools/get-chain.js';
|
|
26
|
+
import { handleQuarantineStatus } from './tools/quarantine-status.js';
|
|
27
|
+
import { handleRevokeArtifact } from './tools/revoke-artifact.js';
|
|
28
|
+
import { handleSetVerificationTier } from './tools/set-verification-tier.js';
|
|
29
|
+
import { handleFullLifecycle } from './tools/full-lifecycle.js';
|
|
30
|
+
import { handleMeasureBehavior } from './tools/measure-behavior.js';
|
|
31
|
+
import { handleDelegateSubagent } from './tools/delegate-subagent.js';
|
|
32
|
+
import { handleRotateKeys } from './tools/rotate-keys.js';
|
|
33
|
+
// ── Resources ────────────────────────────────────────────────────
|
|
34
|
+
import { PROTOCOL_SPECIFICATION, SPECIFICATION_URI } from './resources/specification.js';
|
|
35
|
+
import { generateSampleBundle, SAMPLE_BUNDLE_URI } from './resources/sample-bundle.js';
|
|
36
|
+
import { CRYPTO_PRIMITIVES_DOC, CRYPTO_PRIMITIVES_URI } from './resources/crypto-primitives.js';
|
|
37
|
+
import { PATENT_CLAIMS_DOC, PATENT_CLAIMS_URI } from './resources/patent-claims.js';
|
|
38
|
+
// ── Prompts ──────────────────────────────────────────────────────
|
|
39
|
+
import { NCCOE_DEMO_PROMPT } from './prompts/nccoe-demo.js';
|
|
40
|
+
import { GOVERNANCE_REPORT_PROMPT } from './prompts/governance-report.js';
|
|
41
|
+
import { DRIFT_ANALYSIS_PROMPT } from './prompts/drift-analysis.js';
|
|
52
42
|
// ── Server Factory ──────────────────────────────────────────────
|
|
53
43
|
export async function createAGAServer() {
|
|
54
|
-
const server = new McpServer({ name: 'aga-mcp-server', version: '0.
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
const issuerKP = generateKeyPair();
|
|
58
|
-
const portalKP = generateKeyPair();
|
|
59
|
-
const chainKP = generateKeyPair();
|
|
60
|
-
const portal = new Portal();
|
|
61
|
-
let quarantine = null;
|
|
62
|
-
let chainInitialized = false;
|
|
63
|
-
// ── Auto-chain helper (auto-inits if needed) ──────────────────
|
|
64
|
-
async function autoChain(type, payload) {
|
|
65
|
-
if (!chainInitialized) {
|
|
66
|
-
const genesis = createGenesisEvent(chainKP, sha256Str('AGA Protocol Specification v1.0.0'));
|
|
67
|
-
await storage.storeEvent(genesis);
|
|
68
|
-
chainInitialized = true;
|
|
69
|
-
portal.sequenceCounter = 0;
|
|
70
|
-
portal.lastLeafHash = genesis.leaf_hash;
|
|
71
|
-
}
|
|
72
|
-
const prev = await storage.getLatestEvent();
|
|
73
|
-
if (!prev)
|
|
74
|
-
throw new Error('Chain initialization failed');
|
|
75
|
-
const event = appendEvent(type, payload, prev, chainKP);
|
|
76
|
-
await storage.storeEvent(event);
|
|
77
|
-
portal.sequenceCounter = event.sequence_number;
|
|
78
|
-
portal.lastLeafHash = event.leaf_hash;
|
|
79
|
-
return event;
|
|
80
|
-
}
|
|
81
|
-
const j = (x) => ({ content: [{ type: 'text', text: JSON.stringify(x, null, 2) }] });
|
|
82
|
-
// ── Governance middleware (NCCoE Section 4: Portal as PEP) ────
|
|
83
|
-
const quarantineRef = { get current() { return quarantine; } };
|
|
84
|
-
const behavioralMonitor = new BehavioralMonitor();
|
|
44
|
+
const server = new McpServer({ name: 'aga-mcp-server', version: '2.0.0' });
|
|
45
|
+
const ctx = await createContext();
|
|
46
|
+
const quarantineRef = { get current() { return ctx.quarantine; } };
|
|
85
47
|
function governedTool(name, description, schema, handler) {
|
|
86
|
-
const wrap = createGovernanceWrapper(portal, quarantineRef, name, behavioralMonitor);
|
|
48
|
+
const wrap = createGovernanceWrapper(ctx.portal, quarantineRef, name, ctx.behavioralMonitor);
|
|
87
49
|
server.tool(name, description, schema, wrap(handler));
|
|
88
50
|
}
|
|
89
51
|
// ══════════════════════════════════════════════════════════════
|
|
90
|
-
//
|
|
91
|
-
// ══════════════════════════════════════════════════════════════
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}));
|
|
116
|
-
// ══════════════════════════════════════════════════════════════
|
|
117
|
-
// TOOL: init_chain (Claim 3a)
|
|
118
|
-
// ══════════════════════════════════════════════════════════════
|
|
119
|
-
server.tool('init_chain', 'Initialize continuity chain with genesis event. (Claim 3a)', { specification_hash: z.string().optional() }, async ({ specification_hash }) => {
|
|
120
|
-
if (chainInitialized)
|
|
121
|
-
return j({ success: false, error: 'Chain already initialized' });
|
|
122
|
-
const genesis = createGenesisEvent(chainKP, specification_hash ?? sha256Str('AGA Protocol Specification v1.0.0'));
|
|
123
|
-
await storage.storeEvent(genesis);
|
|
124
|
-
chainInitialized = true;
|
|
125
|
-
portal.sequenceCounter = 0;
|
|
126
|
-
portal.lastLeafHash = genesis.leaf_hash;
|
|
127
|
-
return j({ success: true, genesis_event_id: genesis.event_id, genesis_leaf_hash: genesis.leaf_hash });
|
|
128
|
-
});
|
|
129
|
-
// ══════════════════════════════════════════════════════════════
|
|
130
|
-
// TOOL: attest_subject (Claims 1a-1d)
|
|
131
|
-
// ══════════════════════════════════════════════════════════════
|
|
132
|
-
server.tool('attest_subject', 'Attest subject, generate sealed Policy Artifact. Auto-loads into portal. (Claims 1a-1d)', {
|
|
133
|
-
subject_content: z.string().describe('Content/bytes of the subject'),
|
|
134
|
-
subject_metadata: z.object({ filename: z.string().optional(), version: z.string().optional(), author: z.string().optional(), content_type: z.string().optional() }),
|
|
52
|
+
// 20 TOOLS
|
|
53
|
+
// ══════════════════════════════════════════════════════════════
|
|
54
|
+
// 1. aga_server_info (ungoverned)
|
|
55
|
+
server.tool('aga_server_info', 'Get AGA server info, public keys, portal state, and framework alignment.', {}, async () => handleServerInfo({}, ctx));
|
|
56
|
+
// Also register as get_server_info for backward compat
|
|
57
|
+
server.tool('get_server_info', 'Get AGA server info (alias for aga_server_info).', {}, async () => handleServerInfo({}, ctx));
|
|
58
|
+
// 2. aga_init_chain (ungoverned)
|
|
59
|
+
server.tool('aga_init_chain', 'Initialize continuity chain with genesis event. (Claim 3a)', { specification_hash: z.string().optional() }, async (args) => handleInitChain(args, ctx));
|
|
60
|
+
// Also register as init_chain for backward compat
|
|
61
|
+
server.tool('init_chain', 'Initialize continuity chain (alias for aga_init_chain). (Claim 3a)', { specification_hash: z.string().optional() }, async (args) => handleInitChain(args, ctx));
|
|
62
|
+
// 3. aga_create_artifact (ungoverned)
|
|
63
|
+
server.tool('aga_create_artifact', 'Attest subject, generate sealed Policy Artifact, load into portal. Accepts content or pre-computed hashes. (Claims 1a-1d)', {
|
|
64
|
+
subject_content: z.string().optional().describe('Content/bytes of the subject'),
|
|
65
|
+
subject_bytes_hash: z.string().optional().describe('Pre-computed SHA-256 bytes hash'),
|
|
66
|
+
subject_metadata_hash: z.string().optional().describe('Pre-computed SHA-256 metadata hash'),
|
|
67
|
+
subject_metadata: z.object({
|
|
68
|
+
filename: z.string().optional(),
|
|
69
|
+
version: z.string().optional(),
|
|
70
|
+
author: z.string().optional(),
|
|
71
|
+
content_type: z.string().optional(),
|
|
72
|
+
}).optional(),
|
|
73
|
+
measurement_cadence_ms: z.number().optional(),
|
|
74
|
+
enforcement_action: z.string().optional(),
|
|
75
|
+
ttl_seconds: z.number().optional(),
|
|
76
|
+
measurement_types: z.array(z.string()).optional(),
|
|
135
77
|
evidence_items: z.array(z.object({ label: z.string(), content: z.string() })).default([]),
|
|
136
78
|
behavioral_baseline: z.object({
|
|
137
79
|
permitted_tools: z.array(z.string()),
|
|
@@ -139,231 +81,163 @@ export async function createAGAServer() {
|
|
|
139
81
|
forbidden_sequences: z.array(z.array(z.string())),
|
|
140
82
|
window_ms: z.number(),
|
|
141
83
|
}).optional(),
|
|
142
|
-
}, async (
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
})
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
return j({
|
|
163
|
-
success: true, artifact_hash: hashArtifact(artifact), sealed_hash: artifact.sealed_hash,
|
|
164
|
-
subject_identifier: subId, portal_state: portal.state,
|
|
165
|
-
issuer_public_key: pkToHex(issuerKP.publicKey),
|
|
166
|
-
});
|
|
84
|
+
}, async (args) => handleCreateArtifact(args, ctx));
|
|
85
|
+
// 4. aga_measure_subject (governed)
|
|
86
|
+
governedTool('aga_measure_subject', 'Measure subject state, compare to sealed reference. Generates signed receipt. (Claims 1e-1g)', {
|
|
87
|
+
subject_content: z.string().optional().describe('Raw content to measure'),
|
|
88
|
+
subject_bytes_hash: z.string().optional().describe('Pre-computed SHA-256 bytes hash (64 hex)'),
|
|
89
|
+
subject_metadata_hash: z.string().optional().describe('Pre-computed SHA-256 metadata hash (64 hex)'),
|
|
90
|
+
subject_metadata: z.object({
|
|
91
|
+
filename: z.string().optional(),
|
|
92
|
+
version: z.string().optional(),
|
|
93
|
+
author: z.string().optional(),
|
|
94
|
+
content_type: z.string().optional(),
|
|
95
|
+
}).optional(),
|
|
96
|
+
}, async (args) => handleMeasureSubject({ ...args, subject_metadata: args.subject_metadata ?? {} }, ctx));
|
|
97
|
+
// 5. aga_verify_artifact (ungoverned)
|
|
98
|
+
server.tool('aga_verify_artifact', 'Verify an artifact signature against an issuer public key.', {
|
|
99
|
+
artifact: z.any().describe('The policy artifact to verify'),
|
|
100
|
+
issuer_public_key: z.string().optional().describe('Issuer public key (hex)'),
|
|
101
|
+
}, async (args) => {
|
|
102
|
+
const pk = args.issuer_public_key ?? (await import('./crypto/sign.js')).pkToHex(ctx.issuerKP.publicKey);
|
|
103
|
+
return handleVerifyArtifact({ artifact: args.artifact ?? ctx.activeArtifact, issuer_public_key: pk }, ctx);
|
|
167
104
|
});
|
|
168
|
-
//
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}, async (
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
subjectId: portal.artifact.subject_identifier, artifactRef: artRef,
|
|
206
|
-
currentHash: currentStr, sealedHash: sealedStr,
|
|
207
|
-
driftDetected: !result.match, driftDescription: driftDesc,
|
|
208
|
-
action, measurementType: portal.artifact.enforcement_parameters.measurement_types.join(','),
|
|
209
|
-
seq: portal.sequenceCounter + 1, prevLeaf: portal.lastLeafHash, portalKP,
|
|
210
|
-
});
|
|
211
|
-
await storage.storeReceipt(receipt);
|
|
212
|
-
await autoChain('INTERACTION_RECEIPT', { receipt_id: receipt.receipt_id, drift_detected: !result.match, enforcement_action: action });
|
|
213
|
-
return j({
|
|
214
|
-
success: true, match: result.match, drift_detected: !result.match,
|
|
215
|
-
ttl_ok: result.ttl_ok, revoked: result.revoked,
|
|
216
|
-
enforcement_action: action, portal_state: portal.state,
|
|
217
|
-
receipt_id: receipt.receipt_id,
|
|
218
|
-
});
|
|
105
|
+
// 6. aga_start_monitoring (governed)
|
|
106
|
+
governedTool('aga_start_monitoring', 'Start or restart behavioral monitoring with a new baseline.', {
|
|
107
|
+
behavioral_baseline: z.object({
|
|
108
|
+
permitted_tools: z.array(z.string()),
|
|
109
|
+
rate_limits: z.record(z.number()),
|
|
110
|
+
forbidden_sequences: z.array(z.array(z.string())),
|
|
111
|
+
window_ms: z.number(),
|
|
112
|
+
}).optional(),
|
|
113
|
+
}, async (args) => handleStartMonitoring(args, ctx));
|
|
114
|
+
// 7. aga_get_portal_state (ungoverned)
|
|
115
|
+
server.tool('aga_get_portal_state', 'Get current portal state, loaded artifact info, and enforcement status.', {}, async () => handleGetPortalState({}, ctx));
|
|
116
|
+
// 8. aga_trigger_measurement (governed)
|
|
117
|
+
governedTool('aga_trigger_measurement', 'Trigger a measurement of subject content and generate a receipt.', {
|
|
118
|
+
subject_content: z.string().optional().describe('Raw content to measure'),
|
|
119
|
+
subject_bytes_hash: z.string().optional().describe('Pre-computed SHA-256 bytes hash (64 hex)'),
|
|
120
|
+
subject_metadata_hash: z.string().optional().describe('Pre-computed SHA-256 metadata hash (64 hex)'),
|
|
121
|
+
measurement_type: z.string().optional(),
|
|
122
|
+
subject_metadata: z.record(z.string()).optional(),
|
|
123
|
+
}, async (args) => handleTriggerMeasurement(args, ctx));
|
|
124
|
+
// 9. aga_generate_receipt (governed)
|
|
125
|
+
governedTool('aga_generate_receipt', 'Generate a signed measurement receipt manually.', {
|
|
126
|
+
subject_content: z.string().optional(),
|
|
127
|
+
drift_detected: z.boolean().optional(),
|
|
128
|
+
drift_description: z.string().optional(),
|
|
129
|
+
measurement_type: z.string().optional(),
|
|
130
|
+
action_type: z.string().optional(),
|
|
131
|
+
action_detail: z.string().optional(),
|
|
132
|
+
}, async (args) => handleGenerateReceipt(args, ctx));
|
|
133
|
+
// 10. aga_export_bundle (governed)
|
|
134
|
+
governedTool('aga_export_bundle', 'Package artifact + receipts + Merkle proofs for offline verification. (Claim 9)', {}, async () => handleExportBundle({}, ctx));
|
|
135
|
+
// 11. aga_verify_bundle (ungoverned - verification is always allowed)
|
|
136
|
+
server.tool('aga_verify_bundle', 'Verify evidence bundle offline - 4-step verification. (Section J)', {
|
|
137
|
+
bundle: z.any(),
|
|
138
|
+
pinned_public_key: z.string().optional(),
|
|
139
|
+
}, async (args) => {
|
|
140
|
+
const pk = args.pinned_public_key ?? (await import('./crypto/sign.js')).pkToHex(ctx.issuerKP.publicKey);
|
|
141
|
+
return handleVerifyBundle({ bundle: args.bundle, pinned_public_key: pk }, ctx);
|
|
219
142
|
});
|
|
220
|
-
//
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
143
|
+
// 12. aga_disclose_claim (governed)
|
|
144
|
+
governedTool('aga_disclose_claim', 'Request disclosure of a claim. Auto-substitutes if sensitivity denied. (Claim 2)', {
|
|
145
|
+
claim_id: z.string(),
|
|
146
|
+
requester_id: z.string().default('anonymous'),
|
|
147
|
+
mode: z.enum(['PROOF_ONLY', 'REVEAL_MIN', 'REVEAL_FULL']).default('REVEAL_MIN'),
|
|
148
|
+
disclosure_mode: z.enum(['PROOF_ONLY', 'REVEAL_MIN', 'REVEAL_FULL']).optional(),
|
|
149
|
+
}, async (args) => handleDiscloseClaim({
|
|
150
|
+
claim_id: args.claim_id,
|
|
151
|
+
requester_id: args.requester_id,
|
|
152
|
+
mode: args.disclosure_mode ?? args.mode,
|
|
153
|
+
}, ctx));
|
|
154
|
+
// 13. aga_get_chain (ungoverned)
|
|
155
|
+
server.tool('aga_get_chain', 'Get continuity chain events with optional verification and filtering. (Claim 3c)', {
|
|
156
|
+
start_seq: z.number().optional(),
|
|
157
|
+
end_seq: z.number().optional(),
|
|
158
|
+
verify: z.boolean().optional(),
|
|
159
|
+
filter_type: z.string().optional().describe('Filter: all, behavioral, delegations, receipts, revocations, attestations, disclosure, keys'),
|
|
160
|
+
}, async (args) => handleGetChain(args, ctx));
|
|
161
|
+
// 14. aga_quarantine_status (ungoverned)
|
|
162
|
+
server.tool('aga_quarantine_status', 'Get quarantine state and forensic capture status. (Claim 5)', {}, async () => handleQuarantineStatus({}, ctx));
|
|
163
|
+
// 15. aga_revoke_artifact (governed)
|
|
164
|
+
governedTool('aga_revoke_artifact', 'Revoke an active policy artifact mid-session. Supports TERMINATED or SAFE_STATE transition. (NCCoE Phase 3b)', {
|
|
165
|
+
sealed_hash: z.string().optional().describe('Sealed hash of artifact to revoke'),
|
|
225
166
|
reason: z.string().describe('Reason for revocation'),
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
//
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
//
|
|
264
|
-
//
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
const
|
|
270
|
-
|
|
271
|
-
return j({ success: false, error: 'No checkpoint. Call create_checkpoint first.' });
|
|
272
|
-
const receipts = await storage.getReceiptsByArtifact(hashArtifact(artifact));
|
|
273
|
-
const batchEvents = await storage.getEvents(cp.batch_start_sequence, cp.batch_end_sequence);
|
|
274
|
-
const proofs = receipts
|
|
275
|
-
.filter(r => r.sequence_number >= cp.batch_start_sequence && r.sequence_number <= cp.batch_end_sequence)
|
|
276
|
-
.map(r => eventInclusionProof(batchEvents, r.sequence_number));
|
|
277
|
-
const bundle = generateBundle(artifact, receipts, proofs, cp, portalKP);
|
|
278
|
-
return j({ success: true, bundle, offline_verifiable: true, receipt_count: receipts.length, proof_count: proofs.length });
|
|
279
|
-
});
|
|
280
|
-
// ══════════════════════════════════════════════════════════════
|
|
281
|
-
// TOOL: verify_bundle_offline (Section J)
|
|
282
|
-
// ══════════════════════════════════════════════════════════════
|
|
283
|
-
governedTool('verify_bundle_offline', 'Verify evidence bundle offline. (Section J)', { bundle: z.any(), pinned_public_key: z.string() }, async ({ bundle, pinned_public_key }) => j({ success: true, verification: verifyBundleOffline(bundle, pinned_public_key) }));
|
|
284
|
-
// ══════════════════════════════════════════════════════════════
|
|
285
|
-
// TOOL: request_claim (Claim 2)
|
|
286
|
-
// ══════════════════════════════════════════════════════════════
|
|
287
|
-
governedTool('request_claim', 'Request disclosure of a claim. Auto-substitutes if denied. (Claim 2)', { claim_id: z.string(), requester_id: z.string().default('anonymous'), mode: z.enum(['PROOF_ONLY', 'REVEAL_MIN', 'REVEAL_FULL']).default('REVEAL_MIN') }, async ({ claim_id, requester_id, mode }) => {
|
|
288
|
-
const latest = await storage.getLatestEvent();
|
|
289
|
-
const result = processDisclosure({ requested_claim_id: claim_id, requester_id, mode, timestamp: utcNow() }, DEFAULT_CLAIMS, CLAIM_VALUES, 1, latest?.sequence_number ?? 0, portalKP);
|
|
290
|
-
if (result.substitution_receipt)
|
|
291
|
-
await autoChain('SUBSTITUTION', result.substitution_receipt);
|
|
292
|
-
else
|
|
293
|
-
await autoChain('DISCLOSURE', { claim_id, mode, permitted: result.permitted });
|
|
294
|
-
return j({ success: true, ...result });
|
|
295
|
-
});
|
|
296
|
-
// ══════════════════════════════════════════════════════════════
|
|
297
|
-
// TOOL: list_claims
|
|
298
|
-
// ══════════════════════════════════════════════════════════════
|
|
299
|
-
server.tool('list_claims', 'List available claims with sensitivity levels.', {}, async () => {
|
|
300
|
-
return j({ claims: DEFAULT_CLAIMS.claims_taxonomy.map(c => ({ claim_id: c.claim_id, sensitivity: c.sensitivity, substitutes: c.substitutes, permitted_modes: c.permitted_modes })) });
|
|
301
|
-
});
|
|
302
|
-
// ══════════════════════════════════════════════════════════════
|
|
303
|
-
// TOOL: delegate_to_subagent (NCCoE: constrained sub-mandates)
|
|
304
|
-
// ══════════════════════════════════════════════════════════════
|
|
305
|
-
governedTool('delegate_to_subagent', 'Derive a constrained policy artifact for a sub-agent. Scope can only diminish, never expand. (NCCoE constrained delegation)', {
|
|
306
|
-
enforcement_triggers: z.array(z.string()).describe('Subset of parent enforcement triggers'),
|
|
307
|
-
measurement_types: z.array(z.string()).describe('Subset of parent measurement types'),
|
|
308
|
-
requested_ttl_seconds: z.number().describe('Requested TTL (will be clamped to parent remaining)'),
|
|
309
|
-
delegation_purpose: z.string().describe('Purpose of the delegation'),
|
|
310
|
-
}, async ({ enforcement_triggers, measurement_types, requested_ttl_seconds, delegation_purpose }) => {
|
|
311
|
-
if (!portal.artifact)
|
|
312
|
-
return j({ success: false, error: 'No artifact loaded. Call attest_subject first.' });
|
|
313
|
-
const result = deriveArtifact(portal.artifact, {
|
|
314
|
-
enforcement_triggers: enforcement_triggers,
|
|
315
|
-
measurement_types: measurement_types,
|
|
316
|
-
requested_ttl_seconds,
|
|
317
|
-
delegation_purpose,
|
|
318
|
-
}, issuerKP);
|
|
319
|
-
if (result.success) {
|
|
320
|
-
await autoChain('ATTESTATION', {
|
|
321
|
-
type: 'DELEGATION',
|
|
322
|
-
parent_artifact_hash: result.parent_artifact_hash,
|
|
323
|
-
child_artifact_hash: result.child_artifact_hash,
|
|
324
|
-
effective_ttl: result.effective_ttl_seconds,
|
|
325
|
-
scope_reduction: result.scope_reduction,
|
|
326
|
-
purpose: delegation_purpose,
|
|
327
|
-
});
|
|
328
|
-
}
|
|
329
|
-
return j(result);
|
|
330
|
-
});
|
|
331
|
-
// ══════════════════════════════════════════════════════════════
|
|
332
|
-
// TOOL: measure_behavior (NIST-2025-0035)
|
|
333
|
-
// ══════════════════════════════════════════════════════════════
|
|
334
|
-
server.tool('measure_behavior', 'Measure behavioral patterns of agent tool usage. Detects unauthorized tools, rate violations, and forbidden sequences. (NIST-2025-0035)', {}, async () => {
|
|
335
|
-
const measurement = behavioralMonitor.measure();
|
|
336
|
-
if (measurement.drift_detected) {
|
|
337
|
-
await autoChain('INTERACTION_RECEIPT', {
|
|
338
|
-
type: 'BEHAVIORAL_DRIFT',
|
|
339
|
-
violations: measurement.violations,
|
|
340
|
-
behavioral_hash: measurement.behavioral_hash,
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
return j({
|
|
344
|
-
success: true,
|
|
345
|
-
...measurement,
|
|
346
|
-
violation_count: measurement.violations.length,
|
|
347
|
-
});
|
|
348
|
-
});
|
|
349
|
-
// ══════════════════════════════════════════════════════════════
|
|
350
|
-
// TOOL: get_receipts — V3 NEW
|
|
351
|
-
// ══════════════════════════════════════════════════════════════
|
|
352
|
-
server.tool('get_receipts', 'Get all signed receipts, optionally filtered by artifact.', { artifact_hash: z.string().optional() }, async ({ artifact_hash }) => {
|
|
353
|
-
const receipts = artifact_hash
|
|
354
|
-
? await storage.getReceiptsByArtifact(artifact_hash)
|
|
355
|
-
: await storage.getAllReceipts();
|
|
356
|
-
return j({ count: receipts.length, receipts: receipts.map(r => ({ receipt_id: r.receipt_id, drift_detected: r.drift_detected, enforcement_action: r.enforcement_action, measurement_type: r.measurement_type, timestamp: r.timestamp })) });
|
|
357
|
-
});
|
|
358
|
-
// ══════════════════════════════════════════════════════════════
|
|
359
|
-
// TOOL: get_chain_events — V3 NEW
|
|
360
|
-
// ══════════════════════════════════════════════════════════════
|
|
361
|
-
server.tool('get_chain_events', 'Get continuity chain events.', { start_seq: z.number().optional(), end_seq: z.number().optional() }, async ({ start_seq, end_seq }) => {
|
|
362
|
-
const events = (start_seq !== undefined && end_seq !== undefined)
|
|
363
|
-
? await storage.getEvents(start_seq, end_seq)
|
|
364
|
-
: await storage.getAllEvents();
|
|
365
|
-
return j({ count: events.length, events: events.map(e => ({ sequence_number: e.sequence_number, event_type: e.event_type, event_id: e.event_id, timestamp: e.timestamp, leaf_hash: e.leaf_hash.slice(0, 16) + '...' })) });
|
|
167
|
+
transition_to: z.enum(['TERMINATED', 'SAFE_STATE']).optional(),
|
|
168
|
+
}, async (args) => handleRevokeArtifact(args, ctx));
|
|
169
|
+
// 16. aga_set_verification_tier (ungoverned)
|
|
170
|
+
server.tool('aga_set_verification_tier', 'Set the verification tier (BRONZE, SILVER, GOLD).', {
|
|
171
|
+
tier: z.enum(['BRONZE', 'SILVER', 'GOLD']),
|
|
172
|
+
}, async (args) => handleSetVerificationTier(args, ctx));
|
|
173
|
+
// 17. aga_demonstrate_lifecycle (ungoverned)
|
|
174
|
+
server.tool('aga_demonstrate_lifecycle', 'Execute full AGA lifecycle demo: attest → measure → drift → revoke → bundle → verify.', {
|
|
175
|
+
subject_content: z.string().optional(),
|
|
176
|
+
subject_metadata: z.record(z.string()).optional(),
|
|
177
|
+
scenario: z.string().optional().describe('Scenario: drone, scada, or custom'),
|
|
178
|
+
include_drift: z.boolean().optional(),
|
|
179
|
+
include_revocation: z.boolean().optional(),
|
|
180
|
+
include_behavioral: z.boolean().optional(),
|
|
181
|
+
}, async (args) => handleFullLifecycle(args, ctx));
|
|
182
|
+
// 18. aga_measure_behavior (ungoverned)
|
|
183
|
+
server.tool('aga_measure_behavior', 'Measure behavioral patterns or record tool invocation. (NIST-2025-0035)', {
|
|
184
|
+
tool_name: z.string().optional().describe('Tool name to record/test'),
|
|
185
|
+
record_only: z.boolean().optional().describe('If true, just record without measuring'),
|
|
186
|
+
}, async (args) => handleMeasureBehavior(args, ctx));
|
|
187
|
+
// 19. aga_delegate_to_subagent (governed)
|
|
188
|
+
governedTool('aga_delegate_to_subagent', 'Derive constrained policy artifact for sub-agent. Scope only diminishes. (NCCoE)', {
|
|
189
|
+
sub_agent_id: z.string().optional(),
|
|
190
|
+
permitted_tools: z.array(z.string()).optional(),
|
|
191
|
+
enforcement_triggers: z.array(z.string()).optional(),
|
|
192
|
+
measurement_types: z.array(z.string()).optional(),
|
|
193
|
+
ttl_seconds: z.number().optional(),
|
|
194
|
+
requested_ttl_seconds: z.number().optional(),
|
|
195
|
+
delegation_purpose: z.string().optional(),
|
|
196
|
+
delegation_reason: z.string().optional(),
|
|
197
|
+
}, async (args) => handleDelegateSubagent(args, ctx));
|
|
198
|
+
// 20. aga_rotate_keys (governed)
|
|
199
|
+
governedTool('aga_rotate_keys', 'Rotate a keypair (issuer, portal, or chain). Old key should be revoked.', {
|
|
200
|
+
key_type: z.enum(['issuer', 'portal', 'chain']).optional(),
|
|
201
|
+
keypair: z.enum(['issuer', 'portal', 'chain']).optional(),
|
|
202
|
+
reason: z.string().optional(),
|
|
203
|
+
}, async (args) => handleRotateKeys(args, ctx));
|
|
204
|
+
// ══════════════════════════════════════════════════════════════
|
|
205
|
+
// 4 RESOURCES
|
|
206
|
+
// ══════════════════════════════════════════════════════════════
|
|
207
|
+
server.resource('protocol-specification', SPECIFICATION_URI, { mimeType: 'text/markdown', description: 'AGA Protocol Specification v2.0.0 with SPIFFE integration and framework alignment' }, async () => ({ contents: [{ uri: SPECIFICATION_URI, mimeType: 'text/markdown', text: PROTOCOL_SPECIFICATION }] }));
|
|
208
|
+
server.resource('sample-bundle', SAMPLE_BUNDLE_URI, { mimeType: 'application/json', description: 'Pre-generated cryptographically signed evidence bundle' }, async () => {
|
|
209
|
+
const { bundle, issuerPkHex } = generateSampleBundle();
|
|
210
|
+
const text = JSON.stringify({ issuer_public_key: issuerPkHex, bundle: JSON.parse(bundle) }, null, 2);
|
|
211
|
+
return { contents: [{ uri: SAMPLE_BUNDLE_URI, mimeType: 'application/json', text }] };
|
|
366
212
|
});
|
|
213
|
+
server.resource('crypto-primitives', CRYPTO_PRIMITIVES_URI, { mimeType: 'text/markdown', description: 'AGA cryptographic primitives documentation' }, async () => ({ contents: [{ uri: CRYPTO_PRIMITIVES_URI, mimeType: 'text/markdown', text: CRYPTO_PRIMITIVES_DOC }] }));
|
|
214
|
+
server.resource('patent-claims', PATENT_CLAIMS_URI, { mimeType: 'text/markdown', description: 'USPTO 19/433,835 patent claims mapped to 20 tools' }, async () => ({ contents: [{ uri: PATENT_CLAIMS_URI, mimeType: 'text/markdown', text: PATENT_CLAIMS_DOC }] }));
|
|
215
|
+
// ══════════════════════════════════════════════════════════════
|
|
216
|
+
// 3 PROMPTS
|
|
217
|
+
// ══════════════════════════════════════════════════════════════
|
|
218
|
+
server.prompt(NCCOE_DEMO_PROMPT.name, NCCOE_DEMO_PROMPT.description, {
|
|
219
|
+
agent_code: z.string().optional().describe('The agent source code to attest'),
|
|
220
|
+
include_behavioral: z.string().optional().describe('Include behavioral drift detection phase'),
|
|
221
|
+
}, async (args) => ({
|
|
222
|
+
messages: [{
|
|
223
|
+
role: 'user',
|
|
224
|
+
content: { type: 'text', text: NCCOE_DEMO_PROMPT.template(args) },
|
|
225
|
+
}],
|
|
226
|
+
}));
|
|
227
|
+
server.prompt(GOVERNANCE_REPORT_PROMPT.name, GOVERNANCE_REPORT_PROMPT.description, {}, async () => ({
|
|
228
|
+
messages: [{
|
|
229
|
+
role: 'user',
|
|
230
|
+
content: { type: 'text', text: GOVERNANCE_REPORT_PROMPT.template() },
|
|
231
|
+
}],
|
|
232
|
+
}));
|
|
233
|
+
server.prompt(DRIFT_ANALYSIS_PROMPT.name, DRIFT_ANALYSIS_PROMPT.description, {
|
|
234
|
+
drift_type: z.string().optional().describe('Type of drift: binary, behavioral, or both'),
|
|
235
|
+
}, async (args) => ({
|
|
236
|
+
messages: [{
|
|
237
|
+
role: 'user',
|
|
238
|
+
content: { type: 'text', text: DRIFT_ANALYSIS_PROMPT.template(args) },
|
|
239
|
+
}],
|
|
240
|
+
}));
|
|
367
241
|
return server;
|
|
368
242
|
}
|
|
369
243
|
//# sourceMappingURL=server.js.map
|