@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversion-receipt.js","sourceRoot":"","sources":["../src/conversion-receipt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAK3D;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAG,kBAAkB,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAqB,UAAU,CAAC;AAEvE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,EAAE,GAAG,MAAM,CAAC;AA2BjE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,SAAiB,EAAU,EAAE,CAAC,CAClE,GAAG,SAAS,GAAG,yBAAyB,EAAE,CAC3C,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,KAAc,EAA8B,EAAE;IAC/D,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACtD,MAAM,MAAM,GAAG,KAAgC,CAAC;IAChD,OAAO,MAAM,CAAC,OAAO,KAAK,CAAC;WACtB,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ;WACjC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;WACrC,OAAO,MAAM,CAAC,YAAY,KAAK,QAAQ;WACvC,MAAM,CAAC,YAAY,CAAC,MAAM,GAAG,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ACrF,2FAA2F,CAC9F,CAAC;IACJ,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The derived identity for a hosted create run.
|
|
3
|
+
*
|
|
4
|
+
* The hosted API demands a caller-minted `Idempotency-Key` on the claim, and
|
|
5
|
+
* until now no tool derived one — so the design-draft skill had to teach key
|
|
6
|
+
* minting in prose, and a paraphrased key meant either a wedged claim
|
|
7
|
+
* (`409 idempotency_conflict`, same key with a changed body) or a second run
|
|
8
|
+
* bought for the same work (new key, same body). Deriving it from the request
|
|
9
|
+
* removes both from the caller's hands.
|
|
10
|
+
*/
|
|
11
|
+
export declare const CREATE_WORKFLOW_REVISION = "create-v1";
|
|
12
|
+
export type CreateCandidateSpecInput = {
|
|
13
|
+
slot: string;
|
|
14
|
+
direction?: string;
|
|
15
|
+
referenceId?: string;
|
|
16
|
+
useReferenceImage?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export declare const createRunKey: (args: {
|
|
19
|
+
concept: string;
|
|
20
|
+
aspect: string;
|
|
21
|
+
mode?: string;
|
|
22
|
+
candidates: readonly CreateCandidateSpecInput[];
|
|
23
|
+
referenceImageSha256?: string;
|
|
24
|
+
}) => string;
|
|
25
|
+
//# sourceMappingURL=create-identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-identity.d.ts","sourceRoot":"","sources":["../src/create-identity.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,eAAO,MAAM,wBAAwB,cAAc,CAAC;AAEpD,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAmBF,eAAO,MAAM,YAAY,GAAI,MAAM;IACjC,OAAO,EAA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,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;aAC1D,GAAG,CAAC,kBAAkB,CAAC;aACvB,IAAI,CAAC,GAAG,CAAC;QACZ,wBAAwB;KACzB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;CACb,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derived identities for a draft run. Free-text keys were a measured
|
|
3
|
+
* double-spend hazard, and a candidate is a paid image, so nothing here is
|
|
4
|
+
* authored: every key is a function of the inputs that produced the work.
|
|
5
|
+
*/
|
|
6
|
+
export declare const DRAFT_WORKFLOW_REVISION = "draft-v1";
|
|
7
|
+
/**
|
|
8
|
+
* The corpus query is one paid retrieval per (query, mode, count), so the same
|
|
9
|
+
* draft inputs replay the same set instead of buying another.
|
|
10
|
+
*/
|
|
11
|
+
export declare const draftCorpusKey: (args: {
|
|
12
|
+
query: string;
|
|
13
|
+
mode: string;
|
|
14
|
+
count: number;
|
|
15
|
+
redesignSourceSha256?: string | null;
|
|
16
|
+
}) => string;
|
|
17
|
+
/**
|
|
18
|
+
* One paid image. Keyed on everything that changes the request: the design
|
|
19
|
+
* problem, this candidate's direction, the exact reference bytes attached to
|
|
20
|
+
* it, the canvas, and the prompt revision — so a retry replays the same image
|
|
21
|
+
* and a changed direction buys a genuinely different one.
|
|
22
|
+
*/
|
|
23
|
+
export declare const draftCandidateKey: (args: {
|
|
24
|
+
query: string;
|
|
25
|
+
candidateId: string;
|
|
26
|
+
referenceSha256: string;
|
|
27
|
+
aspect: string;
|
|
28
|
+
referenceMode: string;
|
|
29
|
+
}) => string;
|
|
30
|
+
//# sourceMappingURL=draft-identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draft-identity.d.ts","sourceRoot":"","sources":["../src/draft-identity.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AAEH,eAAO,MAAM,uBAAuB,aAAa,CAAC;AAMlD;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC,KAAG,MAUO,CAAC;AAEZ;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,MAAM;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;CACvB,KAAG,MAcO,CAAC"}
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draft-identity.js","sourceRoot":"","sources":["../src/draft-identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE3D;;;;GAIG;AAEH,MAAM,CAAC,MAAM,uBAAuB,GAAG,UAAU,CAAC;AAElD,MAAM,WAAW,GAAG,CAAC,KAAa,EAAE,UAAU,GAAG,EAAE,EAAU,EAAE,CAAC,CAC9D,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CACtE,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAK9B,EAAU,EAAE,CAAC;IACZ,cAAc;IACd,IAAI;IACJ,WAAW,CAAC;QACV,IAAI,CAAC,KAAK;QACV,IAAI,CAAC,IAAI;QACT,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;QAClB,IAAI,CAAC,oBAAoB,IAAI,EAAE;QAC/B,uBAAuB;KACxB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;CACb,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAMjC,EAAU,EAAE,CAAC;IACZ,iBAAiB;IACjB,IAAI;IACJ,IAAI,CAAC,WAAW;IAChB,WAAW,CAAC;QACV,IAAI,CAAC,KAAK;QACV,uEAAuE;QACvE,kEAAkE;QAClE,IAAI,CAAC,eAAe;QACpB,IAAI,CAAC,MAAM;QACX,IAAI,CAAC,aAAa;QAClB,qBAAqB;QACrB,uBAAuB;KACxB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;CACb,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { DraftCandidateId, DraftMode } from './draft-workspace.js';
|
|
2
|
+
/**
|
|
3
|
+
* The generation prompts, as code.
|
|
4
|
+
*
|
|
5
|
+
* These were prose in the skill: a template an agent filled in, plus rules
|
|
6
|
+
* about which image may be attached to which candidate. Prose is where they
|
|
7
|
+
* drifted — a model that paraphrases a template loses the constraints inside
|
|
8
|
+
* it. Here they are one function, so every draft run asks for the same thing
|
|
9
|
+
* and the caller supplies only the design problem.
|
|
10
|
+
*
|
|
11
|
+
* THE FOUR REFERENCES ARE THE FOUR DIRECTIONS. Diversity comes from retrieval,
|
|
12
|
+
* and each candidate is steered by the one image paired with it, so the prompt
|
|
13
|
+
* text is identical across candidates and carries no authored per-candidate
|
|
14
|
+
* "visual quality" at all. That is deliberate: a written direction is a second,
|
|
15
|
+
* weaker steering signal that competes with the image, and asking a model to
|
|
16
|
+
* author four of them puts the diversity back inside the model whose narrow
|
|
17
|
+
* defaults this whole flow exists to escape.
|
|
18
|
+
*
|
|
19
|
+
* The rules encoded below, each one previously a paragraph of prose:
|
|
20
|
+
* - ONE viewport per candidate, never a whole page squeezed into one canvas;
|
|
21
|
+
* - exactly ONE image reference per generation, never a composite;
|
|
22
|
+
* - the corpus image is loose inspiration, never a template to clone, and is
|
|
23
|
+
* never described back to the model in words;
|
|
24
|
+
* - a reskin preserves the source's structure and changes only its visual
|
|
25
|
+
* language, so the source is the sole reference for every candidate;
|
|
26
|
+
* - no device frame, no presentation mockup.
|
|
27
|
+
*/
|
|
28
|
+
export declare const DRAFT_PROMPT_REVISION = "draft-prompt-v2";
|
|
29
|
+
export declare const promptDigest: (prompt: string) => string;
|
|
30
|
+
export declare const draftCandidatePrompt: (args: {
|
|
31
|
+
query: string;
|
|
32
|
+
mode: DraftMode;
|
|
33
|
+
}) => string;
|
|
34
|
+
export declare const draftCandidateIdFor: (index: number) => DraftCandidateId;
|
|
35
|
+
//# sourceMappingURL=draft-prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draft-prompts.d.ts","sourceRoot":"","sources":["../src/draft-prompts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AAEvD,eAAO,MAAM,YAAY,GAAI,QAAQ,MAAM,KAAG,MAE7C,CAAC;AAIF,eAAO,MAAM,oBAAoB,GAAI,MAAM;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,SAAS,CAAC;CACjB,KAAG,MAkBH,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,OAAO,MAAM,KAAG,gBAEnD,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
/**
|
|
3
|
+
* The generation prompts, as code.
|
|
4
|
+
*
|
|
5
|
+
* These were prose in the skill: a template an agent filled in, plus rules
|
|
6
|
+
* about which image may be attached to which candidate. Prose is where they
|
|
7
|
+
* drifted — a model that paraphrases a template loses the constraints inside
|
|
8
|
+
* it. Here they are one function, so every draft run asks for the same thing
|
|
9
|
+
* and the caller supplies only the design problem.
|
|
10
|
+
*
|
|
11
|
+
* THE FOUR REFERENCES ARE THE FOUR DIRECTIONS. Diversity comes from retrieval,
|
|
12
|
+
* and each candidate is steered by the one image paired with it, so the prompt
|
|
13
|
+
* text is identical across candidates and carries no authored per-candidate
|
|
14
|
+
* "visual quality" at all. That is deliberate: a written direction is a second,
|
|
15
|
+
* weaker steering signal that competes with the image, and asking a model to
|
|
16
|
+
* author four of them puts the diversity back inside the model whose narrow
|
|
17
|
+
* defaults this whole flow exists to escape.
|
|
18
|
+
*
|
|
19
|
+
* The rules encoded below, each one previously a paragraph of prose:
|
|
20
|
+
* - ONE viewport per candidate, never a whole page squeezed into one canvas;
|
|
21
|
+
* - exactly ONE image reference per generation, never a composite;
|
|
22
|
+
* - the corpus image is loose inspiration, never a template to clone, and is
|
|
23
|
+
* never described back to the model in words;
|
|
24
|
+
* - a reskin preserves the source's structure and changes only its visual
|
|
25
|
+
* language, so the source is the sole reference for every candidate;
|
|
26
|
+
* - no device frame, no presentation mockup.
|
|
27
|
+
*/
|
|
28
|
+
export const DRAFT_PROMPT_REVISION = 'draft-prompt-v2';
|
|
29
|
+
export const promptDigest = (prompt) => (createHash('sha256').update(prompt).digest('hex'));
|
|
30
|
+
const collapse = (value) => value.replace(/\s+/gu, ' ').trim();
|
|
31
|
+
export const draftCandidatePrompt = (args) => {
|
|
32
|
+
const query = collapse(args.query);
|
|
33
|
+
if (args.mode === 'structure-preserving-reskin') {
|
|
34
|
+
return collapse(`
|
|
35
|
+
Reskin this interface for ${query}. Preserve the attached source's
|
|
36
|
+
information architecture, content hierarchy, primary actions, and
|
|
37
|
+
interactions. Change only its visual language: palette, typography,
|
|
38
|
+
spacing, and detail are yours to choose. Show the first viewport or
|
|
39
|
+
primary screen. Fill the canvas without a device or presentation frame.
|
|
40
|
+
`);
|
|
41
|
+
}
|
|
42
|
+
return collapse(`
|
|
43
|
+
Create one distinctive interface for ${query}. Show only the first
|
|
44
|
+
viewport, with the primary goal immediately clear. Use the attached image
|
|
45
|
+
as loose visual inspiration, not a template: take its feeling, not its
|
|
46
|
+
layout. Leave breathing room and choose the visual language yourself. Fill
|
|
47
|
+
the canvas without a device or presentation frame.
|
|
48
|
+
`);
|
|
49
|
+
};
|
|
50
|
+
export const draftCandidateIdFor = (index) => ['A', 'B', 'C', 'D'][index];
|
|
51
|
+
//# sourceMappingURL=draft-prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draft-prompts.js","sourceRoot":"","sources":["../src/draft-prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAIzC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAEvD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,CACtD,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAClD,CAAC;AAEF,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAE/E,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,IAGpC,EAAU,EAAE;IACX,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnC,IAAI,IAAI,CAAC,IAAI,KAAK,6BAA6B,EAAE,CAAC;QAChD,OAAO,QAAQ,CAAC;kCACc,KAAK;;;;;KAKlC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAC;2CACyB,KAAK;;;;;GAK7C,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAa,EAAoB,EAAE,CACrE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,KAAK,CAC3B,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type InspirationClient } from './cli-corpus-types.js';
|
|
2
|
+
import { draftCandidateIdFor } from './draft-prompts.js';
|
|
3
|
+
import { type DraftMode, type DraftPaths, type DraftRecord } from './draft-workspace.js';
|
|
4
|
+
/**
|
|
5
|
+
* Everything `12ui draft` does before a single image is bought: one corpus
|
|
6
|
+
* search, four references paired one-to-one with four candidates, a generation
|
|
7
|
+
* manifest with derived keys, and a durable record of all of it.
|
|
8
|
+
*
|
|
9
|
+
* This is the step that used to be five screens of skill prose. Each rule it
|
|
10
|
+
* encodes was previously an instruction a model could paraphrase away.
|
|
11
|
+
*/
|
|
12
|
+
export declare const DRAFT_CANDIDATE_COUNT = 4;
|
|
13
|
+
export type DraftAspect = 'landscape' | 'portrait' | 'square';
|
|
14
|
+
export type PrepareDraftRunInput = {
|
|
15
|
+
paths: DraftPaths;
|
|
16
|
+
client: InspirationClient;
|
|
17
|
+
origin: string;
|
|
18
|
+
query: string;
|
|
19
|
+
mode: DraftMode;
|
|
20
|
+
aspect: DraftAspect;
|
|
21
|
+
provider: 'auto' | 'codex' | 'openai';
|
|
22
|
+
projectRoot: string;
|
|
23
|
+
redesignSource?: {
|
|
24
|
+
path: string;
|
|
25
|
+
sha256: string;
|
|
26
|
+
};
|
|
27
|
+
now?: () => Date;
|
|
28
|
+
};
|
|
29
|
+
export declare const prepareDraftRun: (input: PrepareDraftRunInput) => Promise<DraftRecord>;
|
|
30
|
+
export declare const draftRunPaths: (runDir: string) => DraftPaths;
|
|
31
|
+
export { draftCandidateIdFor };
|
|
32
|
+
//# sourceMappingURL=draft-run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draft-run.d.ts","sourceRoot":"","sources":["../src/draft-run.ts"],"names":[],"mappings":"AAKA,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,mBAAmB,EAAsC,MAAM,oBAAoB,CAAC;AAC7F,OAAO,EAIL,KAAK,SAAS,EAEd,KAAK,UAAU,EACf,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAE9B;;;;;;;GAOG;AAEH,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,UAAU,GAAG,QAAQ,CAAC;AAE9D,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,UAAU,CAAC;IAClB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAClD,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;CAClB,CAAC;AA4BF,eAAO,MAAM,eAAe,GAAU,OAAO,oBAAoB,KAAG,OAAO,CAAC,WAAW,CAoHtF,CAAC;AAEF,eAAO,MAAM,aAAa,gCAAa,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { downloadCorpusInspiration } from './cli-corpus-run.js';
|
|
5
|
+
import { INSPIRATION_EVIDENCE_FILE, INSPIRATION_MANIFEST_FILE, } from './cli-corpus-types.js';
|
|
6
|
+
import { loadCorpusReferenceImage } from './cli-corpus-reference-image.js';
|
|
7
|
+
import { draftCandidateKey, draftCorpusKey } from './draft-identity.js';
|
|
8
|
+
import { draftCandidateIdFor, draftCandidatePrompt, promptDigest } from './draft-prompts.js';
|
|
9
|
+
import { DRAFT_CANDIDATE_IDS, draftPaths, writeDraftRecord, } from './draft-workspace.js';
|
|
10
|
+
/**
|
|
11
|
+
* Everything `12ui draft` does before a single image is bought: one corpus
|
|
12
|
+
* search, four references paired one-to-one with four candidates, a generation
|
|
13
|
+
* manifest with derived keys, and a durable record of all of it.
|
|
14
|
+
*
|
|
15
|
+
* This is the step that used to be five screens of skill prose. Each rule it
|
|
16
|
+
* encodes was previously an instruction a model could paraphrase away.
|
|
17
|
+
*/
|
|
18
|
+
export const DRAFT_CANDIDATE_COUNT = 4;
|
|
19
|
+
/**
|
|
20
|
+
* The corpus reference's own declared labels, kept as provenance for the
|
|
21
|
+
* selection record. Never used as prompt text — see `draft-prompts.ts`.
|
|
22
|
+
*/
|
|
23
|
+
const referenceLabel = (item) => {
|
|
24
|
+
const label = (item.description ?? '').trim() || (item.uiType ?? '').trim();
|
|
25
|
+
return label.length > 160 ? `${label.slice(0, 159)}…` : label;
|
|
26
|
+
};
|
|
27
|
+
const readInspirationItems = async (referencesDir) => {
|
|
28
|
+
try {
|
|
29
|
+
const evidence = JSON.parse(await readFile(path.join(referencesDir, INSPIRATION_EVIDENCE_FILE), 'utf8'));
|
|
30
|
+
return Object.fromEntries((evidence.response?.items ?? []).map((item) => [
|
|
31
|
+
item.id,
|
|
32
|
+
{ uiType: item.uiType ?? null, description: item.description ?? null },
|
|
33
|
+
]));
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
// Provenance labels are a convenience; their absence never blocks a run.
|
|
37
|
+
return {};
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
export const prepareDraftRun = async (input) => {
|
|
41
|
+
const now = input.now ?? (() => new Date());
|
|
42
|
+
const manifest = await downloadCorpusInspiration({
|
|
43
|
+
client: input.client,
|
|
44
|
+
request: { q: input.query, mode: 'balanced', k: DRAFT_CANDIDATE_COUNT },
|
|
45
|
+
outDir: input.paths.referencesDir,
|
|
46
|
+
origin: input.origin,
|
|
47
|
+
idempotencyKey: draftCorpusKey({
|
|
48
|
+
query: input.query,
|
|
49
|
+
mode: 'balanced',
|
|
50
|
+
count: DRAFT_CANDIDATE_COUNT,
|
|
51
|
+
redesignSourceSha256: input.redesignSource?.sha256 ?? null,
|
|
52
|
+
}),
|
|
53
|
+
// A redesign conditions RETRIEVAL on the existing screen; whether it also
|
|
54
|
+
// conditions generation is the difference between the two modes below.
|
|
55
|
+
...(input.redesignSource
|
|
56
|
+
? { referenceImage: await loadCorpusReferenceImage(input.redesignSource.path) }
|
|
57
|
+
: {}),
|
|
58
|
+
now,
|
|
59
|
+
});
|
|
60
|
+
const references = [...manifest.references].sort((left, right) => left.ordinal - right.ordinal);
|
|
61
|
+
if (references.length < DRAFT_CANDIDATE_COUNT) {
|
|
62
|
+
throw new Error(`The corpus returned ${references.length} reference(s) for this query and a draft needs`
|
|
63
|
+
+ ` ${DRAFT_CANDIDATE_COUNT}. Broaden the query and run 12ui draft again; nothing has been`
|
|
64
|
+
+ ' generated, so nothing has been bought.');
|
|
65
|
+
}
|
|
66
|
+
const labels = await readInspirationItems(input.paths.referencesDir);
|
|
67
|
+
// A reskin conditions every candidate on the source and takes its diversity
|
|
68
|
+
// from nothing else; the other modes pair one corpus image per candidate.
|
|
69
|
+
const reskin = input.mode === 'structure-preserving-reskin';
|
|
70
|
+
const referenceMode = reskin ? 'preserve-structure' : 'inspiration';
|
|
71
|
+
const prompt = draftCandidatePrompt({ query: input.query, mode: input.mode });
|
|
72
|
+
await mkdir(input.paths.candidatesDir, { recursive: true });
|
|
73
|
+
const candidates = DRAFT_CANDIDATE_IDS.map((id, index) => {
|
|
74
|
+
const reference = references[index];
|
|
75
|
+
const generationReference = reskin && input.redesignSource
|
|
76
|
+
? { path: input.redesignSource.path, sha256: input.redesignSource.sha256 }
|
|
77
|
+
: { path: reference.file, sha256: reference.sha256 };
|
|
78
|
+
return {
|
|
79
|
+
id,
|
|
80
|
+
direction: referenceLabel(labels[reference.id] ?? {}),
|
|
81
|
+
prompt,
|
|
82
|
+
promptSha256: promptDigest(prompt),
|
|
83
|
+
outputPath: path.join(input.paths.candidatesDir, `${id}.png`),
|
|
84
|
+
idempotencyKey: draftCandidateKey({
|
|
85
|
+
query: input.query,
|
|
86
|
+
candidateId: id,
|
|
87
|
+
// In a reskin every candidate shares the source, so the paired corpus
|
|
88
|
+
// reference still distinguishes the four purchases.
|
|
89
|
+
referenceSha256: reference.sha256,
|
|
90
|
+
aspect: input.aspect,
|
|
91
|
+
referenceMode,
|
|
92
|
+
}),
|
|
93
|
+
referenceId: reference.id,
|
|
94
|
+
referencePath: generationReference.path,
|
|
95
|
+
referenceSha256: generationReference.sha256,
|
|
96
|
+
};
|
|
97
|
+
});
|
|
98
|
+
const batchManifest = {
|
|
99
|
+
version: 1,
|
|
100
|
+
projectRoot: input.projectRoot,
|
|
101
|
+
provider: input.provider,
|
|
102
|
+
aspect: input.aspect,
|
|
103
|
+
referenceMode,
|
|
104
|
+
candidates: candidates.map((candidate) => ({
|
|
105
|
+
id: candidate.id,
|
|
106
|
+
prompt: candidate.prompt,
|
|
107
|
+
reference: path.relative(input.paths.runDir, candidate.referencePath),
|
|
108
|
+
out: path.relative(input.paths.runDir, candidate.outputPath),
|
|
109
|
+
idempotencyKey: candidate.idempotencyKey,
|
|
110
|
+
})),
|
|
111
|
+
};
|
|
112
|
+
const serialized = `${JSON.stringify(batchManifest, null, 2)}\n`;
|
|
113
|
+
await writeFile(input.paths.generationManifest, serialized, { encoding: 'utf8', mode: 0o600 });
|
|
114
|
+
const record = {
|
|
115
|
+
version: 1,
|
|
116
|
+
createdAt: now().toISOString(),
|
|
117
|
+
runDir: input.paths.runDir,
|
|
118
|
+
query: input.query,
|
|
119
|
+
mode: input.mode,
|
|
120
|
+
aspect: input.aspect,
|
|
121
|
+
referenceMode,
|
|
122
|
+
origin: input.origin,
|
|
123
|
+
redesignSource: input.redesignSource
|
|
124
|
+
? { path: input.redesignSource.path, sha256: input.redesignSource.sha256 }
|
|
125
|
+
: null,
|
|
126
|
+
corpus: {
|
|
127
|
+
query: input.query,
|
|
128
|
+
mode: manifest.response.mode,
|
|
129
|
+
setId: manifest.response.setId,
|
|
130
|
+
idempotencyKey: manifest.idempotencyKey,
|
|
131
|
+
manifestPath: path.join(input.paths.referencesDir, INSPIRATION_MANIFEST_FILE),
|
|
132
|
+
references: references.map((reference) => ({
|
|
133
|
+
ordinal: reference.ordinal,
|
|
134
|
+
id: reference.id,
|
|
135
|
+
path: reference.file,
|
|
136
|
+
sha256: reference.sha256,
|
|
137
|
+
aspect: reference.aspect,
|
|
138
|
+
})),
|
|
139
|
+
},
|
|
140
|
+
generation: {
|
|
141
|
+
manifestPath: input.paths.generationManifest,
|
|
142
|
+
manifestSha256: createHash('sha256').update(serialized).digest('hex'),
|
|
143
|
+
provider: input.provider,
|
|
144
|
+
candidates,
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
await writeDraftRecord(input.paths.draftRecord, record);
|
|
148
|
+
return record;
|
|
149
|
+
};
|
|
150
|
+
export const draftRunPaths = draftPaths;
|
|
151
|
+
export { draftCandidateIdFor };
|
|
152
|
+
//# sourceMappingURL=draft-run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draft-run.js","sourceRoot":"","sources":["../src/draft-run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EACL,yBAAyB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B;YAC5C,cAAc,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;YACrE,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,UAAU;SACX;KACF,CAAC;IACF,MAAM,gBAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IACxD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The run directory `12ui draft` creates and every later command is handed.
|
|
3
|
+
*
|
|
4
|
+
* It lives under the system temp root, not the working directory: measured
|
|
5
|
+
* across two harness passes, agents both spammed the user's repo with run
|
|
6
|
+
* artifacts and hardcoded `/tmp/<product>-12ui`, which ignores TMPDIR and
|
|
7
|
+
* collides the moment two runs share a machine. `mkdtemp` settles both — the
|
|
8
|
+
* directory is unique by construction and the caller never has to invent a
|
|
9
|
+
* path. The command prints it as its first line because it is the one value
|
|
10
|
+
* every subsequent command needs.
|
|
11
|
+
*/
|
|
12
|
+
export declare const DRAFT_RECORD_FILENAME = "draft.json";
|
|
13
|
+
export declare const DRAFT_REFERENCES_DIRECTORY = "references";
|
|
14
|
+
export declare const DRAFT_CANDIDATES_DIRECTORY = "candidates";
|
|
15
|
+
export declare const DRAFT_GENERATION_MANIFEST = "generation.json";
|
|
16
|
+
export declare const DRAFT_SELECTION_FILENAME = "selection.json";
|
|
17
|
+
export declare const DRAFT_BRANCH_DIRECTORY = "branch";
|
|
18
|
+
export declare const DRAFT_CANDIDATE_IDS: readonly ["A", "B", "C", "D"];
|
|
19
|
+
export type DraftCandidateId = typeof DRAFT_CANDIDATE_IDS[number];
|
|
20
|
+
export type DraftMode = 'new-interface' | 'exploratory-redesign' | 'structure-preserving-reskin';
|
|
21
|
+
/** `Editorial architecture homepage` -> `editorial-architecture-homepage`. */
|
|
22
|
+
export declare const draftSlug: (query: string) => string;
|
|
23
|
+
export type DraftPaths = {
|
|
24
|
+
runDir: string;
|
|
25
|
+
referencesDir: string;
|
|
26
|
+
candidatesDir: string;
|
|
27
|
+
generationManifest: string;
|
|
28
|
+
draftRecord: string;
|
|
29
|
+
selection: string;
|
|
30
|
+
branchDir: string;
|
|
31
|
+
};
|
|
32
|
+
export declare const draftPaths: (runDir: string) => DraftPaths;
|
|
33
|
+
export declare const createDraftWorkspace: (args: {
|
|
34
|
+
query: string;
|
|
35
|
+
/** Overridden only by tests; production always uses the system temp root. */
|
|
36
|
+
root?: string;
|
|
37
|
+
}) => Promise<DraftPaths>;
|
|
38
|
+
export type DraftCandidateRecord = {
|
|
39
|
+
id: DraftCandidateId;
|
|
40
|
+
/**
|
|
41
|
+
* What steered this candidate — the corpus reference's own declared labels,
|
|
42
|
+
* recorded as provenance. It is never written into the prompt: the image is
|
|
43
|
+
* the direction, and describing it back to the model would flatten it.
|
|
44
|
+
*/
|
|
45
|
+
direction: string;
|
|
46
|
+
prompt: string;
|
|
47
|
+
promptSha256: string;
|
|
48
|
+
outputPath: string;
|
|
49
|
+
idempotencyKey: string;
|
|
50
|
+
referenceId: string | null;
|
|
51
|
+
referencePath: string;
|
|
52
|
+
referenceSha256: string;
|
|
53
|
+
};
|
|
54
|
+
export type DraftRecord = {
|
|
55
|
+
version: 1;
|
|
56
|
+
createdAt: string;
|
|
57
|
+
runDir: string;
|
|
58
|
+
query: string;
|
|
59
|
+
mode: DraftMode;
|
|
60
|
+
aspect: 'landscape' | 'portrait' | 'square';
|
|
61
|
+
referenceMode: 'inspiration' | 'preserve-structure';
|
|
62
|
+
origin: string;
|
|
63
|
+
redesignSource: {
|
|
64
|
+
path: string;
|
|
65
|
+
sha256: string;
|
|
66
|
+
} | null;
|
|
67
|
+
corpus: {
|
|
68
|
+
query: string;
|
|
69
|
+
mode: 'direct' | 'balanced' | 'adventurer';
|
|
70
|
+
setId: string;
|
|
71
|
+
idempotencyKey: string;
|
|
72
|
+
manifestPath: string;
|
|
73
|
+
references: {
|
|
74
|
+
ordinal: number;
|
|
75
|
+
id: string;
|
|
76
|
+
path: string;
|
|
77
|
+
sha256: string;
|
|
78
|
+
aspect: string;
|
|
79
|
+
}[];
|
|
80
|
+
};
|
|
81
|
+
generation: {
|
|
82
|
+
manifestPath: string;
|
|
83
|
+
manifestSha256: string;
|
|
84
|
+
provider: 'auto' | 'codex' | 'openai';
|
|
85
|
+
candidates: DraftCandidateRecord[];
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
export declare const writeDraftRecord: (file: string, record: DraftRecord) => Promise<void>;
|
|
89
|
+
export declare const readDraftRecord: (file: string) => Promise<DraftRecord | undefined>;
|
|
90
|
+
//# sourceMappingURL=draft-workspace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draft-workspace.d.ts","sourceRoot":"","sources":["../src/draft-workspace.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,qBAAqB,eAAe,CAAC;AAClD,eAAO,MAAM,0BAA0B,eAAe,CAAC;AACvD,eAAO,MAAM,0BAA0B,eAAe,CAAC;AACvD,eAAO,MAAM,yBAAyB,oBAAoB,CAAC;AAC3D,eAAO,MAAM,wBAAwB,mBAAmB,CAAC;AACzD,eAAO,MAAM,sBAAsB,WAAW,CAAC;AAE/C,eAAO,MAAM,mBAAmB,+BAAgC,CAAC;AACjE,MAAM,MAAM,gBAAgB,GAAG,OAAO,mBAAmB,CAAC,MAAM,CAAC,CAAC;AAElE,MAAM,MAAM,SAAS,GAAG,eAAe,GAAG,sBAAsB,GAAG,6BAA6B,CAAC;AAEjG,8EAA8E;AAC9E,eAAO,MAAM,SAAS,GAAI,OAAO,MAAM,KAAG,MAYzC,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,MAAM,CA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I,EAAE,QAAQ,GAAG,UAAU,GAAG,YAAY,CAAC;QAC3C,KAAK,EAAE,MAAM,CAAC;QACd,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;KAC7F,CAAC;IACF,UAAU,EAAE;QACV,YAAY,EAAE,MAAM,CAAC;QACrB,cAAc,EAAE,MAAM,CAAC;QACvB,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;QACtC,UAAU,EAAE,oBAAoB,EAAE,CAAC;KACpC,CAAC;CACH,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAU,MAAM,MAAM,EAAE,QAAQ,WAAW,KAAG,OAAO,CAAC,IAAI,CAEtF,CAAC;AAEF,eAAO,MAAM,eAAe,GAAU,MAAM,MAAM,KAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAMnF,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { mkdtemp, readFile, writeFile } from 'node:fs/promises';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
/**
|
|
5
|
+
* The run directory `12ui draft` creates and every later command is handed.
|
|
6
|
+
*
|
|
7
|
+
* It lives under the system temp root, not the working directory: measured
|
|
8
|
+
* across two harness passes, agents both spammed the user's repo with run
|
|
9
|
+
* artifacts and hardcoded `/tmp/<product>-12ui`, which ignores TMPDIR and
|
|
10
|
+
* collides the moment two runs share a machine. `mkdtemp` settles both — the
|
|
11
|
+
* directory is unique by construction and the caller never has to invent a
|
|
12
|
+
* path. The command prints it as its first line because it is the one value
|
|
13
|
+
* every subsequent command needs.
|
|
14
|
+
*/
|
|
15
|
+
export const DRAFT_RECORD_FILENAME = 'draft.json';
|
|
16
|
+
export const DRAFT_REFERENCES_DIRECTORY = 'references';
|
|
17
|
+
export const DRAFT_CANDIDATES_DIRECTORY = 'candidates';
|
|
18
|
+
export const DRAFT_GENERATION_MANIFEST = 'generation.json';
|
|
19
|
+
export const DRAFT_SELECTION_FILENAME = 'selection.json';
|
|
20
|
+
export const DRAFT_BRANCH_DIRECTORY = 'branch';
|
|
21
|
+
export const DRAFT_CANDIDATE_IDS = ['A', 'B', 'C', 'D'];
|
|
22
|
+
/** `Editorial architecture homepage` -> `editorial-architecture-homepage`. */
|
|
23
|
+
export const draftSlug = (query) => {
|
|
24
|
+
const slug = query
|
|
25
|
+
.toLowerCase()
|
|
26
|
+
.replace(/[^a-z0-9]+/gu, '-')
|
|
27
|
+
.replace(/^-+|-+$/gu, '')
|
|
28
|
+
.split('-')
|
|
29
|
+
.filter(Boolean)
|
|
30
|
+
.slice(0, 4)
|
|
31
|
+
.join('-')
|
|
32
|
+
.slice(0, 32)
|
|
33
|
+
.replace(/-+$/u, '');
|
|
34
|
+
return slug || 'design';
|
|
35
|
+
};
|
|
36
|
+
export const draftPaths = (runDir) => {
|
|
37
|
+
const resolved = path.resolve(runDir);
|
|
38
|
+
return {
|
|
39
|
+
runDir: resolved,
|
|
40
|
+
referencesDir: path.join(resolved, DRAFT_REFERENCES_DIRECTORY),
|
|
41
|
+
candidatesDir: path.join(resolved, DRAFT_CANDIDATES_DIRECTORY),
|
|
42
|
+
generationManifest: path.join(resolved, DRAFT_GENERATION_MANIFEST),
|
|
43
|
+
draftRecord: path.join(resolved, DRAFT_RECORD_FILENAME),
|
|
44
|
+
selection: path.join(resolved, DRAFT_SELECTION_FILENAME),
|
|
45
|
+
branchDir: path.join(resolved, DRAFT_BRANCH_DIRECTORY),
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export const createDraftWorkspace = async (args) => {
|
|
49
|
+
const root = args.root ?? os.tmpdir();
|
|
50
|
+
const runDir = await mkdtemp(path.join(root, `12ui-${draftSlug(args.query)}-`));
|
|
51
|
+
return draftPaths(runDir);
|
|
52
|
+
};
|
|
53
|
+
export const writeDraftRecord = async (file, record) => {
|
|
54
|
+
await writeFile(file, `${JSON.stringify(record, null, 2)}\n`, { encoding: 'utf8', mode: 0o600 });
|
|
55
|
+
};
|
|
56
|
+
export const readDraftRecord = async (file) => {
|
|
57
|
+
try {
|
|
58
|
+
return JSON.parse(await readFile(file, 'utf8'));
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=draft-workspace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draft-workspace.js","sourceRoot":"","sources":["../src/draft-workspace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;;;;;;;GAUG;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,YAAY,CAAC;AAClD,MAAM,CAAC,MAAM,0BAA0B,GAAG,YAAY,CAAC;AACvD,MAAM,CAAC,MAAM,0BAA0B,GAAG,YAAY,CAAC;AACvD,MAAM,CAAC,MAAM,yBAAyB,GAAG,iBAAiB,CAAC;AAC3D,MAAM,CAAC,MAAM,wBAAwB,GAAG,gBAAgB,CAAC;AACzD,MAAM,CAAC,MAAM,sBAAsB,GAAG,QAAQ,CAAC;AAE/C,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAU,CAAC;AAKjE,8EAA8E;AAC9E,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAa,EAAU,EAAE;IACjD,MAAM,IAAI,GAAG,KAAK;SACf,WAAW,EAAE;SACb,OAAO,CAAC,cAAc,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AC,CAAC,CAAC;IAChF,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC,CAAC;AA6CF,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EAAE,IAAY,EAAE,MAAmB,EAAiB,EAAE;IACzF,MAAM,SAAS,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AACnG,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAAE,IAAY,EAAoC,EAAE;IACtF,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAgB,CAAC;IACjE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `12ui image batch-status` — the motion surface for `image generate-batch`.
|
|
3
|
+
*
|
|
4
|
+
* The batch deliberately keeps its output directory empty until it is terminal,
|
|
5
|
+
* which is correct for atomicity and disastrous for patience: a caller that can
|
|
6
|
+
* only observe an empty directory concludes the batch died. This reads the
|
|
7
|
+
* staging ledgers instead and reports what each candidate is actually doing and
|
|
8
|
+
* for how long, so the wait is legible without being interrupted.
|
|
9
|
+
*/
|
|
10
|
+
export type ImageBatchCandidateProgress = {
|
|
11
|
+
id: string;
|
|
12
|
+
status: 'complete' | 'generating' | 'prepared' | 'failed' | 'not-started';
|
|
13
|
+
outputPath: string;
|
|
14
|
+
startedAt?: string;
|
|
15
|
+
elapsedSeconds?: number;
|
|
16
|
+
typicalSeconds: number;
|
|
17
|
+
error?: string;
|
|
18
|
+
};
|
|
19
|
+
export type ImageBatchStatusReport = {
|
|
20
|
+
manifestPath: string;
|
|
21
|
+
batchAttemptFile: string;
|
|
22
|
+
completionPath: string;
|
|
23
|
+
complete: boolean;
|
|
24
|
+
/** No provider call was ever made. Not a failure, and not work in flight. */
|
|
25
|
+
neverDispatched: boolean;
|
|
26
|
+
counts: {
|
|
27
|
+
total: number;
|
|
28
|
+
complete: number;
|
|
29
|
+
generating: number;
|
|
30
|
+
prepared: number;
|
|
31
|
+
failed: number;
|
|
32
|
+
};
|
|
33
|
+
candidates: ImageBatchCandidateProgress[];
|
|
34
|
+
narrative: string;
|
|
35
|
+
nextAction?: string;
|
|
36
|
+
elapsedSeconds?: number;
|
|
37
|
+
};
|
|
38
|
+
export declare const summarizeImageBatchProgress: (args: {
|
|
39
|
+
manifestPath: string;
|
|
40
|
+
now?: number;
|
|
41
|
+
}) => Promise<ImageBatchStatusReport>;
|
|
42
|
+
//# sourceMappingURL=image-batch-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-batch-status.d.ts","sourceRoot":"","sources":["../src/image-batch-status.ts"],"names":[],"mappings":"AA+BA;;;;;;;;GAQG;AAEH,MAAM,MAAM,2BAA2B,GAAG;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,UAAU,GAAG,YAAY,GAAG,UAAU,GAAG,QAAQ,GAAG,aAAa,CAAC;IAC1E,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,6EAA6E;IAC7E,eAAe,EAAE,OAAO,CAAC;IACzB,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAClG,UAAU,EAAE,2BAA2B,EAAE,CAAC;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AA6CF,eAAO,MAAM,2BAA2B,GAAU,MAAM;IACtD,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,KAAG,OAAO,CAAC,sBAAsB,CAoGjC,CAAC"}
|