@pipelex/sdk 0.47.0 → 0.48.0
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 +8 -6
- package/dist/cli/script.d.ts +1 -1
- package/dist/cli/source.d.ts +8 -7
- package/dist/cli/source.js +11 -5
- package/dist/cli/source.js.map +1 -1
- package/dist/client.d.ts +321 -210
- package/dist/client.js +819 -514
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +5 -2
- package/dist/errors.js +5 -2
- package/dist/errors.js.map +1 -1
- package/dist/hooks/bundle-gather.d.ts +28 -40
- package/dist/hooks/bundle-gather.js +55 -230
- package/dist/hooks/bundle-gather.js.map +1 -1
- package/dist/hooks/claude-mthds-check.d.ts +7 -5
- package/dist/hooks/claude-mthds-check.js +8 -53
- package/dist/hooks/claude-mthds-check.js.map +1 -1
- package/dist/hooks/validate-stage.d.ts +27 -0
- package/dist/hooks/validate-stage.js +57 -0
- package/dist/hooks/validate-stage.js.map +1 -0
- package/dist/index.d.ts +3 -4
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/method-trees.d.ts +208 -73
- package/dist/method-trees.js +221 -34
- package/dist/method-trees.js.map +1 -1
- package/dist/models.d.ts +162 -59
- package/dist/prepare-inputs.d.ts +46 -27
- package/dist/prepare-inputs.js +123 -42
- package/dist/prepare-inputs.js.map +1 -1
- package/dist/product-models.d.ts +14 -16
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/architecture.md +17 -18
- package/docs/cli.md +1 -1
- package/docs/crate-routes.md +42 -20
- package/docs/errors.md +5 -5
- package/docs/hook-bundle.md +1 -1
- package/docs/input-preparation.md +11 -11
- package/docs/method-trees.md +119 -21
- package/docs/run-results.md +5 -2
- package/package.json +2 -2
- package/dist/bundle-resources.d.ts +0 -62
- package/dist/bundle-resources.js +0 -165
- package/dist/bundle-resources.js.map +0 -1
- package/docs/bundle-resources.md +0 -107
|
@@ -1,252 +1,77 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* `POST /v1/validate` around an edited `.mthds` file.
|
|
2
|
+
* The method tree the validate stage sends to `POST /v1/validate` around an edited `.mthds` file.
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* the
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
4
|
+
* It is the tree a run of the method would send: the edited file's directory listed by the `mthds`
|
|
5
|
+
* package's lister, under the MTHDS standard's membership rule and Manifest Discovery, so it is
|
|
6
|
+
* rooted at the nearest `METHODS.toml` at or above that directory, else at the directory itself,
|
|
7
|
+
* and holds every file the rule keeps — every bundle of the method, and every file a step reads,
|
|
8
|
+
* such as a `PipeDocGen` step's `template_file`, under its tree path. The client sends it inline
|
|
9
|
+
* when small and by hash otherwise, uploading the files the API lacks.
|
|
11
10
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
11
|
+
* Capped, because the hook should not send a large tree on every edit, and because a tree it
|
|
12
|
+
* cannot list whole would risk a wrong verdict: on any of the caps, on a tree the standard refuses
|
|
13
|
+
* (a symbolic link or a special file in it, an unreadable directory), and on an edited file the
|
|
14
|
+
* tree does not hold (one the membership rule keeps out), the caller treats validate as
|
|
15
|
+
* unavailable rather than risk a wrong block.
|
|
17
16
|
*/
|
|
18
|
-
import {
|
|
19
|
-
import { dirname,
|
|
20
|
-
import {
|
|
21
|
-
import { bundleResourcePathRefusal, canonicalBundleResourcePath } from "../bundle-resources.js";
|
|
22
|
-
/** Mirror of pipelex's `scan_config.excluded_dirs` (dot-dirs are skipped wholesale). */
|
|
23
|
-
const EXCLUDED_DIRS = new Set([
|
|
24
|
-
"venv",
|
|
25
|
-
"env",
|
|
26
|
-
"virtualenv",
|
|
27
|
-
"__pycache__",
|
|
28
|
-
"node_modules",
|
|
29
|
-
"results",
|
|
30
|
-
]);
|
|
31
|
-
/** The server's default bounds on the files a request sends with its bundle. */
|
|
32
|
-
const DEFAULT_MAX_RESOURCE_FILES = 32;
|
|
33
|
-
const DEFAULT_MAX_RESOURCE_FILE_BYTES = 5 * 1024 * 1024;
|
|
34
|
-
const DEFAULT_MAX_RESOURCE_BYTES = 10 * 1024 * 1024;
|
|
17
|
+
import { realpathSync } from "node:fs";
|
|
18
|
+
import { dirname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
19
|
+
import { listDirectoryTree } from "../method-trees.js";
|
|
35
20
|
export const DEFAULT_GATHER_CAPS = {
|
|
36
|
-
maxFiles:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
maxResourceFileBytes: DEFAULT_MAX_RESOURCE_FILE_BYTES,
|
|
40
|
-
maxResourceBytes: DEFAULT_MAX_RESOURCE_BYTES,
|
|
21
|
+
maxFiles: 100,
|
|
22
|
+
maxFileBytes: 5 * 1024 * 1024,
|
|
23
|
+
maxTotalBytes: 12 * 1024 * 1024,
|
|
41
24
|
};
|
|
42
25
|
/**
|
|
43
|
-
*
|
|
44
|
-
* the
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* bundle. The caps guard the opposite failure (over-supply), never this one.
|
|
26
|
+
* List the method tree around the edited file: its directory, listed under the standard's
|
|
27
|
+
* membership rule and the hook's caps. The files are read when the client sends them, so a format
|
|
28
|
+
* write-back made before this call is reflected, and a file changed after it is refused by the
|
|
29
|
+
* tree's own check of its hash rather than sent stale.
|
|
48
30
|
*/
|
|
49
|
-
function
|
|
50
|
-
const entries = readdirSync(dir, { withFileTypes: true });
|
|
51
|
-
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
52
|
-
if (entry.name.startsWith(".") || EXCLUDED_DIRS.has(entry.name)) {
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
const full = join(dir, entry.name);
|
|
56
|
-
if (entry.isDirectory()) {
|
|
57
|
-
walkMthdsFiles(full, collected);
|
|
58
|
-
}
|
|
59
|
-
else if (entry.isFile() && entry.name.endsWith(".mthds")) {
|
|
60
|
-
collected.push(full);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Gather the `.mthds` files under the edited file's parent directory, the
|
|
66
|
-
* edited file first (absent any `main_pipe`, the server's primary blueprint is
|
|
67
|
-
* the first content — make that the file being edited). Contents are read
|
|
68
|
-
* fresh from disk, so a format write-back is already reflected.
|
|
69
|
-
*/
|
|
70
|
-
export function gatherBundle(editedFilePath, caps = DEFAULT_GATHER_CAPS) {
|
|
31
|
+
export async function gatherMethodTree(editedFilePath, caps = DEFAULT_GATHER_CAPS) {
|
|
71
32
|
const editedAbs = resolve(editedFilePath);
|
|
72
|
-
|
|
73
|
-
const paths = [];
|
|
74
|
-
try {
|
|
75
|
-
walkMthdsFiles(parentDir, paths);
|
|
76
|
-
}
|
|
77
|
-
catch {
|
|
78
|
-
return { ok: false, reason: "unreadable" };
|
|
79
|
-
}
|
|
80
|
-
const ordered = [editedAbs, ...paths.filter((path) => resolve(path) !== editedAbs)];
|
|
81
|
-
if (ordered.length > caps.maxFiles) {
|
|
82
|
-
return { ok: false, reason: "overflow" };
|
|
83
|
-
}
|
|
84
|
-
let totalBytes = 0;
|
|
85
|
-
for (const path of ordered) {
|
|
86
|
-
try {
|
|
87
|
-
totalBytes += statSync(path).size;
|
|
88
|
-
}
|
|
89
|
-
catch {
|
|
90
|
-
return { ok: false, reason: "unreadable" };
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
if (totalBytes > caps.maxTotalBytes) {
|
|
94
|
-
return { ok: false, reason: "overflow" };
|
|
95
|
-
}
|
|
96
|
-
const files = [];
|
|
97
|
-
for (const path of ordered) {
|
|
98
|
-
try {
|
|
99
|
-
files.push({ content: readFileSync(path, "utf-8"), uri: relative(parentDir, path) });
|
|
100
|
-
}
|
|
101
|
-
catch {
|
|
102
|
-
return { ok: false, reason: "unreadable" };
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
const gathered = gatherTemplateFiles(parentDir, ordered, files, caps);
|
|
106
|
-
if (!gathered.ok)
|
|
107
|
-
return gathered;
|
|
108
|
-
return { ok: true, files, resources: gathered.resources };
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* The paths of the template files the steps of one `.mthds` file name: each
|
|
112
|
-
* `PipeDocGen` pipe's `template_file`. A file that does not parse names none, the
|
|
113
|
-
* server giving its verdict on it.
|
|
114
|
-
*/
|
|
115
|
-
export function templateFilesNamedBy(mthdsContent) {
|
|
116
|
-
let document;
|
|
33
|
+
let tree;
|
|
117
34
|
try {
|
|
118
|
-
|
|
35
|
+
tree = await listDirectoryTree(dirname(editedAbs), {
|
|
36
|
+
maxFileCount: caps.maxFiles,
|
|
37
|
+
maxFileSize: caps.maxFileBytes,
|
|
38
|
+
maxTotalSize: caps.maxTotalBytes,
|
|
39
|
+
}, "validate");
|
|
119
40
|
}
|
|
120
|
-
catch {
|
|
121
|
-
return
|
|
41
|
+
catch (err) {
|
|
42
|
+
return { ok: false, reason: isLimitExceeded(err) ? "overflow" : "unreadable" };
|
|
122
43
|
}
|
|
123
|
-
const
|
|
124
|
-
if (!
|
|
125
|
-
return
|
|
126
|
-
const named = [];
|
|
127
|
-
for (const pipe of Object.values(pipes)) {
|
|
128
|
-
if (isRecord(pipe) &&
|
|
129
|
-
pipe["type"] === "PipeDocGen" &&
|
|
130
|
-
typeof pipe["template_file"] === "string") {
|
|
131
|
-
named.push(pipe["template_file"]);
|
|
132
|
-
}
|
|
44
|
+
const treePath = treePathOf(editedAbs, tree.root);
|
|
45
|
+
if (treePath === undefined || !tree.files.some((file) => file.path === treePath)) {
|
|
46
|
+
return { ok: false, reason: "outside" };
|
|
133
47
|
}
|
|
134
|
-
return
|
|
48
|
+
return { ok: true, tree };
|
|
135
49
|
}
|
|
136
|
-
/**
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
* the step's file was not supplied.
|
|
142
|
-
*
|
|
143
|
-
* Validate is unavailable rather than a wrong verdict when the request cannot carry
|
|
144
|
-
* what loading the bundle from disk would find: a file that leads out of the
|
|
145
|
-
* bundle's directory through a link is never read (`unreadable`), and one path that
|
|
146
|
-
* names different files beside different `.mthds` files, or a file beside one and
|
|
147
|
-
* nothing beside another, is a `conflict`. Every size is checked against the caps
|
|
148
|
-
* before any file is read, the bytes compared to tell two files apart included, so
|
|
149
|
-
* the hook never holds more than the caps allow (`overflow`).
|
|
150
|
-
*/
|
|
151
|
-
function gatherTemplateFiles(parentDir, paths, files, caps) {
|
|
152
|
-
const maxFiles = caps.maxResourceFiles ?? DEFAULT_MAX_RESOURCE_FILES;
|
|
153
|
-
const maxFileBytes = caps.maxResourceFileBytes ?? DEFAULT_MAX_RESOURCE_FILE_BYTES;
|
|
154
|
-
const maxBytes = caps.maxResourceBytes ?? DEFAULT_MAX_RESOURCE_BYTES;
|
|
155
|
-
let root;
|
|
50
|
+
/** The edited file's tree path under `root`, or `undefined` when it lies outside it. */
|
|
51
|
+
function treePathOf(editedAbs, root) {
|
|
52
|
+
if (root === null)
|
|
53
|
+
return undefined;
|
|
54
|
+
let real;
|
|
156
55
|
try {
|
|
157
|
-
|
|
56
|
+
real = realpathSync(editedAbs);
|
|
158
57
|
}
|
|
159
58
|
catch {
|
|
160
|
-
return
|
|
161
|
-
}
|
|
162
|
-
// Each path a step names, once, with the file it names beside the first `.mthds` file
|
|
163
|
-
// naming it, or `null` when there is none there.
|
|
164
|
-
const located = new Map();
|
|
165
|
-
let fileCount = 0;
|
|
166
|
-
let totalBytes = 0;
|
|
167
|
-
for (const [index, mthdsPath] of paths.entries()) {
|
|
168
|
-
for (const named of templateFilesNamedBy(files[index].content)) {
|
|
169
|
-
if (bundleResourcePathRefusal(named) !== undefined)
|
|
170
|
-
continue;
|
|
171
|
-
const key = canonicalBundleResourcePath(named);
|
|
172
|
-
const found = locateRegularFile(join(dirname(mthdsPath), key));
|
|
173
|
-
if (found !== null) {
|
|
174
|
-
if (!found.real.startsWith(root + sep))
|
|
175
|
-
return { ok: false, reason: "unreadable" };
|
|
176
|
-
if (found.size > maxFileBytes)
|
|
177
|
-
return { ok: false, reason: "overflow" };
|
|
178
|
-
}
|
|
179
|
-
if (!located.has(key)) {
|
|
180
|
-
located.set(key, found);
|
|
181
|
-
if (found === null)
|
|
182
|
-
continue;
|
|
183
|
-
fileCount += 1;
|
|
184
|
-
if (fileCount > maxFiles)
|
|
185
|
-
return { ok: false, reason: "overflow" };
|
|
186
|
-
totalBytes += found.size;
|
|
187
|
-
if (totalBytes > maxBytes)
|
|
188
|
-
return { ok: false, reason: "overflow" };
|
|
189
|
-
continue;
|
|
190
|
-
}
|
|
191
|
-
const known = located.get(key);
|
|
192
|
-
if (known === null || found === null) {
|
|
193
|
-
if (known !== found)
|
|
194
|
-
return { ok: false, reason: "conflict" };
|
|
195
|
-
continue;
|
|
196
|
-
}
|
|
197
|
-
if (!sameFileContent(known, found))
|
|
198
|
-
return { ok: false, reason: "conflict" };
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
const resources = Object.create(null);
|
|
202
|
-
let readBytes = 0;
|
|
203
|
-
for (const [key, found] of located) {
|
|
204
|
-
if (found === null)
|
|
205
|
-
continue;
|
|
206
|
-
try {
|
|
207
|
-
const bytes = readFileSync(found.real);
|
|
208
|
-
// A file that grew since it was measured is held to the caps as read.
|
|
209
|
-
readBytes += bytes.length;
|
|
210
|
-
if (bytes.length > maxFileBytes || readBytes > maxBytes) {
|
|
211
|
-
return { ok: false, reason: "overflow" };
|
|
212
|
-
}
|
|
213
|
-
resources[key] = bytes;
|
|
214
|
-
}
|
|
215
|
-
catch {
|
|
216
|
-
return { ok: false, reason: "unreadable" };
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
return { ok: true, resources };
|
|
220
|
-
}
|
|
221
|
-
/** The regular file at `path`, link resolved, or `null` when there is none there. */
|
|
222
|
-
function locateRegularFile(path) {
|
|
223
|
-
try {
|
|
224
|
-
const real = realpathSync(path);
|
|
225
|
-
const stats = statSync(real);
|
|
226
|
-
return stats.isFile() ? { real, size: stats.size } : null;
|
|
59
|
+
return undefined;
|
|
227
60
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
* per-file cap before this reads either, so a comparison reads at most two files of
|
|
235
|
-
* that size; files of different sizes differ unread, and an unreadable one holds none.
|
|
236
|
-
*/
|
|
237
|
-
function sameFileContent(left, right) {
|
|
238
|
-
if (left.real === right.real)
|
|
239
|
-
return true;
|
|
240
|
-
if (left.size !== right.size)
|
|
241
|
-
return false;
|
|
242
|
-
try {
|
|
243
|
-
return Buffer.compare(readFileSync(left.real), readFileSync(right.real)) === 0;
|
|
244
|
-
}
|
|
245
|
-
catch {
|
|
246
|
-
return false;
|
|
61
|
+
const relativePath = relative(root, real);
|
|
62
|
+
if (relativePath === "" ||
|
|
63
|
+
relativePath === ".." ||
|
|
64
|
+
relativePath.startsWith(`..${sep}`) ||
|
|
65
|
+
isAbsolute(relativePath)) {
|
|
66
|
+
return undefined;
|
|
247
67
|
}
|
|
68
|
+
return relativePath.split(sep).join("/").normalize("NFC");
|
|
248
69
|
}
|
|
249
|
-
|
|
250
|
-
|
|
70
|
+
/** Whether a listing failed on one of the caps: the lister's `limit_exceeded`. */
|
|
71
|
+
function isLimitExceeded(err) {
|
|
72
|
+
const cause = err instanceof Error ? err.cause : undefined;
|
|
73
|
+
return (typeof cause === "object" &&
|
|
74
|
+
cause !== null &&
|
|
75
|
+
cause.code === "limit_exceeded");
|
|
251
76
|
}
|
|
252
77
|
//# sourceMappingURL=bundle-gather.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle-gather.js","sourceRoot":"","sources":["../../src/hooks/bundle-gather.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"bundle-gather.js","sourceRoot":"","sources":["../../src/hooks/bundle-gather.ts"],"names":[],"mappings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,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IAC1C,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAC5B,CAAC;AAED,wFAAwF;AACxF,SAAS,UAAU,CAAC,SAAiB,EAAE,IAAmB;IACxD,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IACpC,IAAI,IAAY,CAAC;IACjB,IAAI,CAAC;QACH,IAAI,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC1C,IACE,YAAY,KAAK,EAAE;QACnB,YAAY,KAAK,IAAI;QACrB,YAAY,CAAC,UAAU,CAAC,KAAK,GAAG,EAAE,CAAC;QACnC,UAAU,CAAC,YAAY,CAAC,EACxB,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAC5D,CAAC;AAED,kFAAkF;AAClF,SAAS,eAAe,CAAC,GAAY;IACnC,MAAM,KAAK,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3D,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACb,KAA4B,CAAC,IAAI,KAAK,gBAAgB,CACxD,CAAC;AACJ,CAAC"}
|
|
@@ -27,11 +27,13 @@
|
|
|
27
27
|
* Failure posture (fail-open, per the networked-hook plan):
|
|
28
28
|
* - no `.mthds` in the payload / unparseable stdin → pass silently
|
|
29
29
|
* - WASM engine fails to load → no file is checked; the note above is still sent
|
|
30
|
-
* - validate unavailable (no `PIPELEX_API_KEY`, network error,
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
30
|
+
* - validate unavailable (no `PIPELEX_API_KEY`, network error, the stage's
|
|
31
|
+
* 10-second deadline over the handshake, the blob route, the uploads and the
|
|
32
|
+
* validation together, any non-2xx, a method tree past the hook's caps, one
|
|
33
|
+
* the standard's lister refuses, such as one holding a symbolic link, an
|
|
34
|
+
* edited file the tree does not hold, or a file of the tree that failed to
|
|
35
|
+
* upload) → the local lint/format verdicts already applied; the validate
|
|
36
|
+
* stage passes silently (`validate-stage.ts`)
|
|
35
37
|
*
|
|
36
38
|
* The hook always exits 0; a block/deny is expressed on stdout, never via the
|
|
37
39
|
* exit code.
|
|
@@ -27,11 +27,13 @@
|
|
|
27
27
|
* Failure posture (fail-open, per the networked-hook plan):
|
|
28
28
|
* - no `.mthds` in the payload / unparseable stdin → pass silently
|
|
29
29
|
* - WASM engine fails to load → no file is checked; the note above is still sent
|
|
30
|
-
* - validate unavailable (no `PIPELEX_API_KEY`, network error,
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
30
|
+
* - validate unavailable (no `PIPELEX_API_KEY`, network error, the stage's
|
|
31
|
+
* 10-second deadline over the handshake, the blob route, the uploads and the
|
|
32
|
+
* validation together, any non-2xx, a method tree past the hook's caps, one
|
|
33
|
+
* the standard's lister refuses, such as one holding a symbolic link, an
|
|
34
|
+
* edited file the tree does not hold, or a file of the tree that failed to
|
|
35
|
+
* upload) → the local lint/format verdicts already applied; the validate
|
|
36
|
+
* stage passes silently (`validate-stage.ts`)
|
|
35
37
|
*
|
|
36
38
|
* The hook always exits 0; a block/deny is expressed on stdout, never via the
|
|
37
39
|
* exit code.
|
|
@@ -39,10 +41,7 @@
|
|
|
39
41
|
import { readFileSync, writeFileSync } from "node:fs";
|
|
40
42
|
import { resolve as resolvePath } from "node:path";
|
|
41
43
|
import { decideAfterLint, decideAfterValidate, encodeOutcome, extractCodexMthdsTargets, extractMthdsFilePath, extractVibeMthdsFilePath, mergeOutcomes, selectCodexTargets, uncheckedShellPatchNote, } from "./check-core.js";
|
|
42
|
-
import {
|
|
43
|
-
import { createHookClient } from "./validate-client.js";
|
|
44
|
-
/** Per-request ceiling on the one network call — well under the hook's overall timeout. */
|
|
45
|
-
const VALIDATE_TIMEOUT_MS = 10_000;
|
|
44
|
+
import { runValidateStage } from "./validate-stage.js";
|
|
46
45
|
async function readStdin() {
|
|
47
46
|
const chunks = [];
|
|
48
47
|
for await (const chunk of process.stdin) {
|
|
@@ -118,50 +117,6 @@ async function loadEngine() {
|
|
|
118
117
|
/* eslint-enable no-console */
|
|
119
118
|
return engine;
|
|
120
119
|
}
|
|
121
|
-
/**
|
|
122
|
-
* Run the networked validate stage. Every no-verdict condition maps to
|
|
123
|
-
* `unavailable` — a machine consumer branches on the structured verdict,
|
|
124
|
-
* never on transport.
|
|
125
|
-
*/
|
|
126
|
-
async function runValidateStage(filePath) {
|
|
127
|
-
if (!process.env.PIPELEX_API_KEY) {
|
|
128
|
-
return { status: "unavailable" };
|
|
129
|
-
}
|
|
130
|
-
const gathered = gatherBundle(filePath);
|
|
131
|
-
if (!gathered.ok) {
|
|
132
|
-
return { status: "unavailable" };
|
|
133
|
-
}
|
|
134
|
-
try {
|
|
135
|
-
const client = createHookClient();
|
|
136
|
-
// The client owns the ceiling: on timeout it aborts the fetch itself, so the
|
|
137
|
-
// request does not keep running after the hook has given up on it.
|
|
138
|
-
const result = await client.validateFiles(gathered.files, {
|
|
139
|
-
allowSignatures: true,
|
|
140
|
-
resources: gathered.resources,
|
|
141
|
-
timeoutMs: VALIDATE_TIMEOUT_MS,
|
|
142
|
-
});
|
|
143
|
-
if (result.is_valid === true) {
|
|
144
|
-
return {
|
|
145
|
-
status: "valid",
|
|
146
|
-
pendingSignatures: Array.isArray(result.pending_signatures)
|
|
147
|
-
? result.pending_signatures
|
|
148
|
-
: [],
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
if (result.is_valid === false) {
|
|
152
|
-
return {
|
|
153
|
-
status: "invalid",
|
|
154
|
-
message: result.message,
|
|
155
|
-
validationErrors: Array.isArray(result.validation_errors) ? result.validation_errors : [],
|
|
156
|
-
renderedMarkdown: result.rendered_markdown,
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
return { status: "unavailable" }; // no discriminant — no verdict
|
|
160
|
-
}
|
|
161
|
-
catch {
|
|
162
|
-
return { status: "unavailable" };
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
120
|
/** Synchronous fd-1 write — the process exits right after, an async write could truncate. */
|
|
166
121
|
function emit(outcome, platform) {
|
|
167
122
|
const encoded = encodeOutcome(outcome, platform);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-mthds-check.js","sourceRoot":"","sources":["../../src/hooks/claude-mthds-check.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"claude-mthds-check.js","sourceRoot":"","sources":["../../src/hooks/claude-mthds-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,wBAAwB,EACxB,oBAAoB,EACpB,wBAAwB,EACxB,aAAa,EACb,kBAAkB,EAClB,uBAAuB,GAIxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAIvD,KAAK,UAAU,SAAS;IACtB,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QACxC,MAAM,CAAC,I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@@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `.mthds` post-edit hook's networked stage: the edited file's method tree validated through
|
|
3
|
+
* the SDK (`POST /v1/validate`, `allow_signatures: true`), held to one deadline over the whole
|
|
4
|
+
* stage, so the hook never outlasts its harness's patience whatever the network does.
|
|
5
|
+
*/
|
|
6
|
+
import type { PipelexApiClient } from "../client.js";
|
|
7
|
+
import type { ValidateStage } from "./check-core.js";
|
|
8
|
+
/**
|
|
9
|
+
* The deadline over the whole validate stage, well under the hook's overall timeout: the version
|
|
10
|
+
* handshake, the blob route, the uploads of the files the API lacks (a tree up to the gatherer's
|
|
11
|
+
* caps, 12 MiB) and the validation itself all run under it.
|
|
12
|
+
*/
|
|
13
|
+
export declare const VALIDATE_TIMEOUT_MS = 10000;
|
|
14
|
+
/** What the stage may be handed instead of what it builds from the environment. */
|
|
15
|
+
export interface ValidateStageOptions {
|
|
16
|
+
/** The client to validate through; by default the hook's, given a `PIPELEX_API_KEY`. */
|
|
17
|
+
readonly client?: Pick<PipelexApiClient, "validate">;
|
|
18
|
+
/** The stage's deadline, `VALIDATE_TIMEOUT_MS` by default. */
|
|
19
|
+
readonly timeoutMs?: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Run the networked validate stage on `filePath`. Every no-verdict condition maps to
|
|
23
|
+
* `unavailable` — no API key, a tree the gatherer refuses, the deadline running out, any failure
|
|
24
|
+
* of the client — so a machine consumer branches on the structured verdict, never on transport,
|
|
25
|
+
* and the lint and format verdicts the hook already applied stand.
|
|
26
|
+
*/
|
|
27
|
+
export declare function runValidateStage(filePath: string, options?: ValidateStageOptions): Promise<ValidateStage>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `.mthds` post-edit hook's networked stage: the edited file's method tree validated through
|
|
3
|
+
* the SDK (`POST /v1/validate`, `allow_signatures: true`), held to one deadline over the whole
|
|
4
|
+
* stage, so the hook never outlasts its harness's patience whatever the network does.
|
|
5
|
+
*/
|
|
6
|
+
import { gatherMethodTree } from "./bundle-gather.js";
|
|
7
|
+
import { createHookClient } from "./validate-client.js";
|
|
8
|
+
/**
|
|
9
|
+
* The deadline over the whole validate stage, well under the hook's overall timeout: the version
|
|
10
|
+
* handshake, the blob route, the uploads of the files the API lacks (a tree up to the gatherer's
|
|
11
|
+
* caps, 12 MiB) and the validation itself all run under it.
|
|
12
|
+
*/
|
|
13
|
+
export const VALIDATE_TIMEOUT_MS = 10_000;
|
|
14
|
+
/**
|
|
15
|
+
* Run the networked validate stage on `filePath`. Every no-verdict condition maps to
|
|
16
|
+
* `unavailable` — no API key, a tree the gatherer refuses, the deadline running out, any failure
|
|
17
|
+
* of the client — so a machine consumer branches on the structured verdict, never on transport,
|
|
18
|
+
* and the lint and format verdicts the hook already applied stand.
|
|
19
|
+
*/
|
|
20
|
+
export async function runValidateStage(filePath, options = {}) {
|
|
21
|
+
if (options.client === undefined && !process.env.PIPELEX_API_KEY) {
|
|
22
|
+
return { status: "unavailable" };
|
|
23
|
+
}
|
|
24
|
+
// One deadline over the whole stage: the signal reaches every request and upload the
|
|
25
|
+
// validation makes, each stopped in flight once it fires, so nothing keeps running after the
|
|
26
|
+
// hook has given up on it.
|
|
27
|
+
const deadline = AbortSignal.timeout(options.timeoutMs ?? VALIDATE_TIMEOUT_MS);
|
|
28
|
+
const gathered = await gatherMethodTree(filePath);
|
|
29
|
+
if (!gathered.ok) {
|
|
30
|
+
return { status: "unavailable" };
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
const client = options.client ?? createHookClient();
|
|
34
|
+
const result = await client.validate({ tree: gathered.tree }, true, { signal: deadline });
|
|
35
|
+
if (result.is_valid === true) {
|
|
36
|
+
return {
|
|
37
|
+
status: "valid",
|
|
38
|
+
pendingSignatures: Array.isArray(result.pending_signatures)
|
|
39
|
+
? result.pending_signatures
|
|
40
|
+
: [],
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
if (result.is_valid === false) {
|
|
44
|
+
return {
|
|
45
|
+
status: "invalid",
|
|
46
|
+
message: result.message,
|
|
47
|
+
validationErrors: Array.isArray(result.validation_errors) ? result.validation_errors : [],
|
|
48
|
+
renderedMarkdown: result.rendered_markdown,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return { status: "unavailable" }; // no discriminant — no verdict
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return { status: "unavailable" };
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=validate-stage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-stage.js","sourceRoot":"","sources":["../../src/hooks/validate-stage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAU1C;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,QAAgB,EAChB,UAAgC,EAAE;IAElC,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC;QACjE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;IACnC,CAAC;IACD,qFAAqF;IACrF,6FAA6F;IAC7F,2BAA2B;IAC3B,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,IAAI,mBAAmB,CAAC,CAAC;IAC/E,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAClD,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;IACnC,CAAC;IACD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,gBAAgB,EAAE,CAAC;QACpD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC1F,IAAI,MAAM,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;YAC7B,OAAO;gBACL,MAAM,EAAE,OAAO;gBACf,iBAAiB,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAC;oBACzD,CAAC,CAAC,MAAM,CAAC,kBAAkB;oBAC3B,CAAC,CAAC,EAAE;aACP,CAAC;QACJ,CAAC;QACD,IAAI,MAAM,CAAC,QAAQ,KAAK,KAAK,EAAE,CAAC;YAC9B,OAAO;gBACL,MAAM,EAAE,SAAS;gBACjB,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,gBAAgB,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE;gBACzF,gBAAgB,EAAE,MAAM,CAAC,iBAAiB;aAC3C,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC,+BAA+B;IACnE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;IACnC,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -12,10 +12,9 @@ export * from "mthds/protocol";
|
|
|
12
12
|
export { PipelexApiClient, DEFAULT_API_BASE_URL, isGatewayCutOff } from "./client.js";
|
|
13
13
|
export { buildUserAgent, validateAppInfo, MAX_USER_AGENT_LENGTH } from "./user-agent.js";
|
|
14
14
|
export type { AppInfo, RuntimeInfo } from "./user-agent.js";
|
|
15
|
-
export type {
|
|
16
|
-
export type { BundleResourceBytes, BundleResources } from "./bundle-resources.js";
|
|
15
|
+
export type { PipelexApiRunExtensions, PipelexHostedRunExtensions, PipelexRunOptions, PipelexStartOptions, PipelexStartRequestOptions, PipelexValidateSource, ValidateMethodSelector, ValidateOptions, PipelexApiClientOptions, } from "./client.js";
|
|
17
16
|
export { INLINE_TREE_MAX_BYTES } from "./method-trees.js";
|
|
18
|
-
export type {
|
|
17
|
+
export type { MethodTreeForms, MethodTreeLimits } from "./method-trees.js";
|
|
19
18
|
export { parseMethodSelector } from "./method-selector.js";
|
|
20
19
|
export type { ParsedMethodSelector } from "./method-selector.js";
|
|
21
20
|
export { ExactJsonUnsupportedError, parseExactJson, stringifyExactJson } from "./exact-json.js";
|
|
@@ -27,7 +26,7 @@ export type { InputFormFault, PrepareInputsBase, PrepareInputsClosure, PrepareIn
|
|
|
27
26
|
export { inputFormFault } from "./prepare-inputs.js";
|
|
28
27
|
export { locateArtifacts, collectArtifacts, artifactFilename, PIPELEX_STORAGE_SCHEME, BULK_RESOLVE_MAX_URIS, DEFAULT_ARTIFACT_MAX_BYTES, DEFAULT_ARTIFACT_TIMEOUT_MS, DEFAULT_DOWNLOAD_MAX_TOTAL_BYTES, DEFAULT_DOWNLOAD_CONCURRENCY, } from "./artifacts.js";
|
|
29
28
|
export type { ArtifactItemError, ArtifactLocation, ArtifactScope, BulkResolveStorageUrlsInput, BulkResolvedStorageUrls, DownloadArtifactsOptions, DownloadArtifactsRequest, DownloadArtifactsResult, DownloadedArtifact, FetchArtifactOptions, ResolvedArtifact, } from "./artifacts.js";
|
|
30
|
-
export type { DiagnosticKind, DiagnosticRange, Diagnostic, LintResponse, FormatResponse, DictStuff, DictWorkingMemory, DictPipeOutput, DictRunResultExecute, MethodProvenance, PipelexRunResultStart, PipelexHostedToolingExtensions, DryRunStatus, ValidatedPipeEntry, LiftablePipeEntry, PipelexValidationReport, PipelexInvalidReport, PipelexValidationResult, ValidationErrorCategory, ValidationErrorItem, FixSafety, FixOpKind, TomlScalar, TomlValue, FixValue, SetKeyOp, EnsureTableOp, DeleteKeyOp, DeleteTableOp, RenameTableKeyOp, MoveKeyOp, RemapValueOp, FixOp, SuggestedFix,
|
|
29
|
+
export type { DiagnosticKind, DiagnosticRange, Diagnostic, LintResponse, FormatResponse, DictStuff, DictWorkingMemory, DictPipeOutput, DictRunResultExecute, MethodProvenance, PipelexRunResultStart, PipelexHostedToolingExtensions, DryRunStatus, ValidatedPipeEntry, LiftablePipeEntry, TreeFileUse, TreeFileRead, PipelexValidationReport, PipelexInvalidReport, PipelexValidationResult, ValidationErrorCategory, ValidationErrorItem, FixSafety, FixOpKind, TomlScalar, TomlValue, FixValue, SetKeyOp, EnsureTableOp, DeleteKeyOp, DeleteTableOp, RenameTableKeyOp, MoveKeyOp, RemapValueOp, FixOp, SuggestedFix, CrateRequestBase, CrateRouteOptions, CrateInvalidReport, GeneratedArtifact, ResolveRequest, ResolveValidReport, ResolveResponse, CodegenKind, CodegenTarget, CodegenRequest, CodegenValidReport, CodegenResponse, PipeIORequest, PipeIOValidReport, PipeIOResponse, ModelCheckCategory, ModelReferenceKind, ModelReferenceResolution, ModelReferenceMatchBase, PresetMatch, AliasMatch, WaterfallMatch, HandleMatch, ModelReferenceMatch, ModelReferenceVerdictBase, PresetReferenceVerdict, AliasReferenceVerdict, WaterfallReferenceVerdict, HandleReferenceVerdict, ModelReferenceVerdict, } from "./models.js";
|
|
31
30
|
export { runCodegenCheck, isStampableArtifactPath, STAMPABLE_ARTIFACT_SUFFIXES, CodegenLockError, } from "./codegen-check.js";
|
|
32
31
|
export type { CodegenCheckInput, CodegenCheckReport, CodegenDrift, CodegenDriftCategory, CodegenTreeFile, } from "./codegen-check.js";
|
|
33
32
|
export type { UserProfile, ListMethodExamplesQuery, ListMethodsQuery, ListMethodVersionsQuery, MethodData, MethodDeletionAccepted, MethodDeletionState, MethodDetail, MethodDraftInput, MethodExample, MethodExampleCreateInput, MethodExampleLatestRunInput, MethodExampleLatestRunOutcome, MethodExampleLatestRunRecorded, MethodExampleLatestRunResult, MethodExampleLatestRunStale, MethodExamplePage, MethodExampleUpdateInput, MethodPage, MethodPublished, MethodPublishInput, MethodPublishOutcome, MethodPublishRefusalReason, MethodPublishRefused, MethodPublishResult, MethodPublishUnchanged, MethodRenameInput, MethodSummary, MethodTreeInput, MethodVersion, MethodVersionPage, MethodVersionSummary, MethodWriteInput, SavedMethodFile, Membership, MembershipsResponse, OrgRole, SubscriptionResponse, PlanView, InvoiceView, CheckoutResponse, ChangePlanResponse, BillingPortalResponse, PipelexApiKey, PipelexApiKeyCreated, PipelexApiKeyList, OnboardingRole, OnboardingCurrentTool, OnboardingInputType, OnboardingHeardFrom, OnboardingSubmission, ResolvedStorageUrl, UploadInput, UploadedFile, UploadGrantInput, UploadGrant, ListRunsQuery, PipelineRun, RunDetail, RunHistoryItem, RunPage, UpdateRunInput, } from "./product-models.js";
|
package/dist/index.js
CHANGED
|
@@ -19,9 +19,10 @@ export { PipelexApiClient, DEFAULT_API_BASE_URL, isGatewayCutOff } from "./clien
|
|
|
19
19
|
// makes its own raw requests to the API sends the same value, and can check an `appInfo`
|
|
20
20
|
// against the grammar and the length ceiling before constructing a client.
|
|
21
21
|
export { buildUserAgent, validateAppInfo, MAX_USER_AGENT_LENGTH } from "./user-agent.js";
|
|
22
|
-
// A
|
|
23
|
-
//
|
|
24
|
-
//
|
|
22
|
+
// A method's tree: the four forms every method-taking route takes it in, the limits
|
|
23
|
+
// `methodTreeLimits` reports, and the inline threshold below which a tree travels whole. The
|
|
24
|
+
// standard's own tree types (`MethodTreeSource`, `BlobRef`, `MissingBlobsResult` and the rest)
|
|
25
|
+
// come with the `mthds/protocol` re-export above.
|
|
25
26
|
export { INLINE_TREE_MAX_BYTES } from "./method-trees.js";
|
|
26
27
|
// A method selector (`mt_…`, `mt_…@<n>`, `mt_…@draft`) → its bare id and the version it names.
|
|
27
28
|
export { parseMethodSelector } from "./method-selector.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,6FAA6F;AAC7F,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,oFAAoF;AACpF,kFAAkF;AAClF,mFAAmF;AACnF,wBAAwB;AACxB,cAAc,gBAAgB,CAAC;AAE/B,wEAAwE;AACxE,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACtF,sFAAsF;AACtF,yFAAyF;AACzF,2EAA2E;AAC3E,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,6FAA6F;AAC7F,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,oFAAoF;AACpF,kFAAkF;AAClF,mFAAmF;AACnF,wBAAwB;AACxB,cAAc,gBAAgB,CAAC;AAE/B,wEAAwE;AACxE,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACtF,sFAAsF;AACtF,yFAAyF;AACzF,2EAA2E;AAC3E,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAczF,oFAAoF;AACpF,6FAA6F;AAC7F,+FAA+F;AAC/F,kDAAkD;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,+FAA+F;AAC/F,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,+FAA+F;AAC/F,6FAA6F;AAC7F,iGAAiG;AACjG,8FAA8F;AAC9F,iEAAiE;AACjE,OAAO,EAAE,yBAAyB,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CA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