noosphere 0.5.0 → 0.8.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/dist/index.d.cts CHANGED
@@ -1,4 +1,18 @@
1
- type Modality = 'llm' | 'image' | 'video' | 'tts';
1
+ type Modality = 'llm' | 'image' | 'video' | 'tts' | 'stt' | 'music' | 'embedding';
2
+ type ModelStatus = 'installed' | 'available' | 'downloading' | 'running' | 'error';
3
+ interface LocalModelInfo {
4
+ sizeBytes: number;
5
+ family?: string;
6
+ parameterSize?: string;
7
+ quantization?: string;
8
+ format?: string;
9
+ digest?: string;
10
+ modifiedAt?: string;
11
+ running?: boolean;
12
+ vramRequired?: number;
13
+ diskPath?: string;
14
+ runtime: string;
15
+ }
2
16
  interface BaseOptions {
3
17
  provider?: string;
4
18
  model?: string;
@@ -78,6 +92,7 @@ interface ModelInfo {
78
92
  id: string;
79
93
  provider: string;
80
94
  name: string;
95
+ description?: string;
81
96
  modality: Modality;
82
97
  local: boolean;
83
98
  cost: {
@@ -85,6 +100,8 @@ interface ModelInfo {
85
100
  unit: string;
86
101
  };
87
102
  logo?: ProviderLogo$1;
103
+ status?: ModelStatus;
104
+ localInfo?: LocalModelInfo;
88
105
  capabilities?: {
89
106
  contextWindow?: number;
90
107
  maxTokens?: number;
@@ -202,6 +219,25 @@ interface NoosphereConfig {
202
219
  };
203
220
  onUsage?: (usage: UsageEvent) => void | Promise<void>;
204
221
  }
222
+ interface TranscriptionOptions extends BaseOptions {
223
+ audio: string;
224
+ language?: string;
225
+ task?: 'transcribe' | 'translate';
226
+ }
227
+ interface TranscriptionResult {
228
+ text: string;
229
+ language: string;
230
+ duration: number;
231
+ segments?: Array<{
232
+ start: number;
233
+ end: number;
234
+ text: string;
235
+ }>;
236
+ }
237
+ interface MusicOptions extends BaseOptions {
238
+ prompt: string;
239
+ duration?: number;
240
+ }
205
241
 
206
242
  interface NoosphereProvider {
207
243
  readonly id: string;
@@ -218,6 +254,54 @@ interface NoosphereProvider {
218
254
  dispose?(): Promise<void>;
219
255
  }
220
256
 
257
+ interface OllamaPullProgress {
258
+ status: string;
259
+ digest?: string;
260
+ total?: number;
261
+ completed?: number;
262
+ }
263
+ interface OllamaModelDetail {
264
+ modelfile: string;
265
+ parameters: string;
266
+ template: string;
267
+ details: {
268
+ parent_model: string;
269
+ format: string;
270
+ family: string;
271
+ families: string[];
272
+ parameter_size: string;
273
+ quantization_level: string;
274
+ };
275
+ }
276
+ interface OllamaRunningModel {
277
+ name: string;
278
+ model: string;
279
+ size: number;
280
+ digest: string;
281
+ expires_at: string;
282
+ size_vram: number;
283
+ }
284
+ declare class OllamaProvider implements NoosphereProvider {
285
+ readonly id = "ollama";
286
+ readonly name = "Ollama (Local)";
287
+ readonly modalities: Modality[];
288
+ readonly isLocal = true;
289
+ private baseUrl;
290
+ constructor(config?: {
291
+ host?: string;
292
+ port?: number;
293
+ });
294
+ ping(): Promise<boolean>;
295
+ listModels(_modality?: Modality): Promise<ModelInfo[]>;
296
+ private toModelInfo;
297
+ chat(options: ChatOptions): Promise<NoosphereResult>;
298
+ stream(options: ChatOptions): NoosphereStream;
299
+ pullModel(name: string): AsyncGenerator<OllamaPullProgress>;
300
+ deleteModel(name: string): Promise<void>;
301
+ showModel(name: string): Promise<OllamaModelDetail>;
302
+ getRunningModels(): Promise<OllamaRunningModel[]>;
303
+ }
304
+
221
305
  declare class Noosphere {
222
306
  private config;
223
307
  private registry;
@@ -234,8 +318,14 @@ declare class Noosphere {
234
318
  getProviders(modality?: Modality): Promise<ProviderInfo[]>;
235
319
  getModels(modality?: Modality): Promise<ModelInfo[]>;
236
320
  getModel(provider: string, modelId: string): Promise<ModelInfo | null>;
237
- syncModels(): Promise<SyncResult>;
321
+ syncModels(modality?: Modality): Promise<SyncResult>;
238
322
  getUsage(options?: UsageQueryOptions): UsageSummary;
323
+ installModel(name: string): Promise<AsyncGenerator<OllamaPullProgress>>;
324
+ uninstallModel(name: string): Promise<void>;
325
+ getHardware(): Promise<{
326
+ ollama: boolean;
327
+ runningModels: OllamaRunningModel[];
328
+ }>;
239
329
  dispose(): Promise<void>;
240
330
  private init;
241
331
  private resolveProviderForModality;
@@ -260,6 +350,63 @@ declare class NoosphereError extends Error {
260
350
  isRetryable(): boolean;
261
351
  }
262
352
 
353
+ declare class HfLocalProvider implements NoosphereProvider {
354
+ readonly id = "hf-local";
355
+ readonly name = "HuggingFace Local Models";
356
+ readonly modalities: Modality[];
357
+ readonly isLocal = true;
358
+ private cachedModels;
359
+ ping(): Promise<boolean>;
360
+ listModels(modality?: Modality): Promise<ModelInfo[]>;
361
+ private fetchCatalog;
362
+ private scanLocalCache;
363
+ }
364
+
365
+ declare class WhisperLocalProvider implements NoosphereProvider {
366
+ readonly id = "whisper-local";
367
+ readonly name = "Whisper (Local)";
368
+ readonly modalities: Modality[];
369
+ readonly isLocal = true;
370
+ private runtime;
371
+ ping(): Promise<boolean>;
372
+ private detectRuntime;
373
+ listModels(_modality?: Modality): Promise<ModelInfo[]>;
374
+ private isModelCached;
375
+ transcribe(options: TranscriptionOptions): Promise<TranscriptionResult>;
376
+ }
377
+
378
+ declare class AudioCraftProvider implements NoosphereProvider {
379
+ readonly id = "audiocraft";
380
+ readonly name = "AudioCraft (Local)";
381
+ readonly modalities: Modality[];
382
+ readonly isLocal = true;
383
+ private detected;
384
+ ping(): Promise<boolean>;
385
+ listModels(_modality?: Modality): Promise<ModelInfo[]>;
386
+ }
387
+
388
+ interface OpenAICompatConfig {
389
+ baseUrl: string;
390
+ apiKey?: string;
391
+ name?: string;
392
+ id?: string;
393
+ }
394
+ declare class OpenAICompatProvider implements NoosphereProvider {
395
+ readonly id: string;
396
+ readonly name: string;
397
+ readonly modalities: Modality[];
398
+ readonly isLocal = true;
399
+ private baseUrl;
400
+ private headers;
401
+ constructor(config: OpenAICompatConfig);
402
+ ping(): Promise<boolean>;
403
+ listModels(_modality?: Modality): Promise<ModelInfo[]>;
404
+ chat(options: ChatOptions): Promise<NoosphereResult>;
405
+ stream(options: ChatOptions): NoosphereStream;
406
+ }
407
+ /** Auto-detect running OpenAI-compatible servers on common ports */
408
+ declare function detectOpenAICompatServers(): Promise<OpenAICompatProvider[]>;
409
+
263
410
  interface ProviderLogo {
264
411
  svg?: string;
265
412
  png?: string;
@@ -278,4 +425,4 @@ declare function getProviderLogo(providerId: string | undefined | null): Provide
278
425
  declare function getAllProviderLogos(): Record<string, ProviderLogo>;
279
426
  declare const PROVIDER_LOGOS: Record<string, ProviderLogo>;
280
427
 
281
- export { type BaseOptions, type ChatOptions, type ImageOptions, type LocalServiceConfig, type Modality, type ModelInfo, Noosphere, type NoosphereConfig, NoosphereError, type NoosphereErrorCode, type NoosphereProvider, type NoosphereResult, type NoosphereStream, PROVIDER_IDS, PROVIDER_LOGOS, type ProviderInfo, type ProviderLogo$1 as ProviderLogo, type SpeakOptions, type StreamEvent, type SyncResult, type UsageEvent, type UsageQueryOptions, type UsageSummary, type VideoOptions, getAllProviderLogos, getProviderLogo };
428
+ export { AudioCraftProvider, type BaseOptions, type ChatOptions, HfLocalProvider, type ImageOptions, type LocalModelInfo, type LocalServiceConfig, type Modality, type ModelInfo, type ModelStatus, type MusicOptions, Noosphere, type NoosphereConfig, NoosphereError, type NoosphereErrorCode, type NoosphereProvider, type NoosphereResult, type NoosphereStream, type OllamaModelDetail, OllamaProvider, type OllamaPullProgress, type OllamaRunningModel, type OpenAICompatConfig, OpenAICompatProvider, PROVIDER_IDS, PROVIDER_LOGOS, type ProviderInfo, type ProviderLogo$1 as ProviderLogo, type SpeakOptions, type StreamEvent, type SyncResult, type TranscriptionOptions, type TranscriptionResult, type UsageEvent, type UsageQueryOptions, type UsageSummary, type VideoOptions, WhisperLocalProvider, detectOpenAICompatServers, getAllProviderLogos, getProviderLogo };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,18 @@
1
- type Modality = 'llm' | 'image' | 'video' | 'tts';
1
+ type Modality = 'llm' | 'image' | 'video' | 'tts' | 'stt' | 'music' | 'embedding';
2
+ type ModelStatus = 'installed' | 'available' | 'downloading' | 'running' | 'error';
3
+ interface LocalModelInfo {
4
+ sizeBytes: number;
5
+ family?: string;
6
+ parameterSize?: string;
7
+ quantization?: string;
8
+ format?: string;
9
+ digest?: string;
10
+ modifiedAt?: string;
11
+ running?: boolean;
12
+ vramRequired?: number;
13
+ diskPath?: string;
14
+ runtime: string;
15
+ }
2
16
  interface BaseOptions {
3
17
  provider?: string;
4
18
  model?: string;
@@ -78,6 +92,7 @@ interface ModelInfo {
78
92
  id: string;
79
93
  provider: string;
80
94
  name: string;
95
+ description?: string;
81
96
  modality: Modality;
82
97
  local: boolean;
83
98
  cost: {
@@ -85,6 +100,8 @@ interface ModelInfo {
85
100
  unit: string;
86
101
  };
87
102
  logo?: ProviderLogo$1;
103
+ status?: ModelStatus;
104
+ localInfo?: LocalModelInfo;
88
105
  capabilities?: {
89
106
  contextWindow?: number;
90
107
  maxTokens?: number;
@@ -202,6 +219,25 @@ interface NoosphereConfig {
202
219
  };
203
220
  onUsage?: (usage: UsageEvent) => void | Promise<void>;
204
221
  }
222
+ interface TranscriptionOptions extends BaseOptions {
223
+ audio: string;
224
+ language?: string;
225
+ task?: 'transcribe' | 'translate';
226
+ }
227
+ interface TranscriptionResult {
228
+ text: string;
229
+ language: string;
230
+ duration: number;
231
+ segments?: Array<{
232
+ start: number;
233
+ end: number;
234
+ text: string;
235
+ }>;
236
+ }
237
+ interface MusicOptions extends BaseOptions {
238
+ prompt: string;
239
+ duration?: number;
240
+ }
205
241
 
206
242
  interface NoosphereProvider {
207
243
  readonly id: string;
@@ -218,6 +254,54 @@ interface NoosphereProvider {
218
254
  dispose?(): Promise<void>;
219
255
  }
220
256
 
257
+ interface OllamaPullProgress {
258
+ status: string;
259
+ digest?: string;
260
+ total?: number;
261
+ completed?: number;
262
+ }
263
+ interface OllamaModelDetail {
264
+ modelfile: string;
265
+ parameters: string;
266
+ template: string;
267
+ details: {
268
+ parent_model: string;
269
+ format: string;
270
+ family: string;
271
+ families: string[];
272
+ parameter_size: string;
273
+ quantization_level: string;
274
+ };
275
+ }
276
+ interface OllamaRunningModel {
277
+ name: string;
278
+ model: string;
279
+ size: number;
280
+ digest: string;
281
+ expires_at: string;
282
+ size_vram: number;
283
+ }
284
+ declare class OllamaProvider implements NoosphereProvider {
285
+ readonly id = "ollama";
286
+ readonly name = "Ollama (Local)";
287
+ readonly modalities: Modality[];
288
+ readonly isLocal = true;
289
+ private baseUrl;
290
+ constructor(config?: {
291
+ host?: string;
292
+ port?: number;
293
+ });
294
+ ping(): Promise<boolean>;
295
+ listModels(_modality?: Modality): Promise<ModelInfo[]>;
296
+ private toModelInfo;
297
+ chat(options: ChatOptions): Promise<NoosphereResult>;
298
+ stream(options: ChatOptions): NoosphereStream;
299
+ pullModel(name: string): AsyncGenerator<OllamaPullProgress>;
300
+ deleteModel(name: string): Promise<void>;
301
+ showModel(name: string): Promise<OllamaModelDetail>;
302
+ getRunningModels(): Promise<OllamaRunningModel[]>;
303
+ }
304
+
221
305
  declare class Noosphere {
222
306
  private config;
223
307
  private registry;
@@ -234,8 +318,14 @@ declare class Noosphere {
234
318
  getProviders(modality?: Modality): Promise<ProviderInfo[]>;
235
319
  getModels(modality?: Modality): Promise<ModelInfo[]>;
236
320
  getModel(provider: string, modelId: string): Promise<ModelInfo | null>;
237
- syncModels(): Promise<SyncResult>;
321
+ syncModels(modality?: Modality): Promise<SyncResult>;
238
322
  getUsage(options?: UsageQueryOptions): UsageSummary;
323
+ installModel(name: string): Promise<AsyncGenerator<OllamaPullProgress>>;
324
+ uninstallModel(name: string): Promise<void>;
325
+ getHardware(): Promise<{
326
+ ollama: boolean;
327
+ runningModels: OllamaRunningModel[];
328
+ }>;
239
329
  dispose(): Promise<void>;
240
330
  private init;
241
331
  private resolveProviderForModality;
@@ -260,6 +350,63 @@ declare class NoosphereError extends Error {
260
350
  isRetryable(): boolean;
261
351
  }
262
352
 
353
+ declare class HfLocalProvider implements NoosphereProvider {
354
+ readonly id = "hf-local";
355
+ readonly name = "HuggingFace Local Models";
356
+ readonly modalities: Modality[];
357
+ readonly isLocal = true;
358
+ private cachedModels;
359
+ ping(): Promise<boolean>;
360
+ listModels(modality?: Modality): Promise<ModelInfo[]>;
361
+ private fetchCatalog;
362
+ private scanLocalCache;
363
+ }
364
+
365
+ declare class WhisperLocalProvider implements NoosphereProvider {
366
+ readonly id = "whisper-local";
367
+ readonly name = "Whisper (Local)";
368
+ readonly modalities: Modality[];
369
+ readonly isLocal = true;
370
+ private runtime;
371
+ ping(): Promise<boolean>;
372
+ private detectRuntime;
373
+ listModels(_modality?: Modality): Promise<ModelInfo[]>;
374
+ private isModelCached;
375
+ transcribe(options: TranscriptionOptions): Promise<TranscriptionResult>;
376
+ }
377
+
378
+ declare class AudioCraftProvider implements NoosphereProvider {
379
+ readonly id = "audiocraft";
380
+ readonly name = "AudioCraft (Local)";
381
+ readonly modalities: Modality[];
382
+ readonly isLocal = true;
383
+ private detected;
384
+ ping(): Promise<boolean>;
385
+ listModels(_modality?: Modality): Promise<ModelInfo[]>;
386
+ }
387
+
388
+ interface OpenAICompatConfig {
389
+ baseUrl: string;
390
+ apiKey?: string;
391
+ name?: string;
392
+ id?: string;
393
+ }
394
+ declare class OpenAICompatProvider implements NoosphereProvider {
395
+ readonly id: string;
396
+ readonly name: string;
397
+ readonly modalities: Modality[];
398
+ readonly isLocal = true;
399
+ private baseUrl;
400
+ private headers;
401
+ constructor(config: OpenAICompatConfig);
402
+ ping(): Promise<boolean>;
403
+ listModels(_modality?: Modality): Promise<ModelInfo[]>;
404
+ chat(options: ChatOptions): Promise<NoosphereResult>;
405
+ stream(options: ChatOptions): NoosphereStream;
406
+ }
407
+ /** Auto-detect running OpenAI-compatible servers on common ports */
408
+ declare function detectOpenAICompatServers(): Promise<OpenAICompatProvider[]>;
409
+
263
410
  interface ProviderLogo {
264
411
  svg?: string;
265
412
  png?: string;
@@ -278,4 +425,4 @@ declare function getProviderLogo(providerId: string | undefined | null): Provide
278
425
  declare function getAllProviderLogos(): Record<string, ProviderLogo>;
279
426
  declare const PROVIDER_LOGOS: Record<string, ProviderLogo>;
280
427
 
281
- export { type BaseOptions, type ChatOptions, type ImageOptions, type LocalServiceConfig, type Modality, type ModelInfo, Noosphere, type NoosphereConfig, NoosphereError, type NoosphereErrorCode, type NoosphereProvider, type NoosphereResult, type NoosphereStream, PROVIDER_IDS, PROVIDER_LOGOS, type ProviderInfo, type ProviderLogo$1 as ProviderLogo, type SpeakOptions, type StreamEvent, type SyncResult, type UsageEvent, type UsageQueryOptions, type UsageSummary, type VideoOptions, getAllProviderLogos, getProviderLogo };
428
+ export { AudioCraftProvider, type BaseOptions, type ChatOptions, HfLocalProvider, type ImageOptions, type LocalModelInfo, type LocalServiceConfig, type Modality, type ModelInfo, type ModelStatus, type MusicOptions, Noosphere, type NoosphereConfig, NoosphereError, type NoosphereErrorCode, type NoosphereProvider, type NoosphereResult, type NoosphereStream, type OllamaModelDetail, OllamaProvider, type OllamaPullProgress, type OllamaRunningModel, type OpenAICompatConfig, OpenAICompatProvider, PROVIDER_IDS, PROVIDER_LOGOS, type ProviderInfo, type ProviderLogo$1 as ProviderLogo, type SpeakOptions, type StreamEvent, type SyncResult, type TranscriptionOptions, type TranscriptionResult, type UsageEvent, type UsageQueryOptions, type UsageSummary, type VideoOptions, WhisperLocalProvider, detectOpenAICompatServers, getAllProviderLogos, getProviderLogo };