craterview 0.4.19 → 0.4.20
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/index.ts +24 -1
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -18,7 +18,7 @@ import { imageSize } from "image-size";
|
|
|
18
18
|
// Mirrored from package.json, which is the number a release bumps. It cannot be imported
|
|
19
19
|
// from there — this ships as TypeScript, so the import would have to resolve in the
|
|
20
20
|
// consumer's toolchain — so test/version.test.ts asserts the two agree.
|
|
21
|
-
export const VERSION = "0.4.
|
|
21
|
+
export const VERSION = "0.4.20";
|
|
22
22
|
const DEFAULT_BASE_URL = "https://api.craterview.ai";
|
|
23
23
|
// The server rejects a longer wait outright, so asking for one costs a 422 rather than the
|
|
24
24
|
// wait you asked for. `run()` clamps to this rather than letting that happen.
|
|
@@ -406,6 +406,12 @@ export interface ModelInfo {
|
|
|
406
406
|
* help with it, where a smaller region does. Zero means this axis is unbounded for you.
|
|
407
407
|
*/
|
|
408
408
|
max_input_megapixels: number;
|
|
409
|
+
/**
|
|
410
|
+
* The most of a picture this model works on in one job with `denoise` sent as true, in
|
|
411
|
+
* megapixels; `max_input_megapixels` applies otherwise. Null for a model that takes no
|
|
412
|
+
* `denoise`. Zero means this axis is unbounded for you.
|
|
413
|
+
*/
|
|
414
|
+
max_denoise_input_megapixels?: number | null;
|
|
409
415
|
/** Whole credits. The price is flat and knowable before you send anything. */
|
|
410
416
|
credits_per_image: number;
|
|
411
417
|
/** Whole credits. Null means this model takes stills only. */
|
|
@@ -481,6 +487,16 @@ export interface GalleryState {
|
|
|
481
487
|
post_id: string;
|
|
482
488
|
}
|
|
483
489
|
|
|
490
|
+
/** How far a running job has got. */
|
|
491
|
+
export interface JobProgress {
|
|
492
|
+
/** `starting` while your file is fetched and read, `processing` while the model runs,
|
|
493
|
+
* `saving` while the result is stored. */
|
|
494
|
+
stage: "starting" | "processing" | "saving";
|
|
495
|
+
/** Roughly how much of the run is done, from 0 up to but never reaching 1, estimated from
|
|
496
|
+
* how long recent jobs like this one have taken. Null when no estimate holds. */
|
|
497
|
+
fraction: number | null;
|
|
498
|
+
}
|
|
499
|
+
|
|
484
500
|
/** The API's job representation, exactly as it arrives. Snake case is the wire's. */
|
|
485
501
|
export interface JobData {
|
|
486
502
|
id: string;
|
|
@@ -519,6 +535,8 @@ export interface JobData {
|
|
|
519
535
|
/** Whole credits. TypeScript cannot say integer, but the API only ever sends one. */
|
|
520
536
|
credits?: number | null;
|
|
521
537
|
eta_seconds?: number | null;
|
|
538
|
+
/** How far the job has got while it runs. Absent while queued and once settled. */
|
|
539
|
+
progress?: JobProgress | null;
|
|
522
540
|
/** Retained past the ordinary expiry because its owner asked, links and all. */
|
|
523
541
|
kept?: boolean;
|
|
524
542
|
/**
|
|
@@ -561,6 +579,10 @@ export interface JobData {
|
|
|
561
579
|
* counting time spent waiting for a GPU as well as time spent on one. An estimate and never
|
|
562
580
|
* a promise — read it as guidance, not a deadline. Absent once a job has settled.
|
|
563
581
|
*
|
|
582
|
+
* `progress` is how far a running job has got: its stage, and roughly what fraction of the
|
|
583
|
+
* run is done — an estimate that never reaches 1 before the job finishes, and null when none
|
|
584
|
+
* holds. Null while the job is queued and once it has settled.
|
|
585
|
+
*
|
|
564
586
|
* `community` says the job is on the community queue, which runs on shared, free capacity —
|
|
565
587
|
* so it waits longer at busy times, and never stops. That is where an account's work goes
|
|
566
588
|
* when it is not paying, by holding credit or by subscribing. An empty balance is never itself
|
|
@@ -580,6 +602,7 @@ export class Job {
|
|
|
580
602
|
get errorCode() { return this.data.error_code ?? null; }
|
|
581
603
|
get credits() { return this.data.credits ?? null; }
|
|
582
604
|
get etaSeconds() { return this.data.eta_seconds ?? null; }
|
|
605
|
+
get progress() { return this.data.progress ?? null; }
|
|
583
606
|
/** Your own name for this job, or null if you did not send one. */
|
|
584
607
|
get customId() { return this.data.custom_id ?? null; }
|
|
585
608
|
// Defaulted rather than nulled: a server too old to send the field is not running a
|