SDK - skenai/WILL GitHub Wiki


version: 2.0.0 date: 2025-03-04 type: system-doc status: public tags: [william, sdk] related: [] changelog:

  • version: 2.0.0 date: 2025-03-04 changes:
    • "MAJOR: Switch to YAML frontmatter"
    • "MAJOR: Enhanced metadata structure" references: []
  • version: 1.0.0 date: 2025-03-03 changes:
    • "MAJOR: Initial documentation" references: []

SDK Guide

Overview

The WILL SDK provides a TypeScript/JavaScript interface to the SKENAI ecosystem.

Installation

npm install @skenai/will-sdk
# or
yarn add @skenai/will-sdk

Basic Usage

1. Initialization

import { WILL } from '@skenai/will-sdk';

const will = new WILL({
  apiKey: 'your-api-key',
  environment: 'production'
});

2. Core Features

// Create a proposal
const proposal = await will.createProposal({
  track: 'G',
  level: 'L0',
  title: 'Example Proposal'
});

// Analyze value
const value = await will.calculateValue({
  economic: 0.5,
  network: 0.7,
  feasibility: 0.9
});

// Detect patterns
const patterns = await will.analyzePatterns({
  timeframe: '7d',
  minConfidence: 0.8
});

Mathematical Framework

1. Value Analysis

interface ValueSpace {
  economic: number;  // [-1, 1]
  network: number;   // [-1, 1]
  feasibility: number; // [0, 1]
}

// Analyze value
const value = await will.calculateValue({
  economic: 0.5,
  network: 0.7,
  feasibility: 0.9
});

2. Pattern Analysis

interface Pattern {
  type: string;
  confidence: number;
  impact: ValueSpace;
  relationships: string[];
}

// Analyze patterns
const patterns = await will.detectPatterns({
  data: yourData,
  options: {
    minConfidence: 0.8,
    maxPatterns: 10
  }
});

3. Track Management

interface TrackState {
  track: 'G' | 'F' | 'O' | 'R' | 'C' | 'E';
  level: 'L0' | 'L1' | 'L2' | 'L3';
  value: ValueSpace;
}

// Get track state
const state = await will.getTrackState('G');

Advanced Features

1. Validation

// Validate proposal
const validation = await will.validateProposal({
  proposal,
  options: {
    strictMode: true,
    validateMath: true
  }
});

2. Pattern Analysis

// Deep pattern analysis
const analysis = await will.analyzePatternNetwork({
  patterns,
  options: {
    depth: 3,
    minStrength: 0.5
  }
});

3. Value Flow

// Track value flow
const flow = await will.trackValueFlow({
  source: 'proposal-id',
  timeframe: '30d'
});

Error Handling

try {
  const result = await will.someOperation();
} catch (error) {
  if (error instanceof WILLValidationError) {
    // Handle validation error
  } else if (error instanceof WILLApiError) {
    // Handle API error
  }
}

Best Practices

1. Performance

// Use batch operations
const results = await will.batchProcess([
  operation1,
  operation2,
  operation3
]);

// Enable caching
will.enableCache({
  ttl: '1h',
  maxSize: 1000
});

2. Security

// Use environment variables
const will = new WILL({
  apiKey: process.env.WILL_API_KEY,
  environment: process.env.NODE_ENV
});

// Enable additional security
will.enableSecurity({
  validateInputs: true,
  sanitizeOutputs: true
});

Additional Resources

Integration with NATURAL Framework

  • Clean repository separation
  • Natural pipeline flow
  • Validator protection
  • Interface standards

Pipeline API Integration

  • /pipeline/submit - Entry point
  • /pipeline/validate - Basic checks
  • /pipeline/analyze - Efficiency (Q.1)
  • /pipeline/patterns - Recognition (Q.2)
  • /pipeline/status - State checks
  • /pipeline/vote - Governance

Integration with Three-Graph Lattice

  • Technical graph validation
  • Economic resource optimization
  • Quality metrics tracking