@12ui/design 0.2.13 → 0.2.15
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 +35 -9
- package/dist/bounded-concurrency.d.ts +13 -0
- package/dist/bounded-concurrency.d.ts.map +1 -0
- package/dist/bounded-concurrency.js +43 -0
- package/dist/bounded-concurrency.js.map +1 -0
- package/dist/branch-client.d.ts +155 -0
- package/dist/branch-client.d.ts.map +1 -0
- package/dist/branch-client.js +179 -0
- package/dist/branch-client.js.map +1 -0
- package/dist/branch-completion.d.ts +37 -0
- package/dist/branch-completion.d.ts.map +1 -0
- package/dist/branch-completion.js +137 -0
- package/dist/branch-completion.js.map +1 -0
- package/dist/branch-dispatch-loop.d.ts +84 -0
- package/dist/branch-dispatch-loop.d.ts.map +1 -0
- package/dist/branch-dispatch-loop.js +206 -0
- package/dist/branch-dispatch-loop.js.map +1 -0
- package/dist/branch-downloads.d.ts +53 -0
- package/dist/branch-downloads.d.ts.map +1 -0
- package/dist/branch-downloads.js +114 -0
- package/dist/branch-downloads.js.map +1 -0
- package/dist/branch-execution-types.d.ts +54 -0
- package/dist/branch-execution-types.d.ts.map +1 -0
- package/dist/branch-execution-types.js +2 -0
- package/dist/branch-execution-types.js.map +1 -0
- package/dist/branch-execution.d.ts +20 -0
- package/dist/branch-execution.d.ts.map +1 -0
- package/dist/branch-execution.js +380 -0
- package/dist/branch-execution.js.map +1 -0
- package/dist/branch-identity.d.ts +71 -0
- package/dist/branch-identity.d.ts.map +1 -0
- package/dist/branch-identity.js +72 -0
- package/dist/branch-identity.js.map +1 -0
- package/dist/branch-materialize.d.ts +33 -0
- package/dist/branch-materialize.d.ts.map +1 -0
- package/dist/branch-materialize.js +64 -0
- package/dist/branch-materialize.js.map +1 -0
- package/dist/branch-page-conversion.d.ts +127 -0
- package/dist/branch-page-conversion.d.ts.map +1 -0
- package/dist/branch-page-conversion.js +382 -0
- package/dist/branch-page-conversion.js.map +1 -0
- package/dist/branch-plan.d.ts +63 -0
- package/dist/branch-plan.d.ts.map +1 -0
- package/dist/branch-plan.js +95 -0
- package/dist/branch-plan.js.map +1 -0
- package/dist/branch-progress.d.ts +99 -0
- package/dist/branch-progress.d.ts.map +1 -0
- package/dist/branch-progress.js +188 -0
- package/dist/branch-progress.js.map +1 -0
- package/dist/branch-run-record.d.ts +164 -0
- package/dist/branch-run-record.d.ts.map +1 -0
- package/dist/branch-run-record.js +94 -0
- package/dist/branch-run-record.js.map +1 -0
- package/dist/branch-schedule.d.ts +74 -0
- package/dist/branch-schedule.d.ts.map +1 -0
- package/dist/branch-schedule.js +130 -0
- package/dist/branch-schedule.js.map +1 -0
- package/dist/branch-status.d.ts +11 -0
- package/dist/branch-status.d.ts.map +1 -0
- package/dist/branch-status.js +118 -0
- package/dist/branch-status.js.map +1 -0
- package/dist/branch-viewport-normalization.d.ts +74 -0
- package/dist/branch-viewport-normalization.d.ts.map +1 -0
- package/dist/branch-viewport-normalization.js +120 -0
- package/dist/branch-viewport-normalization.js.map +1 -0
- package/dist/cli-arguments.d.ts.map +1 -1
- package/dist/cli-arguments.js +5 -0
- package/dist/cli-arguments.js.map +1 -1
- package/dist/cli-branch-command.d.ts +55 -0
- package/dist/cli-branch-command.d.ts.map +1 -0
- package/dist/cli-branch-command.js +475 -0
- package/dist/cli-branch-command.js.map +1 -0
- package/dist/cli-capabilities.d.ts +51 -0
- package/dist/cli-capabilities.d.ts.map +1 -1
- package/dist/cli-capabilities.js +52 -1
- package/dist/cli-capabilities.js.map +1 -1
- package/dist/cli-create-command.d.ts +21 -0
- package/dist/cli-create-command.d.ts.map +1 -0
- package/dist/cli-create-command.js +319 -0
- package/dist/cli-create-command.js.map +1 -0
- package/dist/cli-detach.d.ts +62 -0
- package/dist/cli-detach.d.ts.map +1 -0
- package/dist/cli-detach.js +123 -0
- package/dist/cli-detach.js.map +1 -0
- package/dist/cli-draft-command.d.ts +63 -0
- package/dist/cli-draft-command.d.ts.map +1 -0
- package/dist/cli-draft-command.js +220 -0
- package/dist/cli-draft-command.js.map +1 -0
- package/dist/cli-export-command.d.ts.map +1 -1
- package/dist/cli-export-command.js +2 -3
- package/dist/cli-export-command.js.map +1 -1
- package/dist/cli-image-batch-command.d.ts +21 -0
- package/dist/cli-image-batch-command.d.ts.map +1 -1
- package/dist/cli-image-batch-command.js +65 -4
- package/dist/cli-image-batch-command.js.map +1 -1
- package/dist/cli-image-batch-resume.d.ts +7 -0
- package/dist/cli-image-batch-resume.d.ts.map +1 -1
- package/dist/cli-image-batch-resume.js +19 -2
- package/dist/cli-image-batch-resume.js.map +1 -1
- package/dist/cli-package-command.d.ts +29 -0
- package/dist/cli-package-command.d.ts.map +1 -0
- package/dist/cli-package-command.js +128 -0
- package/dist/cli-package-command.js.map +1 -0
- package/dist/cli-progress.d.ts +137 -0
- package/dist/cli-progress.d.ts.map +1 -1
- package/dist/cli-progress.js +156 -0
- package/dist/cli-progress.js.map +1 -1
- package/dist/cli-select-command.d.ts +12 -0
- package/dist/cli-select-command.d.ts.map +1 -0
- package/dist/cli-select-command.js +66 -0
- package/dist/cli-select-command.js.map +1 -0
- package/dist/cli.js +150 -7
- package/dist/cli.js.map +1 -1
- package/dist/conversion-receipt.d.ts +127 -0
- package/dist/conversion-receipt.d.ts.map +1 -0
- package/dist/conversion-receipt.js +184 -0
- package/dist/conversion-receipt.js.map +1 -0
- package/dist/create-identity.d.ts +25 -0
- package/dist/create-identity.d.ts.map +1 -0
- package/dist/create-identity.js +0 -0
- package/dist/create-identity.js.map +1 -0
- package/dist/draft-identity.d.ts +30 -0
- package/dist/draft-identity.d.ts.map +1 -0
- package/dist/draft-identity.js +0 -0
- package/dist/draft-identity.js.map +1 -0
- package/dist/draft-prompts.d.ts +35 -0
- package/dist/draft-prompts.d.ts.map +1 -0
- package/dist/draft-prompts.js +51 -0
- package/dist/draft-prompts.js.map +1 -0
- package/dist/draft-run.d.ts +32 -0
- package/dist/draft-run.d.ts.map +1 -0
- package/dist/draft-run.js +152 -0
- package/dist/draft-run.js.map +1 -0
- package/dist/draft-workspace.d.ts +90 -0
- package/dist/draft-workspace.d.ts.map +1 -0
- package/dist/draft-workspace.js +64 -0
- package/dist/draft-workspace.js.map +1 -0
- package/dist/image-batch-status.d.ts +42 -0
- package/dist/image-batch-status.d.ts.map +1 -0
- package/dist/image-batch-status.js +142 -0
- package/dist/image-batch-status.js.map +1 -0
- package/dist/image-dimensions.d.ts +12 -0
- package/dist/image-dimensions.d.ts.map +1 -0
- package/dist/image-dimensions.js +14 -0
- package/dist/image-dimensions.js.map +1 -0
- package/dist/image-generation-resume.d.ts +13 -0
- package/dist/image-generation-resume.d.ts.map +1 -1
- package/dist/image-generation-resume.js +13 -0
- package/dist/image-generation-resume.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/legacy-skill-catalog.d.ts.map +1 -1
- package/dist/legacy-skill-catalog.js +140 -0
- package/dist/legacy-skill-catalog.js.map +1 -1
- package/dist/package-client.d.ts +28 -0
- package/dist/package-client.d.ts.map +1 -1
- package/dist/package-client.js +21 -1
- package/dist/package-client.js.map +1 -1
- package/dist/package-manifest-file.d.ts +21 -0
- package/dist/package-manifest-file.d.ts.map +1 -0
- package/dist/package-manifest-file.js +119 -0
- package/dist/package-manifest-file.js.map +1 -0
- package/dist/package-manifest-template.d.ts +23 -0
- package/dist/package-manifest-template.d.ts.map +1 -0
- package/dist/package-manifest-template.js +60 -0
- package/dist/package-manifest-template.js.map +1 -0
- package/dist/package-source-refusal.d.ts +17 -0
- package/dist/package-source-refusal.d.ts.map +1 -0
- package/dist/package-source-refusal.js +61 -0
- package/dist/package-source-refusal.js.map +1 -0
- package/dist/package-submission.d.ts +134 -0
- package/dist/package-submission.d.ts.map +1 -0
- package/dist/package-submission.js +196 -0
- package/dist/package-submission.js.map +1 -0
- package/dist/selection-record.d.ts +95 -0
- package/dist/selection-record.d.ts.map +1 -0
- package/dist/selection-record.js +121 -0
- package/dist/selection-record.js.map +1 -0
- package/package.json +1 -1
- package/skills/design/SKILL.md +43 -266
- package/skills/design-branch/SKILL.md +37 -116
- package/skills/design-convert/SKILL.md +62 -148
- package/skills/design-draft/SKILL.md +71 -135
- package/skills/design-search/SKILL.md +29 -78
- package/skills/design/references/continuation-contract.md +0 -60
- package/skills/design/references/selection-contract.md +0 -112
package/dist/package-client.js
CHANGED
|
@@ -16,9 +16,29 @@ const parseOperation = (value) => {
|
|
|
16
16
|
throw new Error('Package operation is missing pages');
|
|
17
17
|
return record;
|
|
18
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* A refusal from the package routes, kept whole.
|
|
21
|
+
*
|
|
22
|
+
* Every one of them is RFC7807 problem+json whose machine-readable field is
|
|
23
|
+
* `code` — `detail` carries the sentence (`workers/api/src/conversion/problem.ts`,
|
|
24
|
+
* `buildConversionProblem`). A caller that reduces the answer to a sentence
|
|
25
|
+
* cannot tell one refusal from another, and telling them apart is what lets a
|
|
26
|
+
* disproven attachment cost one retry instead of a page. The message stays the
|
|
27
|
+
* detail line, so everything that only reports it reads exactly as before.
|
|
28
|
+
*/
|
|
29
|
+
export class ConversionPackageRequestError extends Error {
|
|
30
|
+
status;
|
|
31
|
+
problem;
|
|
32
|
+
constructor(message, status, problem) {
|
|
33
|
+
super(message);
|
|
34
|
+
this.status = status;
|
|
35
|
+
this.problem = problem;
|
|
36
|
+
this.name = 'ConversionPackageRequestError';
|
|
37
|
+
}
|
|
38
|
+
}
|
|
19
39
|
const problemFor = async (response) => {
|
|
20
40
|
const payload = await response.json().catch(() => null);
|
|
21
|
-
return new
|
|
41
|
+
return new ConversionPackageRequestError(payload?.detail || payload?.title || `${response.status} ${response.statusText}`, response.status, payload ?? {});
|
|
22
42
|
};
|
|
23
43
|
const delay = async (milliseconds, signal) => await new Promise((resolve, reject) => {
|
|
24
44
|
const timer = setTimeout(resolve, milliseconds);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-client.js","sourceRoot":"","sources":["../src/package-client.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAUxD,MAAM,CAAC,MAAM,6BAA6B,GAAG,6CAAsD,CAAC;AACpG,MAAM,CAAC,MAAM,kCAAkC,GAAG,iBAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"package-client.js","sourceRoot":"","sources":["../src/package-client.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAUxD,MAAM,CAAC,MAAM,6BAA6B,GAAG,6CAAsD,CAAC;AACpG,MAAM,CAAC,MAAM,kCAAkC,GAAG,iBAA0B,CAAC;AAoL7E,MAAM,QAAQ,GAAG,CAAC,KAAiB,EAAe,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CACrE,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CACrB,CAAC;AAEjB,MAAM,cAAc,GAAG,CAAC,KAAc,EAA8B,EAAE;IACpE,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IAChI,MAAM,MAAM,GAAG,KAAgC,CAAC;IAChD,IAAI,OAAO,MAAM,CAAC,EAAE,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACpG,IAAI,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;QAC7F,MAAM,IAAI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;YACvF,MAAM,IAAI,KAAK,CAAC,gBAAgB,MAAM,wBAAwB,CAAC,CAAC;QAClE,CAAC;QACD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE;YACzC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC;YAClD,QAAQ,EAAE,QAAQ;YAClB,MAAM;SACP,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,CAAC,EAAE;YAAE,MAAM,MAAM,UAAU,CAAC,QAAQ,CAAC,CAAC;QACnD,OAAO;YACL,KAAK,EAAE,IAAI,UAAU,CAAC,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAC;YACnD,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,IAAI,CAAC,UAAU;SACnE,CAAC;IACJ,CAAC;IAEO,UAAU,CAAC,EAAU;QAC3B,MAAM,UAAU,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;QAC7B,IAAI,CAAC,UAAU;YAAE,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC3D,OAAO,GAAG,IAAI,CAAC,MAAM,2BAA2B,kBAAkB,CAAC,UAAU,CAAC,EAAE,CAAC;IACnF,CAAC;IAEO,OAAO,CAAC,MAA8B;QAC5C,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;QACpC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QACtD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ConversionModel } from './conversion-models.js';
|
|
2
|
+
import { type ConversionOutput } from './conversion-outputs.js';
|
|
3
|
+
import { type ResponsiveConversionQuality } from './responsive-quality.js';
|
|
4
|
+
import type { PackagePageInput } from './package-submission.js';
|
|
5
|
+
/**
|
|
6
|
+
* The local package manifest: the file an agent writes to say which local
|
|
7
|
+
* screenshots stack into which page, in which order. It is deliberately close
|
|
8
|
+
* to the wire manifest but names files instead of multipart parts, and it fills
|
|
9
|
+
* in the ordinals so a hand-written file cannot violate the server's
|
|
10
|
+
* strictly-increasing rule by accident.
|
|
11
|
+
*/
|
|
12
|
+
export type LocalPackageManifest = {
|
|
13
|
+
version: 1;
|
|
14
|
+
output: ConversionOutput;
|
|
15
|
+
model?: ConversionModel;
|
|
16
|
+
responsiveQuality?: ResponsiveConversionQuality;
|
|
17
|
+
pages: PackagePageInput[];
|
|
18
|
+
manifestSha256: string;
|
|
19
|
+
};
|
|
20
|
+
export declare const readLocalPackageManifest: (manifestPath: string) => Promise<LocalPackageManifest>;
|
|
21
|
+
//# sourceMappingURL=package-manifest-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-manifest-file.d.ts","sourceRoot":"","sources":["../src/package-manifest-file.ts"],"names":[],"mappings":"AAIA,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAsB,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEpF,OAAO,EAEL,KAAK,2BAA2B,EACjC,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAEV,gBAAgB,EAEjB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;GAMG;AAEH,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,CAAC,CAAC;IACX,MAAM,EAAE,gBAAgB,CAAC;IACzB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,iBAAiB,CAAC,EAAE,2BAA2B,CAAC;IAChD,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AA0BF,eAAO,MAAM,wBAAwB,GACnC,cAAc,MAAM,KACnB,OAAO,CAAC,oBAAoB,CAiG9B,CAAC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { isConversionModel } from './conversion-models.js';
|
|
5
|
+
import { isConversionOutput } from './conversion-outputs.js';
|
|
6
|
+
import { classifyLocalConversionInput } from './local-conversion-input.js';
|
|
7
|
+
import { isResponsiveConversionQuality, } from './responsive-quality.js';
|
|
8
|
+
const record = (value, label) => {
|
|
9
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
10
|
+
throw new Error(`${label} must be a JSON object`);
|
|
11
|
+
}
|
|
12
|
+
return value;
|
|
13
|
+
};
|
|
14
|
+
const text = (value, label, required = false) => {
|
|
15
|
+
if (value === undefined) {
|
|
16
|
+
if (required)
|
|
17
|
+
throw new Error(`${label} is required`);
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
if (typeof value !== 'string' || !value.trim())
|
|
21
|
+
throw new Error(`${label} must be non-empty text`);
|
|
22
|
+
return value.trim();
|
|
23
|
+
};
|
|
24
|
+
const ordinalOr = (value, fallback, label) => {
|
|
25
|
+
if (value === undefined)
|
|
26
|
+
return fallback;
|
|
27
|
+
if (!Number.isSafeInteger(value) || Number(value) < 0) {
|
|
28
|
+
throw new Error(`${label} must be a non-negative integer`);
|
|
29
|
+
}
|
|
30
|
+
return Number(value);
|
|
31
|
+
};
|
|
32
|
+
export const readLocalPackageManifest = async (manifestPath) => {
|
|
33
|
+
const source = await readFile(manifestPath, 'utf8');
|
|
34
|
+
const manifestSha256 = createHash('sha256').update(source).digest('hex');
|
|
35
|
+
const root = record(JSON.parse(source), 'The package manifest');
|
|
36
|
+
if (root.version !== 1)
|
|
37
|
+
throw new Error('The package manifest version must be 1');
|
|
38
|
+
const output = root.output === undefined ? 'html' : root.output;
|
|
39
|
+
if (!isConversionOutput(output)) {
|
|
40
|
+
throw new Error('The package manifest output is not a supported conversion output');
|
|
41
|
+
}
|
|
42
|
+
if (output === 'web_project' || output === 'app_project') {
|
|
43
|
+
throw new Error('12ui convert package does not submit project outputs; export them from a conversion instead');
|
|
44
|
+
}
|
|
45
|
+
const model = root.model === undefined ? undefined : root.model;
|
|
46
|
+
if (model !== undefined && !isConversionModel(model)) {
|
|
47
|
+
throw new Error('The package manifest model must be fast, standard, or pro');
|
|
48
|
+
}
|
|
49
|
+
const responsiveQuality = root.responsiveQuality;
|
|
50
|
+
if (responsiveQuality !== undefined && !isResponsiveConversionQuality(responsiveQuality)) {
|
|
51
|
+
throw new Error('The package manifest responsiveQuality must be standard or pro');
|
|
52
|
+
}
|
|
53
|
+
if (responsiveQuality !== undefined && output !== 'html') {
|
|
54
|
+
throw new Error('The package manifest responsiveQuality is only valid with output html');
|
|
55
|
+
}
|
|
56
|
+
if (!Array.isArray(root.pages) || root.pages.length === 0) {
|
|
57
|
+
throw new Error('The package manifest must declare at least one page');
|
|
58
|
+
}
|
|
59
|
+
const manifestDirectory = path.dirname(path.resolve(manifestPath));
|
|
60
|
+
const pageIds = new Set();
|
|
61
|
+
const pages = [];
|
|
62
|
+
for (const [pageIndex, pageValue] of root.pages.entries()) {
|
|
63
|
+
const page = record(pageValue, `pages[${pageIndex}]`);
|
|
64
|
+
const id = text(page.id, `pages[${pageIndex}].id`, true);
|
|
65
|
+
if (pageIds.has(id))
|
|
66
|
+
throw new Error(`Page id ${id} is declared twice`);
|
|
67
|
+
pageIds.add(id);
|
|
68
|
+
if (page.kind !== undefined && page.kind !== 'source' && page.kind !== 'additional') {
|
|
69
|
+
throw new Error(`pages[${pageIndex}].kind must be source or additional`);
|
|
70
|
+
}
|
|
71
|
+
if (!Array.isArray(page.viewports) || page.viewports.length === 0) {
|
|
72
|
+
throw new Error(`pages[${pageIndex}].viewports must list at least one screenshot`);
|
|
73
|
+
}
|
|
74
|
+
const viewportIds = new Set();
|
|
75
|
+
const viewports = [];
|
|
76
|
+
for (const [viewportIndex, viewportValue] of page.viewports.entries()) {
|
|
77
|
+
const viewport = record(viewportValue, `pages[${pageIndex}].viewports[${viewportIndex}]`);
|
|
78
|
+
const viewportId = text(viewport.id, `pages[${pageIndex}].viewports[${viewportIndex}].id`, true);
|
|
79
|
+
if (viewportIds.has(viewportId)) {
|
|
80
|
+
throw new Error(`Viewport id ${viewportId} is declared twice on page ${id}`);
|
|
81
|
+
}
|
|
82
|
+
viewportIds.add(viewportId);
|
|
83
|
+
const image = text(viewport.image, `pages[${pageIndex}].viewports[${viewportIndex}].image`, true);
|
|
84
|
+
const imagePath = path.resolve(manifestDirectory, image);
|
|
85
|
+
const classified = classifyLocalConversionInput(imagePath);
|
|
86
|
+
if (classified.kind !== 'image') {
|
|
87
|
+
throw new Error(`Viewport ${viewportId} must name a PNG, JPEG, or WebP screenshot`);
|
|
88
|
+
}
|
|
89
|
+
const bytes = new Uint8Array(await readFile(imagePath));
|
|
90
|
+
const sourceConversionId = text(viewport.sourceConversionId, `pages[${pageIndex}].viewports[${viewportIndex}].sourceConversionId`);
|
|
91
|
+
viewports.push({
|
|
92
|
+
id: viewportId,
|
|
93
|
+
ordinal: ordinalOr(viewport.ordinal, viewportIndex + 1, `pages[${pageIndex}].viewports[${viewportIndex}].ordinal`),
|
|
94
|
+
imagePath,
|
|
95
|
+
bytes,
|
|
96
|
+
mediaType: classified.mediaType,
|
|
97
|
+
...(sourceConversionId ? { sourceConversionId } : {}),
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
pages.push({
|
|
101
|
+
id,
|
|
102
|
+
ordinal: ordinalOr(page.ordinal, pageIndex, `pages[${pageIndex}].ordinal`),
|
|
103
|
+
...(page.kind ? { kind: page.kind } : {}),
|
|
104
|
+
...(text(page.title, `pages[${pageIndex}].title`) ? { title: text(page.title, '') } : {}),
|
|
105
|
+
...(text(page.purpose, `pages[${pageIndex}].purpose`) ? { purpose: text(page.purpose, '') } : {}),
|
|
106
|
+
...(text(page.path, `pages[${pageIndex}].path`) ? { path: text(page.path, '') } : {}),
|
|
107
|
+
viewports,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
version: 1,
|
|
112
|
+
output,
|
|
113
|
+
...(model ? { model } : {}),
|
|
114
|
+
...(responsiveQuality ? { responsiveQuality } : {}),
|
|
115
|
+
pages,
|
|
116
|
+
manifestSha256,
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
//# sourceMappingURL=package-manifest-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-manifest-file.js","sourceRoot":"","sources":["../src/package-manifest-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,iBAAiB,EAAwB,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAyB,MAAM,yBAAyB,CAAC;AACpF,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EACL,6BAA6B,GAE9B,MAAM,yBAAyB,CAAC;AAwBjC,MAAM,MAAM,GAAG,CAAC,KAAc,EAAE,KAAa,EAA2B,EAAE;IACxE,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAChE,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,wBAAwB,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,KAAgC,CAAC;AAC1C,CAAC,CAAC;AAEF,MAAM,IAAI,GAAG,CAAC,KAAc,EAAE,KAAa,EAAE,QAAQ,GAAG,KAAK,EAAsB,EAAE;IACnF,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,IAAI,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,cAAc,CAAC,CAAC;QAC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AAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAA+B,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACpE,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,SAAS,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC1F,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,SAAS,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAClG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,SAAS,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACtF,SAAS;SACV,CAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,OAAO,EAAE,CAAC;QACV,MAAM;QACN,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3B,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACnD,KAAK;QACL,cAAc;KACf,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The starting manifest `12ui convert package --template` prints.
|
|
3
|
+
*
|
|
4
|
+
* The manifest shape used to exist only as an example in skill prose, which
|
|
5
|
+
* made the format a thing an agent had to remember rather than a thing the tool
|
|
6
|
+
* hands out. This module is the single authored copy, and its test feeds it
|
|
7
|
+
* straight back through `readLocalPackageManifest` so the template cannot drift
|
|
8
|
+
* away from the parser that consumes it.
|
|
9
|
+
*
|
|
10
|
+
* Guidance goes to stderr in the command, never in here: stdout stays clean
|
|
11
|
+
* JSON so `12ui convert package --template > package.json` writes a file that
|
|
12
|
+
* parses.
|
|
13
|
+
*/
|
|
14
|
+
export declare const PACKAGE_MANIFEST_TEMPLATE_IMAGES: readonly ["screens/home-viewport-1.png", "screens/home-viewport-2.png", "screens/pricing-viewport-1.png"];
|
|
15
|
+
export declare const packageManifestTemplate: () => Record<string, unknown>;
|
|
16
|
+
export declare const renderPackageManifestTemplate: () => string;
|
|
17
|
+
/**
|
|
18
|
+
* Printed to stderr beside the template. Says the things the JSON cannot: what
|
|
19
|
+
* a viewport is, and which field avoids paying twice for an image that already
|
|
20
|
+
* has a conversion.
|
|
21
|
+
*/
|
|
22
|
+
export declare const PACKAGE_MANIFEST_TEMPLATE_NOTES: string;
|
|
23
|
+
//# sourceMappingURL=package-manifest-template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-manifest-template.d.ts","sourceRoot":"","sources":["../src/package-manifest-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,gCAAgC,2GAInC,CAAC;AAEX,eAAO,MAAM,uBAAuB,QAAO,MAAM,CAAC,MAAM,EAAE,OAAO,CA4B/D,CAAC;AAEH,eAAO,MAAM,6BAA6B,QAAO,MAEhD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,QAKhC,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The starting manifest `12ui convert package --template` prints.
|
|
3
|
+
*
|
|
4
|
+
* The manifest shape used to exist only as an example in skill prose, which
|
|
5
|
+
* made the format a thing an agent had to remember rather than a thing the tool
|
|
6
|
+
* hands out. This module is the single authored copy, and its test feeds it
|
|
7
|
+
* straight back through `readLocalPackageManifest` so the template cannot drift
|
|
8
|
+
* away from the parser that consumes it.
|
|
9
|
+
*
|
|
10
|
+
* Guidance goes to stderr in the command, never in here: stdout stays clean
|
|
11
|
+
* JSON so `12ui convert package --template > package.json` writes a file that
|
|
12
|
+
* parses.
|
|
13
|
+
*/
|
|
14
|
+
export const PACKAGE_MANIFEST_TEMPLATE_IMAGES = [
|
|
15
|
+
'screens/home-viewport-1.png',
|
|
16
|
+
'screens/home-viewport-2.png',
|
|
17
|
+
'screens/pricing-viewport-1.png',
|
|
18
|
+
];
|
|
19
|
+
export const packageManifestTemplate = () => ({
|
|
20
|
+
version: 1,
|
|
21
|
+
output: 'html',
|
|
22
|
+
responsiveQuality: 'standard',
|
|
23
|
+
pages: [
|
|
24
|
+
{
|
|
25
|
+
id: 'home',
|
|
26
|
+
kind: 'source',
|
|
27
|
+
title: 'Home',
|
|
28
|
+
path: '/',
|
|
29
|
+
// Ordered viewports of ONE continuous page. Two entries here means one
|
|
30
|
+
// page that scrolls, not two pages — that is the whole reason a package
|
|
31
|
+
// exists rather than two separate conversions.
|
|
32
|
+
viewports: [
|
|
33
|
+
{ id: 'home-1', image: PACKAGE_MANIFEST_TEMPLATE_IMAGES[0] },
|
|
34
|
+
{ id: 'home-2', image: PACKAGE_MANIFEST_TEMPLATE_IMAGES[1] },
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: 'pricing',
|
|
39
|
+
kind: 'additional',
|
|
40
|
+
title: 'Pricing',
|
|
41
|
+
path: '/pricing',
|
|
42
|
+
viewports: [
|
|
43
|
+
{ id: 'pricing-1', image: PACKAGE_MANIFEST_TEMPLATE_IMAGES[2] },
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
});
|
|
48
|
+
export const renderPackageManifestTemplate = () => (`${JSON.stringify(packageManifestTemplate(), null, 2)}\n`);
|
|
49
|
+
/**
|
|
50
|
+
* Printed to stderr beside the template. Says the things the JSON cannot: what
|
|
51
|
+
* a viewport is, and which field avoids paying twice for an image that already
|
|
52
|
+
* has a conversion.
|
|
53
|
+
*/
|
|
54
|
+
export const PACKAGE_MANIFEST_TEMPLATE_NOTES = [
|
|
55
|
+
'Paths are relative to the manifest file.',
|
|
56
|
+
'Viewports are the ordered slices of one scrolling page; ordinals are filled in by position.',
|
|
57
|
+
'Add "sourceConversionId" to a viewport whose image already converted, to reuse it instead of buying it again.',
|
|
58
|
+
'Supported outputs: html and layerdoc. Export web_project or app_project from a finished conversion instead.',
|
|
59
|
+
].join('\n');
|
|
60
|
+
//# sourceMappingURL=package-manifest-template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-manifest-template.js","sourceRoot":"","sources":["../src/package-manifest-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,CAAC,MAAM,gCAAgC,GAAG;IAC9C,6BAA6B;IAC7B,6BAA6B;IAC7B,gCAAgC;CACxB,CAAC;AAEX,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAA4B,EAAE,CAAC,CAAC;IACrE,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,MAAM;IACd,iBAAiB,EAAE,UAAU;IAC7B,KAAK,EAAE;QACL;YACE,EAAE,EAAE,MAAM;YACV,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,MAAM;YACb,IAAI,EAAE,GAAG;YACT,uEAAuE;YACvE,wEAAwE;YACxE,+CAA+C;YAC/C,SAAS,EAAE;gBACT,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,gCAAgC,CAAC,CAAC,CAAC,EAAE;gBAC5D,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,gCAAgC,CAAC,CAAC,CAAC,EAAE;aAC7D;SACF;QACD;YACE,EAAE,EAAE,SAAS;YACb,IAAI,EAAE,YAAY;YAClB,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,UAAU;YAChB,SAAS,EAAE;gBACT,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,gCAAgC,CAAC,CAAC,CAAC,EAAE;aAChE;SACF;KACF;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,6BAA6B,GAAG,GAAW,EAAE,CAAC,CACzD,GAAG,IAAI,CAAC,SAAS,CAAC,uBAAuB,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAC1D,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC7C,0CAA0C;IAC1C,6FAA6F;IAC7F,+GAA+G;IAC/G,6GAA6G;CAC9G,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ConversionPackageRequestError } from './package-client.js';
|
|
2
|
+
export declare const isSourceConversionRefusal: (error: unknown) => error is ConversionPackageRequestError;
|
|
3
|
+
/**
|
|
4
|
+
* The single viewport a refusal is about.
|
|
5
|
+
*
|
|
6
|
+
* The server proves attachments one at a time and throws on the first that
|
|
7
|
+
* fails, and every refusal it can raise opens with the viewport's own id
|
|
8
|
+
* (`Viewport <id> source_conversion_id …`). A refusal therefore disproves
|
|
9
|
+
* exactly ONE attachment and says nothing about the others — they were never
|
|
10
|
+
* reached. Reading the id out is what keeps a stale entry costing one
|
|
11
|
+
* re-bought screen instead of every reuse in the request.
|
|
12
|
+
*
|
|
13
|
+
* Null when the detail names no viewport, which is the caller's signal that it
|
|
14
|
+
* has no better option than dropping every attachment it sent.
|
|
15
|
+
*/
|
|
16
|
+
export declare const sourceConversionRefusalViewportId: (error: unknown) => string | null;
|
|
17
|
+
//# sourceMappingURL=package-source-refusal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-source-refusal.d.ts","sourceRoot":"","sources":["../src/package-source-refusal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AAuCpE,eAAO,MAAM,yBAAyB,GACpC,OAAO,OAAO,KACb,KAAK,IAAI,6BAKX,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iCAAiC,GAAI,OAAO,OAAO,KAAG,MAAM,GAAG,IAI3E,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ConversionPackageRequestError } from './package-client.js';
|
|
2
|
+
/**
|
|
3
|
+
* Reading the server refusing an ATTACHED conversion, as distinct from it
|
|
4
|
+
* refusing the request that carried one.
|
|
5
|
+
*
|
|
6
|
+
* A viewport that declares `source_conversion_id` is a claim about an existing
|
|
7
|
+
* conversion, and the server proves every field of that claim against the
|
|
8
|
+
* referenced run's durable admitted evidence before the package row exists
|
|
9
|
+
* (`workers/api/src/conversionPackage/sourceConversionAttachment.ts`). A claim
|
|
10
|
+
* that no longer holds — expired since it was recorded, owned by another
|
|
11
|
+
* account, converted with another model or to another output, or run by a
|
|
12
|
+
* pipeline this one cannot resume — is refused at admission, before anything
|
|
13
|
+
* durable is created. So the refusal disproves the reuse, not the page: the
|
|
14
|
+
* same bytes submitted without the attachment convert normally.
|
|
15
|
+
*
|
|
16
|
+
* This module is the single owner of what that refusal looks like on the wire.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* The two codes the attachment proof can raise, both 400
|
|
20
|
+
* (`conversionProblemHttpStatus`): `invalid_request` for evidence that no
|
|
21
|
+
* longer matches, `source_pipeline_stale` for a conversion the current
|
|
22
|
+
* pipeline cannot resume.
|
|
23
|
+
*
|
|
24
|
+
* `invalid_request` alone proves nothing — it is the code for most malformed
|
|
25
|
+
* requests — so the code narrows and the detail decides. `code` is preferred
|
|
26
|
+
* wherever it decides something, and its absence means only that the body did
|
|
27
|
+
* not parse as a problem document, never that a non-refusal may pass.
|
|
28
|
+
*/
|
|
29
|
+
const SOURCE_REFUSAL_CODES = new Set([
|
|
30
|
+
'invalid_request',
|
|
31
|
+
'source_pipeline_stale',
|
|
32
|
+
]);
|
|
33
|
+
const refusalDetail = (error) => (error.problem.detail ?? error.message);
|
|
34
|
+
export const isSourceConversionRefusal = (error) => {
|
|
35
|
+
if (!(error instanceof ConversionPackageRequestError) || error.status !== 400)
|
|
36
|
+
return false;
|
|
37
|
+
const { code } = error.problem;
|
|
38
|
+
if (code !== undefined && !SOURCE_REFUSAL_CODES.has(code))
|
|
39
|
+
return false;
|
|
40
|
+
return refusalDetail(error).includes('source_conversion_id');
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* The single viewport a refusal is about.
|
|
44
|
+
*
|
|
45
|
+
* The server proves attachments one at a time and throws on the first that
|
|
46
|
+
* fails, and every refusal it can raise opens with the viewport's own id
|
|
47
|
+
* (`Viewport <id> source_conversion_id …`). A refusal therefore disproves
|
|
48
|
+
* exactly ONE attachment and says nothing about the others — they were never
|
|
49
|
+
* reached. Reading the id out is what keeps a stale entry costing one
|
|
50
|
+
* re-bought screen instead of every reuse in the request.
|
|
51
|
+
*
|
|
52
|
+
* Null when the detail names no viewport, which is the caller's signal that it
|
|
53
|
+
* has no better option than dropping every attachment it sent.
|
|
54
|
+
*/
|
|
55
|
+
export const sourceConversionRefusalViewportId = (error) => {
|
|
56
|
+
if (!isSourceConversionRefusal(error))
|
|
57
|
+
return null;
|
|
58
|
+
return /^Viewport (?<viewportId>\S+) source_conversion_id\s/u
|
|
59
|
+
.exec(refusalDetail(error))?.groups?.viewportId ?? null;
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=package-source-refusal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-source-refusal.js","sourceRoot":"","sources":["../src/package-source-refusal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AAEpE;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;GAUG;AACH,MAAM,oBAAoB,GAAwB,IAAI,GAAG,CAAC;IACxD,iBAAiB;IACjB,uBAAuB;CACxB,CAAC,CAAC;AAEH,MAAM,aAAa,GAAG,CAAC,KAAoC,EAAU,EAAE,CAAC,CACtE,KAAK,CAAC,OAAO,CAAC,MAAM,IAAI,KAAK,CAAC,OAAO,CACtC,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACvC,KAAc,EAC0B,EAAE;IAC1C,IAAI,CAAC,CAAC,KAAK,YAAY,6BAA6B,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,GAAG;QAAE,OAAO,KAAK,CAAC;IAC5F,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC;IAC/B,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IACxE,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC;AAC/D,CAAC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,KAAc,EAAiB,EAAE;IACjF,IAAI,CAAC,yBAAyB,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACnD,OAAO,sDAAsD;SAC1D,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,IAAI,IAAI,CAAC;AAC5D,CAAC,CAAC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import type { ConversionModel } from './conversion-models.js';
|
|
2
|
+
import { type ConversionOutput } from './conversion-outputs.js';
|
|
3
|
+
import type { ResponsiveConversionQuality } from './responsive-quality.js';
|
|
4
|
+
import { TwelveUiConversionPackageClient, type ConversionPackageFile, type ConversionPackageLegacyManifest, type ConversionPackageOperation } from './package-client.js';
|
|
5
|
+
/**
|
|
6
|
+
* One page, submitted as ONE package conversion of its ordered viewports.
|
|
7
|
+
*
|
|
8
|
+
* Converting a continuous page one screenshot at a time throws away page order
|
|
9
|
+
* and the stitching between viewports, which is the entire reason to have
|
|
10
|
+
* branched. This module is the single owner of that submission for both
|
|
11
|
+
* `12ui convert package` and `12ui branch execute --convert`.
|
|
12
|
+
*/
|
|
13
|
+
export declare const PACKAGE_RESULT_FILENAME = "package.result.json";
|
|
14
|
+
export declare const PACKAGE_POLL_INTERVAL_MS = 4000;
|
|
15
|
+
export declare const PACKAGE_TIMEOUT_MS: number;
|
|
16
|
+
export type PackageImageMediaType = 'image/png' | 'image/jpeg' | 'image/webp';
|
|
17
|
+
export type PackageViewportInput = {
|
|
18
|
+
id: string;
|
|
19
|
+
ordinal: number;
|
|
20
|
+
imagePath: string;
|
|
21
|
+
bytes: Uint8Array;
|
|
22
|
+
mediaType: PackageImageMediaType;
|
|
23
|
+
/**
|
|
24
|
+
* An already-succeeded conversion of exactly these bytes. Attaching it skips
|
|
25
|
+
* both the upload and a second paid conversion of the same image — the reuse
|
|
26
|
+
* path that keeps a base conversion of the winner from being orphaned work.
|
|
27
|
+
*/
|
|
28
|
+
sourceConversionId?: string;
|
|
29
|
+
};
|
|
30
|
+
export type PackagePageInput = {
|
|
31
|
+
id: string;
|
|
32
|
+
ordinal: number;
|
|
33
|
+
kind?: 'source' | 'additional';
|
|
34
|
+
title?: string;
|
|
35
|
+
purpose?: string;
|
|
36
|
+
path?: string;
|
|
37
|
+
viewports: PackageViewportInput[];
|
|
38
|
+
};
|
|
39
|
+
export type PackageSubmission = {
|
|
40
|
+
output: ConversionOutput;
|
|
41
|
+
model?: ConversionModel;
|
|
42
|
+
responsiveQuality?: ResponsiveConversionQuality;
|
|
43
|
+
pages: PackagePageInput[];
|
|
44
|
+
idempotencyKey: string;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* One viewport's own child conversion. Carried out of the operation because a
|
|
48
|
+
* viewport conversion is a durable, reusable artifact in its own right — the
|
|
49
|
+
* winner's conversion is the one a later run can attach instead of buying.
|
|
50
|
+
*/
|
|
51
|
+
export type PackageViewportResult = {
|
|
52
|
+
id: string;
|
|
53
|
+
ordinal: number;
|
|
54
|
+
status: 'queued' | 'running' | 'succeeded' | 'failed';
|
|
55
|
+
conversionId?: string;
|
|
56
|
+
};
|
|
57
|
+
export type PackagePageResult = {
|
|
58
|
+
id: string;
|
|
59
|
+
ordinal: number;
|
|
60
|
+
title?: string;
|
|
61
|
+
conversionId?: string;
|
|
62
|
+
outFile?: string;
|
|
63
|
+
sha256?: string;
|
|
64
|
+
bytes?: number;
|
|
65
|
+
mediaType?: string;
|
|
66
|
+
status: 'succeeded' | 'failed';
|
|
67
|
+
error?: string;
|
|
68
|
+
viewports?: PackageViewportResult[];
|
|
69
|
+
};
|
|
70
|
+
export type PackageSubmissionResult = {
|
|
71
|
+
packageId: string;
|
|
72
|
+
status: ConversionPackageOperation['status'];
|
|
73
|
+
output: ConversionOutput;
|
|
74
|
+
idempotencyKey: string;
|
|
75
|
+
/**
|
|
76
|
+
* When this package and the conversions it bought stop being readable.
|
|
77
|
+
* Optional because a server that answers without it is not a failure — it
|
|
78
|
+
* only means nothing here can prove a viewport conversion is still attachable.
|
|
79
|
+
*/
|
|
80
|
+
expiresAt?: string;
|
|
81
|
+
pages: PackagePageResult[];
|
|
82
|
+
resultPath?: string;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Everything the server publishes about a running package, forwarded whole.
|
|
86
|
+
*
|
|
87
|
+
* A caller that polls a percent which has not moved cannot tell slow work from
|
|
88
|
+
* wedged work, and the measured consequence is an agent abandoning paid work.
|
|
89
|
+
* `running` and `stageSince` are the facts that separate them, so the client
|
|
90
|
+
* carries them rather than reducing the poll to a stage and a percent.
|
|
91
|
+
*/
|
|
92
|
+
export type PackageProgressEvent = {
|
|
93
|
+
stage: string;
|
|
94
|
+
percent?: number;
|
|
95
|
+
completed?: number;
|
|
96
|
+
total?: number;
|
|
97
|
+
running?: number;
|
|
98
|
+
stageSince?: string;
|
|
99
|
+
pagesAvailable?: number;
|
|
100
|
+
bandsAvailable?: number;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* The stitch precondition, checked HERE rather than at admission. Composition
|
|
104
|
+
* joins a page's viewports into one tall source, so a width disagreement is
|
|
105
|
+
* fatal — and the server discovers it only after every viewport is paid for.
|
|
106
|
+
*/
|
|
107
|
+
export declare const assertPackagePageWidths: (pages: readonly PackagePageInput[]) => Promise<Map<string, {
|
|
108
|
+
width: number;
|
|
109
|
+
height: number;
|
|
110
|
+
}>>;
|
|
111
|
+
export declare const buildConversionPackageRequest: (submission: PackageSubmission) => Promise<{
|
|
112
|
+
manifest: ConversionPackageLegacyManifest;
|
|
113
|
+
screenshots: ConversionPackageFile[];
|
|
114
|
+
}>;
|
|
115
|
+
export declare const packageProgressEvent: (operation: ConversionPackageOperation) => PackageProgressEvent;
|
|
116
|
+
/**
|
|
117
|
+
* Submit, wait, and materialize. The package's own operation record is the
|
|
118
|
+
* durable identity: a retry under the same derived key replays it rather than
|
|
119
|
+
* buying the pages again.
|
|
120
|
+
*/
|
|
121
|
+
export declare const submitConversionPackage: (args: {
|
|
122
|
+
client: TwelveUiConversionPackageClient;
|
|
123
|
+
submission: PackageSubmission;
|
|
124
|
+
outDir: string;
|
|
125
|
+
timeoutMs?: number;
|
|
126
|
+
pollIntervalMs?: number;
|
|
127
|
+
/** Fires as soon as the package has an id, before the long wait begins. */
|
|
128
|
+
onSubmitted?: (packageId: string) => void;
|
|
129
|
+
onProgress?: (event: PackageProgressEvent) => void;
|
|
130
|
+
sleep?: (milliseconds: number, signal?: AbortSignal) => Promise<void>;
|
|
131
|
+
signal?: AbortSignal;
|
|
132
|
+
}) => Promise<PackageSubmissionResult>;
|
|
133
|
+
export declare const writePackageResultRecord: (outDir: string, result: PackageSubmissionResult) => Promise<string>;
|
|
134
|
+
//# sourceMappingURL=package-submission.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-submission.d.ts","sourceRoot":"","sources":["../src/package-submission.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,w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