cdx-chores 0.2.0 → 0.2.1-canary.2
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 +1 -1
- package/dist/cjs/{discovery-zdpL5Pn9.cjs → discovery-DWPx7mnv.cjs} +1 -1
- package/dist/cjs/docx-child.cjs +156 -0
- package/dist/cjs/docx-parser.cjs +1706 -0
- package/dist/cjs/docx-worker.cjs +95 -0
- package/dist/cjs/{file-io-jIHYtIe8.cjs → file-io-C4kZv_nR.cjs} +1 -1
- package/dist/cjs/index.cjs +553 -333
- package/dist/cjs/limits-gYOZoKwZ.cjs +67 -0
- package/dist/cjs/{markdown-pdf-template-CxYE95Fl.cjs → markdown-pdf-template-CWs6T91M.cjs} +1 -1
- package/dist/cjs/{menu-prompt-Dm5-2hXQ.cjs → menu-prompt-Ccyj2jTV.cjs} +1 -1
- package/dist/cjs/protocol-DCBoZhtP.cjs +268 -0
- package/dist/cjs/{rolldown-runtime-y5ARvAq5.cjs → rolldown-runtime-Gi87jfEt.cjs} +1 -1
- package/dist/cjs/rolldown-runtime-VH7oDXx4.cjs +28 -0
- package/dist/cjs/{template-codex-eIoxBpgQ.cjs → template-codex-CIONsDRY.cjs} +2 -2
- package/dist/cjs/{workflow-CL1QNEB_.cjs → workflow-CDKCREXZ.cjs} +2 -2
- package/dist/esm/bin.mjs +543 -322
- package/dist/esm/docx-child.mjs +157 -0
- package/dist/esm/docx-parser.mjs +1703 -0
- package/dist/esm/docx-worker.mjs +89 -0
- package/dist/esm/{file-io-D1FsGwfI.mjs → file-io-9Kla0PwA.mjs} +1 -1
- package/dist/esm/file-io.mjs +1 -1
- package/dist/esm/index.d.mts +1 -1
- package/dist/esm/index.mjs +553 -331
- package/dist/esm/limits-BBxswqKh.mjs +44 -0
- package/dist/esm/{markdown-pdf-template-Btv6ZVLJ.mjs → markdown-pdf-template-B0rRw6Dy.mjs} +1 -1
- package/dist/esm/{menu-prompt-Wl4SUpmL.mjs → menu-prompt-BRn2xwbV.mjs} +1 -1
- package/dist/esm/protocol-B_tYnSge.mjs +215 -0
- package/dist/esm/{template-codex-BGyukoLO.mjs → template-codex-3msNZF6m.mjs} +2 -2
- package/dist/esm/{workflow-DgM2Ytdp.mjs → workflow-8lv05XD0.mjs} +2 -2
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -83,7 +83,7 @@ Use `cdx-chores doctor` before relying on a command in a script, a CI job, or a
|
|
|
83
83
|
| `data extract` reviewed suggestions, `data query codex` | Codex-assisted source shaping, semantic header review, and natural-language SQL drafting | Codex support must be configured and an auth/session signal must be available | Run `cdx-chores doctor` |
|
|
84
84
|
| `md pdf-profile codex`, `md pdf-template codex`, `md pdf-project codex` | Codex-assisted Markdown PDF profile, template, and coordinated project drafting | Codex support must be configured for Codex-assisted decisions; deterministic fallback paths remain available where documented | Run `cdx-chores doctor` |
|
|
85
85
|
|
|
86
|
-
The Codex SDK baseline for `v0.2.
|
|
86
|
+
The Codex SDK baseline for `v0.2.1-canary.2` is `@openai/codex-sdk` `0.163.0`.
|
|
87
87
|
|
|
88
88
|
Adopted helper commands and explicit `interactive` sessions accept
|
|
89
89
|
`--codex-model`, `--codex-provider`, and `--codex-reasoning-effort`. Model and
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_rolldown_runtime = require("./rolldown-runtime-
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-Gi87jfEt.cjs");
|
|
2
2
|
let node_fs = require("node:fs");
|
|
3
3
|
let node_path = require("node:path");
|
|
4
4
|
let node_child_process = require("node:child_process");
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
const require_limits = require("./limits-gYOZoKwZ.cjs");
|
|
2
|
+
const require_protocol = require("./protocol-DCBoZhtP.cjs");
|
|
3
|
+
let node_worker_threads = require("node:worker_threads");
|
|
4
|
+
//#region src/docx/runtime/child.ts
|
|
5
|
+
async function runDocxChild(options = {}) {
|
|
6
|
+
const decoder = new require_protocol.RequestFrameDecoder();
|
|
7
|
+
const started = performance.now();
|
|
8
|
+
const readRss = options.sampleRss ?? (() => process.memoryUsage.rss());
|
|
9
|
+
let limits = { ...require_limits.DEFAULT_DOCX_LIMITS };
|
|
10
|
+
let worker;
|
|
11
|
+
let frozen = false;
|
|
12
|
+
let sampling;
|
|
13
|
+
let deadline;
|
|
14
|
+
let resolveDone;
|
|
15
|
+
const done = new Promise((resolve) => {
|
|
16
|
+
resolveDone = resolve;
|
|
17
|
+
});
|
|
18
|
+
async function finish(result, publish = true) {
|
|
19
|
+
if (frozen) return;
|
|
20
|
+
frozen = true;
|
|
21
|
+
clearInterval(sampling);
|
|
22
|
+
clearTimeout(deadline);
|
|
23
|
+
process.stdin.pause();
|
|
24
|
+
if (worker) try {
|
|
25
|
+
await worker.terminate();
|
|
26
|
+
} catch {
|
|
27
|
+
result = {
|
|
28
|
+
ok: false,
|
|
29
|
+
diagnostic: "docx_worker_error"
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
if (publish && result.ok && require_protocol.rssExceeded(readRss(), limits.peakRssBytes)) result = {
|
|
33
|
+
ok: false,
|
|
34
|
+
diagnostic: "docx_limit:peakRssBytes"
|
|
35
|
+
};
|
|
36
|
+
if (publish) {
|
|
37
|
+
let frame;
|
|
38
|
+
try {
|
|
39
|
+
frame = require_protocol.encodeResultFrame(result, limits);
|
|
40
|
+
} catch (error) {
|
|
41
|
+
const diagnostic = require_protocol.limitDiagnostic(error);
|
|
42
|
+
frame = require_protocol.encodeResultFrame({
|
|
43
|
+
ok: false,
|
|
44
|
+
diagnostic
|
|
45
|
+
}, {
|
|
46
|
+
...limits,
|
|
47
|
+
resultBytes: 1024
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
const beforePublishRss = readRss();
|
|
51
|
+
if (result.ok && require_protocol.rssExceeded(beforePublishRss, limits.peakRssBytes)) frame = require_protocol.encodeResultFrame({
|
|
52
|
+
ok: false,
|
|
53
|
+
diagnostic: "docx_limit:peakRssBytes"
|
|
54
|
+
}, {
|
|
55
|
+
...limits,
|
|
56
|
+
resultBytes: 1024
|
|
57
|
+
});
|
|
58
|
+
await new Promise((resolve) => {
|
|
59
|
+
process.stdout.once("error", resolve);
|
|
60
|
+
process.stdout.end(frame, () => {
|
|
61
|
+
process.stdout.removeListener("error", resolve);
|
|
62
|
+
resolve();
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
process.stdin.destroy();
|
|
67
|
+
resolveDone();
|
|
68
|
+
}
|
|
69
|
+
function fail(diagnostic, publish = true) {
|
|
70
|
+
finish({
|
|
71
|
+
ok: false,
|
|
72
|
+
diagnostic
|
|
73
|
+
}, publish);
|
|
74
|
+
}
|
|
75
|
+
function sample() {
|
|
76
|
+
try {
|
|
77
|
+
if (require_protocol.rssExceeded(readRss(), limits.peakRssBytes)) fail("docx_limit:peakRssBytes");
|
|
78
|
+
} catch {
|
|
79
|
+
fail("docx_worker_error");
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function start() {
|
|
83
|
+
const request = decoder.request;
|
|
84
|
+
limits = request.limits;
|
|
85
|
+
clearTimeout(deadline);
|
|
86
|
+
const remaining = limits.elapsedMilliseconds - (performance.now() - started);
|
|
87
|
+
if (remaining <= 0) return fail("docx_limit:elapsedMilliseconds");
|
|
88
|
+
deadline = setTimeout(() => fail("docx_limit:elapsedMilliseconds"), remaining);
|
|
89
|
+
sample();
|
|
90
|
+
if (frozen) return;
|
|
91
|
+
sampling = setInterval(sample, limits.rssSampleMilliseconds);
|
|
92
|
+
try {
|
|
93
|
+
const moduleUrl = require_protocol.runtimeModuleUrl(require("url").pathToFileURL(__filename).href, typeof __filename === "string" ? __filename : void 0);
|
|
94
|
+
worker = new node_worker_threads.Worker(options.workerUrl ?? require_protocol.runtimeAsset("docx-worker", moduleUrl), {
|
|
95
|
+
eval: false,
|
|
96
|
+
execArgv: [],
|
|
97
|
+
env: require_protocol.minimalDocxEnvironment(process.env),
|
|
98
|
+
trackUnmanagedFds: true,
|
|
99
|
+
workerData: {
|
|
100
|
+
bytes: request.bytes.buffer,
|
|
101
|
+
limits
|
|
102
|
+
},
|
|
103
|
+
transferList: [request.bytes.buffer]
|
|
104
|
+
});
|
|
105
|
+
} catch {
|
|
106
|
+
return fail("docx_worker_error");
|
|
107
|
+
}
|
|
108
|
+
let received = false;
|
|
109
|
+
worker.on("message", (message) => {
|
|
110
|
+
if (frozen) return;
|
|
111
|
+
if (received) return fail("docx_protocol_error");
|
|
112
|
+
received = true;
|
|
113
|
+
sample();
|
|
114
|
+
if (frozen) return;
|
|
115
|
+
try {
|
|
116
|
+
finish(require_protocol.validateDocxReadResult(message, limits));
|
|
117
|
+
} catch {
|
|
118
|
+
fail("docx_protocol_error");
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
worker.once("error", () => fail("docx_worker_error"));
|
|
122
|
+
worker.once("exit", () => {
|
|
123
|
+
if (!frozen) fail("docx_worker_error");
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
deadline = setTimeout(() => fail("docx_limit:elapsedMilliseconds"), limits.elapsedMilliseconds);
|
|
127
|
+
process.stdin.on("data", (chunk) => {
|
|
128
|
+
if (frozen) return;
|
|
129
|
+
try {
|
|
130
|
+
const completedBefore = decoder.complete;
|
|
131
|
+
decoder.push(chunk);
|
|
132
|
+
if (!completedBefore && decoder.complete) start();
|
|
133
|
+
} catch (error) {
|
|
134
|
+
fail(require_protocol.limitDiagnostic(error));
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
process.stdin.once("end", () => {
|
|
138
|
+
if (!frozen) fail("docx_cancelled", false);
|
|
139
|
+
});
|
|
140
|
+
process.stdin.once("error", () => {
|
|
141
|
+
if (!frozen) fail("docx_cancelled", false);
|
|
142
|
+
});
|
|
143
|
+
process.stdout.on("error", () => {
|
|
144
|
+
if (!frozen) fail("docx_cancelled", false);
|
|
145
|
+
});
|
|
146
|
+
process.stdin.resume();
|
|
147
|
+
await done;
|
|
148
|
+
}
|
|
149
|
+
//#endregion
|
|
150
|
+
//#region src/docx/runtime/docx-child.ts
|
|
151
|
+
runDocxChild().catch(() => {
|
|
152
|
+
process.exitCode = 1;
|
|
153
|
+
process.stdin.destroy();
|
|
154
|
+
process.stdout.end();
|
|
155
|
+
});
|
|
156
|
+
//#endregion
|