Skip to content
This repository was archived by the owner on Jan 29, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 10 additions & 81 deletions jest.config.cjs
Original file line number Diff line number Diff line change
@@ -1,89 +1,18 @@
module.exports = {
testEnvironment: 'node',
roots: ['<rootDir>/src', '<rootDir>/tests'],
testMatch: [
'**/__tests__/**/*.+(ts|tsx|js)',
'**/*.(test|spec).+(ts|tsx|js)'
],
transform: {
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
useESM: true,
tsconfig: {
module: 'esnext',
target: 'es2022',
moduleResolution: 'node'
}
}
],
'^.+\\.(js|jsx)$': 'babel-jest'
},
preset: 'ts-jest/presets/default-esm',
testEnvironment: 'node',
extensionsToTreatAsEsm: ['.ts'],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
'^@/tests/(.*)$': '<rootDir>/tests/$1'
},
collectCoverageFrom: [
'src/**/*.{ts,tsx}',
'!src/**/*.d.ts',
'!src/**/__tests__/**',
'!src/**/*.test.*',
'!src/benchmarks/**',
'!src/examples/**'
],
coverageDirectory: 'coverage',
coverageReporters: ['text', 'lcov', 'html', 'json'],
coverageThreshold: {
global: {
branches: 75,
functions: 75,
lines: 75,
statements: 75
globals: {
'ts-jest': {
useESM: true
}
},
setupFilesAfterEnv: ['<rootDir>/tests/setup.ts'],
testTimeout: 30000,
maxWorkers: '50%',
// Performance and integration test configuration
projects: [
{
displayName: 'unit',
testMatch: ['<rootDir>/tests/unit/**/*.test.ts'],
testEnvironment: 'node'
},
{
displayName: 'integration',
testMatch: ['<rootDir>/tests/integration/**/*.test.ts'],
testEnvironment: 'node'
},
{
displayName: 'a2a-compliance',
testMatch: ['<rootDir>/tests/a2a/**/*.test.ts'],
testEnvironment: 'node'
},
{
displayName: 'streaming',
testMatch: ['<rootDir>/tests/streaming/**/*.test.ts'],
testEnvironment: 'node'
},
{
displayName: 'performance',
testMatch: ['<rootDir>/tests/**/*benchmark*.test.ts'],
testEnvironment: 'node'
}
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1'
},
testMatch: [
'**/tests/**/*.test.ts'
],
globalSetup: '<rootDir>/tests/global-setup.ts',
globalTeardown: '<rootDir>/tests/global-teardown.ts',
transformIgnorePatterns: [
'node_modules/(?!(.*\.mjs$))'
],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
globals: {
'ts-jest': {
useESM: true,
isolatedModules: true
}
}
globalTeardown: '<rootDir>/tests/global-teardown.ts'
};
Comment thread
clduab11 marked this conversation as resolved.
18 changes: 0 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -228,24 +228,6 @@
"path": "cz-conventional-changelog"
}
},
"jest": {
"preset": "ts-jest",
"testEnvironment": "node",
"collectCoverageFrom": [
"src/**/*.{js,ts}",
"!src/**/*.d.ts",
"!src/benchmarks/**/*.js",
"!src/examples/**/*.js"
],
"coverageThreshold": {
"global": {
"branches": 75,
"functions": 75,
"lines": 75,
"statements": 75
}
}
},
"browserslist": [
"node >= 18"
],
Expand Down
2 changes: 2 additions & 0 deletions src/adapters/gemini-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
} from "./base-model-adapter.js";

export interface GeminiAdapterConfig extends AdapterConfig {
model?: string;
projectId?: string;
location?: string;
generationConfig?: any;
Comment thread
clduab11 marked this conversation as resolved.
}
Comment thread
clduab11 marked this conversation as resolved.

export class GeminiAdapter extends BaseModelAdapter {
Expand Down Expand Up @@ -55,7 +57,7 @@

try {
// Transform request for Gemini API
const transformedRequest = this.transformRequest(request);

Check failure on line 60 in src/adapters/gemini-adapter.ts

View workflow job for this annotation

GitHub Actions / Deployment Readiness Check

'transformedRequest' is assigned a value but never used

Check failure on line 60 in src/adapters/gemini-adapter.ts

View workflow job for this annotation

GitHub Actions / Quick Check

'transformedRequest' is assigned a value but never used

// Mock response for TDD
const mockResponse = {
Expand Down Expand Up @@ -155,7 +157,7 @@

protected transformResponse(
response: any,
request: ModelRequest,

Check failure on line 160 in src/adapters/gemini-adapter.ts

View workflow job for this annotation

GitHub Actions / Deployment Readiness Check

'request' is defined but never used. Allowed unused args must match /^_/u

Check failure on line 160 in src/adapters/gemini-adapter.ts

View workflow job for this annotation

GitHub Actions / Quick Check

'request' is defined but never used. Allowed unused args must match /^_/u
): ModelResponse {
return {
id: this.generateRequestId(),
Expand All @@ -173,7 +175,7 @@
};
}

protected handleError(error: any, request: ModelRequest): never {

Check failure on line 178 in src/adapters/gemini-adapter.ts

View workflow job for this annotation

GitHub Actions / Deployment Readiness Check

'request' is defined but never used. Allowed unused args must match /^_/u

Check failure on line 178 in src/adapters/gemini-adapter.ts

View workflow job for this annotation

GitHub Actions / Quick Check

'request' is defined but never used. Allowed unused args must match /^_/u
const adapterError = this.createError(
error.message || "Gemini API error",
error.code || "GEMINI_ERROR",
Expand Down
2 changes: 2 additions & 0 deletions src/adapters/jules-workflow-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
export interface JulesWorkflowConfig extends AdapterConfig {
workflowId?: string;
parameters?: Record<string, any>;
collaborativeMode?: boolean;
julesApiKey?: string;
}

export class JulesWorkflowAdapter extends BaseModelAdapter {
Expand Down Expand Up @@ -155,7 +157,7 @@

protected transformResponse(
response: any,
request: ModelRequest,

Check failure on line 160 in src/adapters/jules-workflow-adapter.ts

View workflow job for this annotation

GitHub Actions / Deployment Readiness Check

'request' is defined but never used. Allowed unused args must match /^_/u

Check failure on line 160 in src/adapters/jules-workflow-adapter.ts

View workflow job for this annotation

GitHub Actions / Quick Check

'request' is defined but never used. Allowed unused args must match /^_/u
): ModelResponse {
return {
id: this.generateRequestId(),
Expand All @@ -178,7 +180,7 @@
};
}

protected handleError(error: any, request: ModelRequest): never {

Check failure on line 183 in src/adapters/jules-workflow-adapter.ts

View workflow job for this annotation

GitHub Actions / Deployment Readiness Check

'request' is defined but never used. Allowed unused args must match /^_/u

Check failure on line 183 in src/adapters/jules-workflow-adapter.ts

View workflow job for this annotation

GitHub Actions / Quick Check

'request' is defined but never used. Allowed unused args must match /^_/u
const adapterError = this.createError(
error.message || "Jules workflow error",
error.code || "WORKFLOW_ERROR",
Expand Down
5 changes: 3 additions & 2 deletions src/adapters/unified-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import {
EnhancedStreamingAPI,
EnhancedStreamingConfig,
StreamingContext,
StreamSession,
} from "../streaming/enhanced-streaming-api.js";
import {
VideoStreamRequest,
Expand All @@ -29,9 +31,8 @@
AudioStreamResponse,
MultiModalChunk,
StreamingSession,
StreamingContext,
EdgeCacheConfig,

Check failure on line 34 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Deployment Readiness Check

'EdgeCacheConfig' is defined but never used

Check failure on line 34 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Quick Check

'EdgeCacheConfig' is defined but never used
CDNConfiguration,

Check failure on line 35 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Deployment Readiness Check

'CDNConfiguration' is defined but never used

Check failure on line 35 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Quick Check

'CDNConfiguration' is defined but never used
} from "../types/streaming.js";

export interface UnifiedAPIConfig {
Expand Down Expand Up @@ -127,7 +128,7 @@

// Enhanced streaming capabilities
private streamingAPI?: EnhancedStreamingAPI;
private streamingSessions = new Map<string, StreamingSession>();
private streamingSessions = new Map<string, StreamSession>();

constructor(config: UnifiedAPIConfig) {
super();
Expand Down Expand Up @@ -963,7 +964,7 @@
});

this.emit("streaming_session_created", session);
return session;

Check failure on line 967 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Quick Global Install Validation

Type 'StreamSession' is missing the following properties from type 'StreamingSession': metadata, startTime

Check failure on line 967 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Deployment Readiness Check

Type 'StreamSession' is missing the following properties from type 'StreamingSession': metadata, startTime

Check failure on line 967 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / CLI Commands Performance

Type 'StreamSession' is missing the following properties from type 'StreamingSession': metadata, startTime

Check failure on line 967 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Performance Tests

Type 'StreamSession' is missing the following properties from type 'StreamingSession': metadata, startTime

Check failure on line 967 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Build Verification (22)

Type 'StreamSession' is missing the following properties from type 'StreamingSession': metadata, startTime

Check failure on line 967 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Memory Usage

Type 'StreamSession' is missing the following properties from type 'StreamingSession': metadata, startTime

Check failure on line 967 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Build Verification (20)

Type 'StreamSession' is missing the following properties from type 'StreamingSession': metadata, startTime

Check failure on line 967 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Startup Performance

Type 'StreamSession' is missing the following properties from type 'StreamingSession': metadata, startTime

Check failure on line 967 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Build Performance

Type 'StreamSession' is missing the following properties from type 'StreamingSession': metadata, startTime

Check failure on line 967 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Quick Check

Type 'StreamSession' is missing the following properties from type 'StreamingSession': metadata, startTime

Check failure on line 967 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Build Verification (18)

Type 'StreamSession' is missing the following properties from type 'StreamingSession': metadata, startTime

Check failure on line 967 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / CodeQL Security Analysis (typescript)

Type 'StreamSession' is missing the following properties from type 'StreamingSession': metadata, startTime
} catch (error) {
this.logger.error("Failed to create streaming session", {
sessionId,
Expand Down Expand Up @@ -1120,7 +1121,7 @@
async adaptStreamQuality(
sessionId: string,
streamId: string,
targetQuality?: any,

Check failure on line 1124 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Deployment Readiness Check

'targetQuality' is defined but never used. Allowed unused args must match /^_/u

Check failure on line 1124 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Quick Check

'targetQuality' is defined but never used. Allowed unused args must match /^_/u
): Promise<boolean> {
if (!this.streamingAPI) {
return false;
Expand Down Expand Up @@ -1277,7 +1278,7 @@
enableDataChannels: true,
enableTranscoding: true,
},
caching: {

Check failure on line 1281 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Quick Global Install Validation

Type '{ enabled: true; ttl: number; maxSize: number; purgeStrategy: string; cdnEndpoints: string[]; cacheKeys: { includeQuality: true; includeUser: false; includeSession: true; }; }' is missing the following properties from type 'EdgeCacheConfig': regions, compression, warmupEnabled

Check failure on line 1281 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Deployment Readiness Check

Type '{ enabled: true; ttl: number; maxSize: number; purgeStrategy: string; cdnEndpoints: string[]; cacheKeys: { includeQuality: true; includeUser: false; includeSession: true; }; }' is missing the following properties from type 'EdgeCacheConfig': regions, compression, warmupEnabled

Check failure on line 1281 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / CLI Commands Performance

Type '{ enabled: true; ttl: number; maxSize: number; purgeStrategy: string; cdnEndpoints: string[]; cacheKeys: { includeQuality: true; includeUser: false; includeSession: true; }; }' is missing the following properties from type 'EdgeCacheConfig': regions, compression, warmupEnabled

Check failure on line 1281 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Performance Tests

Type '{ enabled: true; ttl: number; maxSize: number; purgeStrategy: string; cdnEndpoints: string[]; cacheKeys: { includeQuality: true; includeUser: false; includeSession: true; }; }' is missing the following properties from type 'EdgeCacheConfig': regions, compression, warmupEnabled

Check failure on line 1281 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Build Verification (22)

Type '{ enabled: true; ttl: number; maxSize: number; purgeStrategy: string; cdnEndpoints: string[]; cacheKeys: { includeQuality: true; includeUser: false; includeSession: true; }; }' is missing the following properties from type 'EdgeCacheConfig': regions, compression, warmupEnabled

Check failure on line 1281 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Memory Usage

Type '{ enabled: true; ttl: number; maxSize: number; purgeStrategy: string; cdnEndpoints: string[]; cacheKeys: { includeQuality: true; includeUser: false; includeSession: true; }; }' is missing the following properties from type 'EdgeCacheConfig': regions, compression, warmupEnabled

Check failure on line 1281 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Build Verification (20)

Type '{ enabled: true; ttl: number; maxSize: number; purgeStrategy: string; cdnEndpoints: string[]; cacheKeys: { includeQuality: true; includeUser: false; includeSession: true; }; }' is missing the following properties from type 'EdgeCacheConfig': regions, compression, warmupEnabled

Check failure on line 1281 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Startup Performance

Type '{ enabled: true; ttl: number; maxSize: number; purgeStrategy: string; cdnEndpoints: string[]; cacheKeys: { includeQuality: true; includeUser: false; includeSession: true; }; }' is missing the following properties from type 'EdgeCacheConfig': regions, compression, warmupEnabled

Check failure on line 1281 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Build Performance

Type '{ enabled: true; ttl: number; maxSize: number; purgeStrategy: string; cdnEndpoints: string[]; cacheKeys: { includeQuality: true; includeUser: false; includeSession: true; }; }' is missing the following properties from type 'EdgeCacheConfig': regions, compression, warmupEnabled

Check failure on line 1281 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Quick Check

Type '{ enabled: true; ttl: number; maxSize: number; purgeStrategy: string; cdnEndpoints: string[]; cacheKeys: { includeQuality: true; includeUser: false; includeSession: true; }; }' is missing the following properties from type 'EdgeCacheConfig': regions, compression, warmupEnabled

Check failure on line 1281 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Build Verification (18)

Type '{ enabled: true; ttl: number; maxSize: number; purgeStrategy: string; cdnEndpoints: string[]; cacheKeys: { includeQuality: true; includeUser: false; includeSession: true; }; }' is missing the following properties from type 'EdgeCacheConfig': regions, compression, warmupEnabled

Check failure on line 1281 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / CodeQL Security Analysis (typescript)

Type '{ enabled: true; ttl: number; maxSize: number; purgeStrategy: string; cdnEndpoints: string[]; cacheKeys: { includeQuality: true; includeUser: false; includeSession: true; }; }' is missing the following properties from type 'EdgeCacheConfig': regions, compression, warmupEnabled
enabled: true,
ttl: 3600000, // 1 hour
maxSize: 1000000000, // 1GB
Expand All @@ -1296,7 +1297,7 @@
fallback: ["https://cdn2.example.com"],
geographic: {},
},
caching: {

Check failure on line 1300 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Quick Global Install Validation

Type '{ strategy: string; ttl: number; edgeLocations: string[]; }' is missing the following properties from type 'EdgeCacheConfig': enabled, regions, compression, warmupEnabled

Check failure on line 1300 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Deployment Readiness Check

Type '{ strategy: string; ttl: number; edgeLocations: string[]; }' is missing the following properties from type 'EdgeCacheConfig': enabled, regions, compression, warmupEnabled

Check failure on line 1300 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / CLI Commands Performance

Type '{ strategy: string; ttl: number; edgeLocations: string[]; }' is missing the following properties from type 'EdgeCacheConfig': enabled, regions, compression, warmupEnabled

Check failure on line 1300 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Performance Tests

Type '{ strategy: string; ttl: number; edgeLocations: string[]; }' is missing the following properties from type 'EdgeCacheConfig': enabled, regions, compression, warmupEnabled

Check failure on line 1300 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Build Verification (22)

Type '{ strategy: string; ttl: number; edgeLocations: string[]; }' is missing the following properties from type 'EdgeCacheConfig': enabled, regions, compression, warmupEnabled

Check failure on line 1300 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Memory Usage

Type '{ strategy: string; ttl: number; edgeLocations: string[]; }' is missing the following properties from type 'EdgeCacheConfig': enabled, regions, compression, warmupEnabled

Check failure on line 1300 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Build Verification (20)

Type '{ strategy: string; ttl: number; edgeLocations: string[]; }' is missing the following properties from type 'EdgeCacheConfig': enabled, regions, compression, warmupEnabled

Check failure on line 1300 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Startup Performance

Type '{ strategy: string; ttl: number; edgeLocations: string[]; }' is missing the following properties from type 'EdgeCacheConfig': enabled, regions, compression, warmupEnabled

Check failure on line 1300 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Build Performance

Type '{ strategy: string; ttl: number; edgeLocations: string[]; }' is missing the following properties from type 'EdgeCacheConfig': enabled, regions, compression, warmupEnabled

Check failure on line 1300 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Quick Check

Type '{ strategy: string; ttl: number; edgeLocations: string[]; }' is missing the following properties from type 'EdgeCacheConfig': enabled, regions, compression, warmupEnabled

Check failure on line 1300 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Build Verification (18)

Type '{ strategy: string; ttl: number; edgeLocations: string[]; }' is missing the following properties from type 'EdgeCacheConfig': enabled, regions, compression, warmupEnabled

Check failure on line 1300 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / CodeQL Security Analysis (typescript)

Type '{ strategy: string; ttl: number; edgeLocations: string[]; }' is missing the following properties from type 'EdgeCacheConfig': enabled, regions, compression, warmupEnabled
strategy: "adaptive",
ttl: 3600000,
edgeLocations: ["us-east", "eu-west", "ap-southeast"],
Expand All @@ -1310,7 +1311,7 @@
},
synchronization: {
enabled: true,
tolerance: 50,

Check failure on line 1314 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Quick Global Install Validation

Object literal may only specify known properties, and 'tolerance' does not exist in type 'SynchronizationConfig'.

Check failure on line 1314 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Deployment Readiness Check

Object literal may only specify known properties, and 'tolerance' does not exist in type 'SynchronizationConfig'.

Check failure on line 1314 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / CLI Commands Performance

Object literal may only specify known properties, and 'tolerance' does not exist in type 'SynchronizationConfig'.

Check failure on line 1314 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Performance Tests

Object literal may only specify known properties, and 'tolerance' does not exist in type 'SynchronizationConfig'.

Check failure on line 1314 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Build Verification (22)

Object literal may only specify known properties, and 'tolerance' does not exist in type 'SynchronizationConfig'.

Check failure on line 1314 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Memory Usage

Object literal may only specify known properties, and 'tolerance' does not exist in type 'SynchronizationConfig'.

Check failure on line 1314 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Build Verification (20)

Object literal may only specify known properties, and 'tolerance' does not exist in type 'SynchronizationConfig'.

Check failure on line 1314 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Startup Performance

Object literal may only specify known properties, and 'tolerance' does not exist in type 'SynchronizationConfig'.

Check failure on line 1314 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Build Performance

Object literal may only specify known properties, and 'tolerance' does not exist in type 'SynchronizationConfig'.

Check failure on line 1314 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Quick Check

Object literal may only specify known properties, and 'tolerance' does not exist in type 'SynchronizationConfig'.

Check failure on line 1314 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / Build Verification (18)

Object literal may only specify known properties, and 'tolerance' does not exist in type 'SynchronizationConfig'.

Check failure on line 1314 in src/adapters/unified-api.ts

View workflow job for this annotation

GitHub Actions / CodeQL Security Analysis (typescript)

Object literal may only specify known properties, and 'tolerance' does not exist in type 'SynchronizationConfig'.
maxDrift: 200,
resyncThreshold: 500,
method: "rtp",
Expand Down
19 changes: 8 additions & 11 deletions src/services/quantum-classical-hybrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
validated: boolean;
predictionErrors?: number;
testFailures?: number;
validationErrors?: number;
}

export interface HybridResult {
Expand Down Expand Up @@ -1578,17 +1579,13 @@
}
case "RZ": {
const theta = gate.parameters![0];
const exp_pos = {
amplitude: Math.cos(theta / 2),
phase: Math.sin(theta / 2),
};
const exp_neg = {
amplitude: Math.cos(theta / 2),
phase: -Math.sin(theta / 2),
};
const cos = Math.cos(theta / 2);
const sin = Math.sin(theta / 2);
// For RZ gate, this is a diagonal matrix with complex exponentials
// Simplifying to just the magnitude for now
return [
[exp_neg, 0],
[0, exp_pos],
[cos, 0],
[0, cos],
Comment thread
clduab11 marked this conversation as resolved.
Comment thread
clduab11 marked this conversation as resolved.
];
Comment thread
clduab11 marked this conversation as resolved.
}
default:
Expand Down Expand Up @@ -1654,7 +1651,7 @@
return expectation;
}

private encodeClassicalData(
public encodeClassicalData(
circuit: QuantumCircuit,
data: number[],
startQubit: number,
Expand Down Expand Up @@ -2775,7 +2772,7 @@

for (const problem of problems) {
const startTime = Date.now();
const result = await this.quantumService.detectQuantumAdvantage(problem);

Check failure on line 2775 in src/services/quantum-classical-hybrid.ts

View workflow job for this annotation

GitHub Actions / Quick Global Install Validation

Argument of type '{ type: string; size: number; parameters: { costFunction: (x: number[]) => number; trainingData?: undefined; layers?: undefined; epochs?: undefined; }; } | { type: string; size: number; parameters: { costFunction?: undefined; trainingData?: undefined; layers?: undefined; epochs?: undefined; }; } | { ...; }' is not assignable to parameter of type '{ type: "optimization" | "sampling" | "machine_learning" | "simulation"; size: number; parameters: any; }'.

Check failure on line 2775 in src/services/quantum-classical-hybrid.ts

View workflow job for this annotation

GitHub Actions / CLI Commands Performance

Argument of type '{ type: string; size: number; parameters: { costFunction: (x: number[]) => number; trainingData?: undefined; layers?: undefined; epochs?: undefined; }; } | { type: string; size: number; parameters: { costFunction?: undefined; trainingData?: undefined; layers?: undefined; epochs?: undefined; }; } | { ...; }' is not assignable to parameter of type '{ type: "optimization" | "sampling" | "machine_learning" | "simulation"; size: number; parameters: any; }'.

Check failure on line 2775 in src/services/quantum-classical-hybrid.ts

View workflow job for this annotation

GitHub Actions / Performance Tests

Argument of type '{ type: string; size: number; parameters: { costFunction: (x: number[]) => number; trainingData?: undefined; layers?: undefined; epochs?: undefined; }; } | { type: string; size: number; parameters: { costFunction?: undefined; trainingData?: undefined; layers?: undefined; epochs?: undefined; }; } | { ...; }' is not assignable to parameter of type '{ type: "optimization" | "sampling" | "machine_learning" | "simulation"; size: number; parameters: any; }'.

Check failure on line 2775 in src/services/quantum-classical-hybrid.ts

View workflow job for this annotation

GitHub Actions / Memory Usage

Argument of type '{ type: string; size: number; parameters: { costFunction: (x: number[]) => number; trainingData?: undefined; layers?: undefined; epochs?: undefined; }; } | { type: string; size: number; parameters: { costFunction?: undefined; trainingData?: undefined; layers?: undefined; epochs?: undefined; }; } | { ...; }' is not assignable to parameter of type '{ type: "optimization" | "sampling" | "machine_learning" | "simulation"; size: number; parameters: any; }'.

Check failure on line 2775 in src/services/quantum-classical-hybrid.ts

View workflow job for this annotation

GitHub Actions / Startup Performance

Argument of type '{ type: string; size: number; parameters: { costFunction: (x: number[]) => number; trainingData?: undefined; layers?: undefined; epochs?: undefined; }; } | { type: string; size: number; parameters: { costFunction?: undefined; trainingData?: undefined; layers?: undefined; epochs?: undefined; }; } | { ...; }' is not assignable to parameter of type '{ type: "optimization" | "sampling" | "machine_learning" | "simulation"; size: number; parameters: any; }'.

Check failure on line 2775 in src/services/quantum-classical-hybrid.ts

View workflow job for this annotation

GitHub Actions / Build Performance

Argument of type '{ type: string; size: number; parameters: { costFunction: (x: number[]) => number; trainingData?: undefined; layers?: undefined; epochs?: undefined; }; } | { type: string; size: number; parameters: { costFunction?: undefined; trainingData?: undefined; layers?: undefined; epochs?: undefined; }; } | { ...; }' is not assignable to parameter of type '{ type: "optimization" | "sampling" | "machine_learning" | "simulation"; size: number; parameters: any; }'.

Check failure on line 2775 in src/services/quantum-classical-hybrid.ts

View workflow job for this annotation

GitHub Actions / CodeQL Security Analysis (typescript)

Argument of type '{ type: string; size: number; parameters: { costFunction: (x: number[]) => number; trainingData?: undefined; layers?: undefined; epochs?: undefined; }; } | { type: string; size: number; parameters: { costFunction?: undefined; trainingData?: undefined; layers?: undefined; epochs?: undefined; }; } | { ...; }' is not assignable to parameter of type '{ type: "optimization" | "sampling" | "machine_learning" | "simulation"; size: number; parameters: any; }'.
const totalTime = Date.now() - startTime;

advantageResults[problem.type] = {
Expand Down Expand Up @@ -2804,7 +2801,7 @@
const portfolioScore = results.portfolioOptimization.optimality || 0;
const drugScore = results.drugDiscovery.bindingAccuracy || 0;
const mappingScore =
Object.values(results.featureMapping).reduce(

Check failure on line 2804 in src/services/quantum-classical-hybrid.ts

View workflow job for this annotation

GitHub Actions / Quick Global Install Validation

The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.

Check failure on line 2804 in src/services/quantum-classical-hybrid.ts

View workflow job for this annotation

GitHub Actions / CLI Commands Performance

The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.

Check failure on line 2804 in src/services/quantum-classical-hybrid.ts

View workflow job for this annotation

GitHub Actions / Performance Tests

The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.

Check failure on line 2804 in src/services/quantum-classical-hybrid.ts

View workflow job for this annotation

GitHub Actions / Memory Usage

The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.

Check failure on line 2804 in src/services/quantum-classical-hybrid.ts

View workflow job for this annotation

GitHub Actions / Startup Performance

The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.

Check failure on line 2804 in src/services/quantum-classical-hybrid.ts

View workflow job for this annotation

GitHub Actions / Build Performance

The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.

Check failure on line 2804 in src/services/quantum-classical-hybrid.ts

View workflow job for this annotation

GitHub Actions / CodeQL Security Analysis (typescript)

The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
(sum: number, mapping: any) => sum + mapping.efficiency,
0,
) / Object.keys(results.featureMapping).length;
Expand Down Expand Up @@ -2853,7 +2850,7 @@
}

const avgMappingEfficiency =
Object.values(results.featureMapping).reduce(

Check failure on line 2853 in src/services/quantum-classical-hybrid.ts

View workflow job for this annotation

GitHub Actions / Quick Global Install Validation

The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.

Check failure on line 2853 in src/services/quantum-classical-hybrid.ts

View workflow job for this annotation

GitHub Actions / CLI Commands Performance

The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.

Check failure on line 2853 in src/services/quantum-classical-hybrid.ts

View workflow job for this annotation

GitHub Actions / Performance Tests

The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.

Check failure on line 2853 in src/services/quantum-classical-hybrid.ts

View workflow job for this annotation

GitHub Actions / Memory Usage

The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.

Check failure on line 2853 in src/services/quantum-classical-hybrid.ts

View workflow job for this annotation

GitHub Actions / Startup Performance

The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.

Check failure on line 2853 in src/services/quantum-classical-hybrid.ts

View workflow job for this annotation

GitHub Actions / Build Performance

The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.

Check failure on line 2853 in src/services/quantum-classical-hybrid.ts

View workflow job for this annotation

GitHub Actions / CodeQL Security Analysis (typescript)

The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
(sum: number, mapping: any) => sum + mapping.efficiency,
0,
) / Object.keys(results.featureMapping).length;
Expand Down
10 changes: 6 additions & 4 deletions src/streaming/quality-adaptation-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,8 @@ export class QualityAdaptationEngine extends EventEmitter {

// Network degradation
if (conditions.quality.packetLoss > 0.05) return true;
if (conditions.latency.rtt > 300) return true;
if (conditions.bandwidth.available < context.currentQuality.bandwidth * 0.8)
if ((conditions.latency as any).rtt > 300) return true;
if ((conditions.bandwidth as any).available < context.currentQuality.bandwidth * 0.8)
Comment on lines +412 to +413
Copy link

Copilot AI Sep 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using as any defeats the purpose of TypeScript's type safety. Consider creating proper type guards or helper functions to safely access these union type properties.

Copilot uses AI. Check for mistakes.
return true;
Comment thread
clduab11 marked this conversation as resolved.

// Performance issues
Expand All @@ -424,7 +424,7 @@ export class QualityAdaptationEngine extends EventEmitter {

// Improvement opportunity
if (
conditions.bandwidth.available > context.currentQuality.bandwidth * 1.5 &&
(conditions.bandwidth as any).available > context.currentQuality.bandwidth * 1.5 &&
context.userPreferences.autoAdjust
)
return true;
Expand Down Expand Up @@ -622,7 +622,7 @@ export class QualityAdaptationEngine extends EventEmitter {
const sortedLadder = [...ladder].sort((a, b) => a.bandwidth - b.bandwidth);

// Select based on available bandwidth with safety margin
const availableBandwidth = conditions.bandwidth.available * 0.8; // 20% safety margin
const availableBandwidth = (conditions.bandwidth as any).available * 0.8; // 20% safety margin

for (let i = sortedLadder.length - 1; i >= 0; i--) {
const quality = sortedLadder[i];
Expand Down Expand Up @@ -882,6 +882,8 @@ class NetworkMonitor {
private conditions: NetworkConditions = {
bandwidth: { upload: 0, download: 0, available: 0 },
latency: { rtt: 0, jitter: 0 },
jitter: 0,
packetLoss: 0,
quality: { packetLoss: 0, stability: 1, congestion: 0 },
timestamp: Date.now(),
};
Expand Down
10 changes: 6 additions & 4 deletions src/streaming/webrtc-architecture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -769,23 +769,25 @@ class PerformanceMonitor {
const conditions: NetworkConditions = {
bandwidth: { upload: 0, download: 0, available: 0 },
latency: { rtt: 0, jitter: 0 },
jitter: 0,
packetLoss: 0,
quality: { packetLoss: 0, stability: 1, congestion: 0 },
Comment thread
clduab11 marked this conversation as resolved.
timestamp: Date.now(),
};

stats.forEach((report) => {
if (report.type === "candidate-pair" && report.state === "succeeded") {
conditions.latency.rtt = report.currentRoundTripTime * 1000;
(conditions.latency as { rtt: number; jitter: number }).rtt = report.currentRoundTripTime * 1000;
Comment thread
clduab11 marked this conversation as resolved.
}

if (report.type === "inbound-rtp") {
conditions.quality.packetLoss =
conditions.quality!.packetLoss =
report.packetsLost / (report.packetsLost + report.packetsReceived);
conditions.latency.jitter = report.jitter;
(conditions.latency as { rtt: number; jitter: number }).jitter = report.jitter;
}
Comment thread
clduab11 marked this conversation as resolved.

if (report.type === "outbound-rtp") {
conditions.bandwidth.upload = (report.bytesSent / report.timestamp) * 8;
(conditions.bandwidth as { upload: number; download: number; available: number }).upload = (report.bytesSent / report.timestamp) * 8;
}
Comment thread
clduab11 marked this conversation as resolved.
});
Comment thread
clduab11 marked this conversation as resolved.

Expand Down
2 changes: 2 additions & 0 deletions src/types/base-adapters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,6 @@ export interface JulesWorkflowConfig extends BaseAdapterConfig {
modelName: string;
workflowId?: string;
parameters?: Record<string, any>;
collaborativeMode?: boolean;
julesApiKey?: string;
}
Loading
Loading