popost 4.6.15 → 4.6.16

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.
@@ -1,6 +1,7 @@
1
1
  import { type ProjectTask } from '../providers/task';
2
2
  import type { Runtime } from '../runtime';
3
3
  import { type CleanStats } from './clean';
4
+ import { type ProjectMedia } from './media';
4
5
  import { type ProjectFiles } from './project-files';
5
6
  import { type AgentInfo, type TranscriptPart } from './transcript';
6
7
  export declare const FORMAT = "popost-feedback/1";
@@ -13,6 +14,8 @@ export interface FeedbackOptions {
13
14
  readonly transcript?: string;
14
15
  readonly noTranscript?: boolean;
15
16
  readonly session?: string;
17
+ /** Send no pictures and no video. */
18
+ readonly noMedia?: boolean;
16
19
  }
17
20
  export interface BuiltFeedback {
18
21
  readonly message: string;
@@ -23,11 +26,15 @@ export interface BuiltFeedback {
23
26
  readonly projectDir?: string;
24
27
  readonly task?: ProjectTask;
25
28
  readonly project?: ProjectFiles;
29
+ /** undefined with --no-media or without a project */
30
+ readonly media?: ProjectMedia;
26
31
  readonly stats: CleanStats;
27
32
  readonly gzip: Uint8Array;
28
33
  readonly sha256: string;
29
34
  }
30
35
  /** A path under the home folder as `~/…`. */
31
36
  export declare const tildify: (rt: Runtime, path: string) => string;
37
+ /** Where a media file is, as the user would name it: inside the project relative to it, else with home as `~`. */
38
+ export declare const mediaPath: (rt: Runtime, projectDir: string | undefined, file: string) => string;
32
39
  /** Everything that would be sent, cleaned and compressed. Reads only local files; sends nothing. */
33
40
  export declare const buildFeedback: (rt: Runtime, options: FeedbackOptions) => Promise<BuiltFeedback>;
@@ -0,0 +1,34 @@
1
+ import type { Runtime } from '../runtime';
2
+ export declare const MAX_PICTURES = 8;
3
+ export declare const MAX_PICTURE_BYTES: number;
4
+ export declare const MAX_VIDEO_BYTES: number;
5
+ export type MediaRole = 'input' | 'result';
6
+ /** Where the project records the file. */
7
+ export type MediaFrom = 'product' | 'cast' | 'anchor' | 'character' | 'reference' | 'upload' | 'render' | 'studio-export';
8
+ export type SkipReason = 'too-large' | 'over-limit' | 'unsupported-type' | 'unreadable';
9
+ interface Candidate {
10
+ readonly role: MediaRole;
11
+ readonly from: MediaFrom;
12
+ /** Absolute. */
13
+ readonly file: string;
14
+ }
15
+ export interface MediaFile extends Candidate {
16
+ readonly name: string;
17
+ readonly contentType: string;
18
+ readonly bytes: number;
19
+ readonly sha256: string;
20
+ readonly data: Uint8Array;
21
+ }
22
+ export interface SkippedMedia extends Candidate {
23
+ readonly reason: SkipReason;
24
+ readonly bytes?: number;
25
+ }
26
+ export interface ProjectMedia {
27
+ readonly files: readonly MediaFile[];
28
+ readonly skipped: readonly SkippedMedia[];
29
+ }
30
+ /** The video's type by its first box: `ftyp` (MP4; QuickTime when its brand is `qt `), or an older QuickTime atom. */
31
+ export declare const sniffVideoMime: (head: Uint8Array) => string | null;
32
+ /** The media of the project in `root`, read and capped; the same in the dry run and the upload. */
33
+ export declare const collectMedia: (rt: Runtime, root: string) => Promise<ProjectMedia>;
34
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { TranscriptFormat } from './transcript';
2
+ export declare const REQUEST_MESSAGES = 3;
3
+ /** UTF-16 units, as the platform counts them. */
4
+ export declare const REQUEST_MAX_CHARS = 4000;
5
+ /** At most `max` UTF-16 units, cut at a whole code point, with an ellipsis when cut. */
6
+ export declare const cutText: (text: string, max: number) => string;
7
+ /** The user's first words in a cleaned transcript; undefined for a plain-text transcript or when there are none. */
8
+ export declare const extractRequest: (cleanedText: string, format: TranscriptFormat) => string | undefined;
@@ -20,6 +20,8 @@ export interface TranscriptPart {
20
20
  readonly truncated: boolean;
21
21
  /** Why there is none, for the user. */
22
22
  readonly reason?: string;
23
+ /** The user's first words in the session (request.ts), from the start of the transcript even when only its end goes. */
24
+ readonly request?: string;
23
25
  }
24
26
  export declare class FeedbackError extends Error {
25
27
  readonly code: string;
@@ -2,10 +2,17 @@ import type { PopostClient } from '../providers/api';
2
2
  import { type JsonRecord } from '../providers/base';
3
3
  import type { Runtime } from '../runtime';
4
4
  import type { BuiltFeedback } from './bundle';
5
+ import type { MediaFile } from './media';
6
+ export type MediaState = 'received' | 'missing' | 'invalid';
5
7
  export interface SentFeedback {
6
8
  readonly id: string;
7
9
  readonly reference: string;
8
10
  readonly receivedAt: string;
11
+ /** What the platform found of each media file, in the order sent; empty from a platform that takes none. */
12
+ readonly media: readonly {
13
+ readonly file: MediaFile;
14
+ readonly state: MediaState;
15
+ }[];
9
16
  }
10
17
  /** The body of `POST /feedback`: what the report is, for the team's list; the report itself goes to the upload address. */
11
18
  export declare const reservation: (rt: Runtime, built: BuiltFeedback, operationKey: string) => JsonRecord;
@@ -1,2 +1,2 @@
1
1
  /** The CLI version; equals `metadata.version` in SKILL.md and is sent to popost.ai as `x-popost-client-version`. */
2
- export declare const VERSION = "4.6.15";
2
+ export declare const VERSION = "4.6.16";
@@ -3,11 +3,17 @@ import { type JsonRecord } from '../../providers/base';
3
3
  import type { Runtime } from '../../runtime';
4
4
  import { type ClipGate, type UnplannedClip } from './approved';
5
5
  import { type GenerateKind, type GenerateRequest, type PriceToConfirm } from './index';
6
- /** A failure of the generator, with the exit code it ends with (1: refused or failed; 2: the request or the setup needs fixing). */
6
+ import { type Failure } from './failure';
7
+ import { type FittedPicture } from './picture-fit';
8
+ /**
9
+ * A failure of the generator, with the exit code it ends with (1: refused or failed; 2: the request or the setup needs
10
+ * fixing). failure: what the platform said of a request that failed for good, printed for materials (failure.ts).
11
+ */
7
12
  export declare class GenerateError extends Error {
8
13
  readonly exitCode: number;
14
+ readonly failure?: Failure | undefined;
9
15
  name: string;
10
- constructor(message: string, exitCode?: number);
16
+ constructor(message: string, exitCode?: number, failure?: Failure | undefined);
11
17
  }
12
18
  export interface CloudSettings {
13
19
  readonly videoModel?: string;
@@ -55,12 +61,16 @@ export declare const requestKey: (kind: GenerateKind, fields: JsonRecord) => str
55
61
  export type MediaKind = 'image' | 'video' | 'audio';
56
62
  /** The type of a reference file by its first bytes (the extension is not trusted); null when the platform does not take it. */
57
63
  export declare const mediaType: (kind: MediaKind, head: Uint8Array) => string | null;
58
- /** What a made clip says: what it cost, what this call charged (0 when it was paid before) and its request key. */
64
+ /**
65
+ * What a made clip says: what it cost, what this call charged (0 when it was paid before), its request key, and the
66
+ * pictures that were fitted to the model before they were sent (picture-fit.ts).
67
+ */
59
68
  export interface MadeClip {
60
69
  credits?: number;
61
70
  chargedCredits: number;
62
71
  key: string;
63
72
  task: string;
73
+ fitted?: FittedPicture[];
64
74
  }
65
75
  /** Makes the clip a request asks for at out, on popost.ai; resolves with the credits it cost and was charged now. */
66
76
  export declare const makeClip: (rt: Runtime, client: PopostClient, s: CloudSettings, request: GenerateRequest, out: string) => Promise<MadeClip>;
@@ -69,5 +79,9 @@ export declare const makeClip: (rt: Runtime, client: PopostClient, s: CloudSetti
69
79
  * (POST /videos/quote), no task is looked up, made or waited for, and nothing is charged whatever the settings say.
70
80
  */
71
81
  export declare const priceClip: (rt: Runtime, client: PopostClient, s: CloudSettings, request: GenerateRequest) => Promise<PriceToConfirm>;
72
- /** GET /videos/models: the models a clip can be made with, and the one used when POPOST_VIDEO_MODEL is unset. */
82
+ /**
83
+ * GET /videos/models ({ models, default }): the models a clip can be made with, the platform's default marked
84
+ * "default": true in the list (the one used while POPOST_VIDEO_MODEL is unset, which it stays unless the user names
85
+ * another model).
86
+ */
73
87
  export declare const listModels: (client: PopostClient) => Promise<JsonRecord>;
@@ -0,0 +1,61 @@
1
+ /**
2
+ * A request that failed for good, as a generator tells it (the POPOST_GEN_CMD contract, index.ts): with a non-zero exit
3
+ * code it may print one JSON line { "error": { "code", "retryable"?, "reason"?, "refundedCredits"? } } besides its line
4
+ * on stderr. materials reads it to give a refunded clip's credits back to the budget of the call, and to tell the agent
5
+ * what to change before the request is sent again.
6
+ */
7
+ /**
8
+ * code: the platform's code (CONTENT_REJECTED, VIDEO_REQUEST_REJECTED, UPSTREAM_ERROR, ...). retryable: whether the
9
+ * same request may pass when it is sent again. reason: what the model said was wrong. refundedCredits: what was given
10
+ * back for it (a clip paid when it was sent, refunded when it failed). sound: a content refusal of the request's
11
+ * reference sound (the voice sample), as refusedSound decides.
12
+ */
13
+ export interface Failure {
14
+ code: string;
15
+ retryable?: boolean;
16
+ reason?: string;
17
+ refundedCredits?: number;
18
+ sound?: true;
19
+ }
20
+ /** The request failed and the generator said why (Failure). Its message is the generator's own line. */
21
+ export declare class GenerationFailed extends Error {
22
+ readonly failure: Failure;
23
+ name: string;
24
+ constructor(failure: Failure, message: string);
25
+ }
26
+ /** The failure a generator printed, with only the fields it is known to have; undefined when there is none. */
27
+ export declare const failureOf: (value: unknown) => Failure | undefined;
28
+ /**
29
+ * Whether a content refusal is of the request's reference sound (the voice sample): its reason names a sound ("audit
30
+ * block audio"), or the request had one and the reason names no other part of it (nor is there a reason at all).
31
+ */
32
+ export declare const refusedSound: (f: Pick<Failure, "code" | "reason">, hadSound: boolean) => boolean;
33
+ /** The failure with sound set when it is a refusal of the request's reference sound. */
34
+ export declare const withSound: (f: Failure, hadSound: boolean) => Failure;
35
+ /** What a failure asks of the agent: change the request, ask the user, change the prompt, or try again later. */
36
+ export type FailureKind = 'request' | 'sound' | 'content' | 'later' | 'other';
37
+ export declare const failureKind: (f: Failure) => FailureKind;
38
+ export declare const nextAfter: (f: Failure) => string;
39
+ /**
40
+ * The line a failed clip is told in: what failed and why (the reason as given, else the platform's message), what was
41
+ * charged, and what to do next. o.other: the words for a code this file does not know (describeError's, ending with
42
+ * the code); o.message: the platform's own message, said only when there is no reason.
43
+ */
44
+ export declare const failureLine: (f: Failure, o: {
45
+ other: string;
46
+ message?: string;
47
+ charged: "refunded" | "nothing";
48
+ }) => string;
49
+ /**
50
+ * Why a material could not be made, and what to do next. A generator that said why (failure) is told by its code and
51
+ * reason, with the credits that came back; one that only named a known code in its message is advised by that code.
52
+ * The advice (failure.ts) never tells a request the model will never take to be sent again unchanged, and a refused
53
+ * voice sample stops for the user. hadSound: the request had reference sounds.
54
+ */
55
+ export declare const failedProblem: (m: {
56
+ error?: string;
57
+ failure?: Failure;
58
+ }, hadSound: boolean) => {
59
+ message: string;
60
+ fix: string;
61
+ };
@@ -11,7 +11,10 @@
11
11
  * POPOST_GEN_NO_WAIT=1 in its environment a command may send the request and return before the file is made: it
12
12
  * prints { "pending": { "task"?, "state"?, "chargedCredits"? } } and exits with 4 (StillMaking); the same call later
13
13
  * picks the file up, without paying again (a command that does not know POPOST_GEN_NO_WAIT waits, as before). Such a
14
- * command answers a request with "priceOnly": true the same way whatever budget it has: only the price is wanted.
14
+ * command answers a request with "priceOnly": true the same way whatever budget it has: only the price is wanted. A
15
+ * command that failed may print { "error": { "code", "retryable"?, "reason"?, "refundedCredits"? } } with its non-zero
16
+ * exit code (GenerationFailed, failure.ts): materials then gives refunded credits back to the budget of its call and
17
+ * does not send that request again in the same call.
15
18
  * `popost video generate` is such a command on popost.ai (cloud.ts); skills/popost/tools/video/ has examples of tools
16
19
  * of your own. Which model runs, at what resolution and under what spending limit is the command's business (and its
17
20
  * environment's), never the request's. materials also sets POPOST_GEN_PROJECT (the project: the built-in generator books
@@ -35,6 +38,8 @@ import { type MaterialProvider } from './provenance';
35
38
  import { type ClipMusicBasis, type ModeContext, type RecordedException, type SoundMode } from '../sound/modes';
36
39
  import { type ClipMusicUse } from './clip-sound';
37
40
  import { type ReferenceLimits } from '../product/requests';
41
+ import { type Failure } from './failure';
42
+ import { type FittedPicture } from './picture-fit';
38
43
  export type GenerateKind = 'video' | 'image';
39
44
  export interface GenerateRequest {
40
45
  prompt: string;
@@ -84,11 +89,15 @@ export declare class ConfirmNeeded extends Error {
84
89
  }
85
90
  /** The exit code of a generator that asks for the user's agreement to a price. */
86
91
  export declare const CONFIRM_EXIT = 3;
87
- /** What a generator says of a request it sent and that is still being made: its task, how it stands, what this call charged. */
92
+ /**
93
+ * What a generator says of a request it sent and that is still being made: its task, how it stands, what this call
94
+ * charged, and the pictures it fitted to the model before it sent them (picture-fit.ts).
95
+ */
88
96
  export interface Pending {
89
97
  task?: string;
90
98
  state?: string;
91
99
  chargedCredits?: number;
100
+ fitted?: FittedPicture[];
92
101
  }
93
102
  /** The request was sent and is paid for; the file is still being made. The same call later picks it up without a new charge. */
94
103
  export declare class StillMaking extends Error {
@@ -98,12 +107,16 @@ export declare class StillMaking extends Error {
98
107
  }
99
108
  /** The exit code of a generator that sent the request and returned before the file was made (POPOST_GEN_NO_WAIT=1). */
100
109
  export declare const PENDING_EXIT = 4;
101
- /** What a generator says it made: what the file cost and, when it says so, what this call charged and the request key. */
110
+ /**
111
+ * What a generator says it made: what the file cost and, when it says so, what this call charged, the request key and
112
+ * the pictures it fitted to the model before it sent them.
113
+ */
102
114
  export interface Made {
103
115
  credits?: number;
104
116
  chargedCredits?: number;
105
117
  key?: string;
106
118
  task?: string;
119
+ fitted?: FittedPicture[];
107
120
  }
108
121
  export interface Generator {
109
122
  /** Makes one file at out, with `env` added to its environment. Resolves with what it cost, when the command says. */
@@ -144,7 +157,9 @@ export interface MaterialRequest extends GenerateRequest {
144
157
  /** motionAmount: how much a clip's picture moves (measure/amount.ts), to hold against the reference shot it is for. */
145
158
  /**
146
159
  * pending: sent and paid for, still being made (submitOnly); task is its task on the platform. queued: not sent yet,
147
- * because what it starts from (waitsFor) is still being made; a later run sends it.
160
+ * because what it starts from (waitsFor) is still being made; a later run sends it. failure: what the generator said of
161
+ * a request that failed (its code, whether it may pass again, the model's reason, what was refunded). fitted: the
162
+ * pictures the generator fitted to the model before it sent them (paths in the project where they are in it).
148
163
  */
149
164
  export interface MadeMaterial {
150
165
  receipt?: string;
@@ -156,6 +171,8 @@ export interface MadeMaterial {
156
171
  seconds?: number;
157
172
  motionAmount?: number;
158
173
  error?: string;
174
+ failure?: Failure;
175
+ fitted?: FittedPicture[];
159
176
  anchor?: true;
160
177
  waiting?: true;
161
178
  waitsFor?: string;
@@ -0,0 +1,60 @@
1
+ import type { Runtime } from '../../runtime';
2
+ /** What a model takes: width/height from minRatio to maxRatio, each side from minSide to maxSide pixels. */
3
+ export interface PictureLimits {
4
+ readonly minRatio: number;
5
+ readonly maxRatio: number;
6
+ readonly minSide: number;
7
+ readonly maxSide: number;
8
+ }
9
+ /** The limits of a model that lists none: what the models in use take (2026-12), the narrowest of them. */
10
+ export declare const DEFAULT_PICTURE_LIMITS: PictureLimits;
11
+ /** How a picture becomes one the model takes: the picture scaled to picture, centred on a canvas of canvas. */
12
+ export interface FitPlan {
13
+ readonly from: readonly [number, number];
14
+ readonly picture: readonly [number, number];
15
+ readonly canvas: readonly [number, number];
16
+ }
17
+ /** What the result of a clip says of a picture that was fitted. */
18
+ export interface FittedPicture {
19
+ readonly file: string;
20
+ readonly was: string;
21
+ readonly now: string;
22
+ readonly how: string;
23
+ }
24
+ /**
25
+ * The picture limits of a model's entry in GET /videos/models (or of the `allowed` of a refusal), each one the
26
+ * platform does not state taken from DEFAULT_PICTURE_LIMITS. Limits that contradict each other are not used.
27
+ */
28
+ export declare const pictureLimitsOf: (model: unknown) => PictureLimits;
29
+ /**
30
+ * How a picture of width x height becomes one the model takes, or undefined when it takes it as it is. The canvas
31
+ * has the nearest allowed ratio and holds the whole picture; the scale brings its shorter side up to minSide or its
32
+ * longer side down to maxSide. Sides are whole pixels: a widened canvas is rounded up, so its ratio stays in range.
33
+ */
34
+ export declare const fitPlan: (width: number, height: number, limits: PictureLimits) => FitPlan | undefined;
35
+ /**
36
+ * The orientation of a JPEG from its EXIF block (1 to 8), 1 when it has none. 5 to 8 turn the picture a quarter: its
37
+ * width and height as shown are its stored height and width (ffmpeg turns it when it decodes it).
38
+ */
39
+ export declare const jpegOrientation: (b: Uint8Array) => number;
40
+ /** The size of a picture as it is shown (a turned JPEG's sides swapped); undefined when its header cannot be read. */
41
+ export declare const shownSize: (bytes: Uint8Array) => readonly [number, number] | undefined;
42
+ /** The limits in words. */
43
+ export declare const rangeText: (limits: PictureLimits) => string;
44
+ /** In words: what was done to a picture, for the result of the clip. */
45
+ export declare const fitText: (plan: FitPlan, limits: PictureLimits) => string;
46
+ /** The fitted pictures a generator printed (the contract of index.ts); undefined when there are none. */
47
+ export declare const fittedList: (value: unknown) => FittedPicture[] | undefined;
48
+ /** A key for what the fit makes of a picture: the same picture and plan, the same request key, whatever bytes ffmpeg writes. */
49
+ export declare const fitKey: (plan: FitPlan) => string;
50
+ /** The fitted copy of a picture: its bytes, their type and sha256. src: the user's file, which is only read. */
51
+ export interface FittedBytes {
52
+ readonly bytes: Uint8Array;
53
+ readonly mimeType: string;
54
+ readonly sha256: string;
55
+ }
56
+ /**
57
+ * Writes the fitted copy of the picture at src in a scratch directory and reads it back. The plan is made again from
58
+ * the size ffmpeg decodes, should that differ from the header's (a turned JPEG on an ffmpeg that does not turn it).
59
+ */
60
+ export declare const fitPicture: (rt: Runtime, src: string, mimeType: string, plan: FitPlan, limits: PictureLimits) => Promise<FittedBytes>;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * One voice per speaker through the generated clips of a video when nobody gave the speaker a voice. The first clip in
3
+ * which a speaker speaks natively, alone, is the speaker's voice clip: it is made before the speaker's other clips, its
4
+ * speech becomes the speaker's registered voice (native-reference, cut from the clip: voice/sample.ts), and every later
5
+ * clip of theirs that is made from references takes that sample as its reference sound. So a host, on camera or heard
6
+ * over the pictures, keeps the voice the model gave them in the first clip instead of a new one in each clip, and no
7
+ * separate speech service is added. A clip made from frames takes no reference sounds: it keeps the model's own voice
8
+ * (materials says so).
9
+ */
10
+ import type { Runtime } from '../../runtime';
11
+ import { type VoiceProfile } from '../voice/profile';
12
+ import { type SentSpeech, type VisibleSpeech } from './speech';
13
+ interface Speaking {
14
+ file: string;
15
+ speech?: VisibleSpeech | SentSpeech;
16
+ }
17
+ export interface VoiceClips {
18
+ /** speaker -> the clip whose voice becomes theirs */
19
+ readonly clipOf: ReadonlyMap<string, string>;
20
+ /** request file -> the speakers whose voice clip it waits for */
21
+ readonly waits: ReadonlyMap<string, readonly string[]>;
22
+ }
23
+ /**
24
+ * The voice clips of a list of requests in the order they are made. canCarry tells a request that can take a reference
25
+ * sound (a clip made from references, not from frames): a speaker gets a voice clip only when a later clip of theirs
26
+ * can carry its voice. Speakers in `registered` already have a voice and need none.
27
+ */
28
+ export declare const planVoiceClips: <R extends Speaking>(order: readonly R[], registered: ReadonlySet<string>, canCarry: (r: R) => boolean) => VoiceClips;
29
+ /**
30
+ * The registered voices a natively speaking clip takes as reference sounds, in the order its speakers speak. A person
31
+ * who speaks in a clip speaks natively whatever voice the project registered: the registered voice is the reference of
32
+ * the voice where it can be one (a clip made from references); a clip made from frames takes no reference sounds and
33
+ * speaks with the model's voice, which is said in notes, never refused.
34
+ */
35
+ export declare const clipVoices: (rt: Runtime, dir: string, r: Speaking, fromFrames: boolean, notes: string[]) => Promise<{
36
+ id: string;
37
+ profile: VoiceProfile;
38
+ }[]>;
39
+ /** The voice clips a request still waits for: those of its speakers whose voice clip was not reached yet (settled). */
40
+ export declare const voiceClipsAwaited: (plan: VoiceClips, file: string, settled: ReadonlySet<string>) => string[];
41
+ /**
42
+ * Makes the voice of a made clip the registered voice of the speakers it is the voice clip of, and returns them: they
43
+ * are settled, with a voice or without. A clip without usable speech (no sound, under two seconds of it) gives no
44
+ * voice: its speakers' later clips then speak with the model's own voice, which is said in notes.
45
+ */
46
+ export declare const adoptClipVoice: (rt: Runtime, dir: string, plan: VoiceClips, file: string, notes: string[]) => Promise<string[]>;
47
+ export {};
@@ -1,10 +1,15 @@
1
1
  import type { Runtime } from '../../runtime';
2
2
  /** Shot scores (0..1) this close in two rounds are the same: fixing what made a shot worst moves its score further. */
3
3
  export declare const SIMILAR = 0.05;
4
- /** Rounds the review asks for at least, and at most (references/video-step-7-deliver.md). */
4
+ /**
5
+ * Rounds the review asks for at least, and at most (references/video-step-7-deliver.md). One round is enough when it
6
+ * finds nothing to fix; a fix is always rendered and compared again, so every change is checked, and three rounds are
7
+ * the most: a second round forced on a render that needed nothing, and a fourth, cost a render each without changing
8
+ * what the viewer sees.
9
+ */
5
10
  export declare const ROUNDS: {
6
- readonly least: 2;
7
- readonly most: 4;
11
+ readonly least: 1;
12
+ readonly most: 3;
8
13
  };
9
14
  export interface RenderEntry {
10
15
  /** The video written (absolute), a hash of its bytes, the hash of the project's picture files, when (ISO). */
@@ -33,6 +38,11 @@ export interface CompareEntry {
33
38
  /** The mean score of all shots: worst always names a few shots, and one above the mean is not a difference to chase. */
34
39
  mean?: number;
35
40
  }
41
+ /**
42
+ * The renders recorded for a project in a work directory (absolute; work.ts): oldest first, as written. A reader that
43
+ * does not run where the renders ran (a problem report) looks in the work directories the renders may have used.
44
+ */
45
+ export declare const recordedRenders: (rt: Runtime, work: string, projectDir: string) => Promise<RenderEntry[]>;
36
46
  /**
37
47
  * A hash of the project's files that change the picture: video.json, the files it names, and every file under assets/,
38
48
  * scenes/ and lib/ (a scene loads pictures and scripts by its own paths), sound files left out. The frame cache, the
@@ -9,6 +9,16 @@ export declare const checkReplicationReadiness: (c: ReplicationContract) => Prob
9
9
  export declare const checkReplicationAudio: (c: ReplicationContract, uses: readonly ReplicationAudioUse[], options?: {
10
10
  complete?: boolean;
11
11
  }) => Problem[];
12
+ /**
13
+ * How far the final may run from the retained reference interval, as a share of its length. A timeline that follows
14
+ * the voice rarely lands on the reference's frame, and a viewer does not hear or see a few per cent: within near it
15
+ * passes, within far it passes with a note for the delivery (a warning that does not hold acceptance back), and only
16
+ * further off does it fail. It used to be one frame, which sent agents round after round of re-timing.
17
+ */
18
+ export declare const LENGTH_SLACK: {
19
+ readonly near: 0.03;
20
+ readonly far: 0.1;
21
+ };
12
22
  export interface ReplicationAssessment {
13
23
  artifactReady: boolean;
14
24
  requirementsMet: boolean | null;
@@ -40,6 +40,12 @@ export declare class Wallet {
40
40
  reserve(credits: number, what: string): void;
41
41
  /** What a reserved call was charged in the end (0 when it failed before the platform spoke). */
42
42
  settle(reserved: number, charged: number): void;
43
+ /**
44
+ * Credits this command paid and the platform gave back (a clip paid when it was sent, then failed and was refunded):
45
+ * the command may spend them again. What it spends net never passes max: the caller gives back only what it paid
46
+ * itself and the platform refunded.
47
+ */
48
+ refund(credits: number): void;
43
49
  }
44
50
  /** A wallet that pays nothing: what a hosted call gets when its command confirmed no spending. */
45
51
  export declare const NOTHING: () => Wallet;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "popost",
3
- "version": "4.6.15",
3
+ "version": "4.6.16",
4
4
  "description": "popost Skill and CLI: reproduce videos, create and reproduce image posts, edit canvas and Studio projects, and save social inspiration links in coding agents such as Codex and Claude Code.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "CLIPCAT AI LTD",
@@ -12,13 +12,13 @@ Run `popost video doctor`, then a minimal local render before paid production; i
12
12
 
13
13
  Videos use reference analysis, replication inventory, template/project, `video materials` with the selected adapter, `template fill`, Popost render, actual-output review and editable Studio delivery. A pure generated talking-head video still uses this route; it needs no decorative scene merely to count as Popost. Image posts use the Popost setup, prepare/complete, editable canvas, render/review and export route. Host image tools remain selected. Never claim the complete route ran when only parsing/doctor ran. Keep commands, receipts, request keys, provider units, artifact paths and unresolved limitations in the project. Do not put credentials in the record.
14
14
 
15
- Read the selected model's live limits and billing basis before splitting clips. Merge where duration, speech density, scene control and speaker continuity permit; a reference shot is not necessarily a separately billed generation. Never silently clamp duration, change aspect, drop references or switch model. Before generation compare every prompt with the target product sheet: reference actions and framing may transfer, source product colors, labels, variants and claims do not. Contradictory prompts must be corrected, not papered over by appending another product block.
15
+ The model of popost.ai clips is the platform's default (`"default"` in `popost video generate --models`) unless the user names one; do not set `POPOST_VIDEO_MODEL` or choose a model by your own judgment (native speech, price, length, limits), and name the model in the plan. Read that model's live limits and billing basis before splitting clips. Merge where duration, speech density, scene control and speaker continuity permit; a reference shot is not necessarily a separately billed generation. Never silently clamp duration, change aspect, drop references or switch model. Before generation compare every prompt with the target product sheet: reference actions and framing may transfer, source product colors, labels, variants and claims do not. Contradictory prompts must be corrected, not papered over by appending another product block.
16
16
 
17
17
  ## AI clip audio
18
18
 
19
19
  The video model owns all sound of generated clips, including off-camera narration. Put all required words into native speech lines (offscreen where appropriate) and the prompt. Absence of a dedicated speech/TTS API field does not establish lack of prompt-driven speech. Distinguish supported, unsupported and unknown capabilities using provider documentation and real results; do not force a voice-provider menu. Only explicitly requested supplied voice/music/audio selects the external-audio route. Existing audio/TTS commands remain available for non-AI-video production and explicit audio work.
20
20
 
21
- Use one speaker description across clips; reuse a supported voice reference from the same speaker/accepted take without adding a TTS service. Keep native picture and embedded audio on the same source trim and speed. Music/effect continuity across clips is best effort and must not trigger a question, mandatory regeneration or separate soundtrack purchase. Actual missing sound, imperfect words or changing timbre are model-output observations: preserve the paid output, disclose the exact limitation and continue delivery with honest findings. Do not automatically retry, mark the provider task failed, charge for repair, or replace the native voice. Review evidence must not falsely say passed.
21
+ Use one speaker description across clips; reuse a supported voice reference from the same speaker/accepted take without adding a TTS service. A speaker the user gave no voice keeps the voice of the first clip they speak in: `materials` makes that clip first, registers its voice and gives a sample of it to the speaker's later clips (video-sound.md, "One voice per character"). Narration over the pictures is speech of the clips too (an offscreen line), in the same voice when it is the same person; a separate voice-over or a popost.ai voice only when the user gave or asked for one. Keep native picture and embedded audio on the same source trim and speed. Music/effect continuity across clips is best effort and must not trigger a question, mandatory regeneration or separate soundtrack purchase. Actual missing sound, imperfect words or changing timbre are model-output observations: preserve the paid output, disclose the exact limitation and continue delivery with honest findings. Do not automatically retry, mark the provider task failed, charge for repair, or replace the native voice. Review evidence must not falsely say passed.
22
22
 
23
23
  ## Compile and deliver
24
24
 
@@ -29,7 +29,7 @@ official 通道由 popost CLI 自身直接调用 popost.ai 平台 OpenAPI(HTTP
29
29
  | CREDIT_LIMIT_EXCEEDED | 实际计价超过已确认上限,平台拒绝且未扣费:重新报价并确认 |
30
30
  | RATE_LIMITED | 限流:按 retryAfterSeconds 等待后再操作 |
31
31
  | CLI_VERSION_TOO_OLD | Skill 版本低于平台要求:请用户更新 popost Skill |
32
- | CONTENT_REJECTED | 内容审核未通过:调整提示词或参考图 |
32
+ | CONTENT_REJECTED | 内容审核未通过,同样的请求会再次被拒:先改提示词措辞(去掉品牌、角色、知名作品的名字);改动或去掉用户自己的参考图前先问用户 |
33
33
  | UPSTREAM_ERROR / SERVICE_UNAVAILABLE / NOT_IMPLEMENTED | 平台明确失败,按未扣费处理,稍后重新报价 |
34
34
  | TIMEOUT / INTERNAL_ERROR | 生图请求按 ambiguous 处理(见上) |
35
35
 
@@ -6,7 +6,7 @@ Read this before planning more than one generated clip in a shared scene, and ag
6
6
 
7
7
  ## Plan the handoff before generation
8
8
 
9
- Group continuous action into the fewest generations the selected model supports. Its maximum duration is a production limit. Select the editorial cut from the reference action and dialogue, reserving short handles within the requested duration for trimming. Do not add time or compress speech to fit a rigid split.
9
+ Group continuous action into the fewest generations the model in use supports (on popost.ai the platform's default model, unless the user named another). Its maximum duration is a production limit. Select the editorial cut from the reference action and dialogue, reserving short handles within the requested duration for trimming. Do not add time or compress speech to fit a rigid split.
10
10
 
11
11
  For each join, keep the handoff in the project’s production notes with the preceding and following material, intended cut type (continuous shot, motivated shot change, or reference scene change), source cut-out and cut-in positions once known, speaker turn and sound continuity. Record the actor's position, gaze, hand pose and action phase, prop ownership, product details, framing, camera axis, motion direction and lighting. Inspect the actual previous clip before selecting these values.
12
12
 
@@ -61,9 +61,9 @@ Render checks require the locked clip's audio, in-point, cuts and speed to agree
61
61
 
62
62
  ## One timbre across a mixed video
63
63
 
64
- Use one project-wide speaker profile for a visible host and the voice-over on demonstrations or screen recordings. A registered voice never stops a person from speaking natively in a clip: it is passed as the timbre reference when it is registered with `--mode native-reference` and the clip is made from references; otherwise the clip speaks with the model's voice and `materials` says so in `notes`. Register a user-supplied voice with `popost video voice add project --speaker host --file voice-reference.wav`. An existing preset/clone can also be recorded with `--provider-voice ID`. `voices.json` records the actual reference file and hash.
64
+ In a video of generated clips every voice is the clips' own: the host on camera and the voice over the pictures (an offscreen line of the clip that covers it) speak in one voice, with the same speaker id when it is the same person. A speaker the user gave no voice keeps the voice of the first clip they speak in (video-sound.md, "One voice per character"); do not register a popost.ai voice, speak a voice-over with `voice speak` or `--speak`, or add another speech service unless the user chose a voice or asked for a separate voice-over. When a model refuses a voice sample, ask the user (another voice, or another model) and keep voices.json as it is: removing a voice to get past a refusal gives the clips different voices. Use one project-wide speaker profile for a visible host and the voice-over on demonstrations or screen recordings. A registered voice never stops a person from speaking natively in a clip: it is passed as the timbre reference when it is registered with `--mode native-reference` and the clip is made from references; otherwise the clip speaks with the model's voice and `materials` says so in `notes`. Register a user-supplied voice with `popost video voice add project --speaker host --file voice-reference.wav`. An existing preset/clone can also be recorded with `--provider-voice ID`. `voices.json` records the actual reference file and hash.
65
65
 
66
- With a connected popost.ai account, its voices are the first choice for voice-over and dialogue (no local speaker needed, word times included); a speaker of the user's own (`POPOST_TTS_CMD`, `POPOST_VOICE_CMD`) remains an option. Read the live catalog with `popost video voice list`. It includes published official voices and the account's personal voices, with playable preview URLs and clone state; `--scope mine` lists only the personal ones, `--scope official` only the official ones (default `all`). Names and defaults come from the platform; never embed a copied catalog or upstream clone ids in the Skill. Honour the user's chosen voice. Otherwise use `default-male` for a male speaker or `default-female` for a female speaker; without a gender requirement use `default-male`. A missing configured default is an error, not permission to substitute another voice.
66
+ For a video without generated speaking clips (a template filled with footage, pictures and cards), or when the user chose a voice: with a connected popost.ai account, its voices are the first choice for voice-over and dialogue (no local speaker needed, word times included); a speaker of the user's own (`POPOST_TTS_CMD`, `POPOST_VOICE_CMD`) remains an option. Read the live catalog with `popost video voice list`. It includes published official voices and the account's personal voices, with playable preview URLs and clone state; `--scope mine` lists only the personal ones, `--scope official` only the official ones (default `all`). Names and defaults come from the platform; never embed a copied catalog or upstream clone ids in the Skill. Honour the user's chosen voice. Otherwise use `default-male` for a male speaker or `default-female` for a female speaker; without a gender requirement use `default-male`. A missing configured default is an error, not permission to substitute another voice.
67
67
 
68
68
  ```bash
69
69
  popost video voice use project --speaker host --voice default-male
@@ -142,9 +142,10 @@ to the prompt, and keeps what was sent in `<clip>.product.json`. A clip from a f
142
142
  `materials --check` (and every run) refuses, before anything is paid:
143
143
 
144
144
  - a request without `"products"`; when its prompt says one of the product's `names`, the message says so;
145
- - a product request whose model takes no reference pictures, or fewer than the product has: choose a model that
146
- takes them (`popost video generate --models`, `maxReferenceImages`), or make the shot from the real picture
147
- (section 3). A picture is never left out to make a request fit;
145
+ - a product request whose model takes no reference pictures, or fewer than the product has: make the shot from the
146
+ real picture (section 3), or tell the user and ask whether to use a model that takes them (`popost video generate
147
+ --models`, `maxReferenceImages`); set `POPOST_VIDEO_MODEL` only to a model the user names. A picture is never left
148
+ out to make a request fit;
148
149
  - a product clip whose `"firstFrame"` is not one of the user's pictures or a listed still;
149
150
  - a sheet with errors (a picture nobody looked at for a face is one); and, once the list is to be paid for, inputs
150
151
  or inferred facts the user has not confirmed.
@@ -110,7 +110,7 @@ Use authored text, paths, masks, UI framing and deterministic motion for work th
110
110
 
111
111
  Code is not a universal replacement for a failed native job. A simple geometric character or generic slideshow is a different result when the source needs polished acting or photographic finish. An alternative route must meet the same accepted invariants, or require an explicit user change in those invariants. Permission to spend on repairs does not itself authorize a visual downgrade.
112
112
 
113
- Preserve request keys, receipts and partial checkpoints. Reconcile ambiguous submissions before retrying. Distinguish upload failure, pending continuation, refunded upstream failure, and content rejection from their actual statuses. Do not infer a universal model failure, unsupported duration, or rejected subject from a generic upstream error. Keep failed or unresolved cases visible; do not claim native generation succeeded because an authored replacement file exists.
113
+ Preserve request keys, receipts and partial checkpoints. Reconcile ambiguous submissions before retrying. Distinguish upload failure, pending continuation, refunded upstream failure, a request the model does not take (`VIDEO_REQUEST_REJECTED`, fails again unchanged), and content rejection from their actual statuses (video-tools.md, "Common failures"). Do not infer a universal model failure, unsupported duration, or rejected subject from a generic upstream error. Keep failed or unresolved cases visible; do not claim native generation succeeded because an authored replacement file exists.
114
114
 
115
115
  Quote and execute with the account, model, budget and approvals applicable to the session. A new contract does not authorize an account/provider switch, purchase, top-up, or social posting.
116
116
 
@@ -304,4 +304,4 @@ Existing projects without the new sidecars keep their previous behavior. Do not
304
304
 
305
305
  ## Speech-retimed event clocks
306
306
 
307
- A strict spoken template fill writes `replication.timing.json` with a lossless source-to-target frame map, bound to the source-reading revision and compiled segment clock. Keep this generated file with the editable project; do not edit it by hand. `replication timeline project` reports source and target spans for every required event. Bind the implementation and actual scene motion to those target spans. A source or timeline change invalidates the map and requires a refill. Without a map, checks retain the original source-clock rule. Duration, real artifact evidence, medium, sound and event coverage still have to pass independently; retiming never establishes a quality pass.
307
+ A strict spoken template fill writes `replication.timing.json` with a lossless source-to-target frame map, bound to the source-reading revision and compiled segment clock. Keep this generated file with the editable project; do not edit it by hand. `replication timeline project` reports source and target spans for every required event. Bind the implementation and actual scene motion to those target spans. A source or timeline change invalidates the map and requires a refill. Without a map, checks retain the original source-clock rule. Duration, real artifact evidence, medium, sound and event coverage still have to pass independently; retiming never establishes a quality pass. Duration passes within 3% of the retained interval, passes with a warning to state in the delivery notes within 10%, and fails only beyond: do not re-time a render to land on the reference's frame.
@@ -170,9 +170,16 @@ the user gave or from an approved clip in which the person speaks with:
170
170
  popost video voice sample project --speaker host --from <recording or clip> [--start 3.2 --end 9.0]
171
171
  ```
172
172
 
173
- Without `--start`/`--end` it takes the cleanest run of speech. A clip of several speakers gets each one's sample,
173
+ Without `--start`/`--end` it takes the cleanest run of speech. When nobody gave a speaker a voice, `materials` does
174
+ this by itself: the first clip in which the speaker speaks alone is their voice clip; it is made first (their later
175
+ clips wait for it, `"queued"` with `"waitsFor"`), its voice is registered as theirs (`native-reference`) with a sample
176
+ cut from it, and every later clip of theirs made from references takes the sample, so the whole video has one voice
177
+ for them. Write that first clip with a clear, calm line, so the sample is clean. A clip made from a first frame takes
178
+ no reference sounds and keeps the model's own voice: for a speaker in several clips, make their clips from references
179
+ (the cast's pictures) rather than from frames. A clip of several speakers gets each one's sample,
174
180
  shorter so that they fit the model's reference sounds together; a model that takes fewer reference sounds than a
175
- clip needs is refused before anything is uploaded or paid.
181
+ clip needs is refused before anything is uploaded or paid. Ask the user then: another model only when they name one,
182
+ and the voice sample is not left out without them.
176
183
 
177
184
  ## Did the clip say its lines: the speech check
178
185
 
@@ -145,7 +145,7 @@ alone only when paid work must run before the list can exist, and then only for
145
145
  calibration (`plan --voice` speaks one sentence). No narration: no voice-over in the overview, and none is made,
146
146
  unless the user asks for one in their own words.
147
147
  - Generated clips and pictures: their price per second or per picture (`popost video generate --models`) times what
148
- you plan. Every on-camera stretch is a clip in which a person speaks, as long as the stretch (`video-performers.md`).
148
+ you plan, for the platform's default model (`"default"` there) or the one the user named; never a model you chose. Every on-camera stretch is a clip in which a person speaks, as long as the stretch (`video-performers.md`).
149
149
  - The user's product, when they supplied one: write the product sheet now (`popost video product init`, then its
150
150
  facts; [video-product.md](video-product.md)) and put the `confirm` line of `popost video product check project`
151
151
  into this overview: what you read from their picture and from how such a product is used, for them to correct or