forkit-connect 0.1.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/QUICKSTART.md +55 -0
- package/README.md +96 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +4724 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +21 -0
- package/dist/launcher.d.ts +33 -0
- package/dist/launcher.js +9344 -0
- package/dist/ps-list-loader.d.ts +5 -0
- package/dist/ps-list-loader.js +20 -0
- package/dist/v1/agent-observation.d.ts +42 -0
- package/dist/v1/agent-observation.js +499 -0
- package/dist/v1/api.d.ts +276 -0
- package/dist/v1/api.js +390 -0
- package/dist/v1/credential-store.d.ts +92 -0
- package/dist/v1/credential-store.js +797 -0
- package/dist/v1/currency.d.ts +41 -0
- package/dist/v1/currency.js +127 -0
- package/dist/v1/daemon.d.ts +50 -0
- package/dist/v1/daemon.js +265 -0
- package/dist/v1/discovery.d.ts +61 -0
- package/dist/v1/discovery.js +168 -0
- package/dist/v1/filesystem-models.d.ts +11 -0
- package/dist/v1/filesystem-models.js +261 -0
- package/dist/v1/heartbeat.d.ts +45 -0
- package/dist/v1/heartbeat.js +463 -0
- package/dist/v1/lifecycle-monitor.d.ts +78 -0
- package/dist/v1/lifecycle-monitor.js +512 -0
- package/dist/v1/lmstudio.d.ts +11 -0
- package/dist/v1/lmstudio.js +148 -0
- package/dist/v1/ollama.d.ts +19 -0
- package/dist/v1/ollama.js +164 -0
- package/dist/v1/openai-compatible.d.ts +12 -0
- package/dist/v1/openai-compatible.js +124 -0
- package/dist/v1/process-scout.d.ts +50 -0
- package/dist/v1/process-scout.js +715 -0
- package/dist/v1/providers.d.ts +50 -0
- package/dist/v1/providers.js +106 -0
- package/dist/v1/service.d.ts +680 -0
- package/dist/v1/service.js +8286 -0
- package/dist/v1/state.d.ts +87 -0
- package/dist/v1/state.js +1318 -0
- package/dist/v1/test-credential-backend.d.ts +19 -0
- package/dist/v1/test-credential-backend.js +49 -0
- package/dist/v1/types.d.ts +873 -0
- package/dist/v1/types.js +3 -0
- package/dist/v1/update.d.ts +38 -0
- package/dist/v1/update.js +184 -0
- package/dist/v1/vitality-pulse.d.ts +36 -0
- package/dist/v1/vitality-pulse.js +512 -0
- package/package.json +53 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { DetectedModel, DetectedRuntime, RuntimeType, SourceLabel } from './types';
|
|
2
|
+
export interface RuntimeProviderScanResult {
|
|
3
|
+
ok: boolean;
|
|
4
|
+
runtime: DetectedRuntime;
|
|
5
|
+
models: DetectedModel[];
|
|
6
|
+
error: string | null;
|
|
7
|
+
}
|
|
8
|
+
export interface RuntimeProvider {
|
|
9
|
+
readonly runtimeName: string;
|
|
10
|
+
readonly runtimeType: RuntimeType;
|
|
11
|
+
readonly endpoint: string;
|
|
12
|
+
scan(): Promise<RuntimeProviderScanResult>;
|
|
13
|
+
}
|
|
14
|
+
export interface ScanAggregateResult {
|
|
15
|
+
ok: boolean;
|
|
16
|
+
runtimes: DetectedRuntime[];
|
|
17
|
+
models: DetectedModel[];
|
|
18
|
+
results: RuntimeProviderScanResult[];
|
|
19
|
+
}
|
|
20
|
+
export interface NormalizeDetectedModelInput {
|
|
21
|
+
runtimeName: string;
|
|
22
|
+
runtimeType: RuntimeType;
|
|
23
|
+
modelName: string;
|
|
24
|
+
modelId?: string | null;
|
|
25
|
+
sourceEndpoint: string;
|
|
26
|
+
detectedAt: string;
|
|
27
|
+
digest: string;
|
|
28
|
+
sizeBytes?: number;
|
|
29
|
+
modifiedAt?: string | null;
|
|
30
|
+
sourceLabel?: SourceLabel;
|
|
31
|
+
metadata?: Record<string, unknown>;
|
|
32
|
+
checksumValue?: string | null;
|
|
33
|
+
checksumAlgorithm?: 'sha256' | null;
|
|
34
|
+
checksumSource?: 'manifest' | 'weights_blob' | 'file_hash' | null;
|
|
35
|
+
quantizationLevel?: string | null;
|
|
36
|
+
architectureFamily?: string | null;
|
|
37
|
+
parameterSize?: string | null;
|
|
38
|
+
}
|
|
39
|
+
export declare function normalizeDetectedModel(input: NormalizeDetectedModelInput): DetectedModel;
|
|
40
|
+
export declare function buildDetectedRuntime(input: {
|
|
41
|
+
runtimeName: string;
|
|
42
|
+
runtimeType: RuntimeType;
|
|
43
|
+
endpoint: string;
|
|
44
|
+
status: 'detected' | 'connected' | 'error';
|
|
45
|
+
lastSeenAt: string;
|
|
46
|
+
error?: string | null;
|
|
47
|
+
sourceLabel?: SourceLabel;
|
|
48
|
+
}): DetectedRuntime;
|
|
49
|
+
export declare function scanProviders(providers: RuntimeProvider[]): Promise<ScanAggregateResult>;
|
|
50
|
+
//# sourceMappingURL=providers.d.ts.map
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeDetectedModel = normalizeDetectedModel;
|
|
4
|
+
exports.buildDetectedRuntime = buildDetectedRuntime;
|
|
5
|
+
exports.scanProviders = scanProviders;
|
|
6
|
+
const discovery_1 = require("./discovery");
|
|
7
|
+
function normalizeDetectedModel(input) {
|
|
8
|
+
const sourceLabel = input.sourceLabel ?? 'Verified by Runtime';
|
|
9
|
+
const modelId = input.modelId ?? null;
|
|
10
|
+
const metadata = input.metadata ?? {};
|
|
11
|
+
return {
|
|
12
|
+
runtime: input.runtimeName,
|
|
13
|
+
runtimeName: input.runtimeName,
|
|
14
|
+
runtimeType: input.runtimeType,
|
|
15
|
+
model: input.modelName,
|
|
16
|
+
modelId,
|
|
17
|
+
discoveryHash: '',
|
|
18
|
+
discoverySources: ['provider_scan'],
|
|
19
|
+
digest: input.digest,
|
|
20
|
+
sizeBytes: Number(input.sizeBytes ?? 0),
|
|
21
|
+
modifiedAt: input.modifiedAt ?? null,
|
|
22
|
+
sourceEndpoint: input.sourceEndpoint,
|
|
23
|
+
sourceLabel,
|
|
24
|
+
status: 'detected',
|
|
25
|
+
detectedAt: input.detectedAt,
|
|
26
|
+
runtime_name: input.runtimeName,
|
|
27
|
+
runtime_type: input.runtimeType,
|
|
28
|
+
model_name: input.modelName,
|
|
29
|
+
model_id: modelId,
|
|
30
|
+
source_endpoint: input.sourceEndpoint,
|
|
31
|
+
detected_at: input.detectedAt,
|
|
32
|
+
metadata,
|
|
33
|
+
checksumValue: input.checksumValue ?? null,
|
|
34
|
+
checksumAlgorithm: input.checksumAlgorithm ?? null,
|
|
35
|
+
checksumSource: input.checksumSource ?? null,
|
|
36
|
+
quantizationLevel: input.quantizationLevel ?? null,
|
|
37
|
+
architectureFamily: input.architectureFamily ?? null,
|
|
38
|
+
parameterSize: input.parameterSize ?? null,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function buildDetectedRuntime(input) {
|
|
42
|
+
return {
|
|
43
|
+
runtime: input.runtimeName,
|
|
44
|
+
runtimeName: input.runtimeName,
|
|
45
|
+
runtimeType: input.runtimeType,
|
|
46
|
+
endpoint: input.endpoint,
|
|
47
|
+
discoveryHash: '',
|
|
48
|
+
discoverySources: ['provider_scan'],
|
|
49
|
+
sourceLabel: input.sourceLabel ?? 'Verified by Runtime',
|
|
50
|
+
status: input.status,
|
|
51
|
+
lastSeenAt: input.lastSeenAt,
|
|
52
|
+
error: input.error ?? null,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function dedupeDetectedModels(models) {
|
|
56
|
+
const seen = new Map();
|
|
57
|
+
for (const model of models) {
|
|
58
|
+
seen.set(model.discoveryHash || `${model.runtime}#${model.model}#${model.digest}`, model);
|
|
59
|
+
}
|
|
60
|
+
return [...seen.values()];
|
|
61
|
+
}
|
|
62
|
+
function runtimeStatusRank(status) {
|
|
63
|
+
switch (status) {
|
|
64
|
+
case 'connected':
|
|
65
|
+
return 3;
|
|
66
|
+
case 'detected':
|
|
67
|
+
return 2;
|
|
68
|
+
case 'error':
|
|
69
|
+
default:
|
|
70
|
+
return 1;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function dedupeDetectedRuntimes(runtimes) {
|
|
74
|
+
const seen = new Map();
|
|
75
|
+
for (const runtime of runtimes) {
|
|
76
|
+
const key = `${runtime.runtime}#${runtime.runtimeType}#${(0, discovery_1.buildEndpointHash)(runtime.endpoint)}`;
|
|
77
|
+
const existing = seen.get(key);
|
|
78
|
+
if (!existing) {
|
|
79
|
+
seen.set(key, runtime);
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const next = runtimeStatusRank(runtime.status) >= runtimeStatusRank(existing.status) ? runtime : existing;
|
|
83
|
+
seen.set(key, {
|
|
84
|
+
...next,
|
|
85
|
+
discoverySources: [...new Set([...(existing.discoverySources || []), ...(runtime.discoverySources || [])])],
|
|
86
|
+
lastSeenAt: new Date(existing.lastSeenAt).getTime() >= new Date(runtime.lastSeenAt).getTime()
|
|
87
|
+
? existing.lastSeenAt
|
|
88
|
+
: runtime.lastSeenAt,
|
|
89
|
+
error: next.error ?? existing.error ?? runtime.error ?? null,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
return [...seen.values()];
|
|
93
|
+
}
|
|
94
|
+
async function scanProviders(providers) {
|
|
95
|
+
const results = await Promise.all(providers.map((provider) => provider.scan()));
|
|
96
|
+
const runtimes = dedupeDetectedRuntimes(results.map((result) => result.runtime));
|
|
97
|
+
const models = dedupeDetectedModels(results.flatMap((result) => result.models));
|
|
98
|
+
const ok = results.some((result) => result.ok);
|
|
99
|
+
return {
|
|
100
|
+
ok,
|
|
101
|
+
runtimes,
|
|
102
|
+
models,
|
|
103
|
+
results,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=providers.js.map
|