@neuralforge/model-hub 0.9.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/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@neuralforge/model-hub",
3
+ "version": "0.9.0",
4
+ "description": "Model hub SDK",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc",
9
+ "test": "vitest",
10
+ "lint": "eslint src/"
11
+ },
12
+ "dependencies": {
13
+ "typescript": "^5.4.0",
14
+ "node-fetch": "^3.3.0"
15
+ },
16
+ "devDependencies": {
17
+ "vitest": "^1.6.0",
18
+ "eslint": "^8.57.0"
19
+ }
20
+ }
package/src/auth.ts ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Authentication
3
+ */
4
+
5
+ export async function authenticate(token: string): Promise<boolean> { return token.length > 0; }
6
+ export function getToken(): string | null { return process.env.NF_TOKEN || null; }
7
+
package/src/cache.ts ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Cache management
3
+ */
4
+
5
+ import * as os from 'os';
6
+ import * as path from 'path';
7
+ export function getCacheDir(): string { return path.join(os.homedir(), '.cache', 'neuralforge'); }
8
+
package/src/client.ts ADDED
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Hub API client
3
+ */
4
+
5
+ export interface HubConfig {
6
+ baseUrl: string;
7
+ token?: string;
8
+ }
9
+
10
+ export class HubClient {
11
+ private config: HubConfig;
12
+
13
+ constructor(config: HubConfig) {
14
+ this.config = config;
15
+ }
16
+
17
+ async listModels(query?: string): Promise<string[]> { return []; }
18
+ async getModel(id: string): Promise<any> { return null; }
19
+ async downloadModel(id: string, outDir: string): Promise<string> { return outDir; }
20
+ async uploadModel(path: string, repoId: string): Promise<void> {}
21
+ }
22
+
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Model download
3
+ */
4
+
5
+ export async function downloadModel(modelId: string, revision?: string): Promise<string> { return `/models/${modelId}`; }
6
+
package/src/index.ts ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Hub SDK
3
+ */
4
+
5
+ export { HubClient } from './client';
6
+ export { authenticate } from './auth';
7
+
package/src/upload.ts ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Model upload
3
+ */
4
+
5
+ export async function uploadModel(path: string, repoId: string): Promise<void> {}
6
+
@@ -0,0 +1,13 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { HubClient } from '../src';
3
+
4
+ describe('HubClient', () => {
5
+ it('should be defined', () => {
6
+ expect(HubClient).toBeDefined();
7
+ });
8
+
9
+ it('should initialize correctly', () => {
10
+ const instance = new HubClient();
11
+ expect(instance).toBeInstanceOf(HubClient);
12
+ });
13
+ });
package/tsconfig.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "outDir": "dist",
5
+ "rootDir": "src"
6
+ }
7
+ }