@inferencesh/app 0.1.10 → 0.1.11
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/file.js +5 -2
- package/dist/index.d.ts +1 -0
- package/dist/types.d.ts +32 -39
- package/package.json +2 -2
package/dist/file.js
CHANGED
|
@@ -362,14 +362,17 @@ const EXTENSION_MAP = {
|
|
|
362
362
|
function getExtensionForMimeType(mimeType) {
|
|
363
363
|
return EXTENSION_MAP[mimeType] || "";
|
|
364
364
|
}
|
|
365
|
-
function downloadToFile(url, destPath) {
|
|
365
|
+
function downloadToFile(url, destPath, maxRedirects = 10) {
|
|
366
|
+
if (maxRedirects < 0) {
|
|
367
|
+
return Promise.reject(new Error(`Too many redirects downloading ${url}`));
|
|
368
|
+
}
|
|
366
369
|
return new Promise((resolve, reject) => {
|
|
367
370
|
const parsed = new URL(url);
|
|
368
371
|
const getter = parsed.protocol === "https:" ? httpsGet : httpGet;
|
|
369
372
|
const request = getter(url, (response) => {
|
|
370
373
|
// Follow redirects
|
|
371
374
|
if (response.statusCode && response.statusCode >= 300 && response.statusCode < 400 && response.headers.location) {
|
|
372
|
-
downloadToFile(response.headers.location, destPath).then(resolve, reject);
|
|
375
|
+
downloadToFile(response.headers.location, destPath, maxRedirects - 1).then(resolve, reject);
|
|
373
376
|
return;
|
|
374
377
|
}
|
|
375
378
|
if (response.statusCode && response.statusCode >= 400) {
|
package/dist/index.d.ts
CHANGED
|
@@ -4,4 +4,5 @@ export { createFileSchema, isFileSchema, FILE_SCHEMA_MARKER } from "./schema.js"
|
|
|
4
4
|
export { StorageDir, ensureDir } from "./storage.js";
|
|
5
5
|
export type { StorageDirValue } from "./storage.js";
|
|
6
6
|
export { download } from "./download.js";
|
|
7
|
+
export type { RequestMetadata, RequestMetadata as Metadata } from "./types.js";
|
|
7
8
|
export * from "./output-meta.js";
|
package/dist/types.d.ts
CHANGED
|
@@ -1,60 +1,35 @@
|
|
|
1
|
-
export interface AppSDKTypes {
|
|
2
|
-
}
|
|
3
|
-
/**
|
|
4
|
-
* MetaItemType is the type discriminator for MetaItem
|
|
5
|
-
*/
|
|
6
|
-
export type MetaItemType = string;
|
|
7
|
-
export declare const MetaItemTypeText: MetaItemType;
|
|
8
|
-
export declare const MetaItemTypeImage: MetaItemType;
|
|
9
|
-
export declare const MetaItemTypeVideo: MetaItemType;
|
|
10
|
-
export declare const MetaItemTypeAudio: MetaItemType;
|
|
11
|
-
export declare const MetaItemTypeRaw: MetaItemType;
|
|
12
1
|
/**
|
|
13
|
-
*
|
|
2
|
+
* RequestMetadata is the metadata envelope carried in both directions:
|
|
3
|
+
* engine -> worker on /setup and /run, and worker -> engine API on callbacks.
|
|
14
4
|
*/
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
export interface RequestMetadata {
|
|
6
|
+
worker_id: string;
|
|
7
|
+
app_id: string;
|
|
8
|
+
app_version_id: string;
|
|
9
|
+
app_variant: string;
|
|
10
|
+
gpu_ids: string[];
|
|
11
|
+
task_id: string;
|
|
12
|
+
team_id: string;
|
|
13
|
+
user_id: string;
|
|
14
|
+
}
|
|
15
|
+
export interface AppSDKTypes {
|
|
16
|
+
}
|
|
21
17
|
/**
|
|
22
18
|
* MetaItem represents metadata about an input or output item
|
|
23
19
|
*/
|
|
24
20
|
export interface MetaItem {
|
|
25
21
|
type: MetaItemType;
|
|
26
|
-
/**
|
|
27
|
-
* Text fields
|
|
28
|
-
*/
|
|
29
22
|
tokens?: number;
|
|
30
|
-
/**
|
|
31
|
-
* Image/Video shared fields
|
|
32
|
-
*/
|
|
33
23
|
width?: number;
|
|
34
24
|
height?: number;
|
|
35
25
|
resolution_mp?: number;
|
|
36
|
-
/**
|
|
37
|
-
* Image specific fields
|
|
38
|
-
*/
|
|
39
26
|
steps?: number;
|
|
40
27
|
count?: number;
|
|
41
|
-
/**
|
|
42
|
-
* Video specific fields
|
|
43
|
-
*/
|
|
44
28
|
resolution?: VideoResolution;
|
|
45
29
|
seconds?: number;
|
|
46
30
|
fps?: number;
|
|
47
|
-
/**
|
|
48
|
-
* Audio specific fields
|
|
49
|
-
*/
|
|
50
31
|
sample_rate?: number;
|
|
51
|
-
/**
|
|
52
|
-
* Raw specific fields
|
|
53
|
-
*/
|
|
54
32
|
cost?: number;
|
|
55
|
-
/**
|
|
56
|
-
* App-specific key-value pairs for custom pricing factors
|
|
57
|
-
*/
|
|
58
33
|
extra?: {
|
|
59
34
|
[key: string]: any;
|
|
60
35
|
};
|
|
@@ -66,3 +41,21 @@ export interface OutputMeta {
|
|
|
66
41
|
inputs: MetaItem[];
|
|
67
42
|
outputs: MetaItem[];
|
|
68
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* MetaItemType is the type discriminator for MetaItem
|
|
46
|
+
*/
|
|
47
|
+
export type MetaItemType = string;
|
|
48
|
+
export declare const MetaItemTypeText: MetaItemType;
|
|
49
|
+
export declare const MetaItemTypeImage: MetaItemType;
|
|
50
|
+
export declare const MetaItemTypeVideo: MetaItemType;
|
|
51
|
+
export declare const MetaItemTypeAudio: MetaItemType;
|
|
52
|
+
export declare const MetaItemTypeRaw: MetaItemType;
|
|
53
|
+
/**
|
|
54
|
+
* VideoResolution represents standard video resolution presets
|
|
55
|
+
*/
|
|
56
|
+
export type VideoResolution = string;
|
|
57
|
+
export declare const VideoRes480P: VideoResolution;
|
|
58
|
+
export declare const VideoRes720P: VideoResolution;
|
|
59
|
+
export declare const VideoRes1080P: VideoResolution;
|
|
60
|
+
export declare const VideoRes1440P: VideoResolution;
|
|
61
|
+
export declare const VideoRes4K: VideoResolution;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inferencesh/app",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "App framework for building inference.sh apps — File handling, output metadata, storage utilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/node": "^22.0.0",
|
|
44
44
|
"rimraf": "^6.0.1",
|
|
45
|
-
"typescript": "
|
|
45
|
+
"typescript": "~6.0.3",
|
|
46
46
|
"zod": "^4.3.6"
|
|
47
47
|
},
|
|
48
48
|
"files": [
|