@pbuilder/sdk 0.2.3 → 0.2.4
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.
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"manifestVersion": 1,
|
|
3
3
|
"algorithm": "sha256",
|
|
4
4
|
"entry": "dist/bin/pbuilder-runner.js",
|
|
5
|
-
"packageVersion": "0.2.
|
|
5
|
+
"packageVersion": "0.2.4",
|
|
6
6
|
"files": [
|
|
7
7
|
{
|
|
8
8
|
"path": "dist/bin/pbuilder-runner.js",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
"path": "dist/transport/error-text.js",
|
|
65
|
-
"sha256": "
|
|
65
|
+
"sha256": "1dbb02d8e889c2747cc56209c76238a3686676d7d48561c085b03ffc2041b939"
|
|
66
66
|
},
|
|
67
67
|
{
|
|
68
68
|
"path": "dist/transport/exit-codes.js",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
},
|
|
83
83
|
{
|
|
84
84
|
"path": "dist/transport/runner.js",
|
|
85
|
-
"sha256": "
|
|
85
|
+
"sha256": "fb06fea6d3427f97189ce2f269d5f392ada09fad99c10bb039419bc827e561a2"
|
|
86
86
|
},
|
|
87
87
|
{
|
|
88
88
|
"path": "dist/transport/single-instance-probe.js",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
100
|
"path": "package.json",
|
|
101
|
-
"sha256": "
|
|
101
|
+
"sha256": "5b83a3462c5984431b656a101da8090dfb841c3df230c6f5dbb4a56843a69970"
|
|
102
102
|
}
|
|
103
103
|
]
|
|
104
104
|
}
|
|
@@ -6,3 +6,4 @@ export declare function boundMessage(message: string): string;
|
|
|
6
6
|
export declare function formatRelativeCandidate(candidate: string): string;
|
|
7
7
|
export declare function toProjectRelativePath(subjectPath: string, projectRoot?: string): string;
|
|
8
8
|
export declare function composeWithToken(prefix: string, token: string, suffix?: string): string;
|
|
9
|
+
export declare function scrubAbsolutePaths(message: string, projectRoot?: string): string;
|
|
@@ -42,3 +42,36 @@ export function toProjectRelativePath(subjectPath, projectRoot = process.cwd())
|
|
|
42
42
|
export function composeWithToken(prefix, token, suffix = "") {
|
|
43
43
|
return boundMessage(`${prefix}${truncateToken(token)}${suffix}`);
|
|
44
44
|
}
|
|
45
|
+
// REQ-WPS-07.4/.6, ADR-02: Windows-drive-letter or UNC/WSL-interop backslash-prefixed
|
|
46
|
+
// shapes — replaced FIRST, unconditionally, since node:path's POSIX-default
|
|
47
|
+
// isAbsolute/relative cannot correctly classify either shape on this SDK's POSIX hosts. The
|
|
48
|
+
// drive-letter branch's negative lookbehind keeps it from firing on a letter-colon-slash
|
|
49
|
+
// that isn't a path boundary (e.g. the "e:/" inside "file:///..." must NOT be read as a
|
|
50
|
+
// drive letter — that segment belongs to POSIX_ABS_PATH instead).
|
|
51
|
+
//
|
|
52
|
+
// A literal space does not end the match: it's consumed via the second alternative ONLY
|
|
53
|
+
// when a lookahead proves the path keeps going — more non-terminator characters followed by
|
|
54
|
+
// a separator (e.g. "Program Files\x"). A space with no further separator ahead (the path
|
|
55
|
+
// ends, or a quote/space terminates the token first) is NOT consumed, so prose is never
|
|
56
|
+
// swallowed past the actual path boundary.
|
|
57
|
+
const WINDOWS_UNC_ABS_PATH = /(?:(?<![A-Za-z0-9_])[A-Za-z]:[\\/]|\\\\)(?:[^\s'"<>]|[ ](?=[^\s'"<>]*[\\/]))*/g;
|
|
58
|
+
// REQ-WPS-07.4: a POSIX absolute path. The leading "/" carries a negative lookbehind — the
|
|
59
|
+
// same boundary check the Windows drive-letter branch above already relies on — so a slash
|
|
60
|
+
// preceded by a word character (prose like "and/or", "24/7") is never mistaken for a path
|
|
61
|
+
// root, while a slash preceded by a real boundary (start of string, space, quote, paren, "=",
|
|
62
|
+
// ":") is. That boundary check is what lets a SINGLE segment ("/root", "/etc" — no second
|
|
63
|
+
// "/" to require) count as absolute without also matching prose fractions.
|
|
64
|
+
//
|
|
65
|
+
// Same space-survives-via-lookahead mechanism as WINDOWS_UNC_ABS_PATH above, for the same
|
|
66
|
+
// reason (a directory name with a space, e.g. "Application Support/x", must not truncate the
|
|
67
|
+
// match at the space).
|
|
68
|
+
const POSIX_ABS_PATH = /(?<![A-Za-z0-9_])\/(?:[^\s'"<>]|[ ](?=[^\s'"<>]*\/))+/g;
|
|
69
|
+
// REQ-WPS-07.4/.6: scrubs absolute-path-shaped substrings embedded anywhere in a plain
|
|
70
|
+
// Error's free-text message — Windows/UNC/WSL shapes to the outside-project placeholder
|
|
71
|
+
// (ADR-02), POSIX shapes via the existing toProjectRelativePath formatter (ADR-01). Best-
|
|
72
|
+
// effort, not a security boundary: non-path-shaped secret content is untouched (REQ-WPS-07.5).
|
|
73
|
+
export function scrubAbsolutePaths(message, projectRoot) {
|
|
74
|
+
return message
|
|
75
|
+
.replace(WINDOWS_UNC_ABS_PATH, OUTSIDE_PROJECT_TOKEN)
|
|
76
|
+
.replace(POSIX_ABS_PATH, (match) => toProjectRelativePath(match, projectRoot));
|
|
77
|
+
}
|
package/dist/transport/runner.js
CHANGED
|
@@ -30,7 +30,7 @@ import { formatLocator } from "../core/schema/schema-parse.js";
|
|
|
30
30
|
import { FrameReader, FrameFault } from "./frame-reader.js";
|
|
31
31
|
import { WIRE_PROTOCOL_VERSION, isStructurallyValidGreeting, versionMatches } from "./wire-protocol.js";
|
|
32
32
|
import { StdioEngineClient, TransportFault, IntentRejectedError, OverlappingRunError, } from "./stdio-engine-client.js";
|
|
33
|
-
import { boundMessage, composeWithToken, toProjectRelativePath } from "./error-text.js";
|
|
33
|
+
import { boundMessage, composeWithToken, scrubAbsolutePaths, toProjectRelativePath } from "./error-text.js";
|
|
34
34
|
import { parseFactoryPointer, validateFactoryUrl, resolveFactoryExport } from "./factory-pointer.js";
|
|
35
35
|
import { probeSingleInstance } from "./single-instance-probe.js";
|
|
36
36
|
import { classifyExitCode } from "./exit-codes.js";
|
|
@@ -301,7 +301,9 @@ async function runRunnerBody(argv, io) {
|
|
|
301
301
|
// of being swallowed into a generic "run failed".
|
|
302
302
|
const label = err instanceof AuthoringError || err instanceof TransportFault || err instanceof IntentRejectedError
|
|
303
303
|
? err.message
|
|
304
|
-
:
|
|
304
|
+
: err instanceof Error
|
|
305
|
+
? scrubAbsolutePaths(err.message)
|
|
306
|
+
: "run failed";
|
|
305
307
|
note(io, `pbuilder-runner: ${label}`);
|
|
306
308
|
return classifyExitCode(err);
|
|
307
309
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pbuilder/sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "The public TypeScript/Bun authoring layer for Project Builder schematics. Authors file mutations (create, replaceContent, remove, rename, move, copy, copyIn), lowers them to IR, and talks to the Project Builder engine over framed stdio (see docs/engine-sdk-wire-spec.md).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|