@12ui/design 0.2.70 → 0.2.72

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 (127) hide show
  1. package/README.md +5 -0
  2. package/SKILL.md +1 -1
  3. package/dist/cli-capabilities.d.ts +9 -0
  4. package/dist/cli-capabilities.d.ts.map +1 -1
  5. package/dist/cli-capabilities.js +10 -0
  6. package/dist/cli-capabilities.js.map +1 -1
  7. package/dist/cli-conversion-recovery-advice.d.ts +35 -0
  8. package/dist/cli-conversion-recovery-advice.d.ts.map +1 -0
  9. package/dist/cli-conversion-recovery-advice.js +72 -0
  10. package/dist/cli-conversion-recovery-advice.js.map +1 -0
  11. package/dist/cli-convert-command.d.ts.map +1 -1
  12. package/dist/cli-convert-command.js +153 -35
  13. package/dist/cli-convert-command.js.map +1 -1
  14. package/dist/cli-help/index.d.ts +93 -0
  15. package/dist/cli-help/index.d.ts.map +1 -1
  16. package/dist/cli-help/index.js +2 -0
  17. package/dist/cli-help/index.js.map +1 -1
  18. package/dist/cli-help/scene.d.ts +96 -0
  19. package/dist/cli-help/scene.d.ts.map +1 -0
  20. package/dist/cli-help/scene.js +162 -0
  21. package/dist/cli-help/scene.js.map +1 -0
  22. package/dist/cli-run.d.ts.map +1 -1
  23. package/dist/cli-run.js +6 -0
  24. package/dist/cli-run.js.map +1 -1
  25. package/dist/cli-scene-command.d.ts +3 -0
  26. package/dist/cli-scene-command.d.ts.map +1 -0
  27. package/dist/cli-scene-command.js +292 -0
  28. package/dist/cli-scene-command.js.map +1 -0
  29. package/dist/cli-usage.d.ts +8 -0
  30. package/dist/cli-usage.d.ts.map +1 -1
  31. package/dist/cli-usage.js +26 -1
  32. package/dist/cli-usage.js.map +1 -1
  33. package/dist/conversion-client.d.ts +11 -0
  34. package/dist/conversion-client.d.ts.map +1 -1
  35. package/dist/conversion-client.js +11 -1
  36. package/dist/conversion-client.js.map +1 -1
  37. package/dist/legacy-skill-catalog.d.ts.map +1 -1
  38. package/dist/legacy-skill-catalog.js +11 -0
  39. package/dist/legacy-skill-catalog.js.map +1 -1
  40. package/dist/prototype-browsers.d.ts +8 -2
  41. package/dist/prototype-browsers.d.ts.map +1 -1
  42. package/dist/prototype-browsers.js +8 -3
  43. package/dist/prototype-browsers.js.map +1 -1
  44. package/dist/prototype-process.js +1 -1
  45. package/dist/prototype-process.js.map +1 -1
  46. package/dist/run-journal-commands.d.ts.map +1 -1
  47. package/dist/run-journal-commands.js +6 -0
  48. package/dist/run-journal-commands.js.map +1 -1
  49. package/dist/scene/camera-model.d.ts +48 -0
  50. package/dist/scene/camera-model.d.ts.map +1 -0
  51. package/dist/scene/camera-model.js +89 -0
  52. package/dist/scene/camera-model.js.map +1 -0
  53. package/dist/scene/camera-solve.d.ts +58 -0
  54. package/dist/scene/camera-solve.d.ts.map +1 -0
  55. package/dist/scene/camera-solve.js +288 -0
  56. package/dist/scene/camera-solve.js.map +1 -0
  57. package/dist/scene/capture-plan.d.ts +28 -0
  58. package/dist/scene/capture-plan.d.ts.map +1 -0
  59. package/dist/scene/capture-plan.js +79 -0
  60. package/dist/scene/capture-plan.js.map +1 -0
  61. package/dist/scene/capture.d.ts +21 -0
  62. package/dist/scene/capture.d.ts.map +1 -0
  63. package/dist/scene/capture.js +118 -0
  64. package/dist/scene/capture.js.map +1 -0
  65. package/dist/scene/image-colors.d.ts +25 -0
  66. package/dist/scene/image-colors.d.ts.map +1 -0
  67. package/dist/scene/image-colors.js +110 -0
  68. package/dist/scene/image-colors.js.map +1 -0
  69. package/dist/scene/image-rectify.d.ts +25 -0
  70. package/dist/scene/image-rectify.d.ts.map +1 -0
  71. package/dist/scene/image-rectify.js +82 -0
  72. package/dist/scene/image-rectify.js.map +1 -0
  73. package/dist/scene/image-sheet.d.ts +19 -0
  74. package/dist/scene/image-sheet.d.ts.map +1 -0
  75. package/dist/scene/image-sheet.js +118 -0
  76. package/dist/scene/image-sheet.js.map +1 -0
  77. package/dist/scene/least-squares.d.ts +31 -0
  78. package/dist/scene/least-squares.d.ts.map +1 -0
  79. package/dist/scene/least-squares.js +173 -0
  80. package/dist/scene/least-squares.js.map +1 -0
  81. package/dist/scene/numbers.d.ts +17 -0
  82. package/dist/scene/numbers.d.ts.map +1 -0
  83. package/dist/scene/numbers.js +39 -0
  84. package/dist/scene/numbers.js.map +1 -0
  85. package/dist/scene/placement.d.ts +43 -0
  86. package/dist/scene/placement.d.ts.map +1 -0
  87. package/dist/scene/placement.js +107 -0
  88. package/dist/scene/placement.js.map +1 -0
  89. package/dist/scene/raster.d.ts +18 -0
  90. package/dist/scene/raster.d.ts.map +1 -0
  91. package/dist/scene/raster.js +31 -0
  92. package/dist/scene/raster.js.map +1 -0
  93. package/dist/scene/scene-kit.d.ts +20 -0
  94. package/dist/scene/scene-kit.d.ts.map +1 -0
  95. package/dist/scene/scene-kit.js +74 -0
  96. package/dist/scene/scene-kit.js.map +1 -0
  97. package/dist/scene/scene-verbs.d.ts +4 -0
  98. package/dist/scene/scene-verbs.d.ts.map +1 -0
  99. package/dist/scene/scene-verbs.js +5 -0
  100. package/dist/scene/scene-verbs.js.map +1 -0
  101. package/dist/scene/seeded-random.d.ts +20 -0
  102. package/dist/scene/seeded-random.d.ts.map +1 -0
  103. package/dist/scene/seeded-random.js +42 -0
  104. package/dist/scene/seeded-random.js.map +1 -0
  105. package/dist/scene/spec-expression.d.ts +25 -0
  106. package/dist/scene/spec-expression.d.ts.map +1 -0
  107. package/dist/scene/spec-expression.js +234 -0
  108. package/dist/scene/spec-expression.js.map +1 -0
  109. package/dist/scene/static-server.d.ts +13 -0
  110. package/dist/scene/static-server.d.ts.map +1 -0
  111. package/dist/scene/static-server.js +99 -0
  112. package/dist/scene/static-server.js.map +1 -0
  113. package/open-design.json +2 -2
  114. package/package.json +3 -1
  115. package/scene-kit/starter/camera.js +10 -0
  116. package/scene-kit/starter/gobo.js +60 -0
  117. package/scene-kit/starter/index.html +23 -0
  118. package/scene-kit/starter/lib.js +84 -0
  119. package/scene-kit/starter/main.js +78 -0
  120. package/scene-kit/starter/scene.js +33 -0
  121. package/scene-kit/vendor/LICENSE +21 -0
  122. package/scene-kit/vendor/addons/geometries/RoundedBoxGeometry.js +216 -0
  123. package/scene-kit/vendor/addons/renderers/CSS3DRenderer.js +454 -0
  124. package/scene-kit/vendor/three.core.js +60586 -0
  125. package/scene-kit/vendor/three.module.js +19719 -0
  126. package/skills/12ui-design/SKILL.md +7 -1
  127. package/skills/12ui-design/scene.md +172 -0
package/README.md CHANGED
@@ -99,6 +99,11 @@ keep their backend; external requires the separate key before inference starts.
99
99
  Native does not imply zero cost or a known image model.
100
100
  The CLI owns runtime setup; the skill contains workflow guidance.
101
101
 
102
+ The skill's `scene.md` guide rebuilds a design image as a live Three.js scene
103
+ with the local `12ui scene` tools (`12ui scene --help`): camera solve, placement,
104
+ a starter harness with a bundled three.js, capture with the managed Chromium,
105
+ and review sheets. It needs no account and makes no network request.
106
+
102
107
  `improve --apply` captures the URL and edits the actual repository. Without a
103
108
  target it drafts candidates, stops for an explicit choice, then applies that
104
109
  choice locally. Without `--apply`, the existing hosted implementation-kit behavior
package/SKILL.md CHANGED
@@ -28,7 +28,7 @@ dispatch paid work when it is absent, rejected, or times out.
28
28
  Use `12ui` when it is available on `PATH`. Otherwise invoke the pinned CLI that
29
29
  the plugin's `open-design.json` MCP entry uses:
30
30
 
31
- npx -y @12ui/design@0.2.70 <command> ...
31
+ npx -y @12ui/design@0.2.72 <command> ...
32
32
 
33
33
  Run `12ui auth status --json` (or its pinned `npx` equivalent) before the paid
34
34
  preflight. A desktop user can authenticate with `12ui auth login`; a headless
@@ -24,6 +24,15 @@ export declare const CLI_CAPABILITIES: {
24
24
  readonly withoutTarget: "Draft candidates, require an explicit pick, then edit the actual project locally.";
25
25
  readonly withoutApply: "Hosted implementation kit; does not edit project source.";
26
26
  };
27
+ /** Local helpers for rebuilding a design image as a live Three.js scene (the 12ui-design skill's scene.md). */
28
+ readonly localScene: {
29
+ readonly command: "12ui scene <verb>";
30
+ readonly verbs: readonly ["init", "solve", "ray", "project", "rect", "serve", "capture", "sheet", "blend", "colors", "rectify"];
31
+ readonly network: "none";
32
+ readonly browser: "managed Chromium for capture";
33
+ readonly skill: "12ui-design";
34
+ readonly guide: "scene.md";
35
+ };
27
36
  readonly localExport: {
28
37
  readonly command: "12ui export <run-dir|output-dir> --output <format> --out-dir <directory>";
29
38
  readonly outputs: readonly ["assets", "png", "jpg", "webp", "pdf", "react"];
@@ -1 +1 @@
1
- {"version":3,"file":"cli-capabilities.d.ts","sourceRoot":"","sources":["../src/cli-capabilities.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAuE3B;;;;;OAKG;;;;;;;;;;;IAeH;;;;;;OAMG;;;;;;;QAUD,iFAAiF;;;IAGnF;;;;;;OAMG;;;QAGD,yEAAyE;;;;;QASzE,6EAA6E;;QAE7E,6EAA6E;;;;;;;IAO/E,uEAAuE;;;;;;;;;;;;QAYrE;;;WAGG;;;;;;;;;;;;;;;;;;CAkBG,CAAC"}
1
+ {"version":3,"file":"cli-capabilities.d.ts","sourceRoot":"","sources":["../src/cli-capabilities.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;IA8B3B,+GAA+G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAkD/G;;;;;OAKG;;;;;;;;;;;IAeH;;;;;;OAMG;;;;;;;QAUD,iFAAiF;;;IAGnF;;;;;;OAMG;;;QAGD,yEAAyE;;;;;QASzE,6EAA6E;;QAE7E,6EAA6E;;;;;;;IAO/E,uEAAuE;;;;;;;;;;;;QAYrE;;;WAGG;;;;;;;;;;;;;;;;;;CAkBG,CAAC"}
@@ -5,6 +5,7 @@ import { CLI_CONVERSION_OUTPUTS, CONVERSION_OUTPUT_MEDIA_TYPES, } from './conver
5
5
  import { MAX_IMAGE_OUTPUT_WIDTH } from './image-output-width.js';
6
6
  import { RESPONSIVE_CONVERSION_QUALITIES } from './responsive-quality.js';
7
7
  import { RUN_JOURNAL_FILENAME, RUN_JOURNAL_VERSION } from './run-journal.js';
8
+ import { SCENE_VERBS } from './scene/scene-verbs.js';
8
9
  export const CLI_CAPABILITIES = {
9
10
  inputs: [
10
11
  'image/png',
@@ -34,6 +35,15 @@ export const CLI_CAPABILITIES = {
34
35
  withoutTarget: 'Draft candidates, require an explicit pick, then edit the actual project locally.',
35
36
  withoutApply: 'Hosted implementation kit; does not edit project source.',
36
37
  },
38
+ /** Local helpers for rebuilding a design image as a live Three.js scene (the 12ui-design skill's scene.md). */
39
+ localScene: {
40
+ command: '12ui scene <verb>',
41
+ verbs: SCENE_VERBS,
42
+ network: 'none',
43
+ browser: 'managed Chromium for capture',
44
+ skill: '12ui-design',
45
+ guide: 'scene.md',
46
+ },
37
47
  localExport: {
38
48
  command: '12ui export <run-dir|output-dir> --output <format> --out-dir <directory>',
39
49
  outputs: ['assets', 'png', 'jpg', 'webp', 'pdf', 'react'],
@@ -1 +1 @@
1
- {"version":3,"file":"cli-capabilities.js","sourceRoot":"","sources":["../src/cli-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,+BAA+B,EAC/B,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EACL,sBAAsB,EACtB,6BAA6B,GAC9B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE7E,MAAM,C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AI,EAAE,mCAAmC;YACzC,MAAM,EAAE,iFAAiF;SAC1F;QACD,UAAU,EAAE,IAAI;KACjB;IACD,uEAAuE;IACvE,iBAAiB,EAAE;QACjB,OAAO,EAAE,sEAAsE;QAC/E,QAAQ,EAAE,yBAAyB;QACnC,qBAAqB,EAAE,oBAAoB;QAC3C,eAAe,EAAE,wBAAwB,CAAC,OAAO;KAClD;IACD,MAAM,EAAE;QACN,OAAO,EAAE,qBAAqB;QAC9B,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,kBAAkB,EAAE,sBAAsB;QAC1C,QAAQ,EAAE,gBAAgB;QAC1B;;;WAGG;QACH,eAAe,EAAE;YACf,IAAI,EAAE,oBAAoB;YAC1B,OAAO,EAAE,+BAA+B;YACxC,OAAO,EAAE,EAAE;SACZ;QACD,sBAAsB,EAAE,wBAAwB,CAAC,aAAa;KAC/D;IACD,SAAS,EAAE;QACT,OAAO,EAAE,0BAA0B;QACnC,UAAU,EAAE,uCAAuC;QACnD,UAAU,EAAE,2DAA2D;QACvE,MAAM,EAAE,4CAA4C;QACpD,WAAW,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC;QACtD,UAAU,EAAE,iDAAiD;QAC7D,UAAU,EAAE,mGAAmG;QAC/G,SAAS,EAAE,CAAC,kBAAkB,EAAE,+DAA+D,CAAC;KACjG;CACO,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { type ConversionOperation, type TwelveUiConversionClient, type TerminalConversionStatus } from './conversion-client.js';
2
+ import type { TerminalArtifactReport } from './cli-progress.js';
3
+ import { type ObservedConversionStatus } from './conversion-status-contract.js';
4
+ export declare const terminalConversionOperation: (error: unknown) => (ConversionOperation & {
5
+ status: TerminalConversionStatus;
6
+ }) | null;
7
+ export declare const terminalConversionStatus: (error: unknown) => TerminalConversionStatus | null;
8
+ export declare const conversionRecoveryAdvice: (args: {
9
+ conversionId: string;
10
+ terminalStatus: TerminalConversionStatus | null;
11
+ resumeCommand: string;
12
+ }) => string;
13
+ export type LinkedExportRecoveryState = {
14
+ id: string;
15
+ status: ObservedConversionStatus;
16
+ readError?: string;
17
+ };
18
+ export declare const describeTerminalRecovery: (args: {
19
+ client: Pick<TwelveUiConversionClient, "getConversion">;
20
+ error: unknown;
21
+ conversionId: string;
22
+ fallbackExportId?: string;
23
+ resumeCommand: string;
24
+ parentArtifact?: Pick<TerminalArtifactReport, "name" | "path">;
25
+ linkedArtifact?: Pick<TerminalArtifactReport, "name" | "path">;
26
+ }) => Promise<{
27
+ terminalOperation: (ConversionOperation & {
28
+ status: TerminalConversionStatus;
29
+ }) | null;
30
+ terminalStatus: TerminalConversionStatus | null;
31
+ linkedExport?: LinkedExportRecoveryState;
32
+ artifacts?: TerminalArtifactReport[];
33
+ next: string;
34
+ }>;
35
+ //# sourceMappingURL=cli-conversion-recovery-advice.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-conversion-recovery-advice.d.ts","sourceRoot":"","sources":["../src/cli-conversion-recovery-advice.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC9B,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,iCAAiC,CAAC;AAEzC,eAAO,MAAM,2BAA2B,GACtC,OAAO,OAAO,KACb,CAAC,mBAAmB,GAAG;IAAE,MAAM,EAAE,wBAAwB,CAAA;CAAE,CAAC,GAAG,IAEjE,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,OAAO,OAAO,KAAG,wBAAwB,GAAG,IAEpF,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,MAAM;IAC7C,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,wBAAwB,GAAG,IAAI,CAAC;IAChD,aAAa,EAAE,MAAM,CAAC;CACvB,KAAG,MASH,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,wBAAwB,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAU,MAAM;IACnD,MAAM,EAAE,IAAI,CAAC,wBAAwB,EAAE,eAAe,CAAC,CAAC;IACxD,KAAK,EAAE,OAAO,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,IAAI,CAAC,sBAAsB,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IAC/D,cAAc,CAAC,EAAE,IAAI,CAAC,sBAAsB,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;CAChE,KAAG,OAAO,CAAC;IACV,iBAAiB,EAAE,CAAC,mBAAmB,GAAG;QAAE,MAAM,EAAE,wBAAwB,CAAA;KAAE,CAAC,GAAG,IAAI,CAAC;IACvF,cAAc,EAAE,wBAAwB,GAAG,IAAI,CAAC;IAChD,YAAY,CAAC,EAAE,yBAAyB,CAAC;IACzC,SAAS,CAAC,EAAE,sBAAsB,EAAE,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC;CACd,CAwDA,CAAC"}
@@ -0,0 +1,72 @@
1
+ import { ConversionTerminalError, } from './conversion-client.js';
2
+ import { readConversionStatusObservation, } from './conversion-status-contract.js';
3
+ export const terminalConversionOperation = (error) => (error instanceof ConversionTerminalError ? error.operation : null);
4
+ export const terminalConversionStatus = (error) => (terminalConversionOperation(error)?.status ?? null);
5
+ export const conversionRecoveryAdvice = (args) => {
6
+ if (args.terminalStatus === 'failed') {
7
+ return `contact 12ui support with conversion ID ${args.conversionId};`
8
+ + ' resume only collects a purchase and cannot restart a terminal failure';
9
+ }
10
+ if (args.terminalStatus === 'expired') {
11
+ return `conversion ${args.conversionId} has expired; start a new conversion if you still need the result`;
12
+ }
13
+ return `${args.resumeCommand}; collection is free until the purchase expires`;
14
+ };
15
+ export const describeTerminalRecovery = async (args) => {
16
+ const terminalOperation = terminalConversionOperation(args.error);
17
+ const terminalStatus = terminalOperation?.status ?? null;
18
+ let linkedExport;
19
+ if (terminalOperation && terminalOperation.id === args.conversionId) {
20
+ const exportId = terminalOperation.export?.conversion_id ?? args.fallbackExportId;
21
+ if (exportId) {
22
+ const observation = await readConversionStatusObservation(args.client, exportId);
23
+ linkedExport = {
24
+ id: exportId,
25
+ status: observation.status,
26
+ ...(observation.readError ? { readError: observation.readError.message } : {}),
27
+ };
28
+ }
29
+ }
30
+ let next = conversionRecoveryAdvice({
31
+ conversionId: terminalOperation?.id ?? args.conversionId,
32
+ terminalStatus,
33
+ resumeCommand: args.resumeCommand,
34
+ });
35
+ if (linkedExport) {
36
+ if (linkedExport.status === 'succeeded' || linkedExport.status === 'queued' || linkedExport.status === 'running') {
37
+ next += `; linked responsive export ${linkedExport.id} is ${linkedExport.status}`
38
+ + `; collect it with 12ui resume ${linkedExport.id} --output html --out ${args.linkedArtifact?.path ?? '<file>'}`;
39
+ }
40
+ else if (linkedExport.status === 'unknown') {
41
+ next += `; linked responsive export ${linkedExport.id} could not be read, so its state is unknown`;
42
+ }
43
+ else {
44
+ next += `; linked responsive export ${linkedExport.id} is ${linkedExport.status}`;
45
+ }
46
+ }
47
+ const artifacts = terminalOperation && terminalOperation.id === args.conversionId && args.parentArtifact
48
+ ? [
49
+ { ...args.parentArtifact, state: terminalOperation.status },
50
+ ...(args.linkedArtifact
51
+ ? [{
52
+ ...args.linkedArtifact,
53
+ name: args.linkedArtifact.name ?? 'responsive html',
54
+ state: !linkedExport || linkedExport.status === 'unknown'
55
+ ? 'unknown — linked export was not read'
56
+ : ['succeeded', 'queued', 'running'].includes(linkedExport.status)
57
+ ? `${linkedExport.status} — not collected`
58
+ : linkedExport.status,
59
+ ...(linkedExport?.readError ? { note: linkedExport.readError } : {}),
60
+ }]
61
+ : []),
62
+ ]
63
+ : undefined;
64
+ return {
65
+ terminalOperation,
66
+ terminalStatus,
67
+ ...(linkedExport ? { linkedExport } : {}),
68
+ ...(artifacts ? { artifacts } : {}),
69
+ next,
70
+ };
71
+ };
72
+ //# sourceMappingURL=cli-conversion-recovery-advice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-conversion-recovery-advice.js","sourceRoot":"","sources":["../src/cli-conversion-recovery-advice.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,GAIxB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,+BAA+B,GAEhC,MAAM,iCAAiC,CAAC;AAEzC,MAAM,CAAC,MAAM,2BAA2B,GAAG,CACzC,KAAc,EACuD,EAAE,CAAC,CACxE,KAAK,YAAY,uBAAuB,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAClE,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,KAAc,EAAmC,EAAE,CAAC,CAC3F,2BAA2B,CAAC,KAAK,CAAC,EAAE,MAAM,IAAI,IAAI,CACnD,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,IAIxC,EAAU,EAAE;IACX,IAAI,IAAI,CAAC,cAAc,KAAK,QAAQ,EAAE,CAAC;QACrC,OAAO,2CAA2C,IAAI,CAAC,YAAY,GAAG;cAClE,wEAAwE,CAAC;IAC/E,CAAC;IACD,IAAI,IAAI,CAAC,cAAc,KAAK,SAAS,EAAE,CAAC;QACtC,OAAO,cAAc,IAAI,CAAC,YAAY,mEAAmE,CAAC;IAC5G,CAAC;IACD,OAAO,GAAG,IAAI,CAAC,aAAa,iDAAiD,CAAC;AAChF,CAAC,CAAC;AAQF,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAK,EAAE,IAQ9C,EAME,EAAE;IACH,MAAM,iBAAiB,GAAG,2BAA2B,CAAC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
1
+ {"version":3,"file":"cli-convert-command.d.ts","sourceRoot":"","sources":["../src/cli-convert-command.ts"],"names":[],"mappings":"AAKA,OAAO,EAA2B,KAAK,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAmC5E,OAAO,EAIL,KAAK,wBAAwB,EAC9B,MAAM,iCAAiC,CAAC;AAgBzC,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD;;;;GAIG;AAEH,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,KAAG,MAAM,GAAG,SAOxD,CAAC;AAqHF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,GAAI,SAAS,MAAM,KAAG,MAIpD,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,MAAM;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE;QACb,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,EAAE,wBAAwB,CAAC;QACjC,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,KAAG,MAYH,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,sBAAsB,GAAI,MAAM;IAC3C,MAAM,EAAE,wBAAwB,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;CACnB,KAAG,MAMH,CAAC;AAyLF,eAAO,MAAM,oBAAoB,GAC/B,SAAS,SAAS,MAAM,EAAE,EAC1B,OAAO,QAAQ,EACf,SAAS,eAAe,EACxB,eAAc;IACZ,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,2FAA2F;IAC3F,cAAc,CAAC,EAAE,MAAM,CAAC;CACpB,KACL,OAAO,CAAC,IAAI,CA2xBd,CAAC"}
@@ -8,7 +8,8 @@ import { runConversionDerivation } from './cli-conversion-derivation.js';
8
8
  import { CONVERSION_DURATION_HINTS, createLongRunningProgress, } from './cli-progress.js';
9
9
  import { refuseUsage, usage, usageRefusal } from './cli-usage.js';
10
10
  import { readConversionConfig } from './config.js';
11
- import { TwelveUiConversionClient, } from './conversion-client.js';
11
+ import { TwelveUiConversionClient, ConversionTerminalError, } from './conversion-client.js';
12
+ import { conversionRecoveryAdvice, describeTerminalRecovery, } from './cli-conversion-recovery-advice.js';
12
13
  import { isConversionModel } from './conversion-models.js';
13
14
  import { isCliConversionOutput, } from './conversion-outputs.js';
14
15
  import { recordConvertedImageReceipt } from './conversion-receipt.js';
@@ -201,10 +202,13 @@ const outputPathForRecovery = async (artifact, overrideDirectory) => prepareOutp
201
202
  : artifact.outFile);
202
203
  const completedOperation = async (args) => {
203
204
  const current = await args.client.getConversion(args.id);
204
- if (current.status === 'succeeded') {
205
+ if (current.status === 'succeeded' || current.responsive_alternative) {
205
206
  args.onProgress?.(current);
206
207
  return current;
207
208
  }
209
+ if (current.status === 'failed' || current.status === 'expired') {
210
+ throw new ConversionTerminalError({ ...current, status: current.status });
211
+ }
208
212
  return await args.client.waitForConversion(current.id, {
209
213
  expiresAt: current.expires_at,
210
214
  ...(args.timeoutMs === undefined ? {} : { timeoutMs: args.timeoutMs }),
@@ -431,9 +435,19 @@ export const runConversionCommand = async (command, flags, journal, dependencies
431
435
  });
432
436
  }
433
437
  catch (error) {
434
- progress.finish('stopped', {
438
+ const recoveryReport = await describeTerminalRecovery({
439
+ client, error, conversionId,
440
+ resumeCommand: `re-run 12ui resume ${conversionId}`,
441
+ parentArtifact: { name: recovery.conversion.output, path: shownPath(recovery.conversion.outFile) },
442
+ ...(recovery.linkedExport ? {
443
+ fallbackExportId: recovery.linkedExport.conversionId,
444
+ linkedArtifact: { name: 'responsive html', path: shownPath(recovery.linkedExport.outFile) },
445
+ } : {}),
446
+ });
447
+ progress.finish(recoveryReport.terminalStatus ? 'failed' : 'stopped', {
435
448
  detail: error instanceof Error ? error.message : String(error),
436
- next: `re-run 12ui resume ${conversionId}; collection is free until the purchase expires`,
449
+ artifacts: recoveryReport.artifacts,
450
+ next: recoveryReport.next,
437
451
  });
438
452
  throw error;
439
453
  }
@@ -475,6 +489,11 @@ export const runConversionCommand = async (command, flags, journal, dependencies
475
489
  const current = await client.getConversion(conversionId).catch((error) => {
476
490
  progress.finish('stopped', {
477
491
  detail: error instanceof Error ? error.message : String(error),
492
+ next: conversionRecoveryAdvice({
493
+ conversionId,
494
+ terminalStatus: null,
495
+ resumeCommand: `re-run 12ui resume ${conversionId} --output ${requestedOutput} --out ${resolvedOutFile}`,
496
+ }),
478
497
  });
479
498
  throw error;
480
499
  });
@@ -492,10 +511,13 @@ export const runConversionCommand = async (command, flags, journal, dependencies
492
511
  }
493
512
  let completed;
494
513
  try {
495
- if (current.status === 'succeeded') {
514
+ if (current.status === 'succeeded' || current.responsive_alternative) {
496
515
  reportConversion(progress, current, `collecting ${requestedOutput}`);
497
516
  completed = current;
498
517
  }
518
+ else if (current.status === 'failed' || current.status === 'expired') {
519
+ throw new ConversionTerminalError({ ...current, status: current.status });
520
+ }
499
521
  else {
500
522
  completed = await client.waitForConversion(current.id, {
501
523
  expiresAt: current.expires_at,
@@ -504,20 +526,47 @@ export const runConversionCommand = async (command, flags, journal, dependencies
504
526
  });
505
527
  }
506
528
  }
529
+ catch (error) {
530
+ const savedLinkedExport = current.export
531
+ ? (await readConversionRecovery(conversionId))?.linkedExport
532
+ : undefined;
533
+ const recoveryReport = await describeTerminalRecovery({
534
+ client, error, conversionId,
535
+ resumeCommand: `re-run 12ui resume ${conversionId} --output ${requestedOutput} --out ${resolvedOutFile}`,
536
+ parentArtifact: { name: current.output, path: resolvedOutFile },
537
+ ...(current.export ? {
538
+ fallbackExportId: current.export.conversion_id,
539
+ linkedArtifact: { name: 'responsive html', ...(savedLinkedExport ? { path: savedLinkedExport.outFile } : {}) },
540
+ } : {}),
541
+ });
542
+ progress.finish(recoveryReport.terminalStatus ? 'failed' : 'stopped', {
543
+ detail: error instanceof Error ? error.message : String(error),
544
+ artifacts: recoveryReport.artifacts,
545
+ next: recoveryReport.next,
546
+ });
547
+ throw error;
548
+ }
549
+ let downloaded;
550
+ try {
551
+ downloaded = await downloadCompletedConversion({
552
+ client,
553
+ operation: completed,
554
+ output: requestedOutput,
555
+ outFile: resolvedOutFile,
556
+ });
557
+ }
507
558
  catch (error) {
508
559
  progress.finish('stopped', {
509
560
  detail: error instanceof Error ? error.message : String(error),
510
- next: `re-run 12ui resume ${conversionId} --output ${requestedOutput} --out ${resolvedOutFile};`
511
- + ' collection is free until the purchase expires',
561
+ artifacts: [{ name: requestedOutput, state: 'succeeded — not collected', path: resolvedOutFile }],
562
+ next: conversionRecoveryAdvice({
563
+ conversionId,
564
+ terminalStatus: null,
565
+ resumeCommand: `re-run 12ui resume ${conversionId} --output ${requestedOutput} --out ${resolvedOutFile}`,
566
+ }),
512
567
  });
513
568
  throw error;
514
569
  }
515
- const downloaded = await downloadCompletedConversion({
516
- client,
517
- operation: completed,
518
- output: requestedOutput,
519
- outFile: resolvedOutFile,
520
- });
521
570
  journal.note({ runId: completed.id, artifacts: [resolvedOutFile] });
522
571
  let linkedExport;
523
572
  if (completed.output === 'layerdoc' && completed.export?.conversion_id) {
@@ -749,10 +798,14 @@ export const runConversionCommand = async (command, flags, journal, dependencies
749
798
  : ''}`);
750
799
  let operation;
751
800
  try {
752
- if (created.status === 'succeeded') {
801
+ if (created.status === 'succeeded' || created.responsive_alternative) {
753
802
  reportConversion(progress, created);
754
803
  operation = created;
755
804
  }
805
+ else if (created.status === 'failed' || created.status === 'expired') {
806
+ reportConversion(progress, created);
807
+ throw new ConversionTerminalError({ ...created, status: created.status });
808
+ }
756
809
  else {
757
810
  operation = await client.waitForConversion(created.id, {
758
811
  expiresAt: created.expires_at,
@@ -763,17 +816,23 @@ export const runConversionCommand = async (command, flags, journal, dependencies
763
816
  }
764
817
  catch (error) {
765
818
  const detail = error instanceof Error ? error.message : String(error);
766
- progress.finish('stopped', {
767
- detail: `conversion ${created.id} did not settle: ${detail}`,
768
- ...(exportOperationId && exportOutFile
769
- ? {
770
- artifacts: [
771
- { name: output, state: 'not collected' },
772
- { name: 'responsive html', state: 'unknown — the linked export was not read' },
773
- ],
774
- next: `12ui resume ${created.id} recovers both halves without re-buying`,
775
- }
776
- : { next: `12ui resume ${created.id} recovers the purchase without re-buying` }),
819
+ const recoveryReport = await describeTerminalRecovery({
820
+ client, error, conversionId: created.id,
821
+ resumeCommand: exportOperationId
822
+ ? `12ui resume ${created.id} recovers both halves without re-buying`
823
+ : `12ui resume ${created.id} recovers the purchase without re-buying`,
824
+ parentArtifact: { name: output, path: outFile },
825
+ ...(exportOperationId && exportOutFile ? {
826
+ fallbackExportId: exportOperationId,
827
+ linkedArtifact: { name: 'responsive html', path: exportOutFile },
828
+ } : {}),
829
+ });
830
+ progress.finish(recoveryReport.terminalStatus ? 'failed' : 'stopped', {
831
+ detail: recoveryReport.terminalStatus
832
+ ? `conversion ${created.id} is ${recoveryReport.terminalStatus}: ${detail}`
833
+ : `conversion ${created.id} did not settle: ${detail}`,
834
+ artifacts: recoveryReport.artifacts,
835
+ next: recoveryReport.next,
777
836
  });
778
837
  throw new Error(`Conversion ${created.id} failed: ${detail}`, { cause: error });
779
838
  }
@@ -791,7 +850,22 @@ export const runConversionCommand = async (command, flags, journal, dependencies
791
850
  ...(quiet ? {} : { warn: (message) => process.stderr.write(`${message}\n`) }),
792
851
  });
793
852
  }
794
- const result = await downloadCompletedConversion({ client, operation, output, outFile });
853
+ let result;
854
+ try {
855
+ result = await downloadCompletedConversion({ client, operation, output, outFile });
856
+ }
857
+ catch (error) {
858
+ progress.finish('stopped', {
859
+ detail: error instanceof Error ? error.message : String(error),
860
+ artifacts: [{ name: output, state: 'succeeded — not collected', path: outFile }],
861
+ next: conversionRecoveryAdvice({
862
+ conversionId: created.id,
863
+ terminalStatus: null,
864
+ resumeCommand: `12ui resume ${created.id}`,
865
+ }),
866
+ });
867
+ throw error;
868
+ }
795
869
  journal.note({ artifacts: [outFile] });
796
870
  if (!exportOperationId || !exportOutFile) {
797
871
  const disposition = responsiveAlternativeDisposition(result);
@@ -879,16 +953,35 @@ export const runConversionCommand = async (command, flags, journal, dependencies
879
953
  : undefined;
880
954
  const pending = isPendingConversionStatus(exportStatus);
881
955
  const collect = `12ui resume ${exportOperationId} --output html --out <file>`;
882
- const report = {
883
- ...result,
884
- nextAction: layerDocStateAction({
956
+ const collectToOutput = `12ui resume ${exportOperationId} --output html --out ${exportOutFile}`;
957
+ const terminalExportStatus = !exportResult
958
+ && (exportStatus === 'failed' || exportStatus === 'expired')
959
+ ? exportStatus
960
+ : null;
961
+ const nextAction = exportResult
962
+ ? layerDocStateAction({
885
963
  outFile,
886
964
  linkedExport: {
887
965
  id: exportOperationId,
888
966
  status: exportStatus,
889
- ...(exportResult ? { outFile: exportOutFile } : {}),
967
+ outFile: exportOutFile,
890
968
  },
891
- }),
969
+ })
970
+ : terminalExportStatus
971
+ ? conversionRecoveryAdvice({
972
+ conversionId: exportOperationId,
973
+ terminalStatus: terminalExportStatus,
974
+ resumeCommand: collectToOutput,
975
+ })
976
+ : exportStatus === 'succeeded' || exportStatus === 'unknown'
977
+ ? `Responsive export ${exportOperationId} is ${exportStatus}; collect the existing export with ${collectToOutput}`
978
+ : layerDocStateAction({
979
+ outFile,
980
+ linkedExport: { id: exportOperationId, status: exportStatus },
981
+ });
982
+ const report = {
983
+ ...result,
984
+ nextAction,
892
985
  export: exportResult
893
986
  ? { ...exportResult, status: exportStatus }
894
987
  : {
@@ -955,7 +1048,32 @@ export const runConversionCommand = async (command, flags, journal, dependencies
955
1048
  next: `the purchase stays collectable until ${created.expires_at}`,
956
1049
  });
957
1050
  }
1051
+ else if (exportStatus === 'succeeded' || exportStatus === 'unknown') {
1052
+ progress.finish('stopped', {
1053
+ detail: exportStatus === 'succeeded'
1054
+ ? `the linked responsive export succeeded but collection did not complete: ${exportError}`
1055
+ : `the linked responsive export state could not be read: ${exportReadDetail ?? exportError}`,
1056
+ artifacts: [
1057
+ layerdocRow,
1058
+ {
1059
+ name: 'responsive html',
1060
+ state: exportStatus === 'succeeded' ? 'succeeded — not collected' : 'unknown — not collected',
1061
+ path: exportOutFile,
1062
+ ...((exportObservation?.readError?.message || exportError)
1063
+ ? { note: exportObservation?.readError?.message || exportError || undefined }
1064
+ : {}),
1065
+ },
1066
+ ],
1067
+ spend: spendLine,
1068
+ next: `${collectToOutput}; collection is free until the purchase expires`,
1069
+ });
1070
+ }
958
1071
  else {
1072
+ const next = conversionRecoveryAdvice({
1073
+ conversionId: exportOperationId,
1074
+ terminalStatus: terminalExportStatus,
1075
+ resumeCommand: collectToOutput,
1076
+ });
959
1077
  progress.finish('failed', {
960
1078
  detail: `the linked responsive export ${exportOperationId} ${exportStatus}`,
961
1079
  artifacts: [
@@ -967,7 +1085,7 @@ export const runConversionCommand = async (command, flags, journal, dependencies
967
1085
  },
968
1086
  ],
969
1087
  spend: spendLine,
970
- next: `render a fixed page free from the document: 12ui convert ${outFile} --output html_fixed`,
1088
+ next,
971
1089
  });
972
1090
  }
973
1091
  writeResultWithSummary(report, writeResult);
@@ -980,10 +1098,10 @@ export const runConversionCommand = async (command, flags, journal, dependencies
980
1098
  ? `Conversion ${created.id} succeeded and was written to ${outFile}, but responsive export`
981
1099
  + ` ${exportOperationId} failed with ${responsiveAlternativeLabel(exportDisposition)};`
982
1100
  + ` coverage is recorded in ${exportResult.artifactManifest.manifestFile}.`
983
- : exportStatus === 'unknown'
984
- ? `Conversion ${created.id} succeeded and was written to ${outFile}. Responsive HTML export ${exportOperationId} has an unknown state. ${exportReadDetail ?? exportError}. Keep this purchase and collect the same export when the read issue is resolved: ${collect}.`
1101
+ : exportStatus === 'succeeded' || exportStatus === 'unknown'
1102
+ ? `Conversion ${created.id} succeeded and was written to ${outFile}. Responsive HTML export ${exportOperationId} is ${exportStatus} and was not collected. Use ${collectToOutput}; this collects the existing purchase.`
985
1103
  : `Conversion ${created.id} succeeded and was written to ${outFile}, but its responsive HTML`
986
- + ` export ${exportOperationId} did not: ${exportError}`);
1104
+ + ` export ${exportOperationId} is ${exportStatus}: ${exportError}. ${nextAction}`);
987
1105
  }
988
1106
  };
989
1107
  //# sourceMappingURL=cli-convert-command.js.map