Skip to content

Commit 667a372

Browse files
authored
Merge pull request FinTechTonic#52 from FinTechTonic/fdc3
adds docs , ci , fdc3 , read , sites , improvements
2 parents d2f7fcd + d7fcc6a commit 667a372

18 files changed

Lines changed: 582 additions & 193 deletions

README.md

Lines changed: 101 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
**"Price & Create Structured Financial Products"**
44

5-
[![Documentation](https://img.shields.io/badge/Documentation-Read%20Docs-blue?style=flat-square)](https://tonic-ai.mintlify.app)
5+
[![Documentation](https://img.shields.io/badge/📖-Read%20The%20Docs-blue?style=flat-square)](https://tonic-ai.mintlify.app)
66
[![Company Site](https://img.shields.io/badge/Company%20Site-Visit-green?style=flat-square)](https://josephrp.github.io/creditnexus)
77
[![YouTube Demo](https://img.shields.io/badge/YouTube-Demo-red?style=flat-square&logo=youtube)](YOUTUBE_URL)
88

@@ -25,7 +25,7 @@
2525
[![Encryption](https://img.shields.io/badge/Encryption-At--Rest-brightgreen?style=flat-square)](https://tonic-ai.mintlify.app/compliance/security)
2626
[![Payments](https://img.shields.io/badge/Payments-X402-blue?style=flat-square)](https://tonic-ai.mintlify.app/features/payments)
2727
[![Green Finance](https://img.shields.io/badge/Green-Finance-green?style=flat-square)](https://tonic-ai.mintlify.app/features/green-finance)
28-
[![Discord](https://img.shields.io/badge/Discord-Join-5865F2?style=flat-square&logo=discord)](https://discord.gg/7YS4Cz2Deq)
28+
[![Join us on Discord](https://img.shields.io/discord/1109943800132010065?label=Discord&logo=discord&style=flat-square)](https://discord.gg/qdfnvSPcqP)
2929

3030
CreditNexus is a next-generation financial operating system that bridges the gap between **Sustainabiity-Linked Loans (Legal Contracts)** and **Physical Reality (Satellite Data)**. It uses AI agents to extract covenants from PDF agreements and orchestrates "Ground Truth" verification using geospatial deep learning.
3131

@@ -551,14 +551,34 @@ Complete securitization workflow from pool creation to token minting.
551551

552552
## 🔗 System Interoperability (FDC3)
553553

554-
The platform components are designed to work as a "Chain of Command" using the **FDC3 Standard** for seamless data flow:
554+
CreditNexus is **fully compliant with FDC3 2.0** standards, enabling seamless desktop interoperability with other financial applications. The platform components are designed to work as a "Chain of Command" using the **FDC3 Standard** for seamless data flow:
555555

556556
1.**Extract**: Use the **Document Parser** to turn a PDF into data. Click "Broadcast to Desktop" to send the loan data out.
557557
2.**Trade**: The **Trade Blotter** automatically receives this signal and pre-fills an LMA trade ticket.
558558
3.**Analyze**: **GreenLens** picks up the same signal to show the ESG Margin Ratchet and pricing impact.
559559
4.**Verify**: The **Verification Demo** runs the "Ground Truth" protocol. When a breach is detected, it broadcasts an updated context.
560560
5.**Surveil**: The **Risk War Room** listens for these alerts and automatically highlights assets in breach for immediate investigation.
561561

562+
### FDC3 2.0 Compliance Features
563+
564+
-**App Directory API**: Served at `/api/fdc3/apps` for OpenFin Workspace discovery
565+
-**Context Types**: All custom contexts use `finos.creditnexus.*` namespace (FDC3 2.0 compliant)
566+
-**Intent Handling**: Full support for intent listeners and raisers
567+
-**App Channels**: Custom channels for workflow, extraction, and portfolio events
568+
-**Error Handling**: Robust validation and retry logic for reliable broadcasting
569+
-**Native OpenFin Integration**: Uses built-in FDC3 2.0 API (no deprecated services)
570+
571+
**Context Types Supported:**
572+
- `finos.creditnexus.loan` - Loan data context
573+
- `finos.creditnexus.agreement` - Credit agreement context
574+
- `finos.creditnexus.document` - Document extraction context
575+
- `finos.creditnexus.portfolio` - Portfolio context
576+
- `finos.creditnexus.workflow` - Workflow link sharing context
577+
- `finos.creditnexus.approvalResult` - Approval workflow results
578+
- `finos.creditnexus.esgData` - ESG analytics data
579+
- `finos.cdm.landUse` - Land use classification
580+
- `finos.cdm.greenFinanceAssessment` - Green finance assessment
581+
562582
> 📖 **Learn More**: See [Documentation - Architecture](https://tonic-ai.mintlify.app/architecture/overview) for detailed system design and [Documentation - FDC3 Compliance](https://tonic-ai.mintlify.app/compliance/fdc3-compliance) for interoperability standards.
563583
564584
---
@@ -624,12 +644,18 @@ npm run dev
624644

625645
**Terminal 3 - Launch OpenFin:**
626646
```powershell
627-
# Launch via RVM (no CLI needed !)
628-
.\scripts\launch_openfin.ps1
647+
# Launch via RVM (no CLI needed!)
648+
.\scripts\launch_openfin.sh
629649
# Or simply open the manifest URL in your browser:
630650
# http://localhost:8000/openfin/app.json
631651
```
632652

653+
**Windows (Git Bash/MINGW64):**
654+
```bash
655+
# Launch via RVM
656+
./scripts/launch_openfin.sh
657+
```
658+
633659
### What Happens
634660

635661
1. **Backend Server** starts on `http://127.0.0.1:8000`
@@ -648,6 +674,52 @@ npm run dev
648674
- Loads frontend from `http://localhost:8000` (redirected from Vite)
649675
- Includes FDC3 interoperability
650676

677+
### After the Script Runs
678+
679+
Once `launch_openfin.sh` completes successfully, here's what happens:
680+
681+
1. **OpenFin Runtime Launch**:
682+
- If this is your first time, OpenFin Runtime will download automatically (this may take a few minutes)
683+
- The OpenFin Runtime window will appear
684+
- You'll see the CreditNexus platform loading
685+
686+
2. **Application Window Opens**:
687+
- A new window (1400×900 pixels) will open with the CreditNexus application
688+
- The application loads from `http://localhost:8000`
689+
- You should see the CreditNexus login/interface
690+
691+
3. **FDC3 Integration Active**:
692+
- FDC3 2.0 API is available via `window.fdc3`
693+
- App Directory is accessible at `http://localhost:8000/api/fdc3/apps`
694+
- Context broadcasting and intent handling are ready
695+
696+
4. **What You Can Do Next**:
697+
- **Login/Register**: Create an account or login to access features
698+
- **Test FDC3**: Open multiple windows and test context broadcasting between them
699+
- **Use Document Parser**: Upload a credit agreement PDF and click "Broadcast to Desktop" to test FDC3 context sharing
700+
- **Open Trade Blotter**: It will automatically receive FDC3 contexts from Document Parser
701+
- **Test GreenLens**: It listens for FDC3 contexts to show ESG analytics
702+
- **Verify Integration**: Check that other FDC3-compliant apps can discover CreditNexus via the App Directory
703+
704+
5. **First Launch Notes**:
705+
- OpenFin Runtime download: On first launch, OpenFin may take 1-2 minutes to download and install
706+
- Security prompts: You may see security prompts - allow OpenFin to run
707+
- Port access: Ensure ports 8000 and 5173 are not blocked by firewall
708+
709+
6. **Verifying Everything Works**:
710+
```bash
711+
# Check FDC3 App Directory is accessible
712+
curl http://localhost:8000/api/fdc3/apps
713+
714+
# Should return JSON with CreditNexus app definition
715+
```
716+
717+
7. **If OpenFin Doesn't Launch**:
718+
- Check the script output for error messages
719+
- Verify backend is running: `curl http://localhost:8000/api/health`
720+
- Verify manifest is accessible: `curl http://localhost:8000/openfin/app.json`
721+
- Try opening the manifest URL directly in your browser: `http://localhost:8000/openfin/app.json`
722+
651723
### Configuration
652724

653725
The configuration is in `openfin/app.json`:
@@ -660,8 +732,11 @@ The configuration is in `openfin/app.json`:
660732

661733
**Configuration Files:**
662734
- **App Manifest**: `openfin/app.json` - Platform configuration, window layout, FDC3 settings
663-
- **FDC3 Intents**: `openfin/fdc3-intents.json` - Intent declarations and context types
664-
- **Provider Config**: `openfin/provider.json` - Service provider setup
735+
- **FDC3 Intents**: `openfin/fdc3-intents.json` - Intent declarations and context types (served at `/api/fdc3/apps`)
736+
- **Provider Config**: `openfin/provider.json` - Service provider setup (uses native FDC3 2.0 API)
737+
738+
**FDC3 App Directory:**
739+
The FDC3 App Directory is automatically served by the backend at `http://localhost:8000/api/fdc3/apps`. This allows OpenFin Workspace and other FDC3-compliant platforms to discover and integrate with CreditNexus.
665740

666741
### Troubleshooting
667742

@@ -683,11 +758,23 @@ npm install
683758

684759
**OpenFin Won't Launch:**
685760
```powershell
686-
# Verify OpenFin CLI is installed
687-
openfin --version
761+
# Verify OpenFin RVM is installed (recommended)
762+
# RVM is automatically installed by OpenFin Runtime
688763
689-
# Install if needed
764+
# Alternative: Install OpenFin CLI (optional)
690765
npm install -g @openfin/cli
766+
767+
# Or use the launcher script which handles RVM detection
768+
.\scripts\launch_openfin.sh
769+
```
770+
771+
**FDC3 App Directory Not Accessible:**
772+
```powershell
773+
# Verify the endpoint is accessible
774+
curl http://localhost:8000/api/fdc3/apps
775+
776+
# Check backend logs for errors
777+
# Ensure openfin/fdc3-intents.json exists
691778
```
692779

693780
**Cannot Connect to Services:**
@@ -727,9 +814,13 @@ Then configure `openfin/app.json` to point to the production build location.
727814
### Features
728815

729816
- **FDC3 2.0 Interoperability**: Native support for context broadcasting and intent handling
817+
- **App Directory API**: Automatic discovery endpoint at `/api/fdc3/apps` for OpenFin Workspace
818+
- **Context Type Validation**: Robust validation and error handling for all FDC3 contexts
819+
- **Namespace Compliance**: All custom contexts use `finos.*` namespace per FDC3 2.0 standards
730820
- **Desktop Integration**: Seamless integration with other OpenFin applications
731821
- **Platform Management**: Multi-window platform with workspace support
732822
- **Security**: Configurable security realms and CORS policies
823+
- **Native API**: Uses OpenFin's built-in FDC3 2.0 API (no deprecated services)
733824

734825
### More Information
735826

app/api/fdc3_routes.py

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
"""
2+
FDC3 API routes for CreditNexus.
3+
4+
Provides endpoints for FDC3 2.0 App Directory integration, allowing
5+
OpenFin Workspace and other FDC3-compliant platforms to discover
6+
and integrate with CreditNexus.
7+
"""
8+
9+
import logging
10+
from pathlib import Path
11+
from fastapi import APIRouter, HTTPException
12+
from fastapi.responses import JSONResponse
13+
import json
14+
15+
logger = logging.getLogger(__name__)
16+
17+
router = APIRouter(tags=["fdc3"])
18+
19+
# Path to FDC3 intents configuration file
20+
FDC3_INTENTS_PATH = Path(__file__).parent.parent.parent / "openfin" / "fdc3-intents.json"
21+
22+
23+
@router.get("/apps")
24+
async def get_fdc3_app_directory():
25+
"""
26+
Serve FDC3 2.0 App Directory JSON.
27+
28+
This endpoint provides the app directory entry for CreditNexus,
29+
allowing OpenFin Workspace and other FDC3-compliant platforms
30+
to discover and integrate with the application.
31+
32+
Returns:
33+
JSONResponse: FDC3 2.0 App Directory JSON with proper CORS headers
34+
35+
Raises:
36+
HTTPException: If the app directory file is not found or invalid
37+
"""
38+
try:
39+
# Check if file exists
40+
if not FDC3_INTENTS_PATH.exists():
41+
logger.error(f"FDC3 intents file not found: {FDC3_INTENTS_PATH}")
42+
raise HTTPException(
43+
status_code=500,
44+
detail="FDC3 app directory configuration not found"
45+
)
46+
47+
# Read and parse JSON file
48+
with open(FDC3_INTENTS_PATH, 'r', encoding='utf-8') as f:
49+
app_directory = json.load(f)
50+
51+
# Return with proper headers for CORS and content type
52+
return JSONResponse(
53+
content=app_directory,
54+
headers={
55+
"Content-Type": "application/json",
56+
"Access-Control-Allow-Origin": "*",
57+
"Access-Control-Allow-Methods": "GET, OPTIONS",
58+
"Access-Control-Allow-Headers": "Content-Type"
59+
}
60+
)
61+
except json.JSONDecodeError as e:
62+
logger.error(f"Invalid JSON in FDC3 intents file: {e}")
63+
raise HTTPException(
64+
status_code=500,
65+
detail="Invalid FDC3 app directory configuration"
66+
)
67+
except Exception as e:
68+
logger.error(f"Error serving FDC3 app directory: {e}", exc_info=True)
69+
raise HTTPException(
70+
status_code=500,
71+
detail="Failed to serve FDC3 app directory"
72+
)
73+
74+
75+
@router.options("/apps")
76+
async def options_fdc3_app_directory():
77+
"""
78+
Handle CORS preflight requests for the app directory endpoint.
79+
80+
Returns:
81+
JSONResponse: Empty response with CORS headers
82+
"""
83+
return JSONResponse(
84+
content={},
85+
headers={
86+
"Access-Control-Allow-Origin": "*",
87+
"Access-Control-Allow-Methods": "GET, OPTIONS",
88+
"Access-Control-Allow-Headers": "Content-Type"
89+
}
90+
)

client/src/apps/docu-digitizer/DocumentParser.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ export function DocumentParser({
233233
if (!editableData) return;
234234

235235
const context: CreditNexusLoanContext = {
236-
type: 'fdc3.creditnexus.loan',
236+
type: 'finos.creditnexus.loan',
237237
id: {
238238
LIN: editableData.loan_identification_number,
239239
DealID: editableData.deal_id,

client/src/apps/document-generator/DocumentGenerator.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,11 +379,11 @@ export function DocumentGenerator({ initialCdmData, onDocumentGenerated }: Docum
379379
};
380380

381381
try {
382-
// Cast to CreditNexusContext for broadcast (GeneratedDocumentContext extends Context)
383-
// Note: GeneratedDocumentContext should be added to CreditNexusContext union type
384-
await broadcast(context as any);
382+
// GeneratedDocumentContext is part of CreditNexusContext union type
383+
await broadcast(context);
385384
} catch (err) {
386385
// Don't fail the generation if broadcast fails
386+
console.warn('[FDC3] Failed to broadcast generated document context:', err);
387387
}
388388
}
389389

client/src/apps/trade-blotter/TradeBlotter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ export function TradeBlotter({ state, setState }: TradeBlotterProps) {
551551
</div>
552552
<div>
553553
<label className="text-xs text-muted-foreground">Deal ID</label>
554-
<p className="font-mono">{loanData.deal_id || (context?.type === 'fdc3.creditnexus.loan' ? (context as CreditNexusLoanContext).id?.DealID : undefined) || 'AUTO-' + Date.now().toString(36).toUpperCase()}</p>
554+
<p className="font-mono">{loanData.deal_id || (context?.type === 'finos.creditnexus.loan' ? (context as CreditNexusLoanContext).id?.DealID : undefined) || 'AUTO-' + Date.now().toString(36).toUpperCase()}</p>
555555
</div>
556556
</div>
557557

client/src/components/GroundTruthDashboard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export function GroundTruthDashboard() {
9494
}, [fetchAssets]);
9595

9696
useEffect(() => {
97-
if (context?.type === 'fdc3.creditnexus.loan' && context.loan?.document_text) {
97+
if (context?.type === 'finos.creditnexus.loan' && context.loan?.document_text) {
9898
setLoanId(context.loan.loan_identification_number || context.loan.deal_id || '');
9999
setDocumentText(context.loan.document_text);
100100
setShowCreateForm(true);

client/src/components/ReviewInterface.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export function ReviewInterface({
6060
const handleApprove = () => {
6161
if (extractedData && isDataValid) {
6262
broadcast({
63-
type: 'fdc3.creditnexus.loan',
63+
type: 'finos.creditnexus.loan',
6464
loan: {
6565
agreementDate: extractedData.agreement_date,
6666
parties: extractedData.parties,

client/src/components/VerificationDashboard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export default function VerificationDashboard() {
7171
};
7272

7373
useEffect(() => {
74-
if (context?.type === 'fdc3.creditnexus.loan' && context.loan?.document_text) {
74+
if (context?.type === 'finos.creditnexus.loan' && context.loan?.document_text) {
7575
const loan = context.loan;
7676
setExtractedText(loan.document_text || '');
7777
setLogs([]); // Clear previous logs

client/src/components/VerificationWidget.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export function VerificationWidget({
7979

8080
// Handle FDC3 context
8181
useEffect(() => {
82-
if (context?.type === 'fdc3.creditnexus.loan' && context.loan?.document_text) {
82+
if (context?.type === 'finos.creditnexus.loan' && context.loan?.document_text) {
8383
const loan = context.loan;
8484
setExtractedText(loan.document_text || '');
8585
setLogs([]);

client/src/components/WorkflowProcessingPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export function WorkflowProcessingPage() {
7777

7878
// Get payload from URL or FDC3 context
7979
const payloadFromUrl = searchParams.get('payload')
80-
const workflowContext = context?.type === 'fdc3.creditnexus.workflow' ? context as WorkflowLinkContext : null
80+
const workflowContext = context?.type === 'finos.creditnexus.workflow' ? context as WorkflowLinkContext : null
8181
const encryptedPayload = payloadFromUrl || workflowContext?.linkPayload
8282

8383
useEffect(() => {

0 commit comments

Comments
 (0)