popost 4.6.11 → 4.6.13
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/README.md +2 -0
- package/SKILL.md +6 -4
- package/dist/cli.js +12524 -10602
- package/dist/index.js +12518 -10598
- package/dist/types/commands/feedback.d.ts +2 -0
- package/dist/types/feedback/bundle.d.ts +33 -0
- package/dist/types/feedback/clean.d.ts +44 -0
- package/dist/types/feedback/project-files.d.ts +19 -0
- package/dist/types/feedback/transcript.d.ts +38 -0
- package/dist/types/feedback/upload.d.ts +13 -0
- package/dist/types/providers/link-resolve.d.ts +29 -0
- package/dist/types/runtime.d.ts +3 -0
- package/dist/types/version.d.ts +1 -1
- package/dist/types/video/commands/inputs.d.ts +2 -0
- package/dist/types/video/commands/materials.d.ts +6 -0
- package/dist/types/video/commands/product.d.ts +2 -6
- package/dist/types/video/commands/shared.d.ts +0 -5
- package/dist/types/video/generate/cloud-image.d.ts +3 -1
- package/dist/types/video/generate/cloud.d.ts +6 -0
- package/dist/types/video/generate/dialogue.d.ts +4 -10
- package/dist/types/video/generate/index.d.ts +18 -1
- package/dist/types/video/generate/provenance.d.ts +13 -0
- package/dist/types/video/inputs/collect.d.ts +104 -0
- package/dist/types/video/inputs/record.d.ts +106 -0
- package/dist/types/video/inputs/sheet.d.ts +8 -0
- package/dist/types/video/inputs/summary.d.ts +72 -0
- package/dist/types/video/product/sheet.d.ts +24 -1
- package/dist/types/video/prompt-lang.d.ts +16 -0
- package/dist/types/video/replication/books.d.ts +1 -1
- package/dist/types/video/replication/contract.d.ts +56 -0
- package/dist/types/video/replication/review.d.ts +17 -0
- package/dist/types/video/replication/voice-spans.d.ts +1 -1
- package/dist/types/video/sound/modes.d.ts +0 -8
- package/package.json +1 -1
- package/references/onboarding.md +2 -1
- package/references/post-bundle.md +5 -3
- package/references/video-continuity.md +40 -0
- package/references/video-performers.md +2 -0
- package/references/video-product.md +39 -17
- package/references/video-replication.md +3 -1
- package/references/video-step-0-machine.md +7 -0
- package/references/video-step-1-read.md +12 -7
- package/references/video-step-3-content.md +9 -1
- package/references/video-step-6-voice.md +10 -0
- package/references/video-tools.md +44 -1
- package/references/video.md +23 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ProjectTask } from '../providers/task';
|
|
2
|
+
import type { Runtime } from '../runtime';
|
|
3
|
+
import { type CleanStats } from './clean';
|
|
4
|
+
import { type ProjectFiles } from './project-files';
|
|
5
|
+
import { type AgentInfo, type TranscriptPart } from './transcript';
|
|
6
|
+
export declare const FORMAT = "popost-feedback/1";
|
|
7
|
+
export declare const MESSAGE_MAX_CHARS = 4000;
|
|
8
|
+
/** The most the platform takes, compressed. */
|
|
9
|
+
export declare const MAX_BUNDLE_BYTES: number;
|
|
10
|
+
export interface FeedbackOptions {
|
|
11
|
+
readonly message: string;
|
|
12
|
+
readonly dir?: string;
|
|
13
|
+
readonly transcript?: string;
|
|
14
|
+
readonly noTranscript?: boolean;
|
|
15
|
+
readonly session?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface BuiltFeedback {
|
|
18
|
+
readonly message: string;
|
|
19
|
+
readonly agent: AgentInfo;
|
|
20
|
+
readonly transcript: TranscriptPart & {
|
|
21
|
+
readonly omittedImages: number;
|
|
22
|
+
};
|
|
23
|
+
readonly projectDir?: string;
|
|
24
|
+
readonly task?: ProjectTask;
|
|
25
|
+
readonly project?: ProjectFiles;
|
|
26
|
+
readonly stats: CleanStats;
|
|
27
|
+
readonly gzip: Uint8Array;
|
|
28
|
+
readonly sha256: string;
|
|
29
|
+
}
|
|
30
|
+
/** A path under the home folder as `~/…`. */
|
|
31
|
+
export declare const tildify: (rt: Runtime, path: string) => string;
|
|
32
|
+
/** Everything that would be sent, cleaned and compressed. Reads only local files; sends nothing. */
|
|
33
|
+
export declare const buildFeedback: (rt: Runtime, options: FeedbackOptions) => Promise<BuiltFeedback>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a problem report (`popost feedback`) removes before anything leaves the machine, the same in the dry run and the
|
|
3
|
+
* upload, so the counts the dry run shows are the counts of what is sent:
|
|
4
|
+
*
|
|
5
|
+
* - pictures and other binary data: a `data:` URL, or a string of only base64 characters longer than 1 KB, becomes
|
|
6
|
+
* `[omitted: <mime or 'binary'> <N> KB]` (counted in `omittedImages`);
|
|
7
|
+
* - secrets: known token shapes (popost keys and device tokens, `sk-…`, AWS, GitHub, Slack, `Bearer …`, JWTs, PEM private
|
|
8
|
+
* keys), the signature and token parameters of signed URLs, values under a secret's name (isSecretName: a word of the
|
|
9
|
+
* name is secret, token, password, passwd, pwd, credential(s) or apikey, or `key` after api, access, secret, private,
|
|
10
|
+
* client, auth, signing, encryption, master, service or account) when the value is quoted (`"name": "value"`) or the
|
|
11
|
+
* name is a variable's (`NAME=value`), and the exact values of such variables of this process's environment (counted in
|
|
12
|
+
* `redactions`). A bare `key` (a map key, a storage key) and code (`token: params.token`) are left alone, so the
|
|
13
|
+
* source an agent read stays readable;
|
|
14
|
+
* - the user's home directory, written as `~`.
|
|
15
|
+
*
|
|
16
|
+
* It is a best effort over text the user agreed to send, not a guarantee: the dry run shows the user what goes.
|
|
17
|
+
*/
|
|
18
|
+
import type { Runtime } from '../runtime';
|
|
19
|
+
export declare const REDACTED = "[redacted]";
|
|
20
|
+
/** A string longer than this that is only base64 characters is binary data, not text. */
|
|
21
|
+
export declare const BINARY_MIN_CHARS = 1024;
|
|
22
|
+
export interface CleanStats {
|
|
23
|
+
redactions: number;
|
|
24
|
+
omittedImages: number;
|
|
25
|
+
}
|
|
26
|
+
export interface Cleaner {
|
|
27
|
+
readonly stats: CleanStats;
|
|
28
|
+
/** One string: pictures out, secrets out, home as `~`. */
|
|
29
|
+
readonly text: (value: string) => string;
|
|
30
|
+
/** A parsed JSON value, every string and every value under a secret's name cleaned. */
|
|
31
|
+
readonly json: (value: unknown) => unknown;
|
|
32
|
+
}
|
|
33
|
+
export declare const isSecretName: (name: string) => boolean;
|
|
34
|
+
/** The values of this process's variables named like secrets, longest first (a key inside a longer value goes with it). */
|
|
35
|
+
export declare const environmentSecrets: (env: Runtime["env"]) => string[];
|
|
36
|
+
export declare const createCleaner: (options?: {
|
|
37
|
+
readonly homeDir?: string;
|
|
38
|
+
readonly secrets?: readonly string[];
|
|
39
|
+
}) => Cleaner;
|
|
40
|
+
/** A JSONL text cleaned line by line: a line that parses is cleaned as JSON and written back compact; any other stays text. */
|
|
41
|
+
export declare const cleanJsonl: (cleaner: Cleaner, raw: string) => {
|
|
42
|
+
text: string;
|
|
43
|
+
lines: number;
|
|
44
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Runtime } from '../runtime';
|
|
2
|
+
import type { Cleaner } from './clean';
|
|
3
|
+
export declare const MAX_DEPTH = 6;
|
|
4
|
+
export declare const MAX_LISTED = 2000;
|
|
5
|
+
export declare const DOCUMENT_MAX_BYTES: number;
|
|
6
|
+
export declare const DOCUMENTS_MAX_BYTES: number;
|
|
7
|
+
export interface ListedFile {
|
|
8
|
+
readonly path: string;
|
|
9
|
+
readonly bytes: number;
|
|
10
|
+
}
|
|
11
|
+
export interface ProjectFiles {
|
|
12
|
+
/** Every file found, POSIX paths relative to the project. */
|
|
13
|
+
readonly files: readonly ListedFile[];
|
|
14
|
+
/** The text that goes, by relative path. */
|
|
15
|
+
readonly documents: Readonly<Record<string, string>>;
|
|
16
|
+
/** More files than MAX_LISTED: the list stops there. */
|
|
17
|
+
readonly listTruncated: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare const collectProjectFiles: (rt: Runtime, root: string, cleaner: Cleaner) => Promise<ProjectFiles>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Runtime } from '../runtime';
|
|
2
|
+
import { type Cleaner } from './clean';
|
|
3
|
+
export declare const TRANSCRIPT_MAX_BYTES: number;
|
|
4
|
+
/** More than this is not read at all: only its end, so a huge file cannot exhaust memory. */
|
|
5
|
+
export declare const TRANSCRIPT_READ_MAX_BYTES: number;
|
|
6
|
+
export type TranscriptStatus = 'found' | 'missing' | 'skipped';
|
|
7
|
+
export type TranscriptFormat = 'claude-code-jsonl' | 'codex-jsonl' | 'jsonl' | 'text';
|
|
8
|
+
export interface AgentInfo {
|
|
9
|
+
readonly id: string;
|
|
10
|
+
readonly label: string;
|
|
11
|
+
readonly sessionId?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface TranscriptPart {
|
|
14
|
+
readonly status: TranscriptStatus;
|
|
15
|
+
readonly path?: string;
|
|
16
|
+
readonly format?: TranscriptFormat;
|
|
17
|
+
readonly text?: string;
|
|
18
|
+
readonly lines: number;
|
|
19
|
+
readonly bytes: number;
|
|
20
|
+
readonly truncated: boolean;
|
|
21
|
+
/** Why there is none, for the user. */
|
|
22
|
+
readonly reason?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare class FeedbackError extends Error {
|
|
25
|
+
readonly code: string;
|
|
26
|
+
name: string;
|
|
27
|
+
constructor(code: string, message: string);
|
|
28
|
+
}
|
|
29
|
+
/** The agent this command runs in, and its session: --session first, then what the agent sets. */
|
|
30
|
+
export declare const detectAgent: (rt: Runtime, session?: string) => AgentInfo;
|
|
31
|
+
/**
|
|
32
|
+
* The cleaned transcript. `file`: --transcript (resolved from the working folder); `skip`: --no-transcript. A named file
|
|
33
|
+
* that cannot be read is an error; an agent's transcript that is not found is `missing` with the reason.
|
|
34
|
+
*/
|
|
35
|
+
export declare const readTranscript: (rt: Runtime, agent: AgentInfo, cleaner: Cleaner, options: {
|
|
36
|
+
file?: string;
|
|
37
|
+
skip?: boolean;
|
|
38
|
+
}) => Promise<TranscriptPart>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PopostClient } from '../providers/api';
|
|
2
|
+
import { type JsonRecord } from '../providers/base';
|
|
3
|
+
import type { Runtime } from '../runtime';
|
|
4
|
+
import type { BuiltFeedback } from './bundle';
|
|
5
|
+
export interface SentFeedback {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly reference: string;
|
|
8
|
+
readonly receivedAt: string;
|
|
9
|
+
}
|
|
10
|
+
/** The body of `POST /feedback`: what the report is, for the team's list; the report itself goes to the upload address. */
|
|
11
|
+
export declare const reservation: (rt: Runtime, built: BuiltFeedback, operationKey: string) => JsonRecord;
|
|
12
|
+
/** Reserve, upload, complete; once more with the same operation key when the bytes did not arrive. */
|
|
13
|
+
export declare const sendFeedback: (rt: Runtime, client: PopostClient, built: BuiltFeedback) => Promise<SentFeedback>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Share links the CLI resolves on the user's own machine before a link is submitted to the platform.
|
|
3
|
+
*
|
|
4
|
+
* A share link carries no post id: it only redirects to the post. The platform follows such links from its servers, and
|
|
5
|
+
* some sites refuse those requests while a request from the user's machine gets through, so the CLI follows the
|
|
6
|
+
* redirects here first and submits the post link it ends at. Nothing is charged for this and nothing but the link
|
|
7
|
+
* itself is requested: https only, only hosts of the same site, at most MAX_HOPS hops of HOP_TIMEOUT_MS each, no
|
|
8
|
+
* cookies. A hop is a 3xx with a Location header, or an HTML page that stands for one (meta refresh,
|
|
9
|
+
* `location.replace("…")`, a link in `<noscript>`; at most the first HTML_HOP_MAX_BYTES of it are read); every other
|
|
10
|
+
* response body is discarded. When the walk fails for any reason the original link is submitted unchanged and the
|
|
11
|
+
* platform resolves it (or says why it cannot).
|
|
12
|
+
*
|
|
13
|
+
* The table mirrors the platform's own rules for the same links; short links the platform hands to its data source
|
|
14
|
+
* (Douyin, TikTok, Xiaohongshu, Instagram, Kuaishou, WeChat) are not resolved here.
|
|
15
|
+
*/
|
|
16
|
+
import type { Runtime } from '../runtime';
|
|
17
|
+
export declare const MAX_HOPS = 5;
|
|
18
|
+
export declare const HOP_TIMEOUT_MS = 10000;
|
|
19
|
+
export declare const HTML_HOP_MAX_BYTES: number;
|
|
20
|
+
/**
|
|
21
|
+
* Where an HTML page sends its reader, or null: a meta refresh, then a `location.replace("…")` / `location = "…"` with
|
|
22
|
+
* a string literal, then a link inside `<noscript>`. Nothing else is read as a redirect.
|
|
23
|
+
*/
|
|
24
|
+
export declare const htmlRedirectTarget: (html: string) => string | null;
|
|
25
|
+
/**
|
|
26
|
+
* The post link a share link leads to, or null when `link` is not a share link resolved locally or the walk did not
|
|
27
|
+
* reach a post (refused, failed, left the site, too many hops).
|
|
28
|
+
*/
|
|
29
|
+
export declare const resolveShareLink: (rt: Runtime, link: string) => Promise<string | null>;
|
package/dist/types/runtime.d.ts
CHANGED
|
@@ -157,6 +157,9 @@ export interface EditorHost {
|
|
|
157
157
|
export interface Runtime {
|
|
158
158
|
/** Desktop operating system. Virtual hosts may omit this capability. */
|
|
159
159
|
readonly platform?: string;
|
|
160
|
+
/** Desktop-only: the processor architecture and the Node version, told in a problem report (`popost feedback`). */
|
|
161
|
+
readonly arch?: string;
|
|
162
|
+
readonly nodeVersion?: string;
|
|
160
163
|
readonly fs: FileSystem;
|
|
161
164
|
/** `node:path` of the platform for the real disk, `node:path/posix` for a virtual one. */
|
|
162
165
|
readonly path: PlatformPath;
|
package/dist/types/version.d.ts
CHANGED
|
@@ -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.
|
|
2
|
+
export declare const VERSION = "4.6.13";
|
|
@@ -1 +1,7 @@
|
|
|
1
|
+
import type { Runtime } from '../../runtime';
|
|
2
|
+
import { type AnchorPicture } from '../generate/index';
|
|
3
|
+
/** --anchor-image: the caller's picture as a path in the project; a file from elsewhere is copied to assets/anchor-image.<ext>. */
|
|
4
|
+
export declare const givenAnchor: (rt: Runtime, dir: string, given: string) => Promise<AnchorPicture>;
|
|
5
|
+
/** --character: a character of the user's popost.ai library, its picture downloaded into the project. A key never reaches the message. */
|
|
6
|
+
export declare const characterOf: (rt: Runtime, dir: string, id: string) => Promise<AnchorPicture>;
|
|
1
7
|
export declare const materials: import("../../workflow/subcommands").Subcommand;
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import type { Runtime } from '../../runtime';
|
|
2
2
|
import { type ReferenceLimits } from '../product/requests';
|
|
3
3
|
import { type Commands } from './shared';
|
|
4
|
-
/**
|
|
5
|
-
* What the model of the clips takes, from the built-in generator's own list (POPOST_VIDEO_MODEL, else the platform's
|
|
6
|
-
* default). A generator of the user's own, or a list that cannot be read, gives no limits and says why: the list of
|
|
7
|
-
* requests is then not held to them, and says so.
|
|
8
|
-
*/
|
|
9
|
-
/** POPOST_GEN_CMD names the built-in generator (popost video generate, whatever comes before and after it). */
|
|
4
|
+
/** Recognize either Popost executable form, including profile flags. Adapter arguments may also contain these words. */
|
|
10
5
|
export declare const builtInGenerator: (rt: Runtime) => boolean;
|
|
6
|
+
/** Read the Popost model limits, or the exact-frame capability declared for an external adapter. */
|
|
11
7
|
export declare const referenceLimits: (rt: Runtime) => Promise<{
|
|
12
8
|
limits?: ReferenceLimits;
|
|
13
9
|
unread?: string;
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* What every `popost video` command shares: one way to declare a command, and one place that turns the failures a user
|
|
3
|
-
* (or the model driving the CLI) can fix into `{"ok": false, "error": …}` with exit code 2. Anything else is a bug and
|
|
4
|
-
* is left to the generic handler in `main.ts` (exit code 1).
|
|
5
|
-
*/
|
|
6
1
|
import type { OptionSpec, ParsedArgs, PositionalSpec } from '../../args';
|
|
7
2
|
import type { Runtime } from '../../runtime';
|
|
8
3
|
import type { Subcommand } from '../../workflow/subcommands';
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { type JsonRecord } from '../../providers/base';
|
|
2
2
|
import type { Runtime } from '../../runtime';
|
|
3
3
|
import { type CloudSettings } from './cloud';
|
|
4
|
-
import { type GenerateRequest } from './index';
|
|
4
|
+
import { type GenerateRequest, type PriceToConfirm } from './index';
|
|
5
5
|
/** What a made picture says: what it cost, what this call charged (0 when it was paid before) and its request key. */
|
|
6
6
|
export interface MadePicture {
|
|
7
7
|
credits?: number;
|
|
8
8
|
chargedCredits: number;
|
|
9
9
|
key: string;
|
|
10
10
|
}
|
|
11
|
+
/** What a picture would cost (POST /images/quote, free): nothing is sent to a model and nothing is charged. */
|
|
12
|
+
export declare const pricePicture: (rt: Runtime, s: CloudSettings, config: JsonRecord, request: GenerateRequest) => Promise<PriceToConfirm>;
|
|
11
13
|
/** Makes the picture a request asks for at out, on popost.ai; resolves with what it cost and what this call charged. */
|
|
12
14
|
export declare const makePicture: (rt: Runtime, s: CloudSettings, config: JsonRecord, request: GenerateRequest, out: string) => Promise<MadePicture>;
|
|
@@ -60,8 +60,14 @@ export interface MadeClip {
|
|
|
60
60
|
credits?: number;
|
|
61
61
|
chargedCredits: number;
|
|
62
62
|
key: string;
|
|
63
|
+
task: string;
|
|
63
64
|
}
|
|
64
65
|
/** Makes the clip a request asks for at out, on popost.ai; resolves with the credits it cost and was charged now. */
|
|
65
66
|
export declare const makeClip: (rt: Runtime, client: PopostClient, s: CloudSettings, request: GenerateRequest, out: string) => Promise<MadeClip>;
|
|
67
|
+
/**
|
|
68
|
+
* What a clip would cost, and nothing else: its references are uploaded as for any quote (free), the request is priced
|
|
69
|
+
* (POST /videos/quote), no task is looked up, made or waited for, and nothing is charged whatever the settings say.
|
|
70
|
+
*/
|
|
71
|
+
export declare const priceClip: (rt: Runtime, client: PopostClient, s: CloudSettings, request: GenerateRequest) => Promise<PriceToConfirm>;
|
|
66
72
|
/** GET /videos/models: the models a clip can be made with, and the one used when POPOST_VIDEO_MODEL is unset. */
|
|
67
73
|
export declare const listModels: (client: PopostClient) => Promise<JsonRecord>;
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Lines a person says in a generated clip, with their times. The integrated video models speak lines written into
|
|
3
|
-
* the prompt, with matching mouths, and keep to times given as "0.0-2.3 s ... says": so a request names the lines, who
|
|
4
|
-
* says each, and their language, and this program writes the times and the dialogue block of the prompt. The times
|
|
5
|
-
* come from the template: a line names the beat it re-makes ("beat"), the clip starts where a shot of the template
|
|
6
|
-
* starts ("shot", from 1; default: the shot in which the first named beat begins), and a line's slot is its beat's
|
|
7
|
-
* time counted from that shot's start. A fill then shows the clip from "in": 0 in that shot, and the person speaks
|
|
8
|
-
* where the reference's did. Seconds written by hand ("at", "to") are for a project without a template's beats only.
|
|
9
|
-
* Everything here is checked before a clip is paid for. Pure.
|
|
10
|
-
*/
|
|
11
1
|
import { type Pace } from '../retarget/pace';
|
|
12
2
|
import type { Problem } from '../types';
|
|
13
3
|
/** One line of a request: who says what, in which beat of the template (or, without beats, from when to when in the clip). */
|
|
@@ -17,6 +7,7 @@ export interface SpeechLine {
|
|
|
17
7
|
beat?: number;
|
|
18
8
|
at?: number;
|
|
19
9
|
to?: number;
|
|
10
|
+
offscreen?: boolean;
|
|
20
11
|
}
|
|
21
12
|
/** Native speech with timed lines: the model speaks them, lips and voice made together. */
|
|
22
13
|
export interface DialogueSpeech {
|
|
@@ -32,6 +23,7 @@ export interface TimedLine {
|
|
|
32
23
|
at: number;
|
|
33
24
|
to: number;
|
|
34
25
|
beat?: number;
|
|
26
|
+
offscreen?: true;
|
|
35
27
|
}
|
|
36
28
|
export interface TimedDialogue {
|
|
37
29
|
mode: 'native';
|
|
@@ -113,4 +105,6 @@ export declare const coverageProblems: (requests: readonly {
|
|
|
113
105
|
/** The sentence that keeps music out of a clip of a video whose music is one separate track. */
|
|
114
106
|
export declare const NO_MUSIC = " No background music and no score in this clip: only the ambient sound of the scene, its sound effects and any dialogue. The music of the video is a separate track.";
|
|
115
107
|
/** The dialogue block of a prompt: the language in plain words, native lip-synced speech, each line with its time, and what must not be heard or seen. English whatever the lines' language; the lines are verbatim. */
|
|
108
|
+
/** NO_MUSIC in the language of the prompt. */
|
|
109
|
+
export declare const noMusic: () => string;
|
|
116
110
|
export declare const dialoguePrompt: (d: TimedDialogue) => string;
|
|
@@ -30,6 +30,8 @@ import type { Problem } from '../types';
|
|
|
30
30
|
import { type UnplannedClip } from './approved';
|
|
31
31
|
import { type VisibleSpeech } from './speech';
|
|
32
32
|
import { type BeatTimes } from './dialogue';
|
|
33
|
+
import { type PromptPolicy } from '../prompt-lang';
|
|
34
|
+
import { type MaterialProvider } from './provenance';
|
|
33
35
|
import { type ClipMusicBasis, type ModeContext, type RecordedException, type SoundMode } from '../sound/modes';
|
|
34
36
|
import { type ClipMusicUse } from './clip-sound';
|
|
35
37
|
import { type ReferenceLimits } from '../product/requests';
|
|
@@ -101,6 +103,7 @@ export interface Made {
|
|
|
101
103
|
credits?: number;
|
|
102
104
|
chargedCredits?: number;
|
|
103
105
|
key?: string;
|
|
106
|
+
task?: string;
|
|
104
107
|
}
|
|
105
108
|
export interface Generator {
|
|
106
109
|
/** Makes one file at out, with `env` added to its environment. Resolves with what it cost, when the command says. */
|
|
@@ -135,6 +138,8 @@ export interface MaterialRequest extends GenerateRequest {
|
|
|
135
138
|
anchor?: boolean;
|
|
136
139
|
/** The file of another clip (of this list, or of the project): this clip starts from its last frame, as its firstFrame. */
|
|
137
140
|
continues?: string;
|
|
141
|
+
/** A reviewed source frame to continue from; omitted means the last frame. */
|
|
142
|
+
continueAt?: number;
|
|
138
143
|
}
|
|
139
144
|
/** motionAmount: how much a clip's picture moves (measure/amount.ts), to hold against the reference shot it is for. */
|
|
140
145
|
/**
|
|
@@ -142,6 +147,7 @@ export interface MaterialRequest extends GenerateRequest {
|
|
|
142
147
|
* because what it starts from (waitsFor) is still being made; a later run sends it.
|
|
143
148
|
*/
|
|
144
149
|
export interface MadeMaterial {
|
|
150
|
+
receipt?: string;
|
|
145
151
|
file: string;
|
|
146
152
|
kind: GenerateKind;
|
|
147
153
|
made: boolean;
|
|
@@ -186,12 +192,15 @@ export interface MaterialsReport {
|
|
|
186
192
|
* of the list, or by a clip the project already has (covered).
|
|
187
193
|
*/
|
|
188
194
|
export interface RequestPolicy {
|
|
195
|
+
frames?: boolean;
|
|
189
196
|
selectedIdentity?: boolean;
|
|
190
197
|
times?: BeatTimes;
|
|
191
198
|
covered?: ReadonlySet<number>; /** The exceptions the project records for music inside clips. */
|
|
192
199
|
clipMusic?: readonly RecordedException[];
|
|
193
200
|
}
|
|
194
201
|
export declare const NOTES = "materials.json";
|
|
202
|
+
/** The name of a requested file among the inputs the user confirms (inputs/record.ts): "clip:assets/a.mp4", "picture:assets/a.png". */
|
|
203
|
+
export declare const inputKey: (file: string) => string;
|
|
195
204
|
/** A clip this short is near the shortest a model makes. */
|
|
196
205
|
export declare const SHORT_CLIP = 5;
|
|
197
206
|
/** From this many short clips on, a list is asked whether they could be one call. */
|
|
@@ -257,7 +266,12 @@ export declare const lastFrameFile: (clip: string) => string;
|
|
|
257
266
|
* to (approved.ts). o.plan (materials --confirm): the clips of
|
|
258
267
|
* this list become the agreed clips when the project has none yet.
|
|
259
268
|
*/
|
|
260
|
-
export declare const makeMaterials: (rt: Runtime, o:
|
|
269
|
+
export declare const makeMaterials: (rt: Runtime, o: MaterialsRun) => Promise<MaterialsReport>;
|
|
270
|
+
type MaterialsRun = Parameters<typeof makeMaterialsIn>[1] & {
|
|
271
|
+
lang?: string; /** How the model in use takes prompts (prompt-lang.ts); default "user". */
|
|
272
|
+
policy?: PromptPolicy;
|
|
273
|
+
};
|
|
274
|
+
declare const makeMaterialsIn: (rt: Runtime, o: {
|
|
261
275
|
requests: MaterialRequest[];
|
|
262
276
|
dir: string;
|
|
263
277
|
generator: Generator;
|
|
@@ -272,6 +286,9 @@ export declare const makeMaterials: (rt: Runtime, o: {
|
|
|
272
286
|
times?: BeatTimes;
|
|
273
287
|
music?: boolean;
|
|
274
288
|
modes?: ModeContext;
|
|
289
|
+
frames?: boolean;
|
|
290
|
+
provider?: MaterialProvider;
|
|
275
291
|
submitOnly?: boolean;
|
|
276
292
|
onStep?: (file: string, done: number, total: number) => void;
|
|
277
293
|
}) => Promise<MaterialsReport>;
|
|
294
|
+
export {};
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
import type { Runtime } from '../../runtime';
|
|
2
|
+
export type MaterialProvider = 'popost.ai' | 'external';
|
|
3
|
+
export interface MaterialReceipt {
|
|
4
|
+
version: 1;
|
|
5
|
+
pipeline: 'popost video materials';
|
|
6
|
+
provider: MaterialProvider;
|
|
7
|
+
sha256: string;
|
|
8
|
+
requestHash: string;
|
|
9
|
+
continues?: string;
|
|
10
|
+
continueAt?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare const materialReceiptFile: (clip: string) => string;
|
|
13
|
+
export declare const readMaterialReceipt: (rt: Runtime, full: string) => Promise<MaterialReceipt | undefined>;
|
|
1
14
|
export interface MaterialProvenance {
|
|
2
15
|
request: object;
|
|
3
16
|
voiceHash?: string;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { Runtime } from '../../runtime';
|
|
2
|
+
import { type AnchorPicture, type MaterialRequest } from '../generate/index';
|
|
3
|
+
import type { BeatTimes } from '../generate/dialogue';
|
|
4
|
+
import { type PromptPolicy } from '../prompt-lang';
|
|
5
|
+
import type { Problem } from '../types';
|
|
6
|
+
/** A picture that goes to a model with a request, and what it is there. */
|
|
7
|
+
export interface SentPicture {
|
|
8
|
+
file: string;
|
|
9
|
+
role: 'product' | 'cast' | 'reference' | 'first frame' | 'last frame' | 'anchor';
|
|
10
|
+
name: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ShownClip {
|
|
13
|
+
key: string;
|
|
14
|
+
kind: 'video' | 'image';
|
|
15
|
+
file: string;
|
|
16
|
+
/** The request's own words, and the whole prompt as it is sent (product block, cast and sound sentences included). */
|
|
17
|
+
what: string;
|
|
18
|
+
prompt: string;
|
|
19
|
+
seconds?: number;
|
|
20
|
+
aspect?: string;
|
|
21
|
+
model?: string;
|
|
22
|
+
resolution?: string;
|
|
23
|
+
/** null: no price is known (a generator of the user's own, or the quote could not be read: priceNote says). */
|
|
24
|
+
credits: number | null;
|
|
25
|
+
priceNote?: string;
|
|
26
|
+
pictures: SentPicture[];
|
|
27
|
+
sounds: string[];
|
|
28
|
+
clips: string[];
|
|
29
|
+
products: string[];
|
|
30
|
+
cast: string[];
|
|
31
|
+
notes: string[];
|
|
32
|
+
}
|
|
33
|
+
export interface ShownVoice {
|
|
34
|
+
key: string;
|
|
35
|
+
speaker: string;
|
|
36
|
+
voice: string;
|
|
37
|
+
/** The voice on the platform, when it is one. */
|
|
38
|
+
id?: string;
|
|
39
|
+
name?: string;
|
|
40
|
+
language?: string;
|
|
41
|
+
speed: number;
|
|
42
|
+
lines: string[];
|
|
43
|
+
credits: number | null;
|
|
44
|
+
priceNote?: string;
|
|
45
|
+
/** A recording the user can hear, in the project, and where it comes from; none when there is none without paying. */
|
|
46
|
+
sample?: {
|
|
47
|
+
file: string;
|
|
48
|
+
from: string;
|
|
49
|
+
};
|
|
50
|
+
/** No free sample: the cheapest paid one, one sentence, with its price, for the user to ask for. */
|
|
51
|
+
paidSample?: {
|
|
52
|
+
text: string;
|
|
53
|
+
credits: number | null;
|
|
54
|
+
command: string;
|
|
55
|
+
};
|
|
56
|
+
note?: string;
|
|
57
|
+
}
|
|
58
|
+
export interface Gathered {
|
|
59
|
+
problems: Problem[];
|
|
60
|
+
policy: PromptPolicy;
|
|
61
|
+
model?: string;
|
|
62
|
+
products: {
|
|
63
|
+
key: string;
|
|
64
|
+
id: string;
|
|
65
|
+
what: string;
|
|
66
|
+
pictures: {
|
|
67
|
+
file: string;
|
|
68
|
+
original?: string;
|
|
69
|
+
crop?: string;
|
|
70
|
+
face: string;
|
|
71
|
+
}[];
|
|
72
|
+
confirm?: string;
|
|
73
|
+
}[];
|
|
74
|
+
cast: {
|
|
75
|
+
key: string;
|
|
76
|
+
id: string;
|
|
77
|
+
description: string;
|
|
78
|
+
picture?: string;
|
|
79
|
+
note?: string;
|
|
80
|
+
}[];
|
|
81
|
+
anchor?: {
|
|
82
|
+
file: string;
|
|
83
|
+
note: string;
|
|
84
|
+
};
|
|
85
|
+
clips: ShownClip[];
|
|
86
|
+
kept: string[];
|
|
87
|
+
voices: ShownVoice[];
|
|
88
|
+
balance?: number;
|
|
89
|
+
notes: string[];
|
|
90
|
+
}
|
|
91
|
+
/** How the model in use takes prompts, from the platform's list; "user" when it does not say or cannot be read. */
|
|
92
|
+
export declare const promptPolicy: (rt: Runtime) => Promise<{
|
|
93
|
+
policy: PromptPolicy;
|
|
94
|
+
model?: string;
|
|
95
|
+
}>;
|
|
96
|
+
/** Everything a paid run of this list would send, and what it would cost; nothing is made or charged. */
|
|
97
|
+
export declare const gather: (rt: Runtime, dir: string, o: {
|
|
98
|
+
requests: MaterialRequest[];
|
|
99
|
+
picture?: AnchorPicture;
|
|
100
|
+
anchor?: boolean;
|
|
101
|
+
times?: BeatTimes;
|
|
102
|
+
music?: boolean;
|
|
103
|
+
lang?: string;
|
|
104
|
+
}) => Promise<Gathered>;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { Runtime } from '../../runtime';
|
|
2
|
+
import { type MaterialRequest } from '../generate/index';
|
|
3
|
+
export declare const INPUTS_FILE = "production/inputs.json";
|
|
4
|
+
export declare const VOICE_PLAN_FILE = "production/voice-plan.json";
|
|
5
|
+
/** Where the input sheet, the summary and the voice samples go. */
|
|
6
|
+
export declare const INPUTS_DIR = "production/inputs";
|
|
7
|
+
/** One voice of the video: who speaks, in which voice, how fast, and the lines it will say. */
|
|
8
|
+
export interface PlannedVoice {
|
|
9
|
+
speaker: string;
|
|
10
|
+
voice: string;
|
|
11
|
+
speed?: number;
|
|
12
|
+
language?: string;
|
|
13
|
+
lines: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface VoicePlan {
|
|
16
|
+
version: 1;
|
|
17
|
+
voices: PlannedVoice[];
|
|
18
|
+
}
|
|
19
|
+
/** A text shown to the user in their language beside the text that is sent; sent: the hash of the text it renders. */
|
|
20
|
+
export interface DisplayText {
|
|
21
|
+
sent: string;
|
|
22
|
+
lang: string;
|
|
23
|
+
text: string;
|
|
24
|
+
}
|
|
25
|
+
export interface InputsRecord {
|
|
26
|
+
version: 1;
|
|
27
|
+
/** What the last `inputs show` built: the items with their hashes, the sent texts' hashes, and where the list was read from. */
|
|
28
|
+
shown?: {
|
|
29
|
+
at: string;
|
|
30
|
+
requests?: string;
|
|
31
|
+
anchor?: string;
|
|
32
|
+
lang?: string;
|
|
33
|
+
items: Record<string, string>;
|
|
34
|
+
texts: Record<string, string>;
|
|
35
|
+
sheets: string[];
|
|
36
|
+
summary: string;
|
|
37
|
+
missing?: string[];
|
|
38
|
+
};
|
|
39
|
+
/** The user's answer (or who authorised going on unattended), with the items it was given for. */
|
|
40
|
+
confirmed?: {
|
|
41
|
+
by: 'user' | 'unattended';
|
|
42
|
+
quote: string;
|
|
43
|
+
at: string;
|
|
44
|
+
items: Record<string, string>;
|
|
45
|
+
};
|
|
46
|
+
display?: Record<string, DisplayText>;
|
|
47
|
+
}
|
|
48
|
+
export declare const readInputs: (rt: Runtime, dir: string) => Promise<InputsRecord>;
|
|
49
|
+
export declare const writeInputs: (rt: Runtime, dir: string, record: InputsRecord) => Promise<void>;
|
|
50
|
+
export declare const readVoicePlan: (rt: Runtime, dir: string) => Promise<VoicePlan | undefined>;
|
|
51
|
+
export declare const voiceKey: (speaker: string) => string;
|
|
52
|
+
export declare const voiceHash: (v: PlannedVoice) => string;
|
|
53
|
+
export interface CurrentInputs {
|
|
54
|
+
/** Every item of the project as it stands, by key, with its hash. */
|
|
55
|
+
items: Record<string, string>;
|
|
56
|
+
/** The keys of the requested files that do not exist yet: what a paid run would make. */
|
|
57
|
+
toMake: string[];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The inputs of a project as they stand: its products, cast and voices, the anchor picture when one is given, and
|
|
61
|
+
* every request of the list (when one is given) with all it depends on.
|
|
62
|
+
*/
|
|
63
|
+
export declare const currentInputs: (rt: Runtime, dir: string, o?: {
|
|
64
|
+
requests?: readonly MaterialRequest[];
|
|
65
|
+
anchor?: string;
|
|
66
|
+
}) => Promise<CurrentInputs>;
|
|
67
|
+
/** The keys among `needed` whose item was not confirmed as it stands. */
|
|
68
|
+
export declare const pendingOf: (record: InputsRecord, current: CurrentInputs, needed: readonly string[]) => string[];
|
|
69
|
+
/** The `confirm` block of exit code 3: what to show the user and how to record their answer. */
|
|
70
|
+
export declare const confirmBlock: (rt: Runtime, dir: string, record: InputsRecord, pending: readonly string[], project: string) => {
|
|
71
|
+
confirm: Record<string, unknown>;
|
|
72
|
+
next: string;
|
|
73
|
+
};
|
|
74
|
+
/** Whether a project has anything that makes the paid voice commands wait for the user: inputs that were shown, a voice plan, or a product sheet. */
|
|
75
|
+
export declare const gatesVoice: (rt: Runtime, dir: string) => Promise<boolean>;
|
|
76
|
+
/**
|
|
77
|
+
* What stands between a paid voice command and its work: undefined when the voice (and the lines, when given) are in
|
|
78
|
+
* the voice plan the user confirmed, else the pending keys and why. A project that never showed inputs, has no voice
|
|
79
|
+
* plan and no product sheet is not held (a video that is only narrated).
|
|
80
|
+
*/
|
|
81
|
+
export declare const voicePending: (rt: Runtime, dir: string, o: {
|
|
82
|
+
voice?: string;
|
|
83
|
+
speaker?: string;
|
|
84
|
+
lines?: readonly string[];
|
|
85
|
+
}) => Promise<{
|
|
86
|
+
pending: string[];
|
|
87
|
+
why: string;
|
|
88
|
+
} | undefined>;
|
|
89
|
+
/** A paid command stopped before its work: the user has not confirmed these inputs. Printed as { ok: false, confirm, next } with exit code 3. */
|
|
90
|
+
export declare class InputsPending extends Error {
|
|
91
|
+
readonly block: {
|
|
92
|
+
confirm: Record<string, unknown>;
|
|
93
|
+
next: string;
|
|
94
|
+
};
|
|
95
|
+
name: string;
|
|
96
|
+
constructor(block: {
|
|
97
|
+
confirm: Record<string, unknown>;
|
|
98
|
+
next: string;
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
/** Stops a paid voice command (paying: it was run with --confirm) whose voice or lines the user has not confirmed. */
|
|
102
|
+
export declare const holdVoice: (rt: Runtime, dir: string, project: string, paying: boolean, o: {
|
|
103
|
+
voice?: string;
|
|
104
|
+
speaker?: string;
|
|
105
|
+
lines?: readonly string[];
|
|
106
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Runtime } from '../../runtime';
|
|
2
|
+
import type { Summary, SummaryItem } from './summary';
|
|
3
|
+
/** How many clips or pictures one sheet holds; the first sheet also holds the product, the cast and the voice. */
|
|
4
|
+
export declare const ROWS_A_SHEET = 6;
|
|
5
|
+
/** The page of one sheet. data: the bytes of every picture it shows, by its path in the project. */
|
|
6
|
+
export declare const sheetHtml: (s: Summary, rows: readonly SummaryItem[], first: boolean, page: string, data: ReadonlyMap<string, Uint8Array>) => string;
|
|
7
|
+
/** Writes the sheets of a summary into `outDir` (in the project) and returns their paths in the project. Needs the local browser. */
|
|
8
|
+
export declare const writeSheets: (rt: Runtime, dir: string, outDir: string, s: Summary) => Promise<string[]>;
|