@pipelex/sdk 0.47.0 → 0.48.1
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 +9 -7
- package/dist/artifacts.d.ts +4 -3
- package/dist/artifacts.js +20 -14
- package/dist/artifacts.js.map +1 -1
- 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 +326 -213
- package/dist/client.js +829 -517
- package/dist/client.js.map +1 -1
- package/dist/codegen-check.d.ts +2 -3
- package/dist/codegen-check.js +2 -3
- package/dist/codegen-check.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 +47 -40
- package/dist/hooks/bundle-gather.js +121 -219
- package/dist/hooks/bundle-gather.js.map +1 -1
- package/dist/hooks/check-core.d.ts +70 -6
- package/dist/hooks/check-core.js +188 -29
- package/dist/hooks/check-core.js.map +1 -1
- package/dist/hooks/claude-mthds-check.d.ts +19 -5
- package/dist/hooks/claude-mthds-check.js +20 -53
- package/dist/hooks/claude-mthds-check.js.map +1 -1
- package/dist/hooks/secret-guard.d.ts +38 -0
- package/dist/hooks/secret-guard.js +134 -0
- package/dist/hooks/secret-guard.js.map +1 -0
- package/dist/hooks/validate-stage.d.ts +29 -0
- package/dist/hooks/validate-stage.js +66 -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 +220 -74
- package/dist/method-trees.js +250 -37
- package/dist/method-trees.js.map +1 -1
- package/dist/models.d.ts +162 -59
- package/dist/node-host/node.d.ts +33 -0
- package/dist/node-host/node.js +27 -0
- package/dist/node-host/node.js.map +1 -0
- package/dist/node-host/unavailable.d.ts +8 -0
- package/dist/node-host/unavailable.js +8 -0
- package/dist/node-host/unavailable.js.map +1 -0
- package/dist/node-host.d.ts +53 -0
- package/dist/node-host.js +72 -0
- package/dist/node-host.js.map +1 -0
- 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/upload.d.ts +4 -9
- package/dist/upload.js +13 -16
- package/dist/upload.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/architecture.md +44 -21
- package/docs/cli.md +1 -1
- package/docs/crate-routes.md +43 -21
- package/docs/errors.md +5 -5
- package/docs/hook-bundle.md +27 -1
- package/docs/input-preparation.md +13 -13
- package/docs/method-trees.md +120 -22
- package/docs/run-results.md +5 -2
- package/package.json +8 -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
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
* API a produced verdict is always a 200; server/config faults are non-2xx =
|
|
13
13
|
* no verdict = unavailable)
|
|
14
14
|
* - validate valid + pending `PipeSignature`s → non-blocking additionalContext
|
|
15
|
+
* - tree files kept home as secrets → named in a note after the verdict's
|
|
16
|
+
* text: non-blocking beside a valid verdict, inside an invalid one's block
|
|
17
|
+
* - validate refused (a bundle or the manifest looks like a secret, so
|
|
18
|
+
* nothing was sent) → non-blocking additionalContext naming the files
|
|
15
19
|
* - any stage unavailable → fail-open (the other stages' verdicts stand)
|
|
16
20
|
*/
|
|
17
21
|
import type { Diagnostic, ValidationErrorItem } from "../models.js";
|
|
@@ -24,27 +28,54 @@ export type LintStage = {
|
|
|
24
28
|
} | {
|
|
25
29
|
status: "unavailable";
|
|
26
30
|
};
|
|
27
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* A file of the method's tree that the hook kept on this machine, since it looks like a secret
|
|
33
|
+
* (`secret-guard.ts`): its absolute path, and why, in words that quote nothing of the file.
|
|
34
|
+
*/
|
|
35
|
+
export interface WithheldFile {
|
|
36
|
+
path: string;
|
|
37
|
+
reason: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Verdict of the networked validate stage. `unavailable` = no verdict could be produced.
|
|
41
|
+
* `withheld` lists the files of the tree that stayed home, empty when every file was sent: a
|
|
42
|
+
* verdict is about the tree without them. `refused` = nothing was sent, because a file every
|
|
43
|
+
* validation reads, a bundle or the manifest, looks like a secret, so no tree without it is the
|
|
44
|
+
* method; `root` is the tree's root and `withheld` lists every file of the tree that looks like
|
|
45
|
+
* one, those every validation reads first.
|
|
46
|
+
*/
|
|
28
47
|
export type ValidateStage = {
|
|
29
48
|
status: "valid";
|
|
30
49
|
pendingSignatures: string[];
|
|
50
|
+
withheld: WithheldFile[];
|
|
31
51
|
} | {
|
|
32
52
|
status: "invalid";
|
|
33
53
|
message?: string;
|
|
34
54
|
validationErrors: ValidationErrorItem[];
|
|
35
55
|
renderedMarkdown?: string;
|
|
56
|
+
withheld: WithheldFile[];
|
|
57
|
+
} | {
|
|
58
|
+
status: "refused";
|
|
59
|
+
root: string;
|
|
60
|
+
withheld: WithheldFile[];
|
|
36
61
|
} | {
|
|
37
62
|
status: "unavailable";
|
|
38
63
|
};
|
|
39
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* The hook's decision, prior to JSON encoding. `notes` say which files of a method's tree stayed
|
|
66
|
+
* home: they ride apart from the text so that merging the outcomes of several files of one tree
|
|
67
|
+
* names each note once, and encoding places them after the text (see {@link outcomeText}).
|
|
68
|
+
*/
|
|
40
69
|
export type HookOutcome = {
|
|
41
70
|
kind: "pass";
|
|
42
71
|
} | {
|
|
43
72
|
kind: "block";
|
|
44
73
|
reason: string;
|
|
74
|
+
notes?: string[];
|
|
45
75
|
} | {
|
|
46
76
|
kind: "context";
|
|
47
77
|
context: string;
|
|
78
|
+
notes?: string[];
|
|
48
79
|
};
|
|
49
80
|
/**
|
|
50
81
|
* Which harness invoked the hook. Claude and Codex share the block /
|
|
@@ -171,16 +202,41 @@ export declare function extractVibeMthdsFilePath(stdinJson: string): {
|
|
|
171
202
|
/**
|
|
172
203
|
* Merge per-file outcomes (Codex's `apply_patch` can touch several `.mthds`
|
|
173
204
|
* files in one call) into the single decision the hook emits: any block wins
|
|
174
|
-
* (reasons joined), else contexts are joined, else pass.
|
|
205
|
+
* (reasons joined), else contexts are joined, else pass. The notes of every
|
|
206
|
+
* outcome are kept, whichever kind wins, since a tree's withheld files or its
|
|
207
|
+
* refused validation matter whatever another file's check found, and each is
|
|
208
|
+
* kept once, so several files of one tree, whose notes are the same, name its
|
|
209
|
+
* withheld files once. A merged text carrying notes is left whole, for
|
|
210
|
+
* {@link outcomeText} to make the one cut it needs, with the true count.
|
|
175
211
|
*/
|
|
176
212
|
export declare function mergeOutcomes(outcomes: HookOutcome[]): HookOutcome;
|
|
177
213
|
export declare function truncate(text: string): string;
|
|
214
|
+
/**
|
|
215
|
+
* The text an outcome is encoded with: its own text, then its notes, within the output's cap.
|
|
216
|
+
* The text keeps its place and every character the notes leave it, so a verdict's errors are
|
|
217
|
+
* never cut for a note; the notes take at most {@link NOTES_SHARE}, a bound a note's capped list
|
|
218
|
+
* of files keeps them under but for paths of extreme length.
|
|
219
|
+
*/
|
|
220
|
+
export declare function outcomeText(outcome: Exclude<HookOutcome, {
|
|
221
|
+
kind: "pass";
|
|
222
|
+
}>): string;
|
|
178
223
|
/**
|
|
179
224
|
* Map the lint verdict to a decision. Every engine diagnostic is an error by
|
|
180
225
|
* construction (the shared Rust engine emits `severity: "error"` only), so any
|
|
181
226
|
* diagnostic blocks — the same bar as `plxt lint`'s non-zero exit.
|
|
182
227
|
*/
|
|
183
228
|
export declare function decideAfterLint(filePath: string, lint: LintStage): HookOutcome;
|
|
229
|
+
/**
|
|
230
|
+
* A path as the hook's output shows it, a Markdown code span the agent reads as one inert token,
|
|
231
|
+
* whatever the file's name or the tree's root holds. Each control character, a line break
|
|
232
|
+
* included, is written as a visible escape (`\n`, `\u001b`), so a name cannot start a line of
|
|
233
|
+
* its own in the output; the span is fenced by a run of backticks longer than any inside the
|
|
234
|
+
* path, so a backtick in it cannot close the span; and, as CommonMark's code spans read, it is
|
|
235
|
+
* padded with a space when the path starts or ends with a backtick, which would otherwise join
|
|
236
|
+
* the fence, or starts and ends with a space, which would otherwise be stripped. A backslash is
|
|
237
|
+
* left as it is, so a Windows path reads as itself.
|
|
238
|
+
*/
|
|
239
|
+
export declare function pathSpan(path: string): string;
|
|
184
240
|
/**
|
|
185
241
|
* Map the validate verdict to a decision.
|
|
186
242
|
*
|
|
@@ -190,11 +246,19 @@ export declare function decideAfterLint(filePath: string, lint: LintStage): Hook
|
|
|
190
246
|
* Valid passes, with a non-blocking nudge listing still-unimplemented
|
|
191
247
|
* `PipeSignature`s. Unavailable passes silently — the local lint/format
|
|
192
248
|
* verdicts already applied.
|
|
249
|
+
*
|
|
250
|
+
* A verdict reached without files the hook kept home says which, and why, in
|
|
251
|
+
* a note placed after the verdict's text: non-blocking beside a valid verdict,
|
|
252
|
+
* and inside an invalid one's block, so the agent reads an error about a
|
|
253
|
+
* missing file as the hook's doing while the errors keep their place. A
|
|
254
|
+
* refused validation sent nothing, and its note never blocks, since no verdict
|
|
255
|
+
* was produced; the lint and format verdicts stand.
|
|
193
256
|
*/
|
|
194
257
|
export declare function decideAfterValidate(filePath: string, validate: ValidateStage): HookOutcome;
|
|
195
258
|
/**
|
|
196
|
-
* Encode an outcome as the harness's stdout payload
|
|
197
|
-
*
|
|
198
|
-
*
|
|
259
|
+
* Encode an outcome as the harness's stdout payload, its text and notes as
|
|
260
|
+
* {@link outcomeText} places them. `pass` is empty output; the hook always
|
|
261
|
+
* exits 0. Claude and Codex share the block / `hookSpecificOutput` protocol;
|
|
262
|
+
* Vibe speaks deny / `hook_specific_output`.
|
|
199
263
|
*/
|
|
200
264
|
export declare function encodeOutcome(outcome: HookOutcome, platform?: HookPlatform): string;
|
package/dist/hooks/check-core.js
CHANGED
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
* API a produced verdict is always a 200; server/config faults are non-2xx =
|
|
13
13
|
* no verdict = unavailable)
|
|
14
14
|
* - validate valid + pending `PipeSignature`s → non-blocking additionalContext
|
|
15
|
+
* - tree files kept home as secrets → named in a note after the verdict's
|
|
16
|
+
* text: non-blocking beside a valid verdict, inside an invalid one's block
|
|
17
|
+
* - validate refused (a bundle or the manifest looks like a secret, so
|
|
18
|
+
* nothing was sent) → non-blocking additionalContext naming the files
|
|
15
19
|
* - any stage unavailable → fail-open (the other stages' verdicts stand)
|
|
16
20
|
*/
|
|
17
21
|
import { isAbsolute as isAbsolutePath, resolve as resolvePath } from "node:path";
|
|
@@ -197,7 +201,7 @@ function comparedLines(addedLines) {
|
|
|
197
201
|
* as a clean check.
|
|
198
202
|
*/
|
|
199
203
|
export function uncheckedShellPatchNote(paths) {
|
|
200
|
-
const named = paths.map(
|
|
204
|
+
const named = paths.map(pathSpan);
|
|
201
205
|
const list = named.length === 1 ? named[0] : `${named.slice(0, -1).join(", ")} and ${named.at(-1)}`;
|
|
202
206
|
const context = named.length === 1
|
|
203
207
|
? `The .mthds hook did not check ${list}: it could not confirm which file this shell ` +
|
|
@@ -235,22 +239,41 @@ export function extractVibeMthdsFilePath(stdinJson) {
|
|
|
235
239
|
/**
|
|
236
240
|
* Merge per-file outcomes (Codex's `apply_patch` can touch several `.mthds`
|
|
237
241
|
* files in one call) into the single decision the hook emits: any block wins
|
|
238
|
-
* (reasons joined), else contexts are joined, else pass.
|
|
242
|
+
* (reasons joined), else contexts are joined, else pass. The notes of every
|
|
243
|
+
* outcome are kept, whichever kind wins, since a tree's withheld files or its
|
|
244
|
+
* refused validation matter whatever another file's check found, and each is
|
|
245
|
+
* kept once, so several files of one tree, whose notes are the same, name its
|
|
246
|
+
* withheld files once. A merged text carrying notes is left whole, for
|
|
247
|
+
* {@link outcomeText} to make the one cut it needs, with the true count.
|
|
239
248
|
*/
|
|
240
249
|
export function mergeOutcomes(outcomes) {
|
|
250
|
+
const notes = notesOf(outcomes);
|
|
241
251
|
const blocks = outcomes.filter((outcome) => outcome.kind === "block");
|
|
242
252
|
if (blocks.length > 0) {
|
|
243
|
-
|
|
253
|
+
const reason = joinTexts(blocks.map((block) => block.reason));
|
|
254
|
+
return notes.length > 0
|
|
255
|
+
? { kind: "block", reason, notes }
|
|
256
|
+
: { kind: "block", reason: truncate(reason) };
|
|
244
257
|
}
|
|
245
258
|
const contexts = outcomes.filter((outcome) => outcome.kind === "context");
|
|
246
259
|
if (contexts.length > 0) {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
260
|
+
const context = joinTexts(contexts.map((outcome) => outcome.context));
|
|
261
|
+
return notes.length > 0
|
|
262
|
+
? { kind: "context", context, notes }
|
|
263
|
+
: { kind: "context", context: truncate(context) };
|
|
251
264
|
}
|
|
252
265
|
return { kind: "pass" };
|
|
253
266
|
}
|
|
267
|
+
/** Texts joined as paragraphs, an empty one, that of an outcome holding only notes, left out. */
|
|
268
|
+
function joinTexts(texts) {
|
|
269
|
+
return texts.filter((text) => text !== "").join("\n\n");
|
|
270
|
+
}
|
|
271
|
+
/** Every distinct note of `outcomes`, in order. */
|
|
272
|
+
function notesOf(outcomes) {
|
|
273
|
+
return [
|
|
274
|
+
...new Set(outcomes.flatMap((outcome) => (outcome.kind === "pass" ? [] : (outcome.notes ?? [])))),
|
|
275
|
+
];
|
|
276
|
+
}
|
|
254
277
|
/** Cap on emitted reason/context bodies — same guard as the plxt-era hook. */
|
|
255
278
|
const MAX_OUTPUT_CHARS = 9500;
|
|
256
279
|
export function truncate(text) {
|
|
@@ -260,6 +283,36 @@ export function truncate(text) {
|
|
|
260
283
|
const omitted = text.length - MAX_OUTPUT_CHARS;
|
|
261
284
|
return `${text.slice(0, MAX_OUTPUT_CHARS)}\n\n[truncated, ${omitted} chars omitted]`;
|
|
262
285
|
}
|
|
286
|
+
/** `text` cut to `budget` characters at most, the marker of the cut included, when longer. */
|
|
287
|
+
function fitWithin(text, budget) {
|
|
288
|
+
if (text.length <= budget) {
|
|
289
|
+
return text;
|
|
290
|
+
}
|
|
291
|
+
const marker = (omitted) => `\n\n[truncated, ${omitted} chars omitted]`;
|
|
292
|
+
// The marker is no longer for a smaller count, so measuring it for the whole text bounds it.
|
|
293
|
+
const kept = Math.max(0, budget - marker(text.length).length);
|
|
294
|
+
return `${text.slice(0, kept)}${marker(text.length - kept)}`;
|
|
295
|
+
}
|
|
296
|
+
/** The most of the output's characters an outcome's notes take, so its text keeps the rest. */
|
|
297
|
+
const NOTES_SHARE = 3000;
|
|
298
|
+
/**
|
|
299
|
+
* The text an outcome is encoded with: its own text, then its notes, within the output's cap.
|
|
300
|
+
* The text keeps its place and every character the notes leave it, so a verdict's errors are
|
|
301
|
+
* never cut for a note; the notes take at most {@link NOTES_SHARE}, a bound a note's capped list
|
|
302
|
+
* of files keeps them under but for paths of extreme length.
|
|
303
|
+
*/
|
|
304
|
+
export function outcomeText(outcome) {
|
|
305
|
+
const text = outcome.kind === "block" ? outcome.reason : outcome.context;
|
|
306
|
+
const notes = outcome.notes ?? [];
|
|
307
|
+
if (notes.length === 0) {
|
|
308
|
+
return text;
|
|
309
|
+
}
|
|
310
|
+
const notesText = fitWithin(notes.join("\n\n"), NOTES_SHARE);
|
|
311
|
+
if (text === "") {
|
|
312
|
+
return notesText;
|
|
313
|
+
}
|
|
314
|
+
return `${fitWithin(text, MAX_OUTPUT_CHARS - notesText.length - 2)}\n\n${notesText}`;
|
|
315
|
+
}
|
|
263
316
|
/**
|
|
264
317
|
* One diagnostic as an agent-actionable line: severity, locators, message.
|
|
265
318
|
* `location` and `range` are independent — a schema/semantic diagnostic can name
|
|
@@ -301,6 +354,86 @@ function renderValidationErrorLine(item) {
|
|
|
301
354
|
.join(", ");
|
|
302
355
|
return `- [${item.category ?? "error"}] ${item.message ?? ""}${locators ? ` (${locators})` : ""}`;
|
|
303
356
|
}
|
|
357
|
+
/** How many withheld files a note names; the rest it counts. */
|
|
358
|
+
const WITHHELD_LISTED = 10;
|
|
359
|
+
/** A control character, line breaks included, and the Unicode line and paragraph separators. */
|
|
360
|
+
const CONTROL_CHARACTERS = /[\p{Cc}\u2028\u2029]/gu;
|
|
361
|
+
/** The escapes a reader knows by sight; any other control character is written `\uXXXX`. */
|
|
362
|
+
const NAMED_ESCAPES = { "\n": "\\n", "\r": "\\r", "\t": "\\t" };
|
|
363
|
+
/**
|
|
364
|
+
* A path as the hook's output shows it, a Markdown code span the agent reads as one inert token,
|
|
365
|
+
* whatever the file's name or the tree's root holds. Each control character, a line break
|
|
366
|
+
* included, is written as a visible escape (`\n`, `\u001b`), so a name cannot start a line of
|
|
367
|
+
* its own in the output; the span is fenced by a run of backticks longer than any inside the
|
|
368
|
+
* path, so a backtick in it cannot close the span; and, as CommonMark's code spans read, it is
|
|
369
|
+
* padded with a space when the path starts or ends with a backtick, which would otherwise join
|
|
370
|
+
* the fence, or starts and ends with a space, which would otherwise be stripped. A backslash is
|
|
371
|
+
* left as it is, so a Windows path reads as itself.
|
|
372
|
+
*/
|
|
373
|
+
export function pathSpan(path) {
|
|
374
|
+
const shown = path.replace(CONTROL_CHARACTERS, (character) => NAMED_ESCAPES[character] ?? `\\u${character.codePointAt(0).toString(16).padStart(4, "0")}`);
|
|
375
|
+
const longestRun = Math.max(0, ...(shown.match(/`+/g) ?? []).map((run) => run.length));
|
|
376
|
+
const fence = "`".repeat(longestRun + 1);
|
|
377
|
+
const padded = shown.startsWith("`") ||
|
|
378
|
+
shown.endsWith("`") ||
|
|
379
|
+
(shown.startsWith(" ") && shown.endsWith(" ") && /[^ ]/.test(shown));
|
|
380
|
+
return padded ? `${fence} ${shown} ${fence}` : `${fence}${shown}${fence}`;
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* The withheld files as Markdown list items, each path, rendered by {@link pathSpan}, and why,
|
|
384
|
+
* never what the file holds: the first {@link WITHHELD_LISTED}, then how many more, so a tree
|
|
385
|
+
* full of key files cannot crowd a verdict out of the hook's output.
|
|
386
|
+
*/
|
|
387
|
+
function withheldLines(withheld) {
|
|
388
|
+
const lines = withheld
|
|
389
|
+
.slice(0, WITHHELD_LISTED)
|
|
390
|
+
.map((file) => `- ${pathSpan(file.path)} (${file.reason})`);
|
|
391
|
+
const more = withheld.length - WITHHELD_LISTED;
|
|
392
|
+
return more > 0 ? [...lines, `- and ${more} more ${more === 1 ? "file" : "files"}`] : lines;
|
|
393
|
+
}
|
|
394
|
+
/** Why a key must not ride a method, the workshop's own words. */
|
|
395
|
+
const KEY_BELONGS_IN_THE_ENVIRONMENT = "A key belongs in the environment, never in a method: a method's files leave this machine " +
|
|
396
|
+
"for the Pipelex API, which keeps them in the organization's storage, where every member can " +
|
|
397
|
+
"read them.";
|
|
398
|
+
/** How a file is kept out of the method's tree, which only the tree's own rule decides. */
|
|
399
|
+
const KEEP_IT_OUT = "keep the file out of the method's tree with a `.gitignore` line inside the tree, since one " +
|
|
400
|
+
"above the tree's root is not read, or with a name starting with a dot";
|
|
401
|
+
/**
|
|
402
|
+
* The note on a verdict reached without some files of the tree. A step reading one of them, such
|
|
403
|
+
* as a `PipeDocGen` step's template or a `PipeFunc` step's module, cannot load without it, so the
|
|
404
|
+
* validation reports it missing; the note says so, and the error goes once the secret is out of
|
|
405
|
+
* the file.
|
|
406
|
+
*/
|
|
407
|
+
function withheldNote(withheld) {
|
|
408
|
+
return [
|
|
409
|
+
"The .mthds hook kept these files of the method's tree on this machine, since each looks " +
|
|
410
|
+
"like a secret, and validated the method without them:",
|
|
411
|
+
...withheldLines(withheld),
|
|
412
|
+
"",
|
|
413
|
+
"If a step reads one of them, as its template or its Python module, the validation reports " +
|
|
414
|
+
"that file missing until the secret is moved out of it. " +
|
|
415
|
+
KEY_BELONGS_IN_THE_ENVIRONMENT +
|
|
416
|
+
` Move the secret out of the file, or ${KEEP_IT_OUT}. A file kept home for its name alone ` +
|
|
417
|
+
"that holds no key can be renamed.",
|
|
418
|
+
].join("\n");
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* The note on a validation the hook did not send, a bundle or the manifest looking like a secret.
|
|
422
|
+
* It names the method by its tree's root, which every file of the tree shares, so the notes of
|
|
423
|
+
* several of them are one.
|
|
424
|
+
*/
|
|
425
|
+
function refusedNote(root, withheld) {
|
|
426
|
+
return [
|
|
427
|
+
`The .mthds hook did not validate the method at ${pathSpan(root)}: these files of its tree look ` +
|
|
428
|
+
"like a secret, and every validation reads the method's bundles and its manifest, so " +
|
|
429
|
+
"nothing was sent:",
|
|
430
|
+
...withheldLines(withheld),
|
|
431
|
+
"",
|
|
432
|
+
KEY_BELONGS_IN_THE_ENVIRONMENT +
|
|
433
|
+
" Move the secret out of each bundle or manifest listed, and the next edit is validated; " +
|
|
434
|
+
`any other file listed can instead stay where it is if you ${KEEP_IT_OUT}.`,
|
|
435
|
+
].join("\n");
|
|
436
|
+
}
|
|
304
437
|
/**
|
|
305
438
|
* Map the validate verdict to a decision.
|
|
306
439
|
*
|
|
@@ -310,41 +443,67 @@ function renderValidationErrorLine(item) {
|
|
|
310
443
|
* Valid passes, with a non-blocking nudge listing still-unimplemented
|
|
311
444
|
* `PipeSignature`s. Unavailable passes silently — the local lint/format
|
|
312
445
|
* verdicts already applied.
|
|
446
|
+
*
|
|
447
|
+
* A verdict reached without files the hook kept home says which, and why, in
|
|
448
|
+
* a note placed after the verdict's text: non-blocking beside a valid verdict,
|
|
449
|
+
* and inside an invalid one's block, so the agent reads an error about a
|
|
450
|
+
* missing file as the hook's doing while the errors keep their place. A
|
|
451
|
+
* refused validation sent nothing, and its note never blocks, since no verdict
|
|
452
|
+
* was produced; the lint and format verdicts stand.
|
|
313
453
|
*/
|
|
314
454
|
export function decideAfterValidate(filePath, validate) {
|
|
315
455
|
switch (validate.status) {
|
|
316
456
|
case "unavailable":
|
|
317
457
|
return { kind: "pass" };
|
|
458
|
+
case "refused":
|
|
459
|
+
return {
|
|
460
|
+
kind: "context",
|
|
461
|
+
context: "",
|
|
462
|
+
notes: [refusedNote(validate.root, validate.withheld)],
|
|
463
|
+
};
|
|
318
464
|
case "valid": {
|
|
319
|
-
|
|
465
|
+
const notes = validate.withheld.length > 0 ? [withheldNote(validate.withheld)] : [];
|
|
466
|
+
const nudge = validate.pendingSignatures.length > 0
|
|
467
|
+
? "Bundle is valid but not yet runnable. Signatures still unimplemented (PipeSignature placeholders): " +
|
|
468
|
+
validate.pendingSignatures.join(", ") +
|
|
469
|
+
". They mock their output on dry-run; implement them before running the method for real."
|
|
470
|
+
: "";
|
|
471
|
+
if (nudge === "" && notes.length === 0) {
|
|
320
472
|
return { kind: "pass" };
|
|
321
473
|
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
474
|
+
// A text carrying notes is cut once, by `outcomeText`, which knows what the notes take.
|
|
475
|
+
return notes.length > 0
|
|
476
|
+
? { kind: "context", context: nudge, notes }
|
|
477
|
+
: { kind: "context", context: truncate(nudge) };
|
|
326
478
|
}
|
|
327
479
|
case "invalid": {
|
|
480
|
+
let reason;
|
|
328
481
|
if (validate.renderedMarkdown) {
|
|
329
|
-
|
|
482
|
+
reason = validate.renderedMarkdown;
|
|
330
483
|
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
484
|
+
else {
|
|
485
|
+
const lines = [
|
|
486
|
+
`Validation failed for ${filePath}:`,
|
|
487
|
+
"",
|
|
488
|
+
validate.message || "Bundle is invalid.",
|
|
489
|
+
];
|
|
490
|
+
if (validate.validationErrors.length > 0) {
|
|
491
|
+
lines.push("");
|
|
492
|
+
lines.push(...validate.validationErrors.map(renderValidationErrorLine));
|
|
493
|
+
}
|
|
494
|
+
reason = lines.join("\n");
|
|
339
495
|
}
|
|
340
|
-
return
|
|
496
|
+
return validate.withheld.length > 0
|
|
497
|
+
? { kind: "block", reason, notes: [withheldNote(validate.withheld)] }
|
|
498
|
+
: { kind: "block", reason: truncate(reason) };
|
|
341
499
|
}
|
|
342
500
|
}
|
|
343
501
|
}
|
|
344
502
|
/**
|
|
345
|
-
* Encode an outcome as the harness's stdout payload
|
|
346
|
-
*
|
|
347
|
-
*
|
|
503
|
+
* Encode an outcome as the harness's stdout payload, its text and notes as
|
|
504
|
+
* {@link outcomeText} places them. `pass` is empty output; the hook always
|
|
505
|
+
* exits 0. Claude and Codex share the block / `hookSpecificOutput` protocol;
|
|
506
|
+
* Vibe speaks deny / `hook_specific_output`.
|
|
348
507
|
*/
|
|
349
508
|
export function encodeOutcome(outcome, platform = "claude") {
|
|
350
509
|
switch (outcome.kind) {
|
|
@@ -352,20 +511,20 @@ export function encodeOutcome(outcome, platform = "claude") {
|
|
|
352
511
|
return "";
|
|
353
512
|
case "block":
|
|
354
513
|
if (platform === "vibe") {
|
|
355
|
-
return JSON.stringify({ decision: "deny", reason: outcome
|
|
514
|
+
return JSON.stringify({ decision: "deny", reason: outcomeText(outcome) }) + "\n";
|
|
356
515
|
}
|
|
357
|
-
return JSON.stringify({ decision: "block", reason: outcome
|
|
516
|
+
return JSON.stringify({ decision: "block", reason: outcomeText(outcome) }) + "\n";
|
|
358
517
|
case "context":
|
|
359
518
|
if (platform === "vibe") {
|
|
360
519
|
return (JSON.stringify({
|
|
361
520
|
decision: "allow",
|
|
362
|
-
hook_specific_output: { additional_context: outcome
|
|
521
|
+
hook_specific_output: { additional_context: outcomeText(outcome) },
|
|
363
522
|
}) + "\n");
|
|
364
523
|
}
|
|
365
524
|
return (JSON.stringify({
|
|
366
525
|
hookSpecificOutput: {
|
|
367
526
|
hookEventName: "PostToolUse",
|
|
368
|
-
additionalContext: outcome
|
|
527
|
+
additionalContext: outcomeText(outcome),
|
|
369
528
|
},
|
|
370
529
|
}) + "\n");
|
|
371
530
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-core.js","sourceRoot":"","sources":["../../src/hooks/check-core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;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ACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,OAAoB,EAAE,WAAyB,QAAQ;IACnF,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;QACrB,KAAK,MAAM;YACT,OAAO,EAAE,CAAC;QACZ,KAAK,OAAO;YACV,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;gBACxB,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;YACnF,CAAC;YACD,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;QACpF,KAAK,SAAS;YACZ,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;gBACxB,OAAO,CACL,IAAI,CAAC,SAAS,CAAC;oBACb,QAAQ,EAAE,OAAO;oBACjB,oBAAoB,EAAE,EAAE,kBAAkB,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE;iBACnE,CAAC,GAAG,IAAI,CACV,CAAC;YACJ,CAAC;YACD,OAAO,CACL,IAAI,CAAC,SAAS,CAAC;gBACb,kBAAkB,EAAE;oBAClB,aAAa,EAAE,aAAa;oBAC5B,iBAAiB,EAAE,WAAW,CAAC,OAAO,CAAC;iBACxC;aACF,CAAC,GAAG,IAAI,CACV,CAAC;IACN,CAAC;AACH,CAAC"}
|
|
@@ -27,11 +27,25 @@
|
|
|
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`)
|
|
37
|
+
*
|
|
38
|
+
* Secrets stay home: with a `PIPELEX_API_KEY` set, before any request, every
|
|
39
|
+
* file of the method's tree is read and screened by the workshop's rule, as
|
|
40
|
+
* `secret-guard.ts` refines it; with none, nothing of the tree is read or sent.
|
|
41
|
+
* A file that looks like a secret is left out, never sent and never quoted.
|
|
42
|
+
* When the validation then returns a verdict, a note after the verdict's text
|
|
43
|
+
* names each such file and why; when it returns none (a network error, a
|
|
44
|
+
* non-2xx, the deadline), the stage passes silently as above and no note is
|
|
45
|
+
* shown. One that is a bundle or the manifest, which every validation reads,
|
|
46
|
+
* keeps the whole tree home, and a non-blocking note names the files instead
|
|
47
|
+
* of a verdict (`bundle-gather.ts`). The notes of several files of one tree
|
|
48
|
+
* are named once, each path a Markdown code span that no name can break out of.
|
|
35
49
|
*
|
|
36
50
|
* The hook always exits 0; a block/deny is expressed on stdout, never via the
|
|
37
51
|
* exit code.
|
|
@@ -27,11 +27,25 @@
|
|
|
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`)
|
|
37
|
+
*
|
|
38
|
+
* Secrets stay home: with a `PIPELEX_API_KEY` set, before any request, every
|
|
39
|
+
* file of the method's tree is read and screened by the workshop's rule, as
|
|
40
|
+
* `secret-guard.ts` refines it; with none, nothing of the tree is read or sent.
|
|
41
|
+
* A file that looks like a secret is left out, never sent and never quoted.
|
|
42
|
+
* When the validation then returns a verdict, a note after the verdict's text
|
|
43
|
+
* names each such file and why; when it returns none (a network error, a
|
|
44
|
+
* non-2xx, the deadline), the stage passes silently as above and no note is
|
|
45
|
+
* shown. One that is a bundle or the manifest, which every validation reads,
|
|
46
|
+
* keeps the whole tree home, and a non-blocking note names the files instead
|
|
47
|
+
* of a verdict (`bundle-gather.ts`). The notes of several files of one tree
|
|
48
|
+
* are named once, each path a Markdown code span that no name can break out of.
|
|
35
49
|
*
|
|
36
50
|
* The hook always exits 0; a block/deny is expressed on stdout, never via the
|
|
37
51
|
* exit code.
|
|
@@ -39,10 +53,7 @@
|
|
|
39
53
|
import { readFileSync, writeFileSync } from "node:fs";
|
|
40
54
|
import { resolve as resolvePath } from "node:path";
|
|
41
55
|
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;
|
|
56
|
+
import { runValidateStage } from "./validate-stage.js";
|
|
46
57
|
async function readStdin() {
|
|
47
58
|
const chunks = [];
|
|
48
59
|
for await (const chunk of process.stdin) {
|
|
@@ -118,50 +129,6 @@ async function loadEngine() {
|
|
|
118
129
|
/* eslint-enable no-console */
|
|
119
130
|
return engine;
|
|
120
131
|
}
|
|
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
132
|
/** Synchronous fd-1 write — the process exits right after, an async write could truncate. */
|
|
166
133
|
function emit(outcome, platform) {
|
|
167
134
|
const encoded = encodeOutcome(outcome, platform);
|