popost 4.6.10 → 4.6.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.md +2 -0
  2. package/SKILL.md +4 -2
  3. package/assets/canvas/assets/{dist-C40jmU-w.js → dist-DAI3U0Jz.js} +1 -1
  4. package/assets/canvas/assets/{es-aF1SvUMY.js → es-3zEBH4X5.js} +1 -1
  5. package/assets/canvas/assets/index-Ce4sDSi9.css +1 -0
  6. package/assets/canvas/assets/{index-CxUXSxcb.js → index-Dc4qgNYJ.js} +4 -4
  7. package/assets/canvas/assets/{jszip.min-Bf2BQwaC.js → jszip.min-BwYI3Gs3.js} +1 -1
  8. package/assets/canvas/build-info.json +6 -6
  9. package/assets/canvas/index.html +2 -2
  10. package/dist/cli.js +30435 -27843
  11. package/dist/index.js +30565 -28037
  12. package/dist/types/cloud/account.d.ts +14 -0
  13. package/dist/types/cloud/deliver.d.ts +29 -0
  14. package/dist/types/cloud/entitlement.d.ts +55 -0
  15. package/dist/types/cloud/paid-gate.d.ts +159 -0
  16. package/dist/types/cloud/service.d.ts +68 -23
  17. package/dist/types/commands/update.d.ts +2 -0
  18. package/dist/types/device-login.d.ts +35 -0
  19. package/dist/types/editor/canvas-state.d.ts +1 -1
  20. package/dist/types/editor/handoff.d.ts +10 -3
  21. package/dist/types/editor/http-types.d.ts +4 -1
  22. package/dist/types/editor/routes-cloud.d.ts +4 -3
  23. package/dist/types/install/record.d.ts +15 -0
  24. package/dist/types/providers/api-errors.d.ts +2 -0
  25. package/dist/types/providers/api.d.ts +1 -1
  26. package/dist/types/providers/link.d.ts +2 -0
  27. package/dist/types/runtime.d.ts +38 -0
  28. package/dist/types/update/auto.d.ts +14 -0
  29. package/dist/types/update/check.d.ts +47 -0
  30. package/dist/types/update/install-kind.d.ts +27 -0
  31. package/dist/types/update/npm.d.ts +8 -0
  32. package/dist/types/update/perform.d.ts +64 -0
  33. package/dist/types/update/report.d.ts +7 -0
  34. package/dist/types/update/semver.d.ts +17 -0
  35. package/dist/types/update/session.d.ts +19 -0
  36. package/dist/types/update/state.d.ts +91 -0
  37. package/dist/types/update/verify.d.ts +33 -0
  38. package/dist/types/version.d.ts +1 -1
  39. package/dist/types/video/cache/frames.d.ts +85 -0
  40. package/dist/types/video/cache/holds.d.ts +35 -0
  41. package/dist/types/video/cache/project.d.ts +57 -0
  42. package/dist/types/video/commands/clean.d.ts +9 -0
  43. package/dist/types/video/commands/product.d.ts +15 -0
  44. package/dist/types/video/compile/footage.d.ts +24 -7
  45. package/dist/types/video/compile/index.d.ts +3 -0
  46. package/dist/types/video/generate/index.d.ts +13 -1
  47. package/dist/types/video/preview/cloud.d.ts +20 -1
  48. package/dist/types/video/preview/edit/routes.d.ts +17 -11
  49. package/dist/types/video/preview/export-settings.d.ts +1 -2
  50. package/dist/types/video/preview/project.d.ts +3 -0
  51. package/dist/types/video/preview/shell/dom.d.ts +2 -0
  52. package/dist/types/video/preview/shell/studio/cloud.d.ts +6 -1
  53. package/dist/types/video/preview/shell/studio/compare.d.ts +16 -0
  54. package/dist/types/video/preview/shell/studio/copy.d.ts +24 -3
  55. package/dist/types/video/preview/shell/studio/paid.d.ts +23 -0
  56. package/dist/types/video/preview/shell/studio/style.d.ts +2 -2
  57. package/dist/types/video/preview/shell/studio/workspace.d.ts +2 -0
  58. package/dist/types/video/preview/shell-bundle.d.ts +1 -1
  59. package/dist/types/video/product/requests.d.ts +74 -0
  60. package/dist/types/video/product/review.d.ts +74 -0
  61. package/dist/types/video/product/sheet.d.ts +99 -0
  62. package/dist/types/video/project/schema.d.ts +21 -21
  63. package/dist/types/video/render/index.d.ts +2 -0
  64. package/dist/types/video/render/session.d.ts +4 -0
  65. package/dist/types/video/replication/contract.d.ts +29 -29
  66. package/dist/types/video/replication/production.d.ts +5 -5
  67. package/dist/types/video/replication/schema.d.ts +2 -2
  68. package/dist/types/video/replication/speech-observed.d.ts +6 -6
  69. package/package.json +1 -1
  70. package/references/host-editor.md +21 -6
  71. package/references/image-workflow.md +5 -5
  72. package/references/onboarding.md +20 -0
  73. package/references/post-bundle.md +5 -5
  74. package/references/video-editing.md +19 -7
  75. package/references/video-performers.md +2 -2
  76. package/references/video-product.md +174 -0
  77. package/references/video-replication.md +1 -1
  78. package/references/video-step-1-read.md +5 -0
  79. package/references/video-step-3-content.md +14 -6
  80. package/references/video-step-7-deliver.md +36 -1
  81. package/references/video-tools.md +43 -7
  82. package/references/video.md +5 -0
  83. package/assets/canvas/assets/index-C5rz5H21.css +0 -1
  84. package/dist/types/cloud/auth-flow.d.ts +0 -30
@@ -0,0 +1,14 @@
1
+ import type { Runtime } from '../runtime';
2
+ import type { GlobalInstall } from './perform';
3
+ import { type UpdatePaths } from './state';
4
+ export declare const NO_AUTO_ENV = "POPOST_NO_AUTO_UPDATE";
5
+ export declare const RETRY_SAME_VERSION_MS: number;
6
+ /** False for the commands an update never starts after. */
7
+ export declare const autoCommand: (command: string, args: readonly string[]) => boolean;
8
+ /** Why this installation is never updated automatically, whatever the version; null when it may be. */
9
+ export declare const autoBlocker: (rt: Runtime, paths: UpdatePaths, target: GlobalInstall) => Promise<string | null>;
10
+ /**
11
+ * Starts the background update when it may. Returns `started`, or a short word for the rule that held it back (for
12
+ * tests; nothing is printed either way).
13
+ */
14
+ export declare const startAutoUpdate: (rt: Runtime, paths: UpdatePaths, target: GlobalInstall, command: string, args: readonly string[]) => Promise<string>;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Asking the npm registry which version is published. The daily check makes one request, `GET <registry>/popost/latest`,
3
+ * and, the first time that names a newer version, a second one, `GET <registry>/popost/<running version>`, to see that
4
+ * the running build is a published one. A request that fails is tried again after an hour, not by every command. Only
5
+ * the `name` and `version` strings of the answer and whether it carries a `deprecated` text are read, and a version
6
+ * must be plain semver; nothing else the registry says is used, and nothing it names is ever run. A deprecated version
7
+ * is announced and never installed automatically: `npm deprecate` is how a bad release is stopped.
8
+ *
9
+ * These are the requests of the check. An update makes more, when it runs: npm's own (`npm view`, `npm pack`,
10
+ * `npm install`, with npm's registry, proxy and sign-in settings) and one from this process for the registry's signing
11
+ * keys, `GET <registry>/-/npm/v1/keys` (update/verify.ts).
12
+ */
13
+ import type { Runtime } from '../runtime';
14
+ import { type CheckState, type UpdatePaths } from './state';
15
+ export declare const DEFAULT_REGISTRY = "https://registry.npmjs.org";
16
+ /** One request may take this long; a command never waits for it (update/session.ts). */
17
+ export declare const REQUEST_TIMEOUT_MS = 2500;
18
+ export declare const httpUrl: (value: string | undefined) => string | undefined;
19
+ /**
20
+ * The registry npm is set to use: `npm_config_registry` in the environment, then the `registry=` line of `~/.npmrc`,
21
+ * then the official one. A mirror people configure for npm so serves the check too, as it will serve the install.
22
+ */
23
+ export declare const registryUrl: (rt: Runtime) => Promise<string>;
24
+ /** The request with its own time limit, joined to the caller's abort signal. */
25
+ export declare const registryGet: (rt: Runtime, url: string, signal?: AbortSignal, timeoutMs?: number) => Promise<Response>;
26
+ export interface Published {
27
+ readonly version: string;
28
+ /** The registry marks the version as deprecated (`npm deprecate`): it is never installed automatically. */
29
+ readonly deprecated: boolean;
30
+ }
31
+ /** `deprecated` in a registry answer: any text but the empty one (`npm deprecate popost@x ""` takes the mark away). */
32
+ export declare const isDeprecated: (value: unknown) => boolean;
33
+ /** What the `latest` tag names. Throws when the registry cannot be reached or answers with anything else. */
34
+ export declare const fetchLatestRelease: (rt: Runtime, signal?: AbortSignal) => Promise<Published>;
35
+ /** The version the `latest` tag names. */
36
+ export declare const fetchLatest: (rt: Runtime, signal?: AbortSignal) => Promise<string>;
37
+ /** Whether the registry has `version`: false only on a clear "no such version" (404). Throws when it cannot tell. */
38
+ export declare const fetchPublished: (rt: Runtime, version: string, signal?: AbortSignal) => Promise<boolean>;
39
+ /** No request is due: the last answer is under a day old, or the last failed request under an hour. */
40
+ export declare const checkIsFresh: (rt: Runtime, state: CheckState | null) => boolean;
41
+ /** Whether the running version is a published one, from the cache (`undefined`: not asked yet for this version). */
42
+ export declare const runningPublished: (state: CheckState | null) => boolean | undefined;
43
+ /**
44
+ * One check: asks the registry and stores the answer. Never throws; a failure only records that a request was tried.
45
+ * Returns the stored state, or null when nothing could be learnt.
46
+ */
47
+ export declare const refreshCheck: (rt: Runtime, paths: UpdatePaths, signal?: AbortSignal) => Promise<CheckState | null>;
@@ -0,0 +1,27 @@
1
+ import type { Runtime, SelfInstall } from '../runtime';
2
+ export declare const PACKAGE_NAME = "popost";
3
+ /** What refreshes the Skill copies that exist after the package was replaced by hand. */
4
+ export declare const REFRESH_COMMAND = "popost install --existing";
5
+ export type InstallKind = {
6
+ readonly kind: 'global';
7
+ readonly root: string;
8
+ readonly prefix: string;
9
+ readonly install: SelfInstall;
10
+ }
11
+ /** `command`: what the user runs to update with that manager. */
12
+ | {
13
+ readonly kind: 'managed';
14
+ readonly root: string;
15
+ readonly manager: string;
16
+ readonly command: string;
17
+ readonly reason: string;
18
+ } | {
19
+ readonly kind: 'host' | 'source' | 'pinned' | 'local';
20
+ readonly root?: string;
21
+ readonly reason: string;
22
+ };
23
+ export declare const installKind: (rt: Runtime) => Promise<InstallKind>;
24
+ /** The directories an update writes: the global `node_modules` (the staging directory, the swap) and the package itself. */
25
+ export declare const globalWriteDirs: (rt: Runtime, target: Extract<InstallKind, {
26
+ kind: "global";
27
+ }>) => string[];
@@ -0,0 +1,8 @@
1
+ /** How the update mechanism starts npm: always a fixed argument list, never a shell, and never without a time limit. */
2
+ import type { Runtime, SelfInstall } from '../runtime';
3
+ /** A registry question (`npm view`, `npm root`) may take this long. */
4
+ export declare const NPM_QUERY_TIMEOUT_MS = 60000;
5
+ /** A download or an install may take this long; then npm is ended and the update counts as failed. */
6
+ export declare const NPM_INSTALL_TIMEOUT_MS: number;
7
+ /** How npm is started: its own script with the running Node, or the `npm` on PATH. */
8
+ export declare const npmCommand: (rt: Runtime, install: Pick<SelfInstall, "execPath">) => Promise<string[]>;
@@ -0,0 +1,64 @@
1
+ import type { Runtime } from '../runtime';
2
+ import { type InstallKind } from './install-kind';
3
+ export type GlobalInstall = Extract<InstallKind, {
4
+ kind: 'global';
5
+ }>;
6
+ export declare const MANUAL_COMMAND = "npm install -g popost@latest && popost install --existing";
7
+ export interface UpdatePlan {
8
+ /** Where the package is downloaded, checked and installed before the swap. */
9
+ readonly staging: string;
10
+ /** The package inside the staging directory. */
11
+ readonly staged: string;
12
+ /** The directory the package file is downloaded into. */
13
+ readonly packDir: string;
14
+ /** How npm is started; the registry is asked with it too. */
15
+ readonly npmBase: string[];
16
+ /** `npm view`: the registry's entry for the version (its number, integrity, signatures, deprecation). */
17
+ readonly view: string[];
18
+ /** `npm pack`: the exact version as one file in `packDir`. */
19
+ readonly pack: (version: string) => string[];
20
+ /** The downloaded file, whose hash must be the registry's. */
21
+ readonly tarball: (version: string) => string;
22
+ /** `npm install` of that file into the staging directory. */
23
+ readonly npm: (version: string) => string[];
24
+ /** The new command line's `--version`, run from the staging directory before the swap. */
25
+ readonly verify: string[];
26
+ /** The new package's `popost install --existing`, run after the swap. */
27
+ readonly install: string[];
28
+ }
29
+ /** `spec` is `latest` or an exact version that was read as plain semver; nothing else is ever put on the command line. */
30
+ export declare const updatePlan: (rt: Runtime, target: GlobalInstall, spec: string) => Promise<UpdatePlan>;
31
+ /** How the package was checked before it replaced the installation (update/verify.ts). */
32
+ export type Checked = 'integrity+signature' | 'integrity';
33
+ export type UpdateOutcome =
34
+ /** `version` is what is installed now: the running version when the registry had nothing newer. */
35
+ {
36
+ readonly status: 'ok';
37
+ readonly version: string;
38
+ readonly install: Record<string, unknown>;
39
+ readonly checked?: Checked;
40
+ }
41
+ /** The command line is new; the Skill copies are not. */
42
+ | {
43
+ readonly status: 'skill-failed';
44
+ readonly version: string;
45
+ readonly reason: string;
46
+ readonly install?: Record<string, unknown>;
47
+ readonly checked?: Checked;
48
+ }
49
+ /** `deprecated`: the automatic update stood down for a version the registry marks as deprecated; nothing went wrong. */
50
+ | {
51
+ readonly status: 'failed';
52
+ readonly reason: string;
53
+ readonly deprecated?: boolean;
54
+ };
55
+ export interface UpdateOptions {
56
+ readonly skipNpm?: boolean;
57
+ /** The automatic update: a deprecated version is not installed. */
58
+ readonly background?: boolean;
59
+ readonly holdSwap?: () => Promise<string | null>;
60
+ }
61
+ /** The update, with every reason it gives made safe to show: no credentials, no name of the home directory. */
62
+ export declare const performUpdate: (rt: Runtime, target: GlobalInstall, spec: string, options?: UpdateOptions) => Promise<UpdateOutcome>;
63
+ export declare const restartHint: () => string;
64
+ export declare const skillFailedMessage: (version: string, reason: string) => string;
@@ -0,0 +1,7 @@
1
+ import type { Runtime } from '../runtime';
2
+ /** npm's stderr in a message is cut to this many characters (its end, where npm says what went wrong). */
3
+ export declare const DETAIL_MAX = 300;
4
+ /** `text` without credential values, tokens in the forms npm prints them, and the user's home directory (shown as `~`). */
5
+ export declare const safeText: (rt: Runtime, text: string) => string;
6
+ /** The end of what a program wrote to stderr, safe and at most `max` characters. */
7
+ export declare const safeDetail: (rt: Runtime, text: string, max?: number) => string;
@@ -0,0 +1,17 @@
1
+ /** The little of semver the update check needs: `major.minor.patch`, with or without a pre-release tag. */
2
+ export interface Version {
3
+ readonly major: number;
4
+ readonly minor: number;
5
+ readonly patch: number;
6
+ /** `4.7.0-rc.1`: a pre-release. It is older than `4.7.0` and is never offered as an update. */
7
+ readonly pre: boolean;
8
+ }
9
+ /** `null` for anything that is not a plain semver version (a range, a tag name, a URL, text with spaces). */
10
+ export declare const parseVersion: (text: unknown) => Version | null;
11
+ /** Negative when `a` is older than `b`. Two pre-releases of the same version count as equal: neither is ever offered. */
12
+ export declare const compareVersions: (a: Version, b: Version) => number;
13
+ /**
14
+ * What the published `latest` is to the running `current`: `none` (not newer, a pre-release, or unreadable),
15
+ * `compatible` (a newer patch or minor version) or `major` (a newer major version, which is only ever announced).
16
+ */
17
+ export declare const offer: (current: string, latest: unknown) => "none" | "compatible" | "major";
@@ -0,0 +1,19 @@
1
+ import type { Runtime } from '../runtime';
2
+ import { type UpdatePaths } from './state';
3
+ export declare const NO_CHECK_ENV = "POPOST_NO_UPDATE_CHECK";
4
+ export declare const UPDATE_COMMAND = "popost update";
5
+ /** How long the end of a command waits for a registry request that is still open. */
6
+ export declare const GRACE_MS = 300;
7
+ export interface UpdateSession {
8
+ /** The runtime the command runs with: the given one, plus the `update` field for its JSON output when there is news. */
9
+ readonly rt: Runtime;
10
+ /** After the command: lets the background request finish within the grace, then drops it. Never throws. */
11
+ close(): Promise<void>;
12
+ }
13
+ /** The directory of the update state when this run takes part at all. */
14
+ export declare const activePaths: (rt: Runtime, command: string) => UpdatePaths | undefined;
15
+ /** `command`: what installs it: `popost update`, or the command of the package manager that keeps this copy. */
16
+ export declare const availableMessage: (latest: string, command?: string) => string;
17
+ export declare const updatedMessage: (version: string) => string;
18
+ export declare const autoFailedMessage: (version: string, reason: string) => string;
19
+ export declare const openUpdateSession: (rt: Runtime, command: string, args?: readonly string[]) => Promise<UpdateSession>;
@@ -0,0 +1,91 @@
1
+ import type { Runtime } from '../runtime';
2
+ export declare const UPDATE_DIR = "update";
3
+ export declare const HOUR_MS = 3600000;
4
+ export declare const DAY_MS: number;
5
+ /** A lock or a started attempt older than this belongs to a process that died. */
6
+ export declare const STALE_MS: number;
7
+ export interface CheckState {
8
+ /** The version the registry's `latest` tag named. */
9
+ readonly latest?: string;
10
+ /** The registry marks `latest` as deprecated: it is announced, and never installed automatically. */
11
+ readonly deprecated?: boolean;
12
+ /** ISO time of the last answer. */
13
+ readonly checkedAt?: string;
14
+ /** ISO time of the last request, answered or not: a failed one is retried after an hour, not on every command. */
15
+ readonly triedAt?: string;
16
+ /** Whether the registry has the version that was running (`false`: a build that was never published is left alone). */
17
+ readonly running?: {
18
+ readonly version: string;
19
+ readonly published: boolean;
20
+ };
21
+ /** The notice last shown, so one version is announced once a day and not by every command. */
22
+ readonly noticed?: {
23
+ readonly version: string;
24
+ readonly at: string;
25
+ };
26
+ }
27
+ export type AttemptStatus = 'started' | 'ok' | 'skill-failed' | 'failed';
28
+ export interface AttemptState {
29
+ /** The version the update was to install. */
30
+ readonly version: string;
31
+ /** The version that started it. */
32
+ readonly from: string;
33
+ readonly startedAt: string;
34
+ readonly finishedAt?: string;
35
+ /** `skill-failed`: the command line was updated, the agents' Skill copies were not. */
36
+ readonly status: AttemptStatus;
37
+ readonly reason?: string;
38
+ /** The outcome was told to the user once. */
39
+ readonly reported?: boolean;
40
+ }
41
+ export interface SettingsState {
42
+ readonly auto?: boolean;
43
+ }
44
+ export interface LockState {
45
+ readonly pid: number;
46
+ readonly at: string;
47
+ }
48
+ export interface UpdatePaths {
49
+ readonly dir: string;
50
+ readonly check: string;
51
+ readonly attempt: string;
52
+ readonly settings: string;
53
+ readonly lock: string;
54
+ readonly log: string;
55
+ readonly running: string;
56
+ }
57
+ /** `undefined` when this host has no persistent popost home. */
58
+ export declare const updatePaths: (rt: Runtime) => UpdatePaths | undefined;
59
+ export declare const readState: <T extends object>(rt: Runtime, file: string) => Promise<T | null>;
60
+ /** True when the file was written. */
61
+ export declare const writeState: (rt: Runtime, file: string, value: object) => Promise<boolean>;
62
+ export declare const removeState: (rt: Runtime, file: string) => Promise<void>;
63
+ /** Milliseconds since an ISO time; infinite when there is none or it cannot be read (so "long ago"). */
64
+ export declare const since: (rt: Runtime, iso: string | undefined) => number;
65
+ /** An environment switch that is on: set to anything but nothing, `0`, `false`, `no` or `off`. */
66
+ export declare const switchedOn: (value: string | undefined) => boolean;
67
+ /**
68
+ * The update lock: one process updates at a time. Taken by creating the file exclusively. A lock whose process is
69
+ * gone, or that is older than half an hour, is a leftover and is replaced: it is moved away under a name of its own
70
+ * (one process wins the rename), what was moved is compared with what was judged stale (another process may have taken
71
+ * the lock in between: then it is put back), and the new lock is again created exclusively. After any of this the lock
72
+ * must name this process when read back. False when another update holds it.
73
+ */
74
+ export declare const takeLock: (rt: Runtime, paths: UpdatePaths) => Promise<boolean>;
75
+ /** The lock file names this process: asked again directly before the installation is replaced. */
76
+ export declare const ownsLock: (rt: Runtime, paths: UpdatePaths) => Promise<boolean>;
77
+ /** The live process that holds the lock, or null (no lock, or a leftover). */
78
+ export declare const lockHolder: (rt: Runtime, paths: UpdatePaths) => Promise<LockState | null>;
79
+ export declare const releaseLock: (rt: Runtime, paths: UpdatePaths) => Promise<void>;
80
+ export interface RunningState {
81
+ readonly pid: number;
82
+ /** The package directory the process runs from: only processes of the same installation count. */
83
+ readonly root: string;
84
+ readonly command: string;
85
+ readonly at: string;
86
+ }
87
+ /** Notes that this process is running a command, until `unregisterRunning`. A process that dies leaves a file that is cleared later. */
88
+ export declare const registerRunning: (rt: Runtime, paths: UpdatePaths, command: string) => Promise<void>;
89
+ export declare const unregisterRunning: (rt: Runtime, paths: UpdatePaths) => Promise<void>;
90
+ /** The other live popost processes of this installation (a long render, an editor or Studio service); clears leftovers. */
91
+ export declare const othersRunning: (rt: Runtime, paths: UpdatePaths) => Promise<RunningState[]>;
@@ -0,0 +1,33 @@
1
+ import type { Runtime } from '../runtime';
2
+ export interface RegistryKey {
3
+ readonly keyid: string;
4
+ /** The public key: base64 of the DER SubjectPublicKeyInfo (ECDSA P-256). */
5
+ readonly key: string;
6
+ }
7
+ /** The signing keys of registry.npmjs.org, as it publishes them at /-/npm/v1/keys (read 2026-12-02). */
8
+ export declare const NPM_REGISTRY_KEYS: readonly RegistryKey[];
9
+ export interface Release {
10
+ readonly version: string;
11
+ /** `sha512-<base64>`; undefined when the registry names none. */
12
+ readonly integrity?: string;
13
+ readonly signatures: readonly {
14
+ readonly keyid: string;
15
+ readonly sig: string;
16
+ }[];
17
+ readonly deprecated: boolean;
18
+ }
19
+ /** The registry's entry for one version, from what `npm view popost@<spec> name version deprecated dist --json` printed. */
20
+ export declare const readRelease: (stdout: Uint8Array) => Release | null;
21
+ /** The sha512 integrity of a file, as the registry writes it. */
22
+ export declare const fileIntegrity: (rt: Runtime, file: string) => Promise<string>;
23
+ /** The registry npm uses, from npm itself (`npm config get registry`); what the check works out when npm does not say. */
24
+ export declare const npmRegistry: (rt: Runtime, npm: readonly string[], cwd: string) => Promise<string>;
25
+ export type SignatureCheck = {
26
+ readonly ok: true;
27
+ readonly checked: 'integrity+signature' | 'integrity';
28
+ } | {
29
+ readonly ok: false;
30
+ readonly reason: string;
31
+ };
32
+ /** Step 2 above, for a release whose integrity was already matched against the downloaded file. */
33
+ export declare const checkSignature: (rt: Runtime, registry: string, release: Release) => Promise<SignatureCheck>;
@@ -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.10";
2
+ export declare const VERSION = "4.6.11";
@@ -0,0 +1,85 @@
1
+ /**
2
+ * The lifetime of the frame cache (<project>/.cache/video/<key>/, written by compile/footage.ts). Everything in it can
3
+ * be extracted again from the project's clips, so it is kept only while it saves work:
4
+ * - a build removes the directories of clips the project no longer has (another file, size or date), the ones no
5
+ * build used for a day, and, above the size cap, the least recently used ones this build does not show;
6
+ * - a whole render removes what it extracted once the MP4 is written;
7
+ * - nothing is removed that a running preview or render shows (holds.ts), that another run wrote after this one
8
+ * started, that lies behind a link, or that holds anything but frame pictures.
9
+ * Each directory carries a mark (.used): the clip it was extracted from and when a build last used it. The time is
10
+ * the mark's content, not the file's date, so it reads the same on every file system.
11
+ */
12
+ import type { Runtime } from '../../runtime';
13
+ export { isPlainInside } from './holds';
14
+ /** Where frame pictures go, relative to the project directory. */
15
+ export declare const FOOTAGE_CACHE = ".cache/video";
16
+ export declare const USED_MARK = ".used";
17
+ /** The size cap of one project's frame cache, in MB; POPOST_VIDEO_CACHE_MAX_MB overrides it. */
18
+ export declare const CACHE_MAX_MB = 2048;
19
+ /** A directory no build used for this long is removed by any command that works in the project. */
20
+ export declare const CACHE_MAX_AGE_MS: number;
21
+ export declare const capBytes: (rt: Runtime) => number;
22
+ /** One directory of the cache that is ours to remove. */
23
+ export interface FrameDir {
24
+ key: string;
25
+ /** The size of its pictures; 0 when it was not measured. */
26
+ bytes: number;
27
+ /** When a build last used it (ms): the mark's time, or the directory's date for one written before marks. */
28
+ used: number;
29
+ /** The clip it holds frames of (sourceId); absent for a directory without a mark. */
30
+ source?: string;
31
+ }
32
+ /** Records that a build uses the directory now. source: the clip (sourceId). */
33
+ export declare const markUsed: (rt: Runtime, dir: string, source: string, now: number) => Promise<void>;
34
+ /** The directories of the project's frame cache that are ours. measure: also read every picture's size. */
35
+ export declare const listFrameDirs: (rt: Runtime, root: string, measure?: boolean) => Promise<FrameDir[]>;
36
+ export interface SweepRules {
37
+ /** The directories this run shows. */
38
+ needed: ReadonlySet<string>;
39
+ /** The clips the project has now (sourceId); absent when the run did not read them, then no directory counts as stale. */
40
+ sources?: ReadonlySet<string>;
41
+ /** The directories a running preview or render shows. */
42
+ held: ReadonlySet<string>;
43
+ /** When this run started: what was used since by another run stays. */
44
+ started: number;
45
+ now: number;
46
+ /** Infinity: no size cap (a run that does not know what the timeline shows). */
47
+ capBytes: number;
48
+ /** The final video is written: what this run showed goes too. */
49
+ drop?: boolean;
50
+ }
51
+ export interface SweepPlan {
52
+ remove: FrameDir[];
53
+ /** Set when what this run shows is alone larger than the cap: it stays, and the command says so. */
54
+ over?: {
55
+ neededBytes: number;
56
+ capBytes: number;
57
+ };
58
+ }
59
+ /** Which directories go. A function of its arguments, so that every rule can be tested without a disk. */
60
+ export declare const planSweep: (dirs: readonly FrameDir[], rules: SweepRules) => SweepPlan;
61
+ export interface SweepOptions {
62
+ needed?: readonly string[];
63
+ sources?: readonly string[];
64
+ /** When the run started (ms). */
65
+ started: number;
66
+ /** Infinity leaves the size out, and the pictures unmeasured. Default: capBytes(rt). */
67
+ capBytes?: number;
68
+ drop?: boolean;
69
+ /** The hold of this run itself, which does not protect anything from it. */
70
+ ownHold?: string;
71
+ /** Say what would go, remove nothing. */
72
+ dryRun?: boolean;
73
+ }
74
+ export interface SweepResult {
75
+ removed: FrameDir[];
76
+ freedBytes: number;
77
+ /** What is left, measured (0 when the pictures were not measured). */
78
+ bytes: number;
79
+ over?: {
80
+ neededBytes: number;
81
+ capBytes: number;
82
+ };
83
+ }
84
+ /** Applies planSweep to the project's frame cache. root: the project directory, absolute. */
85
+ export declare const sweepFrames: (rt: Runtime, root: string, o: SweepOptions) => Promise<SweepResult>;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Who shows frames of the cache right now. A preview server and every render page keep a small file in
3
+ * <project>/.cache/video/.holds/ that lists the directories they show and is written again every HOLD_REFRESH_MS; a
4
+ * file not written for HOLD_TTL_MS belongs to a run that was killed, and is removed. Another run never removes a
5
+ * directory a live file lists (frames.ts), so a render that ends does not take the pictures from under an open Studio.
6
+ */
7
+ import type { Runtime } from '../../runtime';
8
+ /** Inside the frame cache (.cache/video); not a key, so never taken for a directory of frames. */
9
+ export declare const HOLDS_DIR = ".holds";
10
+ export declare const HOLD_REFRESH_MS = 30000;
11
+ export declare const HOLD_TTL_MS = 120000;
12
+ /**
13
+ * True when dir is the directory its path says: no part of the way from the project to it is a link. A file system
14
+ * without realpath has no links.
15
+ */
16
+ export declare const isPlainInside: (rt: Runtime, root: string, dir: string) => Promise<boolean>;
17
+ export type HoldKind = 'preview' | 'render';
18
+ export interface FootageHold {
19
+ readonly id: string;
20
+ /** The directories (keys) shown from now on, in place of the ones named before. None: the file goes. */
21
+ keep(keys: readonly string[]): Promise<void>;
22
+ /** Ends the hold. */
23
+ release(): Promise<void>;
24
+ }
25
+ /** A hold of the project (root: absolute). Nothing is written until keep() names a directory. */
26
+ export declare const holdFootage: (rt: Runtime, root: string, kind: HoldKind) => FootageHold;
27
+ export interface LiveHolds {
28
+ /** Every directory a live hold lists. */
29
+ keys: Set<string>;
30
+ kinds: HoldKind[];
31
+ /** A hold file could not be read (it is being written): what it lists is not known, so nothing is removed now. */
32
+ unknown: boolean;
33
+ }
34
+ /** The holds written within HOLD_TTL_MS, without the one named `own`; older files are removed. */
35
+ export declare const liveHolds: (rt: Runtime, root: string, now: number, own?: string) => Promise<LiveHolds>;
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Everything a video project keeps that can be made again, and how it is bounded:
3
+ * .cache/video/<key>/ frames of the clips (cache/frames.ts): pruned by every build, dropped after a render
4
+ * .cache/render-chunks/<set>/ the shots of the last render with each setting (render/chunked.ts prunes inside a
5
+ * set); a set no render used for a day is removed here
6
+ * .studio/drafts/<hash>/ the media of a draft made for a desktop editor: removed by `popost video clean`
7
+ * ageProjectCaches is what every command that works in a project runs; cleanProject is `popost video clean`.
8
+ */
9
+ import type { Runtime } from '../../runtime';
10
+ /** Records that a render used the chunk set now. */
11
+ export declare const markSetUsed: (rt: Runtime, dir: string) => Promise<void>;
12
+ export interface Kept {
13
+ dirs: number;
14
+ bytes: number;
15
+ }
16
+ export interface CacheSizes {
17
+ bytes: number;
18
+ frames: Kept;
19
+ chunks: Kept;
20
+ drafts: Kept;
21
+ }
22
+ /** What the project's caches take on the disk. root: the project directory, absolute. */
23
+ export declare const cacheSizes: (rt: Runtime, root: string) => Promise<CacheSizes>;
24
+ /**
25
+ * What every command that works in a project does on its way out: the frame directories no build used for a day and
26
+ * the chunk sets no render used for a day are removed. Cheap (a few directory listings, no picture is measured) and
27
+ * never a failure of the command. root: the project directory, absolute.
28
+ */
29
+ export declare const ageProjectCaches: (rt: Runtime, root: string) => Promise<void>;
30
+ export interface Cleaned {
31
+ project: string;
32
+ freedBytes: number;
33
+ frames: Kept;
34
+ chunks: Kept;
35
+ drafts: Kept;
36
+ /** What was left in place, and why. */
37
+ kept?: string[];
38
+ }
39
+ /**
40
+ * Removes the project's caches: the frame directories, the chunk sets and the draft folders, each only where it is
41
+ * ours by name and content and no link leads to it. What a running preview or render shows stays, and so does anything
42
+ * written in the last two minutes (a run in progress). Nothing else of the project is touched.
43
+ */
44
+ export declare const cleanProject: (rt: Runtime, root: string, o?: {
45
+ dryRun?: boolean;
46
+ }) => Promise<Cleaned>;
47
+ /** How deep `clean --all` looks below the directory it is given, and how many directories it opens at most. */
48
+ export declare const WALK_DEPTH = 6;
49
+ export declare const WALK_LIMIT = 20000;
50
+ /**
51
+ * The video projects (directories with a video.json) at and below dir. A project is not looked into, links are not
52
+ * followed, node_modules and .git are passed over. truncated: the walk stopped at WALK_LIMIT directories.
53
+ */
54
+ export declare const findProjects: (rt: Runtime, dir: string) => Promise<{
55
+ projects: string[];
56
+ truncated: boolean;
57
+ }>;
@@ -0,0 +1,9 @@
1
+ import type { Runtime } from '../../runtime';
2
+ import { type CacheSizes } from '../cache/project';
3
+ import { type Commands } from './shared';
4
+ /** For doctor: what the caches of the project in the working directory take, when there is one. */
5
+ export declare const projectCache: (rt: Runtime) => Promise<(CacheSizes & {
6
+ project: string;
7
+ note: string;
8
+ }) | undefined>;
9
+ export declare const cleanCommands: Commands;
@@ -0,0 +1,15 @@
1
+ import type { Runtime } from '../../runtime';
2
+ import { type ReferenceLimits } from '../product/requests';
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). */
10
+ export declare const builtInGenerator: (rt: Runtime) => boolean;
11
+ export declare const referenceLimits: (rt: Runtime) => Promise<{
12
+ limits?: ReferenceLimits;
13
+ unread?: string;
14
+ }>;
15
+ export declare const productCommands: Commands;
@@ -1,8 +1,8 @@
1
1
  import type { Runtime } from '../../runtime';
2
2
  import type { FootageFacts, FootageInfo, Project, Resolved } from '../types';
3
3
  import { type FootageColour } from '../media/footage';
4
- /** Where frame pictures go, relative to the project directory. */
5
- export declare const FOOTAGE_CACHE = ".cache/video";
4
+ import type { FootageHold } from '../cache/holds';
5
+ export { FOOTAGE_CACHE } from '../cache/frames';
6
6
  export interface FootageProbe {
7
7
  /** Codecs that common browsers decode directly; other sources keep extracted frame pictures. */
8
8
  native?: Record<string, boolean>;
@@ -15,6 +15,20 @@ export interface FootageStats {
15
15
  extracted: number;
16
16
  reused: number;
17
17
  ms: number;
18
+ /** The size of the frame cache after the build, and what the build removed from it. */
19
+ cacheBytes?: number;
20
+ freedBytes?: number;
21
+ /** Set when the frames this timeline shows are alone larger than the cache's size cap: they stay. */
22
+ overCap?: {
23
+ neededBytes: number;
24
+ capBytes: number;
25
+ };
26
+ }
27
+ export interface ExtractOptions {
28
+ /** The render scale, so a half-size render extracts half-size pictures. */
29
+ scale?: number;
30
+ /** The caller shows the pictures for longer than the build (a render page, the preview): the directories are named in it before anything is removed. */
31
+ hold?: FootageHold;
18
32
  }
19
33
  /** Reads every video material whose file lies inside the project and exists (check reports the others). */
20
34
  export declare const probeFootage: (rt: Runtime, project: Project, projectDir: string) => Promise<FootageProbe>;
@@ -27,12 +41,15 @@ export declare const extractSize: (r: Resolved, id: string, src: Pick<FootageFac
27
41
  height: number;
28
42
  };
29
43
  /**
30
- * Extracts the frames the timeline shows (missing ones only) and returns the timeline with each footage's dir set.
31
- * opts.scale: the render scale, so a half-size render extracts half-size pictures.
44
+ * Extracts the frames the timeline shows (missing ones only) and returns the timeline with each footage's dir set,
45
+ * then removes from the cache what this state of the project no longer needs (never a failure of the build).
32
46
  */
33
- export declare const extractFootage: (rt: Runtime, r: Resolved, projectDir: string, probed: FootageProbe, opts?: {
34
- scale?: number;
35
- }) => Promise<{
47
+ export declare const extractFootage: (rt: Runtime, r: Resolved, projectDir: string, probed: FootageProbe, opts?: ExtractOptions) => Promise<{
36
48
  resolved: Resolved;
37
49
  stats: FootageStats;
38
50
  }>;
51
+ /**
52
+ * A build that shows no extracted frames (no video, or the Studio playing the clips themselves): the caller's hold
53
+ * names nothing, and the cache loses the directories of clips the project no longer has.
54
+ */
55
+ export declare const releaseFootage: (rt: Runtime, r: Resolved, projectDir: string, opts?: ExtractOptions) => Promise<void>;
@@ -6,6 +6,7 @@
6
6
  import type { Runtime } from '../../runtime';
7
7
  import type { Problem, Project, Resolved } from '../types';
8
8
  import { type FootageStats } from './footage';
9
+ import type { FootageHold } from '../cache/holds';
9
10
  export { compilePage } from './page';
10
11
  export { loadWords } from './words';
11
12
  export interface BuiltPage {
@@ -27,6 +28,8 @@ export interface BuildOptions {
27
28
  source?: unknown;
28
29
  /** Fetch the effects of the catalogue the project names and does not have yet (render, preview, draft export). */
29
30
  fetchEffects?: boolean;
31
+ /** The caller shows the page for longer than the build: the frame directories it shows are named in this hold (cache/holds.ts). */
32
+ hold?: FootageHold;
30
33
  }
31
34
  /** projectDir: as the user typed it (the problems name it so), against rt.cwd. */
32
35
  export declare const buildPage: (rt: Runtime, projectDir: string, opts?: BuildOptions) => Promise<BuiltPage>;