@12ui/design 0.2.74 → 0.2.75
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/SKILL.md +1 -1
- package/dist/cli-codex-readiness.d.ts +19 -6
- package/dist/cli-codex-readiness.d.ts.map +1 -1
- package/dist/cli-codex-readiness.js +36 -16
- package/dist/cli-codex-readiness.js.map +1 -1
- package/dist/cli-help/design.d.ts +9 -2
- package/dist/cli-help/design.d.ts.map +1 -1
- package/dist/cli-help/design.js +17 -2
- package/dist/cli-help/design.js.map +1 -1
- package/dist/cli-help/index.d.ts +9 -2
- package/dist/cli-help/index.d.ts.map +1 -1
- package/dist/cli-run.d.ts.map +1 -1
- package/dist/cli-run.js +6 -0
- package/dist/cli-run.js.map +1 -1
- package/dist/cli-usage.d.ts.map +1 -1
- package/dist/cli-usage.js +1 -0
- package/dist/cli-usage.js.map +1 -1
- package/dist/cli-workspace-command.js +1 -1
- package/dist/cli-workspace-command.js.map +1 -1
- package/dist/cli-workspace-draw.d.ts +23 -0
- package/dist/cli-workspace-draw.d.ts.map +1 -0
- package/dist/cli-workspace-draw.js +97 -0
- package/dist/cli-workspace-draw.js.map +1 -0
- package/dist/codex-binary.d.ts +20 -0
- package/dist/codex-binary.d.ts.map +1 -0
- package/dist/codex-binary.js +46 -0
- package/dist/codex-binary.js.map +1 -0
- package/dist/slate-image-executor.js +1 -1
- package/dist/slate-image-executor.js.map +1 -1
- package/dist/slate-local-image.d.ts +3 -6
- package/dist/slate-local-image.d.ts.map +1 -1
- package/dist/slate-local-image.js +2 -18
- package/dist/slate-local-image.js.map +1 -1
- package/dist/workspace-draw-client.d.ts +69 -0
- package/dist/workspace-draw-client.d.ts.map +1 -0
- package/dist/workspace-draw-client.js +193 -0
- package/dist/workspace-draw-client.js.map +1 -0
- package/dist/workspace-draw-codex.d.ts +49 -0
- package/dist/workspace-draw-codex.d.ts.map +1 -0
- package/dist/workspace-draw-codex.js +89 -0
- package/dist/workspace-draw-codex.js.map +1 -0
- package/dist/workspace-draw-engine.d.ts +39 -0
- package/dist/workspace-draw-engine.d.ts.map +1 -0
- package/dist/workspace-draw-engine.js +72 -0
- package/dist/workspace-draw-engine.js.map +1 -0
- package/dist/workspace-draw-messages.d.ts +45 -0
- package/dist/workspace-draw-messages.d.ts.map +1 -0
- package/dist/workspace-draw-messages.js +48 -0
- package/dist/workspace-draw-messages.js.map +1 -0
- package/dist/workspace-draw-run.d.ts +43 -0
- package/dist/workspace-draw-run.d.ts.map +1 -0
- package/dist/workspace-draw-run.js +328 -0
- package/dist/workspace-draw-run.js.map +1 -0
- package/dist/workspace-draw-store.d.ts +23 -0
- package/dist/workspace-draw-store.d.ts.map +1 -0
- package/dist/workspace-draw-store.js +65 -0
- package/dist/workspace-draw-store.js.map +1 -0
- package/dist/workspace-draw-types.d.ts +121 -0
- package/dist/workspace-draw-types.d.ts.map +1 -0
- package/dist/workspace-draw-types.js +21 -0
- package/dist/workspace-draw-types.js.map +1 -0
- package/open-design.json +2 -2
- package/package.json +1 -1
- package/runtime/codex-conversion/src/codex/home.mjs +43 -14
- package/runtime/codex-conversion/src/images/native-files.mjs +20 -0
- package/runtime/codex-conversion/src/images/native-invoke.mjs +5 -2
- package/runtime/codex-conversion/src/images/native-records.mjs +75 -3
- package/runtime/codex-conversion/src/images/native.mjs +7 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-draw-engine.d.ts","sourceRoot":"","sources":["../src/workspace-draw-engine.ts"],"names":[],"mappings":"AAIA,OAAO,EAAuB,KAAK,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE9G,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE7E;;;;GAIG;AAEH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,UAAU,CAAC;AAElD,MAAM,MAAM,YAAY,GACpB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,eAAe,CAAA;CAAE,GACxE;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAA;CAAE,CAAC;AAEhF,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC,UAAU,CAAA;CAAE,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;AAE9F,0EAA0E;AAC1E,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,CAAC,UAAU,KAAG,MAAgF,CAAC;AAEtI;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAU,MAAM,MAAM,EAAE,UAAU,MAAM,GAAG,IAAI,KAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAYtG,CAAC;AAIF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAAI,MAAM,MAAM,GAAG,SAAS,EAAE,KAAK,MAAM,CAAC,UAAU,KAAG,eAAe,GAAG,IAOzG,CAAC;AAEF,eAAO,MAAM,YAAY,GAAU,MAAM;IACvC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IACvB,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB,KAAG,OAAO,CAAC,YAAY,CA6BvB,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { readdir } from 'node:fs/promises';
|
|
2
|
+
import { homedir } from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { probeCodexReadiness } from './cli-codex-readiness.js';
|
|
5
|
+
import { locateCodexBinary, NO_CODEX_BINARY_REASON } from './codex-binary.js';
|
|
6
|
+
/** "The same home": the calling agent's `CODEX_HOME`, else `~/.codex`. */
|
|
7
|
+
export const codexHomeOf = (env) => path.resolve(env.CODEX_HOME?.trim() || path.join(homedir(), '.codex'));
|
|
8
|
+
/**
|
|
9
|
+
* `<home>/sessions/**\/rollout-*-<threadId>.jsonl`: the calling agent's own rollout, cheap proof that the drawing
|
|
10
|
+
* account is the caller's. Null when the thread id is unset or no such file exists.
|
|
11
|
+
*/
|
|
12
|
+
export const findSameHomeRollout = async (home, threadId) => {
|
|
13
|
+
if (!threadId)
|
|
14
|
+
return null;
|
|
15
|
+
let entries;
|
|
16
|
+
try {
|
|
17
|
+
entries = await readdir(path.join(home, 'sessions'), { recursive: true });
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
if (error.code === 'ENOENT')
|
|
21
|
+
return null;
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
const suffix = `-${threadId}.jsonl`;
|
|
25
|
+
const match = entries.filter((entry) => path.basename(entry).startsWith('rollout-') && entry.endsWith(suffix)).sort()[0];
|
|
26
|
+
return match ? path.join(home, 'sessions', match) : null;
|
|
27
|
+
};
|
|
28
|
+
const isRequestedEngine = (value) => value === 'auto' || value === 'codex';
|
|
29
|
+
/**
|
|
30
|
+
* `--engine` is strict: anything but auto or codex is a usage error. `TWELVE_UI_ENGINE` is shared with conversion,
|
|
31
|
+
* where `api` is a valid choice, so for this verb it counts only when it names auto or codex; any other value
|
|
32
|
+
* leaves the default, and a conversion setting never stops a workspace request from drawing.
|
|
33
|
+
*/
|
|
34
|
+
export const parseRequestedEngine = (flag, env) => {
|
|
35
|
+
if (flag !== undefined) {
|
|
36
|
+
const value = flag.trim();
|
|
37
|
+
return isRequestedEngine(value) ? value : null;
|
|
38
|
+
}
|
|
39
|
+
const fromEnv = env.TWELVE_UI_ENGINE?.trim() ?? '';
|
|
40
|
+
return isRequestedEngine(fromEnv) ? fromEnv : 'auto';
|
|
41
|
+
};
|
|
42
|
+
export const chooseEngine = async (args) => {
|
|
43
|
+
const home = codexHomeOf(args.env);
|
|
44
|
+
const located = locateCodexBinary(args.env);
|
|
45
|
+
const readiness = located
|
|
46
|
+
? await (args.probe ?? probeCodexReadiness)({ env: args.env })
|
|
47
|
+
: { ready: false, reason: NO_CODEX_BINARY_REASON, check: 'no_binary', codexBin: '', codexHome: home };
|
|
48
|
+
if (readiness.ready) {
|
|
49
|
+
const version = readiness.version ?? 'unknown';
|
|
50
|
+
const threadId = args.env.CODEX_THREAD_ID?.trim() || null;
|
|
51
|
+
return {
|
|
52
|
+
ok: true,
|
|
53
|
+
engine: 'codex',
|
|
54
|
+
reason: `Codex ${version} signed in with ChatGPT in ${readiness.codexHome}`,
|
|
55
|
+
codex: {
|
|
56
|
+
binary: readiness.codexBin,
|
|
57
|
+
version,
|
|
58
|
+
home: readiness.codexHome,
|
|
59
|
+
threadId,
|
|
60
|
+
sameHomeRollout: await findSameHomeRollout(readiness.codexHome, threadId),
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
ok: false,
|
|
66
|
+
check: readiness.check === 'ready' ? 'binary' : readiness.check,
|
|
67
|
+
reason: located
|
|
68
|
+
? `Codex at ${located.binary} (from ${located.source}) cannot draw here: ${readiness.reason}`
|
|
69
|
+
: `Codex cannot draw here: ${readiness.reason}`,
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=workspace-draw-engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-draw-engine.js","sourceRoot":"","sources":["../src/workspace-draw-engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,mBAAmB,EAAiD,MAAM,0BAA0B,CAAC;AAC9G,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAiB9E,0EAA0E;AAC1E,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAsB,EAAU,EA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E;YAC3E,KAAK,EAAE;gBACL,MAAM,EAAE,SAAS,CAAC,QAAQ;gBAC1B,OAAO;gBACP,IAAI,EAAE,SAAS,CAAC,SAAS;gBACzB,QAAQ;gBACR,eAAe,EAAE,MAAM,mBAAmB,CAAC,SAAS,CAAC,SAAS,EAAE,QAAQ,CAAC;aAC1E;SACF,CAAC;IACJ,CAAC;IACD,OAAO;QACL,EAAE,EAAE,KAAK;QACT,KAAK,EAAE,SAAS,CAAC,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK;QAC/D,MAAM,EAAE,OAAO;YACb,CAAC,CAAC,YAAY,OAAO,CAAC,MAAM,UAAU,OAAO,CAAC,MAAM,uBAAuB,SAAS,CAAC,MAAM,EAAE;YAC7F,CAAC,CAAC,2BAA2B,SAAS,CAAC,MAAM,EAAE;KAClD,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { CodexReadinessCheck } from './cli-codex-readiness.js';
|
|
2
|
+
export declare const DRAW_MESSAGES: {
|
|
3
|
+
readonly added: (args: {
|
|
4
|
+
count: number;
|
|
5
|
+
edit: boolean;
|
|
6
|
+
label: string | null;
|
|
7
|
+
}) => string;
|
|
8
|
+
readonly replayed: (args: {
|
|
9
|
+
count: number;
|
|
10
|
+
}) => string;
|
|
11
|
+
readonly partial: (args: {
|
|
12
|
+
added: number;
|
|
13
|
+
total: number;
|
|
14
|
+
}) => string;
|
|
15
|
+
readonly failed: (args: {
|
|
16
|
+
total: number;
|
|
17
|
+
}) => string;
|
|
18
|
+
readonly tokenInvalid: () => string;
|
|
19
|
+
readonly unknownOp: () => string;
|
|
20
|
+
readonly notDrawing: () => string;
|
|
21
|
+
readonly opInProgress: () => string;
|
|
22
|
+
readonly usage: (reason: string) => string;
|
|
23
|
+
readonly needsEscalation: () => string;
|
|
24
|
+
readonly unreachable: () => string;
|
|
25
|
+
readonly serverFault: () => string;
|
|
26
|
+
/**
|
|
27
|
+
* Codex cannot draw here (decision D2-B): why, in the user's words (the probe's own detail, which names conversion
|
|
28
|
+
* flags, stays in `engineReason` and the record), then that nothing was drawn and that drawing on 12ui needs a 12ui
|
|
29
|
+
* sign-in. The skill relays it word for word.
|
|
30
|
+
*/
|
|
31
|
+
readonly noEngine: (check: Exclude<CodexReadinessCheck, "ready">) => string;
|
|
32
|
+
readonly codexStopped: () => string;
|
|
33
|
+
readonly cliOutdated: () => string;
|
|
34
|
+
};
|
|
35
|
+
/** Why Codex cannot draw here, one sentence per readiness check that can fail. */
|
|
36
|
+
export declare const CODEX_NOT_READY: Record<Exclude<CodexReadinessCheck, 'ready'>, string>;
|
|
37
|
+
/** What a failed option shows on the screen: fixed sentences, at most 200 characters each (I1 2.3). */
|
|
38
|
+
export declare const OPTION_FAILURES: {
|
|
39
|
+
readonly noImage: "Codex did not return an image for this option.";
|
|
40
|
+
readonly protocol: "Codex made more than one image call for this option.";
|
|
41
|
+
readonly timeout: "Codex took too long to draw this option.";
|
|
42
|
+
readonly changed: "This option was drawn on this Mac with different inputs and cannot be drawn again here.";
|
|
43
|
+
readonly codexUnavailable: "Codex cannot draw on this Mac, and drawing on 12ui needs a 12ui sign-in.";
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=workspace-draw-messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-draw-messages.d.ts","sourceRoot":"","sources":["../src/workspace-draw-messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAUpE,eAAO,MAAM,aAAa;2BACV;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,KAAG,MAAM;8BAG5D;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,KAAG,MAAM;6BAG3B;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAG,MAAM;4BAG1C;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,KAAG,MAAM;iCAGvB,MAAM;8BACT,MAAM;+BACL,MAAM;iCACJ,MAAM;6BACR,MAAM,KAAG,MAAM;oCACV,MAAM;gCACV,MAAM;gCACN,MAAM;IACvB;;;;OAIG;+BACe,OAAO,CAAC,mBAAmB,EAAE,OAAO,CAAC,KAAG,MAAM;iCAG9C,MAAM;gCACP,MAAM;CACf,CAAC;AAEX,kFAAkF;AAClF,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,OAAO,CAAC,mBAAmB,EAAE,OAAO,CAAC,EAAE,MAAM,CASjF,CAAC;AAEF,uGAAuG;AACvG,eAAO,MAAM,eAAe;;;;;;CAMlB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every sentence `12ui workspace draw` can print as its `message`, and every failure sentence it pushes to the
|
|
3
|
+
* screen. The agent replies with `message` in one sentence, so none of these may name a price, a credit, a plan,
|
|
4
|
+
* an upgrade or a subscription; a test scans each template with the plugin validator's `scanPaidSurface`.
|
|
5
|
+
*/
|
|
6
|
+
const plural = (count, word) => `${count} ${word}${count === 1 ? '' : 's'}`;
|
|
7
|
+
export const DRAW_MESSAGES = {
|
|
8
|
+
added: (args) => (args.edit ? `Added the edited version${args.label ? ` ${args.label}` : ''}.` : `Added ${plural(args.count, 'option')}.`),
|
|
9
|
+
replayed: (args) => (args.count === 1 ? 'This option was already added.' : `These ${plural(args.count, 'option')} were already added.`),
|
|
10
|
+
partial: (args) => (`Added ${args.added} of ${plural(args.total, 'option')}; the rest could not be drawn and show as failed in the workspace.`),
|
|
11
|
+
failed: (args) => (args.total === 1 ? 'The option could not be drawn; it shows as failed in the workspace.' : `None of the ${plural(args.total, 'option')} could be drawn; they show as failed in the workspace.`),
|
|
12
|
+
tokenInvalid: () => 'The upload token is not valid any more. Call design.slate.data for a fresh one, then run the same command with it.',
|
|
13
|
+
unknownOp: () => 'That request is not in this workspace.',
|
|
14
|
+
notDrawing: () => 'That request has no options to draw.',
|
|
15
|
+
opInProgress: () => 'This request is already being drawn on this Mac. Wait for that command to finish.',
|
|
16
|
+
usage: (reason) => `${reason} Usage: 12ui workspace draw --op <request id> --token <upload token> [--origin <url>] [--engine auto|codex] [--dry-run]`,
|
|
17
|
+
needsEscalation: () => 'This command must run outside the sandbox. Run the same command again with escalated permissions.',
|
|
18
|
+
unreachable: () => 'design.12ui.com could not be reached from here. Run the same command again with escalated permissions.',
|
|
19
|
+
serverFault: () => 'design.12ui.com did not finish the request. Run the same command again.',
|
|
20
|
+
/**
|
|
21
|
+
* Codex cannot draw here (decision D2-B): why, in the user's words (the probe's own detail, which names conversion
|
|
22
|
+
* flags, stays in `engineReason` and the record), then that nothing was drawn and that drawing on 12ui needs a 12ui
|
|
23
|
+
* sign-in. The skill relays it word for word.
|
|
24
|
+
*/
|
|
25
|
+
noEngine: (check) => (`${CODEX_NOT_READY[check]} Nothing was drawn. Drawing on 12ui needs a 12ui sign-in (12ui login).`),
|
|
26
|
+
codexStopped: () => 'Codex stopped being able to draw on this Mac partway through. Run the same command again.',
|
|
27
|
+
cliOutdated: () => 'This 12ui command line is older than the Design workspace needs. Install the current one, then run the same command.',
|
|
28
|
+
};
|
|
29
|
+
/** Why Codex cannot draw here, one sentence per readiness check that can fail. */
|
|
30
|
+
export const CODEX_NOT_READY = {
|
|
31
|
+
no_binary: 'Codex is not installed on this Mac.',
|
|
32
|
+
binary: 'The Codex command line on this Mac could not run.',
|
|
33
|
+
auth_file: 'Codex on this Mac is not signed in.',
|
|
34
|
+
chatgpt_login: 'Codex on this Mac is not signed in with ChatGPT.',
|
|
35
|
+
login_status: 'Codex on this Mac could not confirm its sign-in.',
|
|
36
|
+
exec_flags: 'The Codex command line on this Mac is too old to draw; update Codex.',
|
|
37
|
+
models: 'Codex on this Mac has not loaded the models it can use; open Codex once, then try again.',
|
|
38
|
+
image_generation: 'Codex image generation is not turned on for this Codex sign-in.',
|
|
39
|
+
};
|
|
40
|
+
/** What a failed option shows on the screen: fixed sentences, at most 200 characters each (I1 2.3). */
|
|
41
|
+
export const OPTION_FAILURES = {
|
|
42
|
+
noImage: 'Codex did not return an image for this option.',
|
|
43
|
+
protocol: 'Codex made more than one image call for this option.',
|
|
44
|
+
timeout: 'Codex took too long to draw this option.',
|
|
45
|
+
changed: 'This option was drawn on this Mac with different inputs and cannot be drawn again here.',
|
|
46
|
+
codexUnavailable: 'Codex cannot draw on this Mac, and drawing on 12ui needs a 12ui sign-in.',
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=workspace-draw-messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-draw-messages.js","sourceRoot":"","sources":["../src/workspace-draw-messages.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,MAAM,MAAM,GAAG,CAAC,KAAa,EAAE,IAAY,EAAU,EAAE,CAAC,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;AAEpG,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,KAAK,EAAE,CAAC,IAA4D,EAAU,EAAE,CAAC,CAC/E,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,2BAA2B,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,CACxH;IACD,QAAQ,EAAE,CAAC,IAAuB,EAAU,EAAE,CAAC,CAC7C,IAAI,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,IAAI,CAAC,KAAK,E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,EAAE,iEAAiE;CACpF,CAAC;AAEF,uGAAuG;AACvG,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,OAAO,EAAE,gDAAgD;IACzD,QAAQ,EAAE,sDAAsD;IAChE,OAAO,EAAE,0CAA0C;IACnD,OAAO,EAAE,yFAAyF;IAClG,gBAAgB,EAAE,0EAA0E;CACpF,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type DrawFetch } from './workspace-draw-client.js';
|
|
2
|
+
import { type ExecutorFactory } from './workspace-draw-codex.js';
|
|
3
|
+
import { type ReadinessProbe, type RequestedEngine } from './workspace-draw-engine.js';
|
|
4
|
+
import { type DrawCode } from './workspace-draw-types.js';
|
|
5
|
+
/**
|
|
6
|
+
* `12ui workspace draw`, start to finish (design section 3): the sandbox gate, the op lock, the frozen plan and its
|
|
7
|
+
* images, Codex readiness for the op, every pending option drawn at once, each option pushed as it lands, and one
|
|
8
|
+
* JSON line with a run record behind it. The command builds no prompt: it executes the plan the server froze.
|
|
9
|
+
* When Codex cannot draw here it spends nothing and draws nothing (decision D2-B): it pushes each pending option's
|
|
10
|
+
* failure and exits 4 with the reason and that drawing on 12ui needs a 12ui sign-in.
|
|
11
|
+
*/
|
|
12
|
+
export type DrawArguments = {
|
|
13
|
+
opId: string;
|
|
14
|
+
token: string;
|
|
15
|
+
origin: string;
|
|
16
|
+
engine: RequestedEngine;
|
|
17
|
+
dryRun: boolean;
|
|
18
|
+
};
|
|
19
|
+
export type DrawDependencies = {
|
|
20
|
+
env?: NodeJS.ProcessEnv;
|
|
21
|
+
fetch?: DrawFetch;
|
|
22
|
+
sleep?: (milliseconds: number) => Promise<void>;
|
|
23
|
+
now?: () => Date;
|
|
24
|
+
dataRoot?: string;
|
|
25
|
+
cliVersion?: string;
|
|
26
|
+
probe?: ReadinessProbe;
|
|
27
|
+
executorFactory?: ExecutorFactory;
|
|
28
|
+
/** One progress line per option, on stderr. */
|
|
29
|
+
progress?: (line: string) => void;
|
|
30
|
+
};
|
|
31
|
+
export type DrawResult = {
|
|
32
|
+
exitCode: number;
|
|
33
|
+
output: Record<string, unknown>;
|
|
34
|
+
};
|
|
35
|
+
type Abort = {
|
|
36
|
+
code: DrawCode;
|
|
37
|
+
message: string;
|
|
38
|
+
};
|
|
39
|
+
/** Server and transport failures, as the command's refusal codes. Anything else is a fault and is thrown. */
|
|
40
|
+
export declare const abortOf: (error: unknown) => Abort | null;
|
|
41
|
+
export declare const runWorkspaceDraw: (args: DrawArguments, deps?: DrawDependencies) => Promise<DrawResult>;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=workspace-draw-run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-draw-run.d.ts","sourceRoot":"","sources":["../src/workspace-draw-run.ts"],"names":[],"mappings":"AACA,OAAO,EAAwE,KAAK,SAAS,EAAkB,MAAM,4BAA4B,CAAC;AAClJ,OAAO,EAAuB,KAAK,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACtF,OAAO,EAAgB,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAGrG,OAAO,EAGL,KAAK,QAAQ,EASd,MAAM,2BAA2B,CAAC;AAEnC;;;;;;GAMG;AAEH,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,eAAe,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC;AAEtH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,KAAK,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CAAC;AAE/E,KAAK,KAAK,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAUjD,6GAA6G;AAC7G,eAAO,MAAM,OAAO,GAAI,OAAO,OAAO,KAAG,KAAK,GAAG,IAehD,CAAC;AAyBF,eAAO,MAAM,gBAAgB,GAAU,MAAM,aAAa,EAAE,OAAM,gBAAqB,KAAG,OAAO,CAAC,UAAU,CA8G3G,CAAC"}
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import { packageIdentity } from './client-version.js';
|
|
2
|
+
import { createDrawClient, DrawHttpError, DrawTransportError } from './workspace-draw-client.js';
|
|
3
|
+
import { drawOptionWithCodex } from './workspace-draw-codex.js';
|
|
4
|
+
import { chooseEngine } from './workspace-draw-engine.js';
|
|
5
|
+
import { DRAW_MESSAGES, OPTION_FAILURES } from './workspace-draw-messages.js';
|
|
6
|
+
import { defaultDataRoot, opRootOf, readPreviousRecord, takeOpLock, writeRecord } from './workspace-draw-store.js';
|
|
7
|
+
import { DRAW_EXIT_CODES, RECORD_SCHEMA, } from './workspace-draw-types.js';
|
|
8
|
+
class DrawAbort extends Error {
|
|
9
|
+
abort;
|
|
10
|
+
constructor(abort) {
|
|
11
|
+
super(abort.message);
|
|
12
|
+
this.abort = abort;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/** Server and transport failures, as the command's refusal codes. Anything else is a fault and is thrown. */
|
|
16
|
+
export const abortOf = (error) => {
|
|
17
|
+
if (error instanceof DrawAbort)
|
|
18
|
+
return error.abort;
|
|
19
|
+
if (error instanceof DrawTransportError) {
|
|
20
|
+
if (error.kind === 'unreachable')
|
|
21
|
+
return { code: 'needs_escalation', message: DRAW_MESSAGES.unreachable() };
|
|
22
|
+
if (error.kind === 'corrupt')
|
|
23
|
+
return { code: 'needs_escalation', message: DRAW_MESSAGES.serverFault() };
|
|
24
|
+
return { code: 'cli_outdated', message: DRAW_MESSAGES.cliOutdated() };
|
|
25
|
+
}
|
|
26
|
+
if (error instanceof DrawHttpError) {
|
|
27
|
+
if (error.status === 426 || error.code === 'cli_outdated')
|
|
28
|
+
return { code: 'cli_outdated', message: DRAW_MESSAGES.cliOutdated() };
|
|
29
|
+
if (error.code === 'token_invalid')
|
|
30
|
+
return { code: 'token_invalid', message: DRAW_MESSAGES.tokenInvalid() };
|
|
31
|
+
if (error.code === 'unknown_op')
|
|
32
|
+
return { code: 'unknown_op', message: DRAW_MESSAGES.unknownOp() };
|
|
33
|
+
if (error.code === 'not_a_drawing_request')
|
|
34
|
+
return { code: 'unknown_op', message: DRAW_MESSAGES.notDrawing() };
|
|
35
|
+
return { code: 'needs_escalation', message: DRAW_MESSAGES.serverFault() };
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
};
|
|
39
|
+
const refusal = (opId, abort) => ({
|
|
40
|
+
exitCode: DRAW_EXIT_CODES[abort.code],
|
|
41
|
+
output: { ok: false, code: abort.code, op: opId, message: abort.message, record: null },
|
|
42
|
+
});
|
|
43
|
+
/** The precedence of run-level outcomes when several options fail differently: the one a rerun most needs first. */
|
|
44
|
+
const ABORT_PRECEDENCE = ['cli_outdated', 'token_invalid', 'unknown_op', 'needs_escalation'];
|
|
45
|
+
const imageNames = (plan) => [...new Set(plan.options.flatMap((option) => option.images.map((image) => image.name)))];
|
|
46
|
+
const imageRecords = (option, fetched) => option.images.map((image) => {
|
|
47
|
+
const bytes = fetched.get(image.name);
|
|
48
|
+
return { name: image.name, referenceId: image.referenceId ?? bytes.referenceId, versionId: image.versionId, sha256: bytes.sha256, mimeType: bytes.mimeType };
|
|
49
|
+
});
|
|
50
|
+
export const runWorkspaceDraw = async (args, deps = {}) => {
|
|
51
|
+
const env = deps.env ?? process.env;
|
|
52
|
+
// 1. Sandbox gate: before any network call, file write or dispatch.
|
|
53
|
+
if ((env.CODEX_SANDBOX ?? '') !== '')
|
|
54
|
+
return refusal(args.opId, { code: 'needs_escalation', message: DRAW_MESSAGES.needsEscalation() });
|
|
55
|
+
const clock = deps.now ?? (() => new Date());
|
|
56
|
+
const progress = deps.progress ?? (() => undefined);
|
|
57
|
+
const cliVersion = deps.cliVersion ?? packageIdentity().version;
|
|
58
|
+
const client = createDrawClient({
|
|
59
|
+
origin: args.origin,
|
|
60
|
+
token: args.token,
|
|
61
|
+
opId: args.opId,
|
|
62
|
+
cliVersion,
|
|
63
|
+
...(deps.fetch ? { fetch: deps.fetch } : {}),
|
|
64
|
+
...(deps.sleep ? { sleep: deps.sleep } : {}),
|
|
65
|
+
});
|
|
66
|
+
const opRoot = opRootOf(deps.dataRoot ?? defaultDataRoot(env), args.opId);
|
|
67
|
+
// 2. Op lock (a dry run draws nothing and writes nothing, so it takes none).
|
|
68
|
+
const lock = args.dryRun ? null : await takeOpLock(opRoot);
|
|
69
|
+
if (!args.dryRun && !lock)
|
|
70
|
+
return refusal(args.opId, { code: 'op_in_progress', message: DRAW_MESSAGES.opInProgress() });
|
|
71
|
+
try {
|
|
72
|
+
const startedAt = clock();
|
|
73
|
+
// 3. The plan and every image it names, each checked against its sha256.
|
|
74
|
+
let plan;
|
|
75
|
+
const fetched = new Map();
|
|
76
|
+
try {
|
|
77
|
+
plan = await client.plan();
|
|
78
|
+
const names = imageNames(plan);
|
|
79
|
+
const images = await Promise.all(names.map((name) => client.image(name)));
|
|
80
|
+
names.forEach((name, index) => fetched.set(name, images[index]));
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
const abort = abortOf(error);
|
|
84
|
+
if (!abort)
|
|
85
|
+
throw error;
|
|
86
|
+
return refusal(args.opId, abort);
|
|
87
|
+
}
|
|
88
|
+
// 4. Codex readiness, once for the whole op.
|
|
89
|
+
const choice = await chooseEngine({ env, ...(deps.probe ? { probe: deps.probe } : {}) });
|
|
90
|
+
if (!choice.ok) {
|
|
91
|
+
const refused = { ok: false, code: 'no_engine', op: args.opId, engine: null, engineReason: choice.reason, message: DRAW_MESSAGES.noEngine(choice.check) };
|
|
92
|
+
// A dry run, or `--engine codex`, asked only whether Codex can draw: nothing is pushed.
|
|
93
|
+
if (args.dryRun || args.engine === 'codex') {
|
|
94
|
+
return { exitCode: DRAW_EXIT_CODES.no_engine, output: { ...refused, ...(args.dryRun ? { dryRun: true } : {}), record: null } };
|
|
95
|
+
}
|
|
96
|
+
const unavailable = await recordCodexUnavailable({ args, plan, fetched, client, opRoot, clock, startedAt, cliVersion, reason: choice.reason, progress });
|
|
97
|
+
// A refused push (a stale token, say) is what a rerun needs first; with nothing waiting to be drawn, the
|
|
98
|
+
// request is reported as it stands, whatever Codex can do now.
|
|
99
|
+
const outcome = outcomeOf(plan, unavailable.runs);
|
|
100
|
+
const pending = plan.options.some((option) => option.state === 'pending');
|
|
101
|
+
if (ABORT_PRECEDENCE.includes(outcome.code) || !pending) {
|
|
102
|
+
const code = outcome.code;
|
|
103
|
+
return { exitCode: DRAW_EXIT_CODES[code], output: { ...refused, ok: DRAW_EXIT_CODES[code] === 0, code, message: outcome.message, record: unavailable.recordPath } };
|
|
104
|
+
}
|
|
105
|
+
return { exitCode: DRAW_EXIT_CODES.no_engine, output: { ...refused, record: unavailable.recordPath } };
|
|
106
|
+
}
|
|
107
|
+
if (args.dryRun)
|
|
108
|
+
return dryRun(plan, fetched, choice, args.opId);
|
|
109
|
+
// 5-7. Every pending option at once; each settles on its own.
|
|
110
|
+
const previous = await readPreviousRecord(opRoot);
|
|
111
|
+
const runs = await Promise.all(plan.options.map((option) => drawOption({
|
|
112
|
+
option, fetched, engine: choice.engine, client, env, opRoot, clock, previous, deps,
|
|
113
|
+
}).then((run) => {
|
|
114
|
+
progress(progressLine(run, choice.engine));
|
|
115
|
+
return run;
|
|
116
|
+
})));
|
|
117
|
+
// 8. The record, then the outcome.
|
|
118
|
+
const finishedAt = clock();
|
|
119
|
+
const record = {
|
|
120
|
+
schema: RECORD_SCHEMA,
|
|
121
|
+
opId: args.opId,
|
|
122
|
+
origin: args.origin,
|
|
123
|
+
cliVersion,
|
|
124
|
+
engine: choice.engine,
|
|
125
|
+
engineReason: choice.reason,
|
|
126
|
+
codex: choice.codex,
|
|
127
|
+
plan: { planDigest: plan.planDigest, promptRevision: plan.promptRevision, kind: plan.kind, mode: plan.mode },
|
|
128
|
+
startedAt: startedAt.toISOString(),
|
|
129
|
+
finishedAt: finishedAt.toISOString(),
|
|
130
|
+
wallMs: finishedAt.getTime() - startedAt.getTime(),
|
|
131
|
+
options: runs.map((run) => run.record),
|
|
132
|
+
};
|
|
133
|
+
const recordPath = await writeRecord(opRoot, record);
|
|
134
|
+
const { code, message } = outcomeOf(plan, runs);
|
|
135
|
+
return {
|
|
136
|
+
exitCode: DRAW_EXIT_CODES[code],
|
|
137
|
+
output: {
|
|
138
|
+
ok: DRAW_EXIT_CODES[code] === 0,
|
|
139
|
+
code,
|
|
140
|
+
op: args.opId,
|
|
141
|
+
engine: choice.engine,
|
|
142
|
+
engineReason: choice.reason,
|
|
143
|
+
options: runs.map((run) => ({
|
|
144
|
+
key: run.record.key,
|
|
145
|
+
state: run.record.state,
|
|
146
|
+
label: run.record.label,
|
|
147
|
+
versionId: run.record.versionId,
|
|
148
|
+
ms: run.ms,
|
|
149
|
+
...(run.record.failure ? { failure: run.record.failure } : {}),
|
|
150
|
+
})),
|
|
151
|
+
noReference: plan.options.filter((option) => option.noReferenceReason !== null).map((option) => option.key),
|
|
152
|
+
message,
|
|
153
|
+
record: recordPath,
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
finally {
|
|
158
|
+
await lock?.release();
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
/** Each option's exact Codex request (the plan's prompt, the fetched bytes in order, the frame); draws nothing. */
|
|
162
|
+
const dryRun = (plan, fetched, choice, opId) => ({
|
|
163
|
+
exitCode: 0,
|
|
164
|
+
output: {
|
|
165
|
+
ok: true,
|
|
166
|
+
dryRun: true,
|
|
167
|
+
op: opId,
|
|
168
|
+
engine: choice.engine,
|
|
169
|
+
engineReason: choice.reason,
|
|
170
|
+
codex: { binary: choice.codex.binary, version: choice.codex.version, home: choice.codex.home },
|
|
171
|
+
planDigest: plan.planDigest,
|
|
172
|
+
promptRevision: plan.promptRevision,
|
|
173
|
+
options: plan.options.map((option) => ({
|
|
174
|
+
key: option.key,
|
|
175
|
+
callId: option.callId,
|
|
176
|
+
prompt: option.prompt,
|
|
177
|
+
promptSha256: option.promptSha256,
|
|
178
|
+
images: imageRecords(option, fetched).map(({ mimeType: _mimeType, ...image }) => image),
|
|
179
|
+
frame: option.frame,
|
|
180
|
+
})),
|
|
181
|
+
},
|
|
182
|
+
});
|
|
183
|
+
/**
|
|
184
|
+
* Codex cannot draw here and there is no other engine (decision D2-B): push each pending option's fixed failure so
|
|
185
|
+
* the screen stops waiting, spend nothing, and keep a run record of it. Returns the record's path.
|
|
186
|
+
*/
|
|
187
|
+
const recordCodexUnavailable = async (context) => {
|
|
188
|
+
const { plan, client, clock } = context;
|
|
189
|
+
const runs = await Promise.all(plan.options.map(async (option) => {
|
|
190
|
+
const started = clock().toISOString();
|
|
191
|
+
const base = {
|
|
192
|
+
key: option.key, callId: option.callId, engine: null, prompt: option.prompt, promptSha256: option.promptSha256,
|
|
193
|
+
images: imageRecords(option, context.fetched), frame: option.frame, startedAt: started, finishedAt: started,
|
|
194
|
+
state: 'failed', failure: option.failure, versionId: option.versionId, label: option.label,
|
|
195
|
+
};
|
|
196
|
+
if (option.state === 'filled')
|
|
197
|
+
return { record: { ...base, state: 'replayed' }, ms: 0, drawnThisRun: false };
|
|
198
|
+
if (option.state === 'failed')
|
|
199
|
+
return { record: base, ms: 0, drawnThisRun: false };
|
|
200
|
+
let failure = OPTION_FAILURES.codexUnavailable;
|
|
201
|
+
let abort;
|
|
202
|
+
try {
|
|
203
|
+
await client.push(option.key, { reason: OPTION_FAILURES.codexUnavailable });
|
|
204
|
+
}
|
|
205
|
+
catch (error) {
|
|
206
|
+
abort = abortOf(error) ?? undefined;
|
|
207
|
+
if (!abort)
|
|
208
|
+
throw error;
|
|
209
|
+
failure = abort.message;
|
|
210
|
+
}
|
|
211
|
+
context.progress(`12ui workspace draw: ${option.key} not drawn: ${failure}`);
|
|
212
|
+
return { record: { ...base, failure, finishedAt: clock().toISOString() }, ms: 0, drawnThisRun: true, ...(abort ? { abort } : {}) };
|
|
213
|
+
}));
|
|
214
|
+
const finishedAt = clock();
|
|
215
|
+
const recordPath = await writeRecord(context.opRoot, {
|
|
216
|
+
schema: RECORD_SCHEMA,
|
|
217
|
+
opId: context.args.opId,
|
|
218
|
+
origin: context.args.origin,
|
|
219
|
+
cliVersion: context.cliVersion,
|
|
220
|
+
engine: null,
|
|
221
|
+
engineReason: context.reason,
|
|
222
|
+
codex: null,
|
|
223
|
+
plan: { planDigest: plan.planDigest, promptRevision: plan.promptRevision, kind: plan.kind, mode: plan.mode },
|
|
224
|
+
startedAt: context.startedAt.toISOString(),
|
|
225
|
+
finishedAt: finishedAt.toISOString(),
|
|
226
|
+
wallMs: finishedAt.getTime() - context.startedAt.getTime(),
|
|
227
|
+
options: runs.map((run) => run.record),
|
|
228
|
+
});
|
|
229
|
+
return { recordPath, runs };
|
|
230
|
+
};
|
|
231
|
+
const drawOption = async (context) => {
|
|
232
|
+
const { option, engine, client, clock } = context;
|
|
233
|
+
const started = clock();
|
|
234
|
+
const base = {
|
|
235
|
+
key: option.key,
|
|
236
|
+
callId: option.callId,
|
|
237
|
+
engine,
|
|
238
|
+
prompt: option.prompt,
|
|
239
|
+
promptSha256: option.promptSha256,
|
|
240
|
+
images: imageRecords(option, context.fetched),
|
|
241
|
+
frame: option.frame,
|
|
242
|
+
startedAt: started.toISOString(),
|
|
243
|
+
finishedAt: started.toISOString(),
|
|
244
|
+
state: 'failed',
|
|
245
|
+
failure: null,
|
|
246
|
+
versionId: null,
|
|
247
|
+
label: null,
|
|
248
|
+
};
|
|
249
|
+
const finish = (record, extra = {}) => {
|
|
250
|
+
const finished = clock();
|
|
251
|
+
return {
|
|
252
|
+
record: { ...base, ...record, finishedAt: finished.toISOString() },
|
|
253
|
+
ms: finished.getTime() - started.getTime(),
|
|
254
|
+
drawnThisRun: true,
|
|
255
|
+
...extra,
|
|
256
|
+
};
|
|
257
|
+
};
|
|
258
|
+
if (option.state !== 'pending') {
|
|
259
|
+
// Already resolved on the server: a replay. An earlier run's entry keeps its call directory and timings.
|
|
260
|
+
const earlier = context.previous?.options.find((entry) => entry.key === option.key && entry.callId === option.callId);
|
|
261
|
+
const resolved = option.state === 'filled'
|
|
262
|
+
? { state: 'replayed', versionId: option.versionId, label: option.label, failure: null }
|
|
263
|
+
: { state: 'failed', versionId: null, label: null, failure: option.failure };
|
|
264
|
+
return { record: { ...(earlier ?? base), ...resolved }, ms: 0, drawnThisRun: false };
|
|
265
|
+
}
|
|
266
|
+
try {
|
|
267
|
+
const result = await drawOptionWithCodex({
|
|
268
|
+
root: context.opRoot,
|
|
269
|
+
env: context.env,
|
|
270
|
+
option,
|
|
271
|
+
images: option.images.map((image) => context.fetched.get(image.name).bytes),
|
|
272
|
+
...(context.deps.executorFactory ? { executorFactory: context.deps.executorFactory } : {}),
|
|
273
|
+
});
|
|
274
|
+
if (result.kind === 'environment') {
|
|
275
|
+
return finish({ codex: result.details, failure: result.error }, { codexEnvironment: result.error });
|
|
276
|
+
}
|
|
277
|
+
// 6. Push this option as soon as it lands.
|
|
278
|
+
const pushed = await client.push(option.key, result.kind === 'drawn' ? { png: result.png } : { reason: result.failure });
|
|
279
|
+
return finish({
|
|
280
|
+
codex: result.details,
|
|
281
|
+
state: pushed.state,
|
|
282
|
+
label: pushed.label,
|
|
283
|
+
versionId: pushed.versionId,
|
|
284
|
+
failure: result.kind === 'failed' ? result.failure : null,
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
catch (error) {
|
|
288
|
+
if (error instanceof DrawHttpError && error.code === 'option_already_resolved') {
|
|
289
|
+
return finish({ failure: 'This option was already resolved with a different result.' });
|
|
290
|
+
}
|
|
291
|
+
const abort = abortOf(error);
|
|
292
|
+
if (!abort)
|
|
293
|
+
throw error;
|
|
294
|
+
return finish({ failure: abort.message }, { abort });
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
const progressLine = (run, engine) => {
|
|
298
|
+
const { record } = run;
|
|
299
|
+
const seconds = `${(run.ms / 1000).toFixed(1)} s`;
|
|
300
|
+
if (record.state === 'replayed')
|
|
301
|
+
return `12ui workspace draw: ${record.key} was already added as ${record.label ?? record.versionId}`;
|
|
302
|
+
if (record.state === 'filled')
|
|
303
|
+
return `12ui workspace draw: ${record.key} added as ${record.label ?? record.versionId} (${engine}, ${seconds})`;
|
|
304
|
+
return `12ui workspace draw: ${record.key} failed (${engine}, ${seconds}): ${record.failure ?? 'no image'}`;
|
|
305
|
+
};
|
|
306
|
+
const outcomeOf = (plan, runs) => {
|
|
307
|
+
for (const code of ABORT_PRECEDENCE) {
|
|
308
|
+
const hit = runs.find((run) => run.abort?.code === code);
|
|
309
|
+
if (hit?.abort)
|
|
310
|
+
return hit.abort;
|
|
311
|
+
}
|
|
312
|
+
if (runs.some((run) => run.codexEnvironment))
|
|
313
|
+
return { code: 'no_engine', message: DRAW_MESSAGES.codexStopped() };
|
|
314
|
+
const total = runs.length;
|
|
315
|
+
const failed = runs.filter((run) => run.record.state === 'failed').length;
|
|
316
|
+
const drawn = runs.filter((run) => run.drawnThisRun);
|
|
317
|
+
if (failed === 0) {
|
|
318
|
+
if (drawn.length === 0)
|
|
319
|
+
return { code: 'replayed', message: DRAW_MESSAGES.replayed({ count: total }) };
|
|
320
|
+
const edit = plan.kind === 'edit';
|
|
321
|
+
return { code: 'done', message: DRAW_MESSAGES.added({ count: drawn.length, edit, label: drawn[0]?.record.label ?? null }) };
|
|
322
|
+
}
|
|
323
|
+
const added = total - failed;
|
|
324
|
+
return added > 0
|
|
325
|
+
? { code: 'partial', message: DRAW_MESSAGES.partial({ added, total }) }
|
|
326
|
+
: { code: 'failed', message: DRAW_MESSAGES.failed({ total }) };
|
|
327
|
+
};
|
|
328
|
+
//# sourceMappingURL=workspace-draw-run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-draw-run.js","sourceRoot":"","sources":["../src/workspace-draw-run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,kBAAkB,EAAmD,MAAM,4BAA4B,CAAC;AAClJ,OAAO,EAAE,mBAAmB,EAAwB,MAAM,2BAA2B,CAAC;AACtF,OAAO,EAAE,YAAY,EAA6C,MAAM,4BAA4B,CAAC;AACrG,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,kBAAkB,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACnH,OAAO,EACL,eAAe,EACf,aAAa,GAUd,MAAM,2BAA2B,CAAC;AA6BnC,MAAM,SAAU,SAAQ,KAAK;IAClB,KAAK,CAAQ;IACtB,YAAY,KAAY;QACtB,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AAED,6GAA6G;AAC7G,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAc,EAAgB,EAAE;IACtD,IAAI,KAAK,YAAY,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,EAAE,MAAM,CAAC,KAAK,IAAI,IAAI,EAAE,CAAC,EAAE,CAAC;IAC9H,CAAC;IACD,MAAM,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;IAC7B,OAAO,KAAK,GAAG,CAAC;QACd,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE;QACvE,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AACnE,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type DrawRecord } from './workspace-draw-types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Where one request's draws live on this machine: `<data root>/workspace-draw/<opId>/`, holding the op lock, the
|
|
4
|
+
* codex call store (`calls/`) and the run record (`run.json`). Nothing here is created before the sandbox gate has
|
|
5
|
+
* passed and the command is about to draw.
|
|
6
|
+
*/
|
|
7
|
+
export declare const opRootOf: (dataRoot: string, opId: string) => string;
|
|
8
|
+
export declare const defaultDataRoot: (env: NodeJS.ProcessEnv) => string;
|
|
9
|
+
export type OpLock = {
|
|
10
|
+
release: () => Promise<void>;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* The op lock: one live run per op on this machine. A holder is alive while its process is and its heartbeat (the
|
|
14
|
+
* lock file's mtime, touched every few seconds) is fresh; a dead or silent holder's lock is taken over. Null when a
|
|
15
|
+
* live run holds it.
|
|
16
|
+
*/
|
|
17
|
+
export declare const takeOpLock: (opRoot: string) => Promise<OpLock | null>;
|
|
18
|
+
export declare const recordPathOf: (opRoot: string) => string;
|
|
19
|
+
/** The record an earlier run left, if it is one this command wrote. */
|
|
20
|
+
export declare const readPreviousRecord: (opRoot: string) => Promise<DrawRecord | null>;
|
|
21
|
+
/** Replace the record atomically: a reader never sees half a file. */
|
|
22
|
+
export declare const writeRecord: (opRoot: string, record: DrawRecord) => Promise<string>;
|
|
23
|
+
//# sourceMappingURL=workspace-draw-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-draw-store.d.ts","sourceRoot":"","sources":["../src/workspace-draw-store.ts"],"names":[],"mappings":"AAMA,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE3E;;;;GAIG;AAEH,eAAO,MAAM,QAAQ,GAAI,UAAU,MAAM,EAAE,MAAM,MAAM,KAAG,MAAqD,CAAC;AAEhH,eAAO,MAAM,eAAe,GAAI,KAAK,MAAM,CAAC,UAAU,KAAG,MAA+C,CAAC;AAEzG,MAAM,MAAM,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAAC;AAEtD;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAU,QAAQ,MAAM,KAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAiBtE,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,QAAQ,MAAM,KAAG,MAAuC,CAAC;AAEtF,uEAAuE;AACvE,eAAO,MAAM,kBAAkB,GAAU,QAAQ,MAAM,KAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAQlF,CAAC;AAEF,sEAAsE;AACtE,eAAO,MAAM,WAAW,GAAU,QAAQ,MAAM,EAAE,QAAQ,UAAU,KAAG,OAAO,CAAC,MAAM,CAUpF,CAAC"}
|