popost 4.6.0 → 4.6.1
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 +7 -5
- package/SKILL.md +1 -1
- package/assets/canvas/assets/{dist-Ag5yM9-G.js → dist-BmD8AP0A.js} +1 -1
- package/assets/canvas/assets/{es-DzkTYs_E.js → es-CC29Cabv.js} +1 -1
- package/assets/canvas/assets/{index-DjfLTPyx.js → index-DhwyFpu2.js} +6 -6
- package/assets/canvas/assets/{jszip.min-Cw2BF2G0.js → jszip.min-Bwf_yCrF.js} +1 -1
- package/assets/canvas/build-info.json +5 -5
- package/assets/canvas/index.html +1 -1
- package/dist/cli.js +3454 -1631
- package/dist/index.js +3392 -1616
- package/dist/types/broken-pipe.d.ts +13 -0
- package/dist/types/core/error-text.d.ts +26 -0
- package/dist/types/core/errors.d.ts +5 -3
- package/dist/types/core/image-info.d.ts +1 -1
- package/dist/types/core/image.d.ts +3 -5
- package/dist/types/core/project.d.ts +8 -7
- package/dist/types/core/util.d.ts +1 -2
- package/dist/types/credentials.d.ts +0 -10
- package/dist/types/editor/http-types.d.ts +1 -0
- package/dist/types/i18n.d.ts +11 -0
- package/dist/types/main.d.ts +4 -1
- package/dist/types/profile.d.ts +2 -0
- package/dist/types/providers/api-errors.d.ts +2 -2
- package/dist/types/providers/api.d.ts +4 -5
- package/dist/types/providers/errors.d.ts +5 -1
- package/dist/types/providers/popost-validate.d.ts +0 -1
- package/dist/types/render/audit-script.d.ts +2 -1
- package/dist/types/render/audit.d.ts +2 -0
- package/dist/types/version.d.ts +1 -1
- package/dist/types/workflow/build.d.ts +1 -1
- package/dist/types/workflow/errors.d.ts +1 -1
- package/dist/types/workflow/io.d.ts +1 -1
- package/dist/types/workflow/post-bundle.d.ts +6 -1
- package/dist/types/workflow/series-plan.d.ts +5 -2
- package/dist/types/workflow/template-plugins.d.ts +0 -8
- package/package.json +1 -1
- package/references/post-bundle.md +1 -1
- package/references/providers.md +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface ErrorSource {
|
|
2
|
+
on(event: 'error', listener: (error: NodeJS.ErrnoException) => void): unknown;
|
|
3
|
+
}
|
|
4
|
+
export interface PipeGuard {
|
|
5
|
+
/** Ends the process with this code. */
|
|
6
|
+
readonly exit: (code: number) => void;
|
|
7
|
+
/** The code the command set so far (`process.exitCode`). */
|
|
8
|
+
readonly exitCode: () => number;
|
|
9
|
+
/** Best-effort one-line report for an unexpected stream error. */
|
|
10
|
+
readonly report: (text: string) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const guardBrokenPipe: (streams: readonly ErrorSource[], guard: PipeGuard) => void;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** An operating-system error of a file operation (`ENOENT`, `EISDIR`, …). */
|
|
2
|
+
export declare const isSystemError: (error: unknown) => error is Error & {
|
|
3
|
+
code: string;
|
|
4
|
+
};
|
|
5
|
+
/** What a file-system error code means for `path`; `undefined` for codes without a plain wording. */
|
|
6
|
+
export declare const fileErrorText: (code: string, path: string) => string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* A value as a message quotes it: `'text'` for a string, the JSON of a number, list or object, and "nothing" for a
|
|
9
|
+
* missing one (never Python's `None` / `True`).
|
|
10
|
+
*/
|
|
11
|
+
export declare const quoted: (value: unknown) => string;
|
|
12
|
+
/** A value in running text: a string as it is, anything else as `quoted` shows it. */
|
|
13
|
+
export declare const plain: (value: unknown) => string;
|
|
14
|
+
/** A host that restricts the network (the popost.ai web agent's sandbox) refuses a URL with a `BlockedFetchError`. */
|
|
15
|
+
export declare const isHostBlocked: (error: unknown) => boolean;
|
|
16
|
+
export declare const isTimeout: (error: unknown) => boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Why a request to `url` failed, as a short phrase that names the host: "the DNS lookup for x failed",
|
|
19
|
+
* "x refused the connection", "x did not answer in time", … Never the `TypeError: fetch failed` wrapper.
|
|
20
|
+
*/
|
|
21
|
+
export declare const networkReason: (error: unknown, url?: string) => string;
|
|
22
|
+
/**
|
|
23
|
+
* What a caught error prints in `{"ok": false, "error": …}`: the message alone (the class name stays on `error.name`),
|
|
24
|
+
* file-system errors as "file not found: <path>", a failed request as the host and why it could not be reached.
|
|
25
|
+
*/
|
|
26
|
+
export declare const errorText: (error: unknown) => string;
|
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
export declare class ValueError extends Error {
|
|
3
3
|
name: string;
|
|
4
4
|
}
|
|
5
|
-
/** A required key is missing from a JSON document
|
|
5
|
+
/** A required key is missing from a JSON document. */
|
|
6
6
|
export declare class KeyError extends Error {
|
|
7
|
+
readonly key: string;
|
|
7
8
|
name: string;
|
|
8
|
-
constructor(key: string);
|
|
9
|
+
constructor(key: string, where?: string);
|
|
9
10
|
}
|
|
10
|
-
/** A file the user pointed at is missing or is a directory
|
|
11
|
+
/** A file the user pointed at is missing or is a directory. */
|
|
11
12
|
export declare class OsError extends Error {
|
|
12
13
|
readonly code: 'ENOENT' | 'EISDIR';
|
|
14
|
+
readonly path: string;
|
|
13
15
|
name: string;
|
|
14
16
|
constructor(code: 'ENOENT' | 'EISDIR', path: string);
|
|
15
17
|
}
|
|
@@ -17,7 +17,7 @@ export interface PictureInfo {
|
|
|
17
17
|
readonly hasAlpha?: boolean;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
-
* Format, size and transparency of the picture in `bytes`. An `ImageError` (`
|
|
20
|
+
* Format, size and transparency of the picture in `bytes`. An `ImageError` (`not a readable picture file: name`) when the
|
|
21
21
|
* bytes are not a readable PNG, JPEG, WebP, GIF or SVG.
|
|
22
22
|
*/
|
|
23
23
|
export declare const describePicture: (bytes: Uint8Array, name?: string) => PictureInfo;
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Image header checks in place of Pillow's `Image.open(...).verify()`: the format and pixel size of a PNG, JPEG, WebP or
|
|
3
|
-
* GIF, read from the bytes. A file that is not one of these, or is cut short, is rejected.
|
|
4
|
-
*/
|
|
5
1
|
export type ImageFormat = 'png' | 'jpeg' | 'webp' | 'gif';
|
|
6
2
|
export interface ImageInfo {
|
|
7
3
|
readonly format: ImageFormat;
|
|
@@ -12,11 +8,13 @@ export interface ImageInfo {
|
|
|
12
8
|
export declare class ImageError extends Error {
|
|
13
9
|
name: string;
|
|
14
10
|
}
|
|
11
|
+
/** The message for bytes that are not a picture popost can read (or are a damaged one); `name` is the path the user typed. */
|
|
12
|
+
export declare const notPictureText: (name?: string) => string;
|
|
15
13
|
export declare const u32be: (b: Uint8Array, o: number) => number;
|
|
16
14
|
export declare const ascii: (b: Uint8Array, o: number, n: number) => string;
|
|
17
15
|
/**
|
|
18
16
|
* Format and size of an image, or an `ImageError` when the bytes are not a readable PNG, JPEG, WebP or GIF. `name` (the
|
|
19
|
-
* path the user typed) is
|
|
17
|
+
* path the user typed) is named in the message: `not a readable picture file: x.png`.
|
|
20
18
|
*/
|
|
21
19
|
export declare const sniffImage: (bytes: Uint8Array, name?: string) => ImageInfo;
|
|
22
20
|
export declare const isImage: (bytes: Uint8Array) => boolean;
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Editable HTML project core (port of `project_core.py`). A project is a directory: `social-studio-project.json`
|
|
3
|
-
* (schema v2, workflowVersion 3), one HTML file per page under `pages/` (the only layout authority), `assets/`,
|
|
4
|
-
* `exports/`, `design.md`, and the production records the workflow commands add.
|
|
5
|
-
*/
|
|
6
1
|
import type { Runtime } from '../runtime';
|
|
7
2
|
export declare const SCHEMA = "social-studio-project.v2";
|
|
8
3
|
export declare const MODES: readonly ["original", "strict"];
|
|
@@ -10,8 +5,14 @@ export type Mode = (typeof MODES)[number];
|
|
|
10
5
|
export declare const MANIFEST_NAME = "social-studio-project.json";
|
|
11
6
|
export declare const SAFE_ID: RegExp;
|
|
12
7
|
export declare const MAX_CANVAS = 16384;
|
|
8
|
+
/**
|
|
9
|
+
* The heading under which design.md collects observations, and the prefix of the note `init` adds there. `build` reads
|
|
10
|
+
* design.md by these two markers, so they are the same in every language.
|
|
11
|
+
*/
|
|
12
|
+
export declare const OBSERVATION_LOG = "## Observation log";
|
|
13
|
+
export declare const INIT_NOTE_PREFIX = "init:";
|
|
13
14
|
/** The first line `init` adds to design.md: the file is a starter until the design phase rewrites it. */
|
|
14
|
-
export declare const
|
|
15
|
+
export declare const initDesignNote: () => string;
|
|
15
16
|
export declare class ProjectError extends Error {
|
|
16
17
|
name: string;
|
|
17
18
|
}
|
|
@@ -92,7 +93,7 @@ export declare class Project {
|
|
|
92
93
|
addSource(kind: string, note: string): Promise<void>;
|
|
93
94
|
appendDesignNote(note: string): Promise<void>;
|
|
94
95
|
setConcept(status: string, prompt?: string | null, fixture?: string | null): Promise<void>;
|
|
95
|
-
/** A file the user named, relative to the working directory; missing
|
|
96
|
+
/** A file the user named, relative to the working directory; a missing one is an `OsError` naming it. */
|
|
96
97
|
private readReferenceFile;
|
|
97
98
|
/** Copy a local reference image into `reference/`; the one composition contact sheet of a series is `concept`. */
|
|
98
99
|
importReference(path: string, role?: string, pageId?: string | null, concept?: boolean): Promise<{
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { Runtime } from '../runtime';
|
|
2
|
+
export { errorText } from './error-text';
|
|
2
3
|
/** One JSON document on stdout, like the Python Skill's `print(json.dumps(..., ensure_ascii=False))`. */
|
|
3
4
|
export declare const printJson: (rt: Runtime, value: unknown, pretty?: boolean) => void;
|
|
4
5
|
/** `{"ok": false, "error": …}` on stdout and the exit code (2 unless given). */
|
|
5
6
|
export declare const fail: (rt: Runtime, error: string, code?: number, extra?: Record<string, unknown>) => number;
|
|
6
|
-
/** `TypeName: message`, the shape the Python CLI printed for caught exceptions. */
|
|
7
|
-
export declare const errorText: (error: unknown) => string;
|
|
8
7
|
export declare const sha256: (data: Uint8Array | string) => string;
|
|
9
8
|
export declare const sha256File: (rt: Runtime, path: string) => Promise<string>;
|
|
10
9
|
/** Local time with its UTC offset, to the second: `2026-11-05T12:00:00+08:00` (Python `isoformat(timespec="seconds")`). */
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The stored API key: `<home>/.popost/credentials.json` (the directory can be moved with `POPOST_HOME`), written by
|
|
3
|
-
* `popost auth set`, owner-only where the OS supports it. It is a user-level file outside every project, so a key never
|
|
4
|
-
* ends up in a project, a ZIP or a commit.
|
|
5
|
-
*
|
|
6
|
-
* Resolution order: the environment variables `POPOST_API_KEY` / `POPOST_BASE_URL` first, then this file. The node
|
|
7
|
-
* runtime applies the file once, when it builds `env` (`applyStoredCredentials`), so everything that reads the key
|
|
8
|
-
* (`PopostClient`, the secret scrubber) keeps reading `rt.env`. A host that runs the CLI in-process and passes its own
|
|
9
|
-
* `env` and no `homeDir` never touches the file.
|
|
10
|
-
*/
|
|
11
1
|
import type { Runtime } from './runtime';
|
|
12
2
|
export declare const BASE_URL_ENV = "POPOST_BASE_URL";
|
|
13
3
|
export declare const HOME_ENV = "POPOST_HOME";
|
|
@@ -50,6 +50,7 @@ export declare const fileResponse: (data: Uint8Array, contentType: string, downl
|
|
|
50
50
|
export declare const noStoreResponse: (body: Uint8Array | string, contentType: string, extra?: Record<string, string>) => ApiResponse;
|
|
51
51
|
/** A request the caller got wrong: the Python `ValueError` / `SyntaxError` family. */
|
|
52
52
|
export declare const isBadRequest: (error: unknown) => boolean;
|
|
53
|
+
/** What a failed request answers: the message alone, a file error as "file not found: <path>", a failed fetch by its host. */
|
|
53
54
|
export declare const errorMessage: (error: unknown) => string;
|
|
54
55
|
/** Parse a JSON body that must be an object. */
|
|
55
56
|
export declare const parseJsonObject: (req: ApiRequest) => Record<string, unknown>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type Lang = 'en' | 'zh';
|
|
2
|
+
/** Read in this order; the first one that is set decides. `POPOST_LANG` (`en` or `zh`) overrides the locale. */
|
|
3
|
+
export declare const LANG_ENV: readonly ["POPOST_LANG", "LC_ALL", "LC_MESSAGES", "LANG"];
|
|
4
|
+
/** `zh…` (`zh`, `zh_CN.UTF-8`, `zh-Hant`) means Chinese; anything else, or nothing, means English. */
|
|
5
|
+
export declare const resolveLang: (env: Readonly<Record<string, string | undefined>>) => Lang;
|
|
6
|
+
/** Runs `body` with `lang` as the message language of everything it calls, including what it starts asynchronously. */
|
|
7
|
+
export declare const withLang: <T>(lang: Lang, body: () => T) => T;
|
|
8
|
+
/** The message language of the current invocation; English outside `run()`. */
|
|
9
|
+
export declare const currentLang: () => Lang;
|
|
10
|
+
/** The text for the current language. Both versions carry the same facts: numbers, ids, file names, commands. */
|
|
11
|
+
export declare const msg: (en: string, zh: string) => string;
|
package/dist/types/main.d.ts
CHANGED
|
@@ -3,5 +3,8 @@
|
|
|
3
3
|
* Each group lives in its own module under `commands/` and exports a `CommandMain`.
|
|
4
4
|
*/
|
|
5
5
|
import type { Runtime } from './runtime';
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Run one CLI invocation; returns the exit code. Never throws: an unexpected error is reported as JSON, exit 1. Messages
|
|
8
|
+
* are in the language of `rt.env` (`i18n.ts`) for this invocation only.
|
|
9
|
+
*/
|
|
7
10
|
export declare const run: (argv: readonly string[], rt: Runtime) => Promise<number>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const DEFAULT_KEY_ENV = "POPOST_API_KEY";
|
|
2
2
|
/** The key page of the official service; `PopostClient` swaps in the page of the origin it talks to. */
|
|
3
3
|
export declare const DEFAULT_KEY_PAGE = "https://popost.ai/account/api-keys";
|
|
4
|
-
/** Python `"%d"` for whole numbers, `"%s"` otherwise; booleans and missing values print the fallback. */
|
|
4
|
+
/** Python `"%d"` for whole numbers, `"%s"` otherwise; booleans and missing values print the fallback ("unknown"). */
|
|
5
5
|
export declare const num: (value: unknown, fallback?: string) => string;
|
|
6
|
-
/** Only known fields are read; the server's own text is appended, truncated. */
|
|
6
|
+
/** Only known fields are read; the server's own text is appended as it is, truncated. */
|
|
7
7
|
export declare const describeError: (code: string | undefined, serverMessage?: unknown, details?: unknown, keyEnv?: string) => string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isHostBlocked, isTimeout } from '../core/error-text';
|
|
1
2
|
import { BASE_URL_ENV } from '../credentials';
|
|
2
3
|
import type { Runtime } from '../runtime';
|
|
3
4
|
export { DEFAULT_KEY_ENV } from './api-errors';
|
|
@@ -18,14 +19,11 @@ export declare const checkUrl: (url: string, what: string) => string;
|
|
|
18
19
|
export declare const readCapped: (response: Response, limit: number) => Promise<Uint8Array>;
|
|
19
20
|
/** Refused connections, unresolvable hosts and certificate failures: the request never reached the server. */
|
|
20
21
|
export declare const isNotDelivered: (error: unknown) => boolean;
|
|
21
|
-
export declare const isTimeout: (error: unknown) => boolean;
|
|
22
22
|
/**
|
|
23
23
|
* A host that restricts the network (the popost.ai web agent's sandbox) refuses a URL before anything is sent; its error
|
|
24
24
|
* is named `BlockedFetchError`. Nothing reached any server, so such a failure is never "outcome unknown".
|
|
25
25
|
*/
|
|
26
|
-
export
|
|
27
|
-
/** `Name: message` of a failed fetch, including the underlying cause when there is one. */
|
|
28
|
-
export declare const describeFetchError: (error: unknown) => string;
|
|
26
|
+
export { isHostBlocked, isTimeout };
|
|
29
27
|
export declare const keyEnvName: (name: string | undefined) => string;
|
|
30
28
|
export interface RequestOptions {
|
|
31
29
|
body?: unknown;
|
|
@@ -67,6 +65,7 @@ export declare class PopostClient {
|
|
|
67
65
|
request(method: string, path: string, options?: RequestOptions): Promise<unknown>;
|
|
68
66
|
/** The body of any answer; an unreadable body is an empty one for an error status and "unknown" for a success. */
|
|
69
67
|
private readBody;
|
|
68
|
+
/** A request that got no answer: the host and why (DNS, refused, timeout, …), never the fetch error's own text. */
|
|
70
69
|
private failed;
|
|
71
70
|
private uncertain;
|
|
72
71
|
private parse;
|
|
@@ -86,7 +85,7 @@ export declare class PopostClient {
|
|
|
86
85
|
}>;
|
|
87
86
|
private putBytes;
|
|
88
87
|
}
|
|
89
|
-
/** How a failed download is worded: what was fetched, and what the user can do next. */
|
|
88
|
+
/** How a failed download is worded: what was fetched ("the result image"), and what the user can do next. */
|
|
90
89
|
export interface DownloadLabels {
|
|
91
90
|
readonly what?: string;
|
|
92
91
|
readonly retry?: string;
|
|
@@ -32,8 +32,12 @@ export declare class LedgerError extends Error {
|
|
|
32
32
|
/** A refusal of the `provider cli` commands: `code` is the process exit code (1 refused, 2 usage/environment, 3 unconfirmed). */
|
|
33
33
|
export declare class CliReject extends Error {
|
|
34
34
|
readonly code: number;
|
|
35
|
+
/** Fields the refusal carries next to `error`, e.g. the price and balance of a quote the balance does not cover. */
|
|
36
|
+
readonly details: Readonly<Record<string, unknown>>;
|
|
35
37
|
name: string;
|
|
36
|
-
constructor(code: number, message: string
|
|
38
|
+
constructor(code: number, message: string,
|
|
39
|
+
/** Fields the refusal carries next to `error`, e.g. the price and balance of a quote the balance does not cover. */
|
|
40
|
+
details?: Readonly<Record<string, unknown>>);
|
|
37
41
|
}
|
|
38
42
|
/** Local environment or configuration problems (no request was made): exit 2 instead of 1. */
|
|
39
43
|
export declare const LOCAL_ERROR_CODES: readonly string[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The machine audit that runs inside the page for one canvas root (port of `render_html.AUDIT_JS`): overflow and clipping
|
|
3
|
-
* checks, broken images, unloaded fonts. It returns facts and issues; it never decides what to promote.
|
|
3
|
+
* checks, broken images, unloaded fonts. It returns facts and issues; it never decides what to promote. The issue texts
|
|
4
|
+
* come in with the argument (`arg.messages`, by issue code) in the language of the invocation (`auditMessages`).
|
|
4
5
|
* Shipped as text because it runs in the browser, not in Node. Page scripts are off in the render context, which also stops
|
|
5
6
|
* DOM collections from calling back into script (`NodeList.forEach`, `FontFaceSet.forEach`): iterate real arrays instead.
|
|
6
7
|
*/
|
|
@@ -41,6 +41,8 @@ export interface AuditReport {
|
|
|
41
41
|
reviews: never[];
|
|
42
42
|
pages: AuditPage[];
|
|
43
43
|
}
|
|
44
|
+
/** The texts of the issues the in-page audit (`AUDIT_SCRIPT`) finds, by issue code. */
|
|
45
|
+
export declare const auditMessages: () => Record<string, string>;
|
|
44
46
|
/** Source-level rules that need no browser: no scripts, and external references are reported. */
|
|
45
47
|
export declare const staticScan: (html: string) => AuditIssue[];
|
|
46
48
|
/** Files named explicitly plus the `*.html` files of `htmlDir`, absolute and unique, in that order. */
|
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.1";
|
|
@@ -7,5 +7,5 @@ import { KeyError, OsError, ValueError } from '../core/errors';
|
|
|
7
7
|
export { KeyError, OsError, ValueError };
|
|
8
8
|
/** `(ValueError, OSError, KeyError)` of the Python CLI, plus what replaces JSONDecodeError and PIL's image errors. */
|
|
9
9
|
export declare const isExpectedFailure: (error: unknown) => boolean;
|
|
10
|
-
/**
|
|
10
|
+
/** The text of an expected failure: its message, a file-system error as "file not found: <path>". */
|
|
11
11
|
export declare const failureText: (error: unknown) => string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/** File reads for paths the user typed: relative to the working directory, failing the way Python's `open()` did. */
|
|
2
1
|
import type { Runtime } from '../runtime';
|
|
3
2
|
export declare const fromCwd: (rt: Runtime, path: string) => string;
|
|
4
3
|
export declare const readUserBytes: (rt: Runtime, userPath: string) => Promise<Uint8Array>;
|
|
5
4
|
export declare const readUserText: (rt: Runtime, userPath: string) => Promise<string>;
|
|
5
|
+
/** A `SyntaxError` naming the file when it is not JSON. */
|
|
6
6
|
export declare const readUserJson: (rt: Runtime, userPath: string) => Promise<unknown>;
|
|
7
7
|
/** Python `str.splitlines()`: the same line breaks, and no empty last line. */
|
|
8
8
|
export declare const splitLines: (text: string) => string[];
|
|
@@ -12,13 +12,18 @@ export declare const PARSE_STATUSES: readonly ["pending", "ready", "auth_failed"
|
|
|
12
12
|
export declare const RESOURCE_KINDS: readonly ["image", "video", "music"];
|
|
13
13
|
export type Bundle = Record<string, unknown>;
|
|
14
14
|
/** Interface definition of a future parse service: a placeholder, with no client and no call. */
|
|
15
|
-
export declare const
|
|
15
|
+
export declare const serviceConfig: () => {
|
|
16
16
|
schema: string;
|
|
17
17
|
status: string;
|
|
18
18
|
endpoint: null;
|
|
19
19
|
authEnv: null;
|
|
20
20
|
note: string;
|
|
21
21
|
};
|
|
22
|
+
export type Platform = (typeof PLATFORMS)[number];
|
|
23
|
+
/** The hosts of each platform's post links, short links included (the same list as popost.ai's link input). */
|
|
24
|
+
export declare const PLATFORM_HOSTS: Readonly<Record<Platform, readonly string[]>>;
|
|
25
|
+
/** The platform a post link belongs to, or `null` for a link of none of them (or no web link at all). */
|
|
26
|
+
export declare const platformOfUrl: (url: string) => Platform | null;
|
|
22
27
|
/** A pending ticket for a URL the user gave. Never fetches anything. */
|
|
23
28
|
export declare const makePendingTicket: (rt: Runtime, url: string, platform: string) => Bundle;
|
|
24
29
|
/** `[ok, errors]`: structure and types only; whether the bundle can be built is `evaluateBuildable`'s question. */
|
|
@@ -3,8 +3,11 @@ import { type SheetPlan } from './composition-grid';
|
|
|
3
3
|
export declare const SCHEMA = "popost-series.v1";
|
|
4
4
|
export declare const PLAN_FILE = "series-plan.json";
|
|
5
5
|
export type Plan = Record<string, unknown>;
|
|
6
|
-
/**
|
|
7
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Everything wrong with a plan, in the order the agent should fix it; `pageIds` binds it to the project's pages, and
|
|
8
|
+
* `orderHint` is added to the message when the plan's pages do not match them.
|
|
9
|
+
*/
|
|
10
|
+
export declare const validate: (plan: unknown, pageIds?: readonly string[], orderHint?: string) => string[];
|
|
8
11
|
export declare const load: (project: Project) => Promise<Plan | null>;
|
|
9
12
|
/** Hash of the plan's content: reviews of the sequence are bound to it. Same bytes as Python's sorted `json.dumps`. */
|
|
10
13
|
export declare const digest: (plan: unknown) => string;
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Scene Skill (template) mounting, pure local (port of `template_plugins.py`).
|
|
3
|
-
* - `locateSkill` really reads the scene Skill's SKILL.md, hashes it, lists the references. A missing or unreadable
|
|
4
|
-
* SKILL.md is an error result: never a silent fallback, never a downgrade to free creation.
|
|
5
|
-
* - `recallCandidates` is lexical recall only (`verdict_authoritative` is always false). Platform words are never a
|
|
6
|
-
* content key. The agent reads the full text and decides.
|
|
7
|
-
* - `detectConflict` does not assert a conflict; it only flags `requiresReview`.
|
|
8
|
-
*/
|
|
9
1
|
import type { Runtime } from '../runtime';
|
|
10
2
|
export interface SkillReference {
|
|
11
3
|
path: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "popost",
|
|
3
|
-
"version": "4.6.
|
|
3
|
+
"version": "4.6.1",
|
|
4
4
|
"description": "popost Skill and CLI: create, reproduce and edit social media image posts as editable HTML projects, for coding agents such as Codex and Claude Code.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "CLIPCAT AI LTD",
|
|
@@ -26,7 +26,7 @@ inspiration status <task id> [--timeout 600] [--config PRIVATE_CONFIG]
|
|
|
26
26
|
inspiration import --file bundle.json [--note "为什么收藏"] [--dry-run] [--allow-incomplete] [--config PRIVATE_CONFIG]
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
1. 先写好 bundle:`parseStatus=ready`,图片放在 `resources
|
|
29
|
+
1. 先写好 bundle:`parseStatus=ready`,图片放在 `resources`(每项要有非空且不重复的 `id`,如 `"01"`、`"02"`;`kind=image`,`path` 相对 bundle 文件,或只有 https `url`),文字放 `title`/`body`/`tags`。实际打开每张图确认顺序与内容,不编造原帖文字、作者或数据。
|
|
30
30
|
2. 可选扩展字段(validate 不要求):`author{name,handle,profileUrl,avatarUrl}`、`stats{likes,comments,shares,saves,views}`(非负整数)、`publishedAt`(带时区的 ISO 时间)、`note`。
|
|
31
31
|
3. 先 `--dry-run` 看计划(不联网、不需要密钥),再正式导入。使用浏览器连接的账户;手动配置也支持环境变量 `POPOST_API_KEY` 或 `popost auth set` 保存的 Key、私有配置 `popost.baseUrl` 或 `POPOST_BASE_URL`,见 [providers.md](providers.md)。
|
|
32
32
|
|
package/references/providers.md
CHANGED
|
@@ -22,7 +22,7 @@ official 通道由 popost CLI 自身直接调用 popost.ai 平台 OpenAPI(HTTP
|
|
|
22
22
|
|---|---|
|
|
23
23
|
| UNAUTHORIZED / FORBIDDEN | Resolve the invalid Key or missing permission privately; do not treat it as insufficient credits. Use the key page for the current origin; never request a Key in chat. |
|
|
24
24
|
| INVALID_REQUEST | 参数不合法,逐条列出 issues;修正后重新报价 |
|
|
25
|
-
| INSUFFICIENT_CREDITS | Show required/balance when known and the purchase options returned by `account
|
|
25
|
+
| INSUFFICIENT_CREDITS | Show required/balance when known and the purchase options returned by `account`. A quote the balance does not cover still exits 1 with its price in `billing` (`creditsPerImage`, `totalCredits`, `balance`); a batch quote lists each job's `credits` and the sum as `requiredCredits`. No quote id is recorded, so quote again after a top-up; retain local references and user-selected custom / host generation. No automatic billing fallback. |
|
|
26
26
|
| CREDIT_LIMIT_EXCEEDED | 实际计价超过已确认上限,平台拒绝且未扣费:重新报价并确认 |
|
|
27
27
|
| RATE_LIMITED | 限流:按 retryAfterSeconds 等待后再操作 |
|
|
28
28
|
| CLI_VERSION_TOO_OLD | Skill 版本低于平台要求:请用户更新 popost Skill |
|