@gradio/client 2.5.1 → 2.7.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/CHANGELOG.md +21 -0
- package/dist/browser.js +442 -311
- package/dist/client.d.ts +1 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/helpers/data.d.ts +9 -0
- package/dist/helpers/data.d.ts.map +1 -1
- package/dist/helpers/init_helpers.d.ts +1 -1
- package/dist/helpers/init_helpers.d.ts.map +1 -1
- package/dist/index.cjs +207 -19
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +201 -20
- package/dist/index.min.js +481 -350
- package/dist/types.d.ts +5 -5
- package/dist/upload.d.ts.map +1 -1
- package/dist/utils/bucket_sync.d.ts +38 -0
- package/dist/utils/bucket_sync.d.ts.map +1 -0
- package/dist/utils/run_history.d.ts +9 -0
- package/dist/utils/run_history.d.ts.map +1 -1
- package/dist/utils/submit.d.ts.map +1 -1
- package/dist/utils/view_api.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +19 -15
- package/src/helpers/data.ts +77 -0
- package/src/helpers/init_helpers.ts +29 -14
- package/src/index.ts +12 -0
- package/src/test/bucket_sync.test.ts +138 -0
- package/src/test/data.test.ts +95 -0
- package/src/test/init.test.ts +47 -1
- package/src/test/run_history.test.ts +46 -0
- package/src/test/server.ts +3 -0
- package/src/test/submit.test.ts +75 -1
- package/src/test/upload.test.ts +25 -0
- package/src/types.ts +5 -5
- package/src/upload.ts +5 -1
- package/src/utils/bucket_sync.ts +153 -0
- package/src/utils/run_history.ts +64 -1
- package/src/utils/submit.ts +21 -3
- package/src/utils/view_api.ts +4 -1
package/dist/client.d.ts
CHANGED
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,OAAO,EACP,OAAO,E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MAAM,EACrB,OAAO,GAAE,gBAER,GACC,OAAO,CAAC,MAAM,CAAC;YAIJ,eAAe;YA4Cf,cAAc;IA4BtB,oBAAoB,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAgC1D,gBAAgB,CAC5B,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,OAAO,GAAG;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE,GAC5D,OAAO,CAAC,OAAO,CAAC;IAoFZ,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAI7C,OAAO,CAAC,kBAAkB;CAS1B;AAED;;;;;;;GAOG;AACH,wBAAsB,MAAM,CAC3B,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE,aAER,GACC,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CACpC,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,gBAAgB,GACvB,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC"}
|
package/dist/helpers/data.d.ts
CHANGED
|
@@ -18,4 +18,13 @@ export declare function handle_file(file_or_url: File | string | Blob | Buffer):
|
|
|
18
18
|
* @returns An array of resolved payload values, filtered based on the dependency and component metadata.
|
|
19
19
|
*/
|
|
20
20
|
export declare function handle_payload(resolved_payload: unknown[], dependency: Dependency, components: ComponentMeta[], type: "input" | "output", with_null_state?: boolean): unknown[];
|
|
21
|
+
/**
|
|
22
|
+
* Add the Space JWT required for browser-managed media requests.
|
|
23
|
+
*
|
|
24
|
+
* This is a bearer credential and must not be logged or persisted. Restrict it
|
|
25
|
+
* to Gradio routes that serve files; the user's Hugging Face token remains in
|
|
26
|
+
* the Authorization header used to obtain this credential.
|
|
27
|
+
*/
|
|
28
|
+
export declare function sign_file_urls(data: unknown, root: string, api_prefix: string, jwt: string | false): void;
|
|
29
|
+
export declare function sign_config_file_urls(config: Config, jwt: string | false): void;
|
|
21
30
|
//# sourceMappingURL=data.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/helpers/data.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,OAAO,EACP,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAKrC,wBAAgB,aAAa,CAC5B,MAAM,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EAC5B,QAAQ,EAAE,GAAG,EACb,KAAK,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GACxB,IAAI,CAgBN;AAED,wBAAsB,oBAAoB,CACzC,IAAI,EAAE,QAAQ,EACd,IAAI,GAAE,MAAM,GAAG,SAAqB,EACpC,IAAI,GAAE,MAAM,EAAO,EACnB,IAAI,UAAQ,EACZ,aAAa,GAAE,YAAY,CAAC,OAAO,GAAG,SAAS,CAAC,GAAG,SAAqB,GACtE,OAAO,CAAC,OAAO,EAAE,CAAC,CA2DpB;AAED,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAM9D;AAID,wBAAgB,YAAY,CAAC,GAAG,GAAG,GAAG,EACrC,OAAO,EAAE,GAAG,EACZ,MAAM,EAAE,MAAM,GACZ,OAAO,CAAC,GAAG,CAAC,CASd;AAED,wBAAgB,WAAW,CAC1B,WAAW,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,GACxC,QAAQ,GAAG,IAAI,GAAG,OAA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,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,GACxC,QAAQ,GAAG,IAAI,GAAG,OAAO,CAkC3B;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC7B,gBAAgB,EAAE,OAAO,EAAE,EAC3B,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,aAAa,EAAE,EAC3B,IAAI,EAAE,OAAO,GAAG,QAAQ,EACxB,eAAe,UAAQ,GACrB,OAAO,EAAE,CA0CX;AAID;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC7B,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,GAAG,KAAK,GACjB,IAAI,CA+CN;AAED,wBAAgB,qBAAqB,CACpC,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,GAAG,KAAK,GACjB,IAAI,CASN"}
|
|
@@ -21,7 +21,7 @@ export declare function get_jwt(space: string, token: `hf_${string}`, cookies?:
|
|
|
21
21
|
*/
|
|
22
22
|
export declare function normalise_token_option(options: ClientOptions): void;
|
|
23
23
|
export declare function map_names_to_ids(fns: Config["dependencies"]): Record<string, number>;
|
|
24
|
-
export declare function resolve_config_root(root: string, current_location: string): string;
|
|
24
|
+
export declare function resolve_config_root(root: string, current_location: string, prioritize_current_location?: boolean): string;
|
|
25
25
|
export declare function resolve_config(this: Client, endpoint: string, strip_current_page?: boolean): Promise<Config | undefined>;
|
|
26
26
|
export declare function resolve_cookies(this: Client): Promise<void>;
|
|
27
27
|
export declare function get_cookie_header(http_protocol: string, host: string, auth: [string, string], _fetch: typeof fetch, token?: `hf_${string}`, credentials?: RequestCredentials): Promise<string | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init_helpers.d.ts","sourceRoot":"","sources":["../../src/helpers/init_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAWtD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,GAAG,EAAE,MAAM,CAAC,cAAc,CAAC,GACzB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAOxB;AAED,wBAAgB,mBAAmB,CAClC,IAAI,EAAE,MAAM,EACZ,gBAAgB,EAAE,MAAM,EACxB,2BAA2B,UAAQ,GACjC,MAAM,CAqBR;AAED,wBAAsB,cAAc,CACnC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,kBAAkB,UAAO,GACvB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAkE7B;AAsCD,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBjE;AAGD,wBAAsB,iBAAiB,CACtC,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EACtB,MAAM,EAAE,OAAO,KAAK,EACpB,KAAK,CAAC,EAAE,MAAM,MAAM,EAAE,EACtB,WAAW,CAAC,EAAE,kBAAkB,GAC9B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAyBxB;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG;IACrD,WAAW,EAAE,IAAI,GAAG,KAAK,CAAC;IAC1B,aAAa,EAAE,OAAO,GAAG,QAAQ,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC;CACb,CAkBA;AAED,eAAO,MAAM,qBAAqB,GAAI,eAAe,MAAM,KAAG,MAAM,EAUnE,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -63,9 +63,11 @@ function map_names_to_ids(fns) {
|
|
|
63
63
|
});
|
|
64
64
|
return apis;
|
|
65
65
|
}
|
|
66
|
-
function resolve_config_root(root, current_location) {
|
|
67
|
-
const root_url = new URL(root, current_location);
|
|
66
|
+
function resolve_config_root(root, current_location, prioritize_current_location = false) {
|
|
68
67
|
const current_url = new URL(current_location);
|
|
68
|
+
const root_url = new URL(root, current_url);
|
|
69
|
+
const is_colab_runtime = root_url.hostname.endsWith(".colab-user-runtimes.internal") || root_url.hostname.endsWith(".codatalab-user-runtimes.internal");
|
|
70
|
+
if (prioritize_current_location || is_colab_runtime) return new URL(new URL(root, current_url).pathname, current_url).toString().replace(/\/$/, "");
|
|
69
71
|
if (root_url.hostname !== current_url.hostname) return root;
|
|
70
72
|
root_url.protocol = current_url.protocol;
|
|
71
73
|
root_url.host = current_url.host;
|
|
@@ -76,7 +78,9 @@ async function resolve_config(endpoint, strip_current_page = true) {
|
|
|
76
78
|
if (typeof window !== "undefined" && window.gradio_config && location.origin !== "http://localhost:9876") {
|
|
77
79
|
if (strip_current_page && window.gradio_config.current_page) endpoint = endpoint.substring(0, endpoint.lastIndexOf("/"));
|
|
78
80
|
if (window.gradio_config.dev_mode || typeof window !== "undefined" && window?.BUILD_MODE === "dev") {
|
|
79
|
-
let config_url = join_urls(endpoint,
|
|
81
|
+
let config_url = new URL(join_urls(endpoint, CONFIG_URL));
|
|
82
|
+
if (this.deep_link) config_url.searchParams.set("deep_link", this.deep_link);
|
|
83
|
+
if (this.page !== null) config_url.searchParams.set("page", this.page);
|
|
80
84
|
const config = await handleConfigResponse(await this.fetch(config_url, {
|
|
81
85
|
headers,
|
|
82
86
|
credentials: this.options.credentials ?? "same-origin"
|
|
@@ -88,10 +92,12 @@ async function resolve_config(endpoint, strip_current_page = true) {
|
|
|
88
92
|
};
|
|
89
93
|
}
|
|
90
94
|
const config = { ...window.gradio_config };
|
|
91
|
-
config.root = resolve_config_root(config.root, location.href);
|
|
95
|
+
config.root = resolve_config_root(config.root, location.href, config.is_colab);
|
|
92
96
|
return config;
|
|
93
97
|
} else if (endpoint) {
|
|
94
|
-
let config_url = join_urls(endpoint,
|
|
98
|
+
let config_url = new URL(join_urls(endpoint, CONFIG_URL));
|
|
99
|
+
if (this.deep_link) config_url.searchParams.set("deep_link", this.deep_link);
|
|
100
|
+
if (this.page !== null) config_url.searchParams.set("page", this.page);
|
|
95
101
|
const config = await handleConfigResponse(await this.fetch(config_url, {
|
|
96
102
|
headers,
|
|
97
103
|
credentials: this.options.credentials ?? "same-origin"
|
|
@@ -490,7 +496,8 @@ async function view_api() {
|
|
|
490
496
|
let api_info;
|
|
491
497
|
if (typeof window !== "undefined" && window.gradio_api_info) api_info = window.gradio_api_info;
|
|
492
498
|
else {
|
|
493
|
-
const url = join_urls(config.root, this.api_prefix, API_INFO_URL);
|
|
499
|
+
const url = new URL(join_urls(config.root, this.api_prefix, API_INFO_URL));
|
|
500
|
+
if (this.page !== null) url.searchParams.set("page", this.page);
|
|
494
501
|
response = await this.fetch(url, {
|
|
495
502
|
headers,
|
|
496
503
|
credentials: this.options.credentials ?? "same-origin"
|
|
@@ -610,10 +617,11 @@ async function upload(file_data, root_url, upload_id, max_file_size) {
|
|
|
610
617
|
if (response.error) throw new Error(response.error);
|
|
611
618
|
else {
|
|
612
619
|
if (response.files) return response.files.map((f, i) => {
|
|
620
|
+
const encoded_path = f.split("/").map((segment) => encodeURIComponent(segment)).join("/");
|
|
613
621
|
return new FileData({
|
|
614
622
|
...file_data[i],
|
|
615
623
|
path: f,
|
|
616
|
-
url: `${root_url}${this.api_prefix}/file=${
|
|
624
|
+
url: `${root_url}${this.api_prefix}/file=${encoded_path}`
|
|
617
625
|
});
|
|
618
626
|
});
|
|
619
627
|
return [];
|
|
@@ -775,6 +783,48 @@ function handle_payload(resolved_payload, dependency, components, type, with_nul
|
|
|
775
783
|
}
|
|
776
784
|
return updated_payload;
|
|
777
785
|
}
|
|
786
|
+
var FILE_ROUTE_PREFIXES = [
|
|
787
|
+
"/file=",
|
|
788
|
+
"/file/",
|
|
789
|
+
"/stream/",
|
|
790
|
+
"/proxy="
|
|
791
|
+
];
|
|
792
|
+
/**
|
|
793
|
+
* Add the Space JWT required for browser-managed media requests.
|
|
794
|
+
*
|
|
795
|
+
* This is a bearer credential and must not be logged or persisted. Restrict it
|
|
796
|
+
* to Gradio routes that serve files; the user's Hugging Face token remains in
|
|
797
|
+
* the Authorization header used to obtain this credential.
|
|
798
|
+
*/
|
|
799
|
+
function sign_file_urls(data, root, api_prefix, jwt) {
|
|
800
|
+
if (!jwt || data === null || typeof data !== "object") return;
|
|
801
|
+
const signature = jwt;
|
|
802
|
+
const root_url = new URL(root);
|
|
803
|
+
const root_path = root_url.pathname.replace(/\/+$/, "");
|
|
804
|
+
const normalized_api_prefix = api_prefix ? `/${api_prefix.replace(/^\/+|\/+$/g, "")}` : "";
|
|
805
|
+
const route_bases = new Set([`${root_path}${normalized_api_prefix}`, normalized_api_prefix]);
|
|
806
|
+
if (!normalized_api_prefix) {
|
|
807
|
+
route_bases.add(`${root_path}/gradio_api`);
|
|
808
|
+
route_bases.add("/gradio_api");
|
|
809
|
+
}
|
|
810
|
+
function visit(value) {
|
|
811
|
+
if (value === null || typeof value !== "object") return;
|
|
812
|
+
const object = value;
|
|
813
|
+
if (object.meta?._type === "gradio.FileData" && typeof object.url === "string") {
|
|
814
|
+
const file_url = new URL(object.url, `${root_url.toString().replace(/\/$/, "")}/`);
|
|
815
|
+
const is_file_route = [...route_bases].some((base) => FILE_ROUTE_PREFIXES.some((route) => file_url.pathname.startsWith(`${base}${route}`)));
|
|
816
|
+
if ((file_url.protocol === "http:" || file_url.protocol === "https:") && file_url.origin === root_url.origin && is_file_route) {
|
|
817
|
+
file_url.searchParams.set("__sign", signature);
|
|
818
|
+
object.url = file_url.toString();
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
for (const child of Object.values(object)) visit(child);
|
|
822
|
+
}
|
|
823
|
+
visit(data);
|
|
824
|
+
}
|
|
825
|
+
function sign_config_file_urls(config, jwt) {
|
|
826
|
+
for (const component of config.components || []) sign_file_urls(component.props?.value, config.root, config.api_prefix || "", jwt);
|
|
827
|
+
}
|
|
778
828
|
//#endregion
|
|
779
829
|
//#region src/utils/handle_blob.ts
|
|
780
830
|
async function handle_blob(endpoint, data, api_info) {
|
|
@@ -1433,6 +1483,7 @@ function readable_stream(input, init = {}) {
|
|
|
1433
1483
|
var KEY_ROOT = "gradio:run-history:";
|
|
1434
1484
|
var STORAGE_PREFIX = `${KEY_ROOT}v2:`;
|
|
1435
1485
|
var REPLAY_PREFIX = `${KEY_ROOT}replay:v2:`;
|
|
1486
|
+
var DESTINATION_PREFIX = `${KEY_ROOT}destination:v1:`;
|
|
1436
1487
|
var MAX_RUNS = 100;
|
|
1437
1488
|
var MAX_APPS = 8;
|
|
1438
1489
|
/**
|
|
@@ -1470,6 +1521,34 @@ function replay_key(scope) {
|
|
|
1470
1521
|
const key = storage_key(scope);
|
|
1471
1522
|
return key ? key.replace(STORAGE_PREFIX, REPLAY_PREFIX) : null;
|
|
1472
1523
|
}
|
|
1524
|
+
function destination_key(scope) {
|
|
1525
|
+
const key = storage_key(scope);
|
|
1526
|
+
return key ? key.replace(STORAGE_PREFIX, DESTINATION_PREFIX) : null;
|
|
1527
|
+
}
|
|
1528
|
+
function read_run_history_storage_impl(scope) {
|
|
1529
|
+
const key = destination_key(scope);
|
|
1530
|
+
if (!key) return { type: "browser" };
|
|
1531
|
+
try {
|
|
1532
|
+
const value = JSON.parse(window.localStorage.getItem(key) || "null");
|
|
1533
|
+
if (typeof value?.bucket_id === "string") return value.type === "bucket" ? {
|
|
1534
|
+
type: "bucket",
|
|
1535
|
+
bucket_id: value.bucket_id
|
|
1536
|
+
} : {
|
|
1537
|
+
type: "browser",
|
|
1538
|
+
bucket_id: value.bucket_id
|
|
1539
|
+
};
|
|
1540
|
+
return { type: "browser" };
|
|
1541
|
+
} catch {
|
|
1542
|
+
return { type: "browser" };
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
function set_run_history_storage_impl(scope, storage) {
|
|
1546
|
+
const key = destination_key(scope);
|
|
1547
|
+
if (!key) return;
|
|
1548
|
+
if (storage.type === "browser" && !storage.bucket_id) window.localStorage.removeItem(key);
|
|
1549
|
+
else window.localStorage.setItem(key, JSON.stringify(storage));
|
|
1550
|
+
notify_run_history_change();
|
|
1551
|
+
}
|
|
1473
1552
|
/** When a run was most recently saved under a key, for deciding what to drop. */
|
|
1474
1553
|
function last_saved_at(key) {
|
|
1475
1554
|
try {
|
|
@@ -1486,7 +1565,7 @@ function last_saved_at(key) {
|
|
|
1486
1565
|
*/
|
|
1487
1566
|
function prune_apps(current_key) {
|
|
1488
1567
|
const keys = Object.keys(window.localStorage).filter((key) => key.startsWith(KEY_ROOT));
|
|
1489
|
-
const stale = [...keys.filter((key) => !key.startsWith(STORAGE_PREFIX) && !key.startsWith(REPLAY_PREFIX)), ...keys.filter((key) => key.startsWith(STORAGE_PREFIX) && key !== current_key).sort((a, b) => last_saved_at(b) - last_saved_at(a)).slice(MAX_APPS - 1)];
|
|
1568
|
+
const stale = [...keys.filter((key) => !key.startsWith(STORAGE_PREFIX) && !key.startsWith(REPLAY_PREFIX) && !key.startsWith(DESTINATION_PREFIX)), ...keys.filter((key) => key.startsWith(STORAGE_PREFIX) && key !== current_key).sort((a, b) => last_saved_at(b) - last_saved_at(a)).slice(MAX_APPS - 1)];
|
|
1490
1569
|
for (const key of stale) try {
|
|
1491
1570
|
window.localStorage.removeItem(key);
|
|
1492
1571
|
window.sessionStorage.removeItem(key.replace(STORAGE_PREFIX, REPLAY_PREFIX));
|
|
@@ -1616,6 +1695,7 @@ function apply_run_history_replay_impl(config) {
|
|
|
1616
1695
|
return run ? restore_run_impl(config, run) : false;
|
|
1617
1696
|
}
|
|
1618
1697
|
function start_run_history_impl(options) {
|
|
1698
|
+
if (read_run_history_storage_impl(options).type === "bucket") return null;
|
|
1619
1699
|
const key = storage_key(options);
|
|
1620
1700
|
if (!key) return null;
|
|
1621
1701
|
prune_apps(key);
|
|
@@ -1695,6 +1775,12 @@ function mark_complete(run, event) {
|
|
|
1695
1775
|
function read_run_history(scope) {
|
|
1696
1776
|
return safely(() => read_run_history_impl(scope), []);
|
|
1697
1777
|
}
|
|
1778
|
+
function read_run_history_storage(scope) {
|
|
1779
|
+
return safely(() => read_run_history_storage_impl(scope), { type: "browser" });
|
|
1780
|
+
}
|
|
1781
|
+
function set_run_history_storage(scope, storage) {
|
|
1782
|
+
safely(() => set_run_history_storage_impl(scope, storage), void 0);
|
|
1783
|
+
}
|
|
1698
1784
|
function clear_run_history(scope) {
|
|
1699
1785
|
safely(() => clear_run_history_impl(scope), void 0);
|
|
1700
1786
|
}
|
|
@@ -1735,10 +1821,11 @@ function submit(endpoint, data = {}, event_data, trigger_id, all_events, additio
|
|
|
1735
1821
|
try {
|
|
1736
1822
|
const { token } = this.options;
|
|
1737
1823
|
const { fetch, app_reference, config, session_hash, api_info, api_map, stream_status, pending_stream_messages, pending_diff_streams, event_callbacks, unclosed_events, post_data, options, api_prefix } = this;
|
|
1738
|
-
const
|
|
1824
|
+
const base_headers = additional_headers || { "x-gradio-user": "api" };
|
|
1739
1825
|
const that = this;
|
|
1740
1826
|
if (!api_info) throw new Error(NO_API_INFO_MSG);
|
|
1741
1827
|
if (!config) throw new Error("Could not resolve app config");
|
|
1828
|
+
const root = config.root;
|
|
1742
1829
|
let { fn_index, endpoint_info, dependency } = get_endpoint_info(api_info, endpoint, api_map, config);
|
|
1743
1830
|
let resolved_data = map_data_to_params(data, endpoint_info);
|
|
1744
1831
|
let protocol = config.protocol ?? "ws";
|
|
@@ -1760,6 +1847,11 @@ function submit(endpoint, data = {}, event_data, trigger_id, all_events, additio
|
|
|
1760
1847
|
app_id: config.app_id,
|
|
1761
1848
|
username: config.username
|
|
1762
1849
|
};
|
|
1850
|
+
const history_storage = read_run_history_storage(history_scope);
|
|
1851
|
+
const addt_headers = {
|
|
1852
|
+
...base_headers,
|
|
1853
|
+
...history_enabled && history_storage.type === "bucket" ? { "x-gradio-history-bucket": history_storage.bucket_id } : {}
|
|
1854
|
+
};
|
|
1763
1855
|
const history_run_id = !history_enabled || !is_documented_endpoint ? null : start_run_history({
|
|
1764
1856
|
...history_scope,
|
|
1765
1857
|
endpoint: history_endpoint,
|
|
@@ -1783,6 +1875,7 @@ function submit(endpoint, data = {}, event_data, trigger_id, all_events, additio
|
|
|
1783
1875
|
}, {}) || {};
|
|
1784
1876
|
function fire_event(event) {
|
|
1785
1877
|
update_run_history(history_scope, history_run_id, event);
|
|
1878
|
+
if (event.type === "data" || event.type === "render") sign_file_urls(event.data, root, api_prefix, that.jwt);
|
|
1786
1879
|
if (all_events || events_to_publish[event.type]) push_event(event);
|
|
1787
1880
|
}
|
|
1788
1881
|
async function cancel() {
|
|
@@ -1933,7 +2026,7 @@ function submit(endpoint, data = {}, event_data, trigger_id, all_events, additio
|
|
|
1933
2026
|
...payload,
|
|
1934
2027
|
session_hash,
|
|
1935
2028
|
event_id
|
|
1936
|
-
});
|
|
2029
|
+
}, addt_headers);
|
|
1937
2030
|
if (status !== 200) {
|
|
1938
2031
|
fire_event({
|
|
1939
2032
|
type: "status",
|
|
@@ -2286,6 +2379,7 @@ var Client = class {
|
|
|
2286
2379
|
app_reference;
|
|
2287
2380
|
options;
|
|
2288
2381
|
deep_link = null;
|
|
2382
|
+
page = null;
|
|
2289
2383
|
config;
|
|
2290
2384
|
api_prefix = "";
|
|
2291
2385
|
api_info;
|
|
@@ -2366,6 +2460,7 @@ var Client = class {
|
|
|
2366
2460
|
constructor(app_reference, options = { events: ["data"] }) {
|
|
2367
2461
|
this.app_reference = app_reference;
|
|
2368
2462
|
this.deep_link = options.query_params?.deep_link || null;
|
|
2463
|
+
this.page = options.query_params?.page ?? null;
|
|
2369
2464
|
if (!options.events) options.events = ["data"];
|
|
2370
2465
|
normalise_token_option(options);
|
|
2371
2466
|
this.options = options;
|
|
@@ -2397,14 +2492,10 @@ var Client = class {
|
|
|
2397
2492
|
this.api_map = map_names_to_ids(this.config?.dependencies || []);
|
|
2398
2493
|
}
|
|
2399
2494
|
async _resolve_heartbeat(_config) {
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
if (this.config.space_id && this.options.token) this.jwt = await get_jwt(this.config.space_id, this.options.token, this.cookies);
|
|
2405
|
-
}
|
|
2406
|
-
}
|
|
2407
|
-
if (_config.space_id && this.options.token) this.jwt = await get_jwt(_config.space_id, this.options.token);
|
|
2495
|
+
this.config = _config;
|
|
2496
|
+
this.api_prefix = _config.api_prefix || "";
|
|
2497
|
+
if (_config.space_id && this.options.token) this.jwt = await get_jwt(_config.space_id, this.options.token, this.cookies);
|
|
2498
|
+
sign_config_file_urls(this.config, this.jwt);
|
|
2408
2499
|
if (this.config && this.config.connect_heartbeat) {
|
|
2409
2500
|
const heartbeat_url = new URL(`${this.config.root}${this.api_prefix}/${HEARTBEAT_URL}/${this.session_hash}`);
|
|
2410
2501
|
if (this.jwt) heartbeat_url.searchParams.set("__sign", this.jwt);
|
|
@@ -2445,6 +2536,7 @@ var Client = class {
|
|
|
2445
2536
|
this.config = config;
|
|
2446
2537
|
this.api_prefix = config.api_prefix || "";
|
|
2447
2538
|
this.api_map = map_names_to_ids(config.dependencies || []);
|
|
2539
|
+
sign_config_file_urls(this.config, this.jwt);
|
|
2448
2540
|
try {
|
|
2449
2541
|
this.api_info = await this.view_api();
|
|
2450
2542
|
} catch (e) {
|
|
@@ -2554,7 +2646,9 @@ var Client = class {
|
|
|
2554
2646
|
credentials: this.options.credentials ?? "same-origin"
|
|
2555
2647
|
});
|
|
2556
2648
|
if (!response.ok) throw new Error("Could not connect to component server: " + response.statusText);
|
|
2557
|
-
|
|
2649
|
+
const output = await response.json();
|
|
2650
|
+
sign_file_urls(output, this.config.root, this.config.api_prefix || "", this.jwt);
|
|
2651
|
+
return output;
|
|
2558
2652
|
} catch (e) {
|
|
2559
2653
|
console.warn(e);
|
|
2560
2654
|
}
|
|
@@ -2595,21 +2689,115 @@ async function duplicate_space(app_reference, options) {
|
|
|
2595
2689
|
return await Client.duplicate(app_reference, options);
|
|
2596
2690
|
}
|
|
2597
2691
|
//#endregion
|
|
2692
|
+
//#region src/utils/bucket_sync.ts
|
|
2693
|
+
/**
|
|
2694
|
+
* Client for the durable run history in an HF Hub bucket
|
|
2695
|
+
* (`/gradio_api/run-history/*`).
|
|
2696
|
+
*
|
|
2697
|
+
* Read-only by design. Records are written by the server from the run it
|
|
2698
|
+
* actually executed — there is no push function here, and nothing in this
|
|
2699
|
+
* module can create a record.
|
|
2700
|
+
*
|
|
2701
|
+
* Every call names the bucket it is talking about. The server holds no
|
|
2702
|
+
* per-session binding, so two tabs (or two apps on one origin) cannot end up
|
|
2703
|
+
* reading each other's history.
|
|
2704
|
+
*/
|
|
2705
|
+
var BUCKET_ID_RE = /^[a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-][a-zA-Z0-9_./-]*$/;
|
|
2706
|
+
function is_valid_bucket_id(id) {
|
|
2707
|
+
if (!BUCKET_ID_RE.test(id)) return false;
|
|
2708
|
+
return !id.split("/").some((seg) => seg === "" || seg === "." || seg === "..");
|
|
2709
|
+
}
|
|
2710
|
+
function url(root, path, params) {
|
|
2711
|
+
const query = params ? `?${new URLSearchParams(params)}` : "";
|
|
2712
|
+
const base = root.replace(/\/+$/, "");
|
|
2713
|
+
if (base) return `${base}/gradio_api/run-history/${path}${query}`;
|
|
2714
|
+
if (typeof document !== "undefined" && document.baseURI) return new URL(`gradio_api/run-history/${path}${query}`, document.baseURI).toString();
|
|
2715
|
+
return `gradio_api/run-history/${path}${query}`;
|
|
2716
|
+
}
|
|
2717
|
+
async function parse_error(res) {
|
|
2718
|
+
try {
|
|
2719
|
+
const j = await res.json();
|
|
2720
|
+
return typeof j?.detail === "string" ? j.detail : `${res.status}`;
|
|
2721
|
+
} catch {
|
|
2722
|
+
return `${res.status}`;
|
|
2723
|
+
}
|
|
2724
|
+
}
|
|
2725
|
+
async function request(input, init, fallback, pick) {
|
|
2726
|
+
try {
|
|
2727
|
+
const res = await fetch(input, {
|
|
2728
|
+
credentials: "include",
|
|
2729
|
+
...init
|
|
2730
|
+
});
|
|
2731
|
+
if (!res.ok) return {
|
|
2732
|
+
ok: false,
|
|
2733
|
+
status: res.status,
|
|
2734
|
+
data: fallback,
|
|
2735
|
+
detail: await parse_error(res)
|
|
2736
|
+
};
|
|
2737
|
+
return {
|
|
2738
|
+
ok: true,
|
|
2739
|
+
status: res.status,
|
|
2740
|
+
data: pick(await res.json())
|
|
2741
|
+
};
|
|
2742
|
+
} catch (e) {
|
|
2743
|
+
return {
|
|
2744
|
+
ok: false,
|
|
2745
|
+
status: 0,
|
|
2746
|
+
data: fallback,
|
|
2747
|
+
detail: String(e)
|
|
2748
|
+
};
|
|
2749
|
+
}
|
|
2750
|
+
}
|
|
2751
|
+
/**
|
|
2752
|
+
* Create the bucket if it does not exist and confirm it is writable. Stores
|
|
2753
|
+
* nothing server-side — the caller keeps its own choice and names it on every
|
|
2754
|
+
* later request.
|
|
2755
|
+
*/
|
|
2756
|
+
async function connect_bucket(root, bucket_id) {
|
|
2757
|
+
if (!is_valid_bucket_id(bucket_id)) return {
|
|
2758
|
+
ok: false,
|
|
2759
|
+
status: 422,
|
|
2760
|
+
data: null,
|
|
2761
|
+
detail: "invalid bucket id"
|
|
2762
|
+
};
|
|
2763
|
+
return request(url(root, "connect"), {
|
|
2764
|
+
method: "POST",
|
|
2765
|
+
headers: { "Content-Type": "application/json" },
|
|
2766
|
+
body: JSON.stringify({ bucket_id })
|
|
2767
|
+
}, null, () => null);
|
|
2768
|
+
}
|
|
2769
|
+
async function list_user_buckets(root) {
|
|
2770
|
+
return request(url(root, "buckets"), {}, [], (b) => Array.isArray(b?.buckets) ? b.buckets : []);
|
|
2771
|
+
}
|
|
2772
|
+
async function list_bucket_records(root, bucket) {
|
|
2773
|
+
return request(url(root, "records", { bucket }), {}, [], (b) => Array.isArray(b?.records) ? b.records : []);
|
|
2774
|
+
}
|
|
2775
|
+
function asset_url(root, bucket, endpoint, record_id, filename) {
|
|
2776
|
+
return url(root, `records/${encodeURIComponent(endpoint)}/${encodeURIComponent(record_id)}/assets/${encodeURIComponent(filename)}`, { bucket });
|
|
2777
|
+
}
|
|
2778
|
+
//#endregion
|
|
2598
2779
|
exports.Client = Client;
|
|
2599
2780
|
exports.FileData = FileData;
|
|
2600
2781
|
exports.MISSING_CREDENTIALS_MSG = MISSING_CREDENTIALS_MSG;
|
|
2601
2782
|
exports.apply_run_history_replay = apply_run_history_replay;
|
|
2783
|
+
exports.asset_url = asset_url;
|
|
2602
2784
|
exports.clear_run_history = clear_run_history;
|
|
2603
2785
|
exports.client = client;
|
|
2786
|
+
exports.connect_bucket = connect_bucket;
|
|
2604
2787
|
exports.consume_run_history_replay = consume_run_history_replay;
|
|
2605
2788
|
exports.delete_run_history = delete_run_history;
|
|
2606
2789
|
exports.duplicate = duplicate_space;
|
|
2607
2790
|
exports.handle_file = handle_file;
|
|
2791
|
+
exports.is_valid_bucket_id = is_valid_bucket_id;
|
|
2792
|
+
exports.list_bucket_records = list_bucket_records;
|
|
2793
|
+
exports.list_user_buckets = list_user_buckets;
|
|
2608
2794
|
exports.on_run_history_change = on_run_history_change;
|
|
2609
2795
|
exports.predict = predict;
|
|
2610
2796
|
exports.prepare_files = prepare_files;
|
|
2611
2797
|
exports.read_run_history = read_run_history;
|
|
2798
|
+
exports.read_run_history_storage = read_run_history_storage;
|
|
2612
2799
|
exports.run_history_url = run_history_url;
|
|
2800
|
+
exports.set_run_history_storage = set_run_history_storage;
|
|
2613
2801
|
exports.stage_run_history_replay = stage_run_history_replay;
|
|
2614
2802
|
exports.submit = submit;
|
|
2615
2803
|
exports.upload = upload;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,8 @@ export { submit } from "./utils/submit";
|
|
|
4
4
|
export { upload_files } from "./utils/upload_files";
|
|
5
5
|
export { FileData, upload, prepare_files } from "./upload";
|
|
6
6
|
export { handle_file } from "./helpers/data";
|
|
7
|
-
export { apply_run_history_replay, clear_run_history, consume_run_history_replay, delete_run_history, on_run_history_change, read_run_history, run_history_url, stage_run_history_replay, type ReplayTarget, type RunHistoryScope, type StoredRunComponent, type StoredRun } from "./utils/run_history";
|
|
7
|
+
export { apply_run_history_replay, clear_run_history, consume_run_history_replay, delete_run_history, on_run_history_change, read_run_history, read_run_history_storage, run_history_url, set_run_history_storage, stage_run_history_replay, type ReplayTarget, type RunHistoryStorage, type RunHistoryScope, type StoredRunComponent, type StoredRun } from "./utils/run_history";
|
|
8
|
+
export { asset_url, connect_bucket, is_valid_bucket_id, list_bucket_records, list_user_buckets, type HistoryRecord, type HistoryResult } from "./utils/bucket_sync";
|
|
8
9
|
export type { SpaceStatus, StatusMessage, Status, client_return, UploadResponse, RenderMessage, LogMessage, Payload, Config, ValidationError } from "./types";
|
|
9
10
|
export { MISSING_CREDENTIALS_MSG } from "./constants";
|
|
10
11
|
export { client } from "./client";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EACN,wBAAwB,EACxB,iBAAiB,EACjB,0BAA0B,EAC1B,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,eAAe,EACf,wBAAwB,EACxB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,SAAS,EACd,MAAM,qBAAqB,CAAC;AAE7B,YAAY,EACX,WAAW,EACX,aAAa,EACb,MAAM,EACN,aAAa,EACb,cAAc,EACd,aAAa,EACb,UAAU,EACV,OAAO,EACP,MAAM,EACN,eAAe,EACf,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,uBAAuB,EAAE,MAAM,a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