@lousy-agents/cli 5.21.23 → 5.22.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/dist/index.js
CHANGED
|
@@ -3053,7 +3053,7 @@ exports.basename = (path, { windows } = {}) => {
|
|
|
3053
3053
|
|
|
3054
3054
|
|
|
3055
3055
|
},
|
|
3056
|
-
|
|
3056
|
+
4517(__unused_rspack_module, __unused_rspack___webpack_exports__, __webpack_require__) {
|
|
3057
3057
|
// NAMESPACE OBJECT: ../../node_modules/micromark/lib/constructs.js
|
|
3058
3058
|
var constructs_namespaceObject = {};
|
|
3059
3059
|
__webpack_require__.r(constructs_namespaceObject);
|
|
@@ -3220,6 +3220,17 @@ function getFsSafeNativeConfig() {
|
|
|
3220
3220
|
"auto",
|
|
3221
3221
|
};
|
|
3222
3222
|
}
|
|
3223
|
+
/** Internal provenance; keep the public configuration shape unchanged. */
|
|
3224
|
+
function getNativeModeSetting() {
|
|
3225
|
+
if (overrideConfig.mode !== undefined)
|
|
3226
|
+
return { mode: overrideConfig.mode, source: "programmatic configuration" };
|
|
3227
|
+
for (const source of ["FS_SAFE_NATIVE_MODE", "OPENCLAW_FS_SAFE_NATIVE_MODE"]) {
|
|
3228
|
+
const mode = parseMode(process.env[source]);
|
|
3229
|
+
if (mode !== undefined)
|
|
3230
|
+
return { mode, source };
|
|
3231
|
+
}
|
|
3232
|
+
return { mode: "auto", source: "default" };
|
|
3233
|
+
}
|
|
3223
3234
|
function isFsSafeNativeRequired() {
|
|
3224
3235
|
return (overrideConfig.mode ??
|
|
3225
3236
|
parseMode(process.env.FS_SAFE_NATIVE_MODE) ??
|
|
@@ -3245,6 +3256,62 @@ let native_binding;
|
|
|
3245
3256
|
let loadError;
|
|
3246
3257
|
let attempted = false;
|
|
3247
3258
|
let loadBinding = loadBundledBinding;
|
|
3259
|
+
let resolvePackage = (name) => native_require.resolve(name);
|
|
3260
|
+
let loadOutcome = { reason: "not-probed" };
|
|
3261
|
+
let selectedTarget;
|
|
3262
|
+
let targetDescription;
|
|
3263
|
+
function loadFailure(error, packageName) {
|
|
3264
|
+
try {
|
|
3265
|
+
return classifyLoadFailure(error, packageName);
|
|
3266
|
+
}
|
|
3267
|
+
catch {
|
|
3268
|
+
// Diagnostic inspection must not replace an arbitrary thrown load value.
|
|
3269
|
+
return { reason: "load-failed", code: "UNKNOWN" };
|
|
3270
|
+
}
|
|
3271
|
+
}
|
|
3272
|
+
function classifyLoadFailure(error, packageName) {
|
|
3273
|
+
const code = typeof error === "object" && error !== null && "code" in error ? error.code : undefined;
|
|
3274
|
+
// Resolution must fail for the selected package itself. An exception inside
|
|
3275
|
+
// an installed package (even one naming this package) is not package omission.
|
|
3276
|
+
if (code === "MODULE_NOT_FOUND" && error instanceof Error &&
|
|
3277
|
+
error.message.split("\n", 1)[0] === `Cannot find module '${packageName}'`) {
|
|
3278
|
+
try {
|
|
3279
|
+
resolvePackage(packageName);
|
|
3280
|
+
}
|
|
3281
|
+
catch (resolutionError) {
|
|
3282
|
+
if (resolutionError instanceof Error && "code" in resolutionError &&
|
|
3283
|
+
resolutionError.code === "MODULE_NOT_FOUND" &&
|
|
3284
|
+
resolutionError.message.split("\n", 1)[0] === `Cannot find module '${packageName}'`) {
|
|
3285
|
+
return { reason: "package-missing" };
|
|
3286
|
+
}
|
|
3287
|
+
}
|
|
3288
|
+
}
|
|
3289
|
+
// An allowlist excludes paths, secrets and arbitrary text in exception codes.
|
|
3290
|
+
const knownCodes = ["ERR_DLOPEN_FAILED", "MODULE_NOT_FOUND", "ERR_MODULE_NOT_FOUND",
|
|
3291
|
+
"ERR_PACKAGE_PATH_NOT_EXPORTED", "ERR_INVALID_PACKAGE_CONFIG", "EACCES", "EPERM", "ENOENT"];
|
|
3292
|
+
return { reason: "load-failed", code: typeof code === "string" && knownCodes.includes(code) ? code : "UNKNOWN" };
|
|
3293
|
+
}
|
|
3294
|
+
/** Internal view of the cached load; never attempts to load an addon. */
|
|
3295
|
+
function getNativeFallbackDiagnostic(...capabilities) {
|
|
3296
|
+
const setting = getNativeModeSetting();
|
|
3297
|
+
const target = targetDescription === undefined ? bundledTarget() : selectedTarget;
|
|
3298
|
+
const packageName = target === undefined ? undefined : nativePackageForTarget(target);
|
|
3299
|
+
const manifest = native_require("../package.json");
|
|
3300
|
+
const expected = {
|
|
3301
|
+
target: targetDescription,
|
|
3302
|
+
packageName,
|
|
3303
|
+
packageVersion: packageName === undefined ? undefined : manifest.optionalDependencies[packageName],
|
|
3304
|
+
};
|
|
3305
|
+
if (setting.mode === "off")
|
|
3306
|
+
return { ...expected, reason: "disabled", source: setting.source };
|
|
3307
|
+
const loaded = native_binding;
|
|
3308
|
+
if (loaded) {
|
|
3309
|
+
const missing = capabilities.filter(name => typeof loaded[name] !== "function");
|
|
3310
|
+
if (missing.length)
|
|
3311
|
+
return { ...expected, reason: "capability-missing", capabilities: missing };
|
|
3312
|
+
}
|
|
3313
|
+
return { ...expected, ...loadOutcome };
|
|
3314
|
+
}
|
|
3248
3315
|
function isMuslFilename(file) {
|
|
3249
3316
|
return file.includes("libc.musl-") || file.includes("ld-musl-");
|
|
3250
3317
|
}
|
|
@@ -3374,7 +3441,10 @@ function targetFor(platform, arch, musl) {
|
|
|
3374
3441
|
return undefined;
|
|
3375
3442
|
}
|
|
3376
3443
|
function bundledTarget() {
|
|
3377
|
-
|
|
3444
|
+
const musl = isMusl();
|
|
3445
|
+
selectedTarget = targetFor(process.platform, process.arch, musl);
|
|
3446
|
+
targetDescription = selectedTarget ?? `${process.platform}-${process.arch}${process.platform === "linux" ? `-${musl ? "musl" : "gnu"}` : ""}`;
|
|
3447
|
+
return selectedTarget;
|
|
3378
3448
|
}
|
|
3379
3449
|
function nativePackageForTarget(target) {
|
|
3380
3450
|
return `@openclaw/fs-safe-${target}`;
|
|
@@ -3382,9 +3452,13 @@ function nativePackageForTarget(target) {
|
|
|
3382
3452
|
function loadBundledBinding() {
|
|
3383
3453
|
const target = bundledTarget();
|
|
3384
3454
|
if (!target) {
|
|
3455
|
+
loadOutcome = { reason: "unsupported-target" };
|
|
3385
3456
|
throw new Error(`Unsupported OS or architecture: ${process.platform}-${process.arch}`);
|
|
3386
3457
|
}
|
|
3387
3458
|
const loaded = runNativeInitialization(() => native_require(nativePackageForTarget(target)));
|
|
3459
|
+
if (typeof loaded.closeOwnedFd !== "function") {
|
|
3460
|
+
loadOutcome = { reason: "capability-missing", capabilities: ["closeOwnedFd"] };
|
|
3461
|
+
}
|
|
3388
3462
|
captureNativeFdClose(loaded);
|
|
3389
3463
|
return loaded;
|
|
3390
3464
|
}
|
|
@@ -3426,11 +3500,19 @@ function native_getNativeBinding(...capabilities) {
|
|
|
3426
3500
|
attempted = true;
|
|
3427
3501
|
try {
|
|
3428
3502
|
const loaded = loadBinding();
|
|
3503
|
+
if (typeof loaded.closeOwnedFd !== "function") {
|
|
3504
|
+
loadOutcome = { reason: "capability-missing", capabilities: ["closeOwnedFd"] };
|
|
3505
|
+
}
|
|
3429
3506
|
captureNativeFdClose(loaded);
|
|
3430
3507
|
native_binding = loaded;
|
|
3508
|
+
loadOutcome = { reason: "loaded" };
|
|
3431
3509
|
}
|
|
3432
3510
|
catch (error) {
|
|
3433
3511
|
loadError = error;
|
|
3512
|
+
if (loadOutcome.reason === "not-probed") {
|
|
3513
|
+
selectedTarget ??= bundledTarget();
|
|
3514
|
+
loadOutcome = loadFailure(error, nativePackageForTarget(selectedTarget ?? `${process.platform}-${process.arch}`));
|
|
3515
|
+
}
|
|
3434
3516
|
}
|
|
3435
3517
|
}
|
|
3436
3518
|
if (native_binding)
|
|
@@ -3451,17 +3533,25 @@ function native_requireNativeBinding(...capabilities) {
|
|
|
3451
3533
|
}
|
|
3452
3534
|
return native;
|
|
3453
3535
|
}
|
|
3454
|
-
function __setNativeLoaderForTest(loader) {
|
|
3536
|
+
function __setNativeLoaderForTest(loader, resolver) {
|
|
3455
3537
|
native_binding = undefined;
|
|
3456
3538
|
loadError = undefined;
|
|
3457
3539
|
attempted = false;
|
|
3458
3540
|
loadBinding = loader;
|
|
3541
|
+
loadOutcome = { reason: "not-probed" };
|
|
3542
|
+
selectedTarget = undefined;
|
|
3543
|
+
targetDescription = undefined;
|
|
3544
|
+
resolvePackage = resolver ?? ((name) => native_require.resolve(name));
|
|
3459
3545
|
}
|
|
3460
3546
|
function __resetNativeLoaderForTest() {
|
|
3461
3547
|
native_binding = undefined;
|
|
3462
3548
|
loadError = undefined;
|
|
3463
3549
|
attempted = false;
|
|
3464
3550
|
loadBinding = loadBundledBinding;
|
|
3551
|
+
loadOutcome = { reason: "not-probed" };
|
|
3552
|
+
selectedTarget = undefined;
|
|
3553
|
+
targetDescription = undefined;
|
|
3554
|
+
resolvePackage = (name) => native_require.resolve(name);
|
|
3465
3555
|
}
|
|
3466
3556
|
|
|
3467
3557
|
;// CONCATENATED MODULE: ../../node_modules/@openclaw/fs-safe/dist/file-observation.js
|
|
@@ -4944,6 +5034,15 @@ function assertDirectoryObservationGuardSync(guard) {
|
|
|
4944
5034
|
}
|
|
4945
5035
|
}
|
|
4946
5036
|
|
|
5037
|
+
;// CONCATENATED MODULE: ../../node_modules/@openclaw/fs-safe/dist/native-stat-identity.js
|
|
5038
|
+
/** Native stat identities are unsigned; Node BigIntStats preserves them as signed bits. */
|
|
5039
|
+
function statIdentityFromNative(value) {
|
|
5040
|
+
return value <= 0x7fffffffffffffffn || process.versions.bun ? value : BigInt.asIntN(64, value);
|
|
5041
|
+
}
|
|
5042
|
+
function isNativeStatIdentity(value) {
|
|
5043
|
+
return typeof value === "bigint" && value >= 0n && value <= 0xffffffffffffffffn;
|
|
5044
|
+
}
|
|
5045
|
+
|
|
4947
5046
|
;// CONCATENATED MODULE: ../../node_modules/@openclaw/fs-safe/dist/directory-receipt.js
|
|
4948
5047
|
|
|
4949
5048
|
|
|
@@ -5448,6 +5547,7 @@ function createSuppressedError(error, suppressed, message) {
|
|
|
5448
5547
|
|
|
5449
5548
|
|
|
5450
5549
|
|
|
5550
|
+
|
|
5451
5551
|
/** Shared by tree byte copying and per-file copying; never resolves the target. */
|
|
5452
5552
|
async function readCopyLinkTarget(source) {
|
|
5453
5553
|
return await promises_.readlink(source, { encoding: "buffer" });
|
|
@@ -5517,7 +5617,7 @@ async function copyLinkAtParent(params, input, parent, native) {
|
|
|
5517
5617
|
directory_guard_assertSyncDirectoryGuard(parent);
|
|
5518
5618
|
if (native?.binding.createCopySymlink) {
|
|
5519
5619
|
const created = native.binding.createCopySymlink(native.fd, temporaryName, input.target, params.mode, input.preserveMetadata ? input.identity.atimeNs : undefined, input.preserveMetadata ? input.identity.mtimeNs : undefined);
|
|
5520
|
-
identity = created;
|
|
5620
|
+
identity = { dev: statIdentityFromNative(created.dev), ino: statIdentityFromNative(created.ino) };
|
|
5521
5621
|
if (created.errorCode)
|
|
5522
5622
|
throw Object.assign(new Error(created.errorMessage), { code: created.errorCode });
|
|
5523
5623
|
}
|
|
@@ -6243,14 +6343,61 @@ function pinNodeDirectoryForModeSync(dirPath, options = {}) {
|
|
|
6243
6343
|
}
|
|
6244
6344
|
}
|
|
6245
6345
|
|
|
6346
|
+
;// CONCATENATED MODULE: ../../node_modules/@openclaw/fs-safe/dist/native-guidance.js
|
|
6347
|
+
/** Shared, path-free next steps for status reports and fallback warnings. */
|
|
6348
|
+
function nativeGuidance(reason, modeSource) {
|
|
6349
|
+
switch (reason) {
|
|
6350
|
+
case "disabled": {
|
|
6351
|
+
const enable = modeSource === "programmatic configuration"
|
|
6352
|
+
? 'call configureFsSafeNative({ mode: "auto" }) or configureFsSafeNative({ mode: "require" })'
|
|
6353
|
+
: `set ${modeSource}=auto or ${modeSource}=require`;
|
|
6354
|
+
return `If native loading is intended, ${enable}; keep intentional off settings.`;
|
|
6355
|
+
}
|
|
6356
|
+
case "unsupported-target":
|
|
6357
|
+
return "Portable mode is expected on this target.";
|
|
6358
|
+
case "package-missing":
|
|
6359
|
+
return "Reinstall with optional dependencies included: npm --include=optional, or pnpm without --no-optional / optional=false. Check the lockfile and registry mirror.";
|
|
6360
|
+
case "load-failed":
|
|
6361
|
+
return "Check Node architecture, Linux libc compatibility, package dependencies, and OS code-integrity policy. Reinstalling identical bytes may not help.";
|
|
6362
|
+
case "capability-missing":
|
|
6363
|
+
return "Use matching fs-safe and platform-package versions; some targets intentionally provide only a subset of capabilities.";
|
|
6364
|
+
default:
|
|
6365
|
+
return undefined;
|
|
6366
|
+
}
|
|
6367
|
+
}
|
|
6368
|
+
|
|
6246
6369
|
;// CONCATENATED MODULE: ../../node_modules/@openclaw/fs-safe/dist/native-fallback-warning.js
|
|
6370
|
+
|
|
6371
|
+
|
|
6372
|
+
|
|
6247
6373
|
const warnedFeatures = new Set();
|
|
6374
|
+
function fallbackReason(capabilities) {
|
|
6375
|
+
const diagnostic = getNativeFallbackDiagnostic(...capabilities);
|
|
6376
|
+
const expected = diagnostic.packageName === undefined
|
|
6377
|
+
? `No native package is published for ${diagnostic.target}.`
|
|
6378
|
+
: `Expected ${diagnostic.packageName}@${diagnostic.packageVersion}.`;
|
|
6379
|
+
const guidance = nativeGuidance(diagnostic.reason, getNativeModeSetting().source);
|
|
6380
|
+
switch (diagnostic.reason) {
|
|
6381
|
+
case "disabled":
|
|
6382
|
+
return `native support is disabled by ${diagnostic.source} (disabled). ${expected} ${guidance}`;
|
|
6383
|
+
case "unsupported-target":
|
|
6384
|
+
return `the target ${diagnostic.target} is unsupported (unsupported-target). ${expected} ${guidance}`;
|
|
6385
|
+
case "package-missing":
|
|
6386
|
+
return `the selected native package could not be resolved (package-missing). ${expected} ${guidance}`;
|
|
6387
|
+
case "load-failed":
|
|
6388
|
+
return `the native package could not be loaded (load-failed: ${diagnostic.code}). ${expected} ${guidance}`;
|
|
6389
|
+
case "capability-missing":
|
|
6390
|
+
return `the native package lacks requested functions (capability-missing: ${diagnostic.capabilities.join(", ")}). ${expected} ${guidance}`;
|
|
6391
|
+
default:
|
|
6392
|
+
return `the requested native operation is unavailable (${diagnostic.reason}). ${expected}`;
|
|
6393
|
+
}
|
|
6394
|
+
}
|
|
6248
6395
|
/** Warn once per capability, without including caller paths or native error text. */
|
|
6249
|
-
function warnNativeFallback(feature, limitation) {
|
|
6396
|
+
function warnNativeFallback(feature, limitation, ...capabilities) {
|
|
6250
6397
|
if (warnedFeatures.has(feature))
|
|
6251
6398
|
return;
|
|
6252
6399
|
warnedFeatures.add(feature);
|
|
6253
|
-
process.emitWarning(`${feature} is using its portable fallback because
|
|
6400
|
+
process.emitWarning(`${feature} is using its portable fallback because ${fallbackReason(capabilities)} ${limitation}`, { code: "FS_SAFE_NATIVE_FALLBACK", type: "FsSafeWarning" });
|
|
6254
6401
|
}
|
|
6255
6402
|
function __resetNativeFallbackWarningsForTest() {
|
|
6256
6403
|
warnedFeatures.clear();
|
|
@@ -7089,17 +7236,17 @@ function creation_boundary_assertPrivateFileCreationAvailable() {
|
|
|
7089
7236
|
typeof native.verifyPrivateWindowsFile !== "function")
|
|
7090
7237
|
creation_boundary_unavailable();
|
|
7091
7238
|
}
|
|
7092
|
-
function commandFallback() {
|
|
7239
|
+
function commandFallback(capability) {
|
|
7093
7240
|
if (getFsSafeNativeConfig().mode === "require")
|
|
7094
7241
|
creation_boundary_unavailable();
|
|
7095
|
-
warnNativeFallback("windows-private-creation", "Private Windows creation
|
|
7242
|
+
warnNativeFallback("windows-private-creation", "Private Windows creation launches the packaged .NET helper for each check or creation.", capability);
|
|
7096
7243
|
}
|
|
7097
7244
|
function creationOperation(name) {
|
|
7098
7245
|
const native = native_getNativeBinding();
|
|
7099
7246
|
const operation = native?.[name];
|
|
7100
7247
|
if (typeof operation === "function")
|
|
7101
7248
|
return operation.bind(native);
|
|
7102
|
-
commandFallback();
|
|
7249
|
+
commandFallback(name);
|
|
7103
7250
|
return undefined;
|
|
7104
7251
|
}
|
|
7105
7252
|
/** Full Windows identity, with security validation when requested; no repairs. */
|
|
@@ -9428,6 +9575,7 @@ function mergeDenyMutationPolicies(defaultPolicy, callPolicy) {
|
|
|
9428
9575
|
|
|
9429
9576
|
|
|
9430
9577
|
|
|
9578
|
+
|
|
9431
9579
|
function getNativeDirectoryObservationBackend(enabled = true) {
|
|
9432
9580
|
if (!enabled)
|
|
9433
9581
|
return undefined;
|
|
@@ -9437,14 +9585,15 @@ function getNativeDirectoryObservationBackend(enabled = true) {
|
|
|
9437
9585
|
: undefined;
|
|
9438
9586
|
}
|
|
9439
9587
|
function validateNativeDirectoryObservation(observation) {
|
|
9440
|
-
if (!observation ||
|
|
9441
|
-
|
|
9588
|
+
if (!observation || !isNativeStatIdentity(observation.dev) ||
|
|
9589
|
+
!isNativeStatIdentity(observation.ino) ||
|
|
9442
9590
|
typeof observation.realPath !== "string" ||
|
|
9443
9591
|
observation.realPath.includes("\0") ||
|
|
9444
9592
|
(!external_node_path_.isAbsolute(observation.realPath) && !external_node_path_.win32.isAbsolute(observation.realPath))) {
|
|
9445
9593
|
throw new errors_FsSafeError("path-mismatch", "native directory observation is invalid");
|
|
9446
9594
|
}
|
|
9447
|
-
|
|
9595
|
+
const dev = statIdentityFromNative(observation.dev), ino = statIdentityFromNative(observation.ino);
|
|
9596
|
+
return dev === observation.dev && ino === observation.ino ? observation : { ...observation, dev, ino };
|
|
9448
9597
|
}
|
|
9449
9598
|
/** Exact identity, type, and canonical path captured from one retained handle. */
|
|
9450
9599
|
function inspectNativeDirectoryObservation(backend, pathname, expected, platform = process.platform) {
|
|
@@ -9466,6 +9615,7 @@ function isNativeDirectoryObservationGuard(guard) {
|
|
|
9466
9615
|
|
|
9467
9616
|
|
|
9468
9617
|
|
|
9618
|
+
|
|
9469
9619
|
class NativePolicyDirectoryMismatch extends errors_FsSafeError {
|
|
9470
9620
|
constructor(cause) {
|
|
9471
9621
|
super("path-mismatch", "staging directory pathname changed", { cause });
|
|
@@ -9504,8 +9654,8 @@ function native_policy_directory_observation_nativePolicyDirectoryObserver(bindi
|
|
|
9504
9654
|
}
|
|
9505
9655
|
if (getFsSafeNativeConfig().mode !== mode)
|
|
9506
9656
|
return undefined;
|
|
9507
|
-
if (!observed ||
|
|
9508
|
-
|
|
9657
|
+
if (!observed || !isNativeStatIdentity(observed.dev) ||
|
|
9658
|
+
!isNativeStatIdentity(observed.ino) ||
|
|
9509
9659
|
typeof observed.mode !== "bigint" || observed.mode < 0n || observed.mode > 0xffffffffn ||
|
|
9510
9660
|
typeof observed.nlink !== "bigint" || observed.nlink < 0n || observed.nlink > 0xffffffffffffffffn ||
|
|
9511
9661
|
typeof observed.realPath !== "string" || observed.realPath.includes("\0") ||
|
|
@@ -9518,7 +9668,7 @@ function native_policy_directory_observation_nativePolicyDirectoryObserver(bindi
|
|
|
9518
9668
|
return Object.freeze({
|
|
9519
9669
|
canonicalPath: observed.realPath,
|
|
9520
9670
|
identity: Object.freeze({
|
|
9521
|
-
dev: observed.dev, ino: observed.ino, mode: observed.mode, nlink: observed.nlink,
|
|
9671
|
+
dev: statIdentityFromNative(observed.dev), ino: statIdentityFromNative(observed.ino), mode: observed.mode, nlink: observed.nlink,
|
|
9522
9672
|
}),
|
|
9523
9673
|
});
|
|
9524
9674
|
};
|
|
@@ -12308,6 +12458,64 @@ function __setFsSafeTestHooksForTest(hooks) {
|
|
|
12308
12458
|
test_hooks_fsSafeTestHooks = hooks;
|
|
12309
12459
|
}
|
|
12310
12460
|
|
|
12461
|
+
;// CONCATENATED MODULE: ../../node_modules/@openclaw/fs-safe/dist/root-native-creation-path.js
|
|
12462
|
+
|
|
12463
|
+
|
|
12464
|
+
|
|
12465
|
+
|
|
12466
|
+
|
|
12467
|
+
|
|
12468
|
+
|
|
12469
|
+
|
|
12470
|
+
|
|
12471
|
+
function existingCreationParent(params) {
|
|
12472
|
+
if (params.private || params.policy || params.assertBeforeMutation !== undefined ||
|
|
12473
|
+
getFsSafeTestHooks()?.beforeRootFallbackMutation || !params.originalPath ||
|
|
12474
|
+
params.directory !== external_node_path_.dirname(params.target))
|
|
12475
|
+
return undefined;
|
|
12476
|
+
const segments = params.originalPath.split(external_node_path_.sep === "\\" ? /[\\/]/ : "/");
|
|
12477
|
+
if (segments.some(segment => !isSafePathSegment(segment, { allowDotPrefix: true }) || segment.endsWith(".")) ||
|
|
12478
|
+
external_node_path_.join(params.root.rootReal, ...segments) !== params.target)
|
|
12479
|
+
return undefined;
|
|
12480
|
+
let rootStat;
|
|
12481
|
+
root_context_assertRootIdentityCurrentSync(params.root, stat => { rootStat = stat; });
|
|
12482
|
+
try {
|
|
12483
|
+
const identity = directory_guard_inspectDirectoryIdentitySync(params.directory, undefined, params.directory === params.root.rootReal ? rootStat : undefined);
|
|
12484
|
+
if (realpath_realpathSync.native(windows_path_alias_pathForWindowsFilesystem(params.directory)) !== params.directory)
|
|
12485
|
+
return undefined;
|
|
12486
|
+
return {
|
|
12487
|
+
path: params.directory, identity,
|
|
12488
|
+
relative: external_node_path_.relative(params.root.rootReal, params.directory).split(external_node_path_.sep).join("/"),
|
|
12489
|
+
flags: (nodeDirectorySearchOnlyFlags()?.flags ?? external_node_fs_.constants.O_RDONLY) |
|
|
12490
|
+
(external_node_fs_.constants.O_DIRECTORY ?? 0) | (external_node_fs_.constants.O_NOFOLLOW ?? 0),
|
|
12491
|
+
};
|
|
12492
|
+
}
|
|
12493
|
+
catch {
|
|
12494
|
+
return undefined;
|
|
12495
|
+
}
|
|
12496
|
+
}
|
|
12497
|
+
function probeNativeCreationPath(root, relativePath) {
|
|
12498
|
+
if (typeof relativePath !== "string")
|
|
12499
|
+
return undefined;
|
|
12500
|
+
const segments = relativePath.split(external_node_path_.sep === "\\" ? /[\\/]/ : "/");
|
|
12501
|
+
if (segments.some(segment => !isSafePathSegment(segment, { allowDotPrefix: true }) || segment.endsWith(".")))
|
|
12502
|
+
return undefined;
|
|
12503
|
+
const target = external_node_path_.join(root.rootReal, ...segments);
|
|
12504
|
+
root_context_assertRootIdentityCurrentSync(root);
|
|
12505
|
+
try {
|
|
12506
|
+
if (external_node_fs_.lstatSync(windows_path_alias_pathForWindowsFilesystem(target), { throwIfNoEntry: false }))
|
|
12507
|
+
return undefined;
|
|
12508
|
+
}
|
|
12509
|
+
catch {
|
|
12510
|
+
return undefined;
|
|
12511
|
+
}
|
|
12512
|
+
const parent = existingCreationParent({ root, target, directory: external_node_path_.dirname(target), mkdir: true,
|
|
12513
|
+
originalPath: relativePath, resolveCurrent: async () => target });
|
|
12514
|
+
if (!parent)
|
|
12515
|
+
return undefined;
|
|
12516
|
+
return { rootReal: root.rootReal, rootWithSep: root.rootWithSep, resolved: target, parent };
|
|
12517
|
+
}
|
|
12518
|
+
|
|
12311
12519
|
;// CONCATENATED MODULE: ../../node_modules/@openclaw/fs-safe/dist/root-create-native.js
|
|
12312
12520
|
var root_create_native_addDisposableResource = (undefined && undefined.__addDisposableResource) || function (env, value, async) {
|
|
12313
12521
|
if (value !== null && value !== void 0) {
|
|
@@ -12385,6 +12593,8 @@ var root_create_native_disposeResources = (undefined && undefined.__disposeResou
|
|
|
12385
12593
|
|
|
12386
12594
|
|
|
12387
12595
|
|
|
12596
|
+
|
|
12597
|
+
|
|
12388
12598
|
|
|
12389
12599
|
|
|
12390
12600
|
|
|
@@ -12394,6 +12604,10 @@ function rootWriteQueueKey(root, relativePath) {
|
|
|
12394
12604
|
function buildAtomicWriteTempPath(targetPath) {
|
|
12395
12605
|
return external_node_path_.join(external_node_path_.dirname(targetPath), `.fs-safe-${(0,external_node_crypto_.randomUUID)()}.tmp`);
|
|
12396
12606
|
}
|
|
12607
|
+
const nativeCreateCollisions = new WeakSet();
|
|
12608
|
+
function isNativeCreateCollision(error) {
|
|
12609
|
+
return typeof error === "object" && error !== null && nativeCreateCollisions.has(error);
|
|
12610
|
+
}
|
|
12397
12611
|
function root_create_native_unavailable() {
|
|
12398
12612
|
throw new errors_FsSafeError("helper-unavailable", "native confined creation is unavailable");
|
|
12399
12613
|
}
|
|
@@ -12401,6 +12615,60 @@ async function withNativeDirectory(params, operation, discard) {
|
|
|
12401
12615
|
const binding = native_getNativeBinding("openBeneath", "mkdirChildBeneath");
|
|
12402
12616
|
if (!binding?.openBeneath || !binding.mkdirChildBeneath || (params.private && process.platform === "win32"))
|
|
12403
12617
|
return root_create_native_unavailable();
|
|
12618
|
+
const existing = params.selectedParent ?? existingCreationParent(params);
|
|
12619
|
+
if (existing) {
|
|
12620
|
+
let pending;
|
|
12621
|
+
try {
|
|
12622
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
12623
|
+
try {
|
|
12624
|
+
const rootOwner = root_create_native_addDisposableResource(env_1, openExactNativeRootSync(binding, {
|
|
12625
|
+
rootPath: params.root.rootReal, rootIdentity: params.root.rootIdentity,
|
|
12626
|
+
}), false);
|
|
12627
|
+
const close = captureNativeFdClose(binding);
|
|
12628
|
+
const borrowed = existing.path === params.root.rootReal;
|
|
12629
|
+
const fd = borrowed ? rootOwner.fd : binding.openBeneath(rootOwner.fd, existing.relative, existing.flags).fd;
|
|
12630
|
+
const parentOwner = root_create_native_addDisposableResource(env_1, { [Symbol.dispose]() { if (!borrowed)
|
|
12631
|
+
close(fd); } }, false);
|
|
12632
|
+
strict_file_identity_inspectFileIdentitySync(() => borrowed ? rootOwner.stat : external_node_fs_.fstatSync(fd, { bigint: true }), existing.identity);
|
|
12633
|
+
verifyMkdirDirectory(binding, fd, existing.path);
|
|
12634
|
+
const guard = { dir: existing.path, realPath: existing.path, stat: existing.identity };
|
|
12635
|
+
const assertCurrent = () => {
|
|
12636
|
+
let currentRoot;
|
|
12637
|
+
root_context_assertRootIdentityCurrentSync(params.root, stat => { currentRoot = stat; });
|
|
12638
|
+
if (borrowed) {
|
|
12639
|
+
// Root and parent are the same name in this synchronous fence.
|
|
12640
|
+
directory_guard_inspectDirectoryIdentitySync(existing.path, existing.identity, currentRoot);
|
|
12641
|
+
if (realpath_realpathSync.native(windows_path_alias_pathForWindowsFilesystem(existing.path)) !== existing.path) {
|
|
12642
|
+
throw new errors_FsSafeError("path-mismatch", "directory changed during operation");
|
|
12643
|
+
}
|
|
12644
|
+
}
|
|
12645
|
+
else {
|
|
12646
|
+
directory_guard_assertSyncDirectoryGuard(guard);
|
|
12647
|
+
}
|
|
12648
|
+
};
|
|
12649
|
+
pending = { value: await operation(binding, fd, assertCurrent) };
|
|
12650
|
+
return pending.value;
|
|
12651
|
+
}
|
|
12652
|
+
catch (e_1) {
|
|
12653
|
+
env_1.error = e_1;
|
|
12654
|
+
env_1.hasError = true;
|
|
12655
|
+
}
|
|
12656
|
+
finally {
|
|
12657
|
+
root_create_native_disposeResources(env_1);
|
|
12658
|
+
}
|
|
12659
|
+
}
|
|
12660
|
+
catch (error) {
|
|
12661
|
+
if (pending && discard) {
|
|
12662
|
+
try {
|
|
12663
|
+
await discard(pending.value);
|
|
12664
|
+
}
|
|
12665
|
+
catch (cleanupError) {
|
|
12666
|
+
throw createSuppressedError(cleanupError, error, "creation handoff and cleanup failed");
|
|
12667
|
+
}
|
|
12668
|
+
}
|
|
12669
|
+
throw error;
|
|
12670
|
+
}
|
|
12671
|
+
}
|
|
12404
12672
|
const directoryTarget = params.directory === params.target;
|
|
12405
12673
|
const canonicalTarget = async (target) => directoryTarget
|
|
12406
12674
|
? await resolvePathViaExistingAncestor(target)
|
|
@@ -12417,14 +12685,14 @@ async function withNativeDirectory(params, operation, discard) {
|
|
|
12417
12685
|
const close = captureNativeFdClose(binding);
|
|
12418
12686
|
let pending;
|
|
12419
12687
|
try {
|
|
12420
|
-
const
|
|
12688
|
+
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
12421
12689
|
try {
|
|
12422
12690
|
const admitted = await openNativeRootAdmission(binding, {
|
|
12423
12691
|
rootPath: params.root.rootReal, rootIdentity: params.root.rootIdentity, operation: "create", reportCloseErrors: true, searchOnly: true,
|
|
12424
12692
|
});
|
|
12425
|
-
const rootOwner = root_create_native_addDisposableResource(
|
|
12693
|
+
const rootOwner = root_create_native_addDisposableResource(env_2, admitted.root, true);
|
|
12426
12694
|
const descriptors = [];
|
|
12427
|
-
const directoryOwner = root_create_native_addDisposableResource(
|
|
12695
|
+
const directoryOwner = root_create_native_addDisposableResource(env_2, { [Symbol.dispose]() {
|
|
12428
12696
|
const errors = [];
|
|
12429
12697
|
for (const fd of descriptors.reverse())
|
|
12430
12698
|
try {
|
|
@@ -12522,12 +12790,12 @@ async function withNativeDirectory(params, operation, discard) {
|
|
|
12522
12790
|
pending = { value: await operation(binding, current, assertCurrent) };
|
|
12523
12791
|
return pending.value;
|
|
12524
12792
|
}
|
|
12525
|
-
catch (
|
|
12526
|
-
|
|
12527
|
-
|
|
12793
|
+
catch (e_2) {
|
|
12794
|
+
env_2.error = e_2;
|
|
12795
|
+
env_2.hasError = true;
|
|
12528
12796
|
}
|
|
12529
12797
|
finally {
|
|
12530
|
-
const result_1 = root_create_native_disposeResources(
|
|
12798
|
+
const result_1 = root_create_native_disposeResources(env_2);
|
|
12531
12799
|
if (result_1)
|
|
12532
12800
|
await result_1;
|
|
12533
12801
|
}
|
|
@@ -12606,33 +12874,77 @@ function verifyMkdirDirectory(binding, fd, pathname) {
|
|
|
12606
12874
|
describePolicyStagedDirectory(fd, pathname);
|
|
12607
12875
|
}
|
|
12608
12876
|
function ensureNativeRootCurrent(root) {
|
|
12609
|
-
|
|
12877
|
+
root_context_assertRootIdentityCurrentSync(root);
|
|
12878
|
+
const binding = native_getNativeBinding("openBeneath", "mkdirChildBeneath");
|
|
12879
|
+
if (!binding?.openBeneath || !binding.mkdirChildBeneath)
|
|
12880
|
+
return root_create_native_unavailable();
|
|
12881
|
+
if (binding.verifyRootDirectory) {
|
|
12882
|
+
const closeNative = captureNativeFdClose(binding);
|
|
12883
|
+
const failure = binding.verifyRootDirectory(root.rootReal, root.rootIdentity.dev, root.rootIdentity.ino);
|
|
12884
|
+
if (failure === null)
|
|
12885
|
+
return;
|
|
12886
|
+
if (failure?.fallbackFd !== undefined && failure.fallbackFd !== null) {
|
|
12887
|
+
const env_3 = { stack: [], error: void 0, hasError: false };
|
|
12888
|
+
try {
|
|
12889
|
+
const fd = failure.fallbackFd;
|
|
12890
|
+
if (!Number.isInteger(fd) || fd < 0)
|
|
12891
|
+
throw new errors_FsSafeError("helper-failed", "invalid root fallback descriptor");
|
|
12892
|
+
const owner = root_create_native_addDisposableResource(env_3, { [Symbol.dispose]() { closeNative(fd); } }, false);
|
|
12893
|
+
if (failure.errorCode || failure.closeErrorCode)
|
|
12894
|
+
throw new errors_FsSafeError("helper-failed", "invalid root verification result");
|
|
12895
|
+
ensureNativeRootCurrentLegacy(root, binding);
|
|
12896
|
+
return;
|
|
12897
|
+
}
|
|
12898
|
+
catch (e_3) {
|
|
12899
|
+
env_3.error = e_3;
|
|
12900
|
+
env_3.hasError = true;
|
|
12901
|
+
}
|
|
12902
|
+
finally {
|
|
12903
|
+
root_create_native_disposeResources(env_3);
|
|
12904
|
+
}
|
|
12905
|
+
}
|
|
12906
|
+
const error = failure?.errorCode ? rootVerificationError(failure.errorCode, failure.errorMessage, failure.errorErrno) : undefined;
|
|
12907
|
+
const closeError = failure?.closeErrorCode ? Object.assign(new Error(failure.closeErrorMessage), {
|
|
12908
|
+
code: failure.closeErrorCode,
|
|
12909
|
+
...(typeof failure.closeErrorErrno === "number" ? { errno: failure.closeErrorErrno } : {}),
|
|
12910
|
+
}) : undefined;
|
|
12911
|
+
if (error && closeError)
|
|
12912
|
+
throw createSuppressedError(closeError, error, "root verification and close failed");
|
|
12913
|
+
if (error || closeError)
|
|
12914
|
+
throw error ?? closeError;
|
|
12915
|
+
throw new errors_FsSafeError("helper-failed", "invalid root verification result");
|
|
12916
|
+
}
|
|
12917
|
+
ensureNativeRootCurrentLegacy(root, binding);
|
|
12918
|
+
}
|
|
12919
|
+
function rootVerificationError(code, message, errno) {
|
|
12920
|
+
const error = Object.assign(new Error(message), { code, ...(typeof errno === "number" ? { errno } : {}) });
|
|
12921
|
+
return code === "path-mismatch" || code === "OBSERVATION_REDIRECTED"
|
|
12922
|
+
? new errors_FsSafeError("path-mismatch", "root identity changed during verification", { cause: error }) : error;
|
|
12923
|
+
}
|
|
12924
|
+
function ensureNativeRootCurrentLegacy(root, binding) {
|
|
12925
|
+
const env_4 = { stack: [], error: void 0, hasError: false };
|
|
12610
12926
|
try {
|
|
12611
|
-
|
|
12612
|
-
const binding = native_getNativeBinding("openBeneath", "mkdirChildBeneath");
|
|
12613
|
-
if (!binding?.openBeneath || !binding.mkdirChildBeneath)
|
|
12614
|
-
return root_create_native_unavailable();
|
|
12615
|
-
const rootOwner = root_create_native_addDisposableResource(env_2, openExactNativeRootSync(binding, {
|
|
12927
|
+
const rootOwner = root_create_native_addDisposableResource(env_4, openExactNativeRootSync(binding, {
|
|
12616
12928
|
rootPath: root.rootReal, rootIdentity: root.rootIdentity,
|
|
12617
12929
|
}), false);
|
|
12618
12930
|
verifyMkdirDirectory(binding, rootOwner.fd, root.rootReal);
|
|
12619
12931
|
root_context_assertRootIdentityCurrentSync(root);
|
|
12620
12932
|
}
|
|
12621
|
-
catch (
|
|
12622
|
-
|
|
12623
|
-
|
|
12933
|
+
catch (e_4) {
|
|
12934
|
+
env_4.error = e_4;
|
|
12935
|
+
env_4.hasError = true;
|
|
12624
12936
|
}
|
|
12625
12937
|
finally {
|
|
12626
|
-
root_create_native_disposeResources(
|
|
12938
|
+
root_create_native_disposeResources(env_4);
|
|
12627
12939
|
}
|
|
12628
12940
|
}
|
|
12629
12941
|
function mkdirNativeRootChild(params) {
|
|
12630
|
-
const
|
|
12942
|
+
const env_5 = { stack: [], error: void 0, hasError: false };
|
|
12631
12943
|
try {
|
|
12632
12944
|
const binding = native_getNativeBinding("openBeneath", "mkdirChildBeneath");
|
|
12633
12945
|
if (!binding?.openBeneath || !binding.mkdirChildBeneath)
|
|
12634
12946
|
return root_create_native_unavailable();
|
|
12635
|
-
const rootOwner = root_create_native_addDisposableResource(
|
|
12947
|
+
const rootOwner = root_create_native_addDisposableResource(env_5, openExactNativeRootSync(binding, {
|
|
12636
12948
|
rootPath: params.root.rootReal, rootIdentity: params.root.rootIdentity,
|
|
12637
12949
|
}), false);
|
|
12638
12950
|
verifyMkdirDirectory(binding, rootOwner.fd, params.root.rootReal);
|
|
@@ -12645,17 +12957,17 @@ function mkdirNativeRootChild(params) {
|
|
|
12645
12957
|
? binding.mkdirOpenChildBeneath(rootOwner.fd, name, 0o777, flags).fd
|
|
12646
12958
|
: (binding.mkdirChildBeneath(rootOwner.fd, name, 0o777), binding.openBeneath(rootOwner.fd, name, flags).fd);
|
|
12647
12959
|
const close = captureNativeFdClose(binding);
|
|
12648
|
-
const childOwner = root_create_native_addDisposableResource(
|
|
12960
|
+
const childOwner = root_create_native_addDisposableResource(env_5, { [Symbol.dispose]() { close(child); } }, false);
|
|
12649
12961
|
root_context_assertRootIdentityCurrentSync(params.root);
|
|
12650
12962
|
verifyMkdirDirectory(binding, child, params.target);
|
|
12651
12963
|
verifyMkdirDirectory(binding, rootOwner.fd, params.root.rootReal);
|
|
12652
12964
|
}
|
|
12653
|
-
catch (
|
|
12654
|
-
|
|
12655
|
-
|
|
12965
|
+
catch (e_5) {
|
|
12966
|
+
env_5.error = e_5;
|
|
12967
|
+
env_5.hasError = true;
|
|
12656
12968
|
}
|
|
12657
12969
|
finally {
|
|
12658
|
-
root_create_native_disposeResources(
|
|
12970
|
+
root_create_native_disposeResources(env_5);
|
|
12659
12971
|
}
|
|
12660
12972
|
}
|
|
12661
12973
|
async function tryOpenCreateRootNative(params) {
|
|
@@ -12677,7 +12989,7 @@ async function tryOpenCreateRootNative(params) {
|
|
|
12677
12989
|
if (creationMode() === undefined)
|
|
12678
12990
|
return root_create_native_unavailable();
|
|
12679
12991
|
return await withNativeDirectory(params, async (binding, parent, assertCurrent) => {
|
|
12680
|
-
const
|
|
12992
|
+
const env_6 = { stack: [], error: void 0, hasError: false };
|
|
12681
12993
|
try {
|
|
12682
12994
|
params.assertBeforeMutation?.();
|
|
12683
12995
|
assertCurrent();
|
|
@@ -12687,13 +12999,21 @@ async function tryOpenCreateRootNative(params) {
|
|
|
12687
12999
|
// Native creation owns the only O_CREAT dispatch. The subsequent Node open
|
|
12688
13000
|
// carries neither O_CREAT nor O_TRUNC and must match this retained inode.
|
|
12689
13001
|
const close = captureNativeFdClose(binding);
|
|
12690
|
-
|
|
13002
|
+
let fd;
|
|
13003
|
+
try {
|
|
13004
|
+
fd = binding.openCreateBeneath(parent, external_node_path_.basename(params.target), params.flags, params.mode & 0o7777);
|
|
13005
|
+
}
|
|
13006
|
+
catch (error) {
|
|
13007
|
+
if (hasNodeErrorCode(error, "EEXIST") && typeof error === "object" && error !== null)
|
|
13008
|
+
nativeCreateCollisions.add(error);
|
|
13009
|
+
throw error;
|
|
13010
|
+
}
|
|
12691
13011
|
let rawOpen = true;
|
|
12692
13012
|
const closeRaw = () => { if (rawOpen) {
|
|
12693
13013
|
rawOpen = false;
|
|
12694
13014
|
close(fd);
|
|
12695
13015
|
} };
|
|
12696
|
-
const owner = root_create_native_addDisposableResource(
|
|
13016
|
+
const owner = root_create_native_addDisposableResource(env_6, { [Symbol.dispose]: closeRaw }, false);
|
|
12697
13017
|
try {
|
|
12698
13018
|
const identity = strict_file_identity_inspectFileIdentitySync(() => external_node_fs_.fstatSync(fd, { bigint: true }));
|
|
12699
13019
|
if (!identity.isFile() || identity.nlink !== 1n)
|
|
@@ -12747,26 +13067,26 @@ async function tryOpenCreateRootNative(params) {
|
|
|
12747
13067
|
throw error;
|
|
12748
13068
|
}
|
|
12749
13069
|
}
|
|
12750
|
-
catch (
|
|
12751
|
-
|
|
12752
|
-
|
|
13070
|
+
catch (e_6) {
|
|
13071
|
+
env_6.error = e_6;
|
|
13072
|
+
env_6.hasError = true;
|
|
12753
13073
|
}
|
|
12754
13074
|
finally {
|
|
12755
|
-
root_create_native_disposeResources(
|
|
13075
|
+
root_create_native_disposeResources(env_6);
|
|
12756
13076
|
}
|
|
12757
13077
|
}, async (created) => {
|
|
12758
|
-
const
|
|
13078
|
+
const env_7 = { stack: [], error: void 0, hasError: false };
|
|
12759
13079
|
try {
|
|
12760
|
-
const handle = root_create_native_addDisposableResource(
|
|
12761
|
-
const parent = root_create_native_addDisposableResource(
|
|
13080
|
+
const handle = root_create_native_addDisposableResource(env_7, created.handle, true);
|
|
13081
|
+
const parent = root_create_native_addDisposableResource(env_7, { [Symbol.dispose]: created.releaseCreationParent }, false);
|
|
12762
13082
|
await created.cleanupCreated();
|
|
12763
13083
|
}
|
|
12764
|
-
catch (
|
|
12765
|
-
|
|
12766
|
-
|
|
13084
|
+
catch (e_7) {
|
|
13085
|
+
env_7.error = e_7;
|
|
13086
|
+
env_7.hasError = true;
|
|
12767
13087
|
}
|
|
12768
13088
|
finally {
|
|
12769
|
-
const result_2 = root_create_native_disposeResources(
|
|
13089
|
+
const result_2 = root_create_native_disposeResources(env_7);
|
|
12770
13090
|
if (result_2)
|
|
12771
13091
|
await result_2;
|
|
12772
13092
|
}
|
|
@@ -13502,7 +13822,7 @@ function privateDirectoryBackend() {
|
|
|
13502
13822
|
if (getFsSafeNativeConfig().mode === "require") {
|
|
13503
13823
|
throw new errors_FsSafeError("helper-unavailable", "private directory creation requires an up-to-date native parent identity capability");
|
|
13504
13824
|
}
|
|
13505
|
-
warnNativeFallback("windows-private-directory", "Private Windows directory creation
|
|
13825
|
+
warnNativeFallback("windows-private-directory", "Private Windows directory creation launches the packaged .NET helper for each check or creation.", "createPrivateDirectoryWithParentIdentity");
|
|
13506
13826
|
return undefined;
|
|
13507
13827
|
}
|
|
13508
13828
|
async function createDirectory(targetPath, options = {}) {
|
|
@@ -19312,6 +19632,247 @@ async function read_opened_file_readOpenedFileSafely(params) {
|
|
|
19312
19632
|
};
|
|
19313
19633
|
}
|
|
19314
19634
|
|
|
19635
|
+
;// CONCATENATED MODULE: ../../node_modules/@openclaw/fs-safe/dist/root-mkdir-native.js
|
|
19636
|
+
var root_mkdir_native_addDisposableResource = (undefined && undefined.__addDisposableResource) || function (env, value, async) {
|
|
19637
|
+
if (value !== null && value !== void 0) {
|
|
19638
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
19639
|
+
var dispose, inner;
|
|
19640
|
+
if (async) {
|
|
19641
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
19642
|
+
dispose = value[Symbol.asyncDispose];
|
|
19643
|
+
}
|
|
19644
|
+
if (dispose === void 0) {
|
|
19645
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
19646
|
+
dispose = value[Symbol.dispose];
|
|
19647
|
+
if (async) inner = dispose;
|
|
19648
|
+
}
|
|
19649
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
19650
|
+
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
19651
|
+
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
19652
|
+
}
|
|
19653
|
+
else if (async) {
|
|
19654
|
+
env.stack.push({ async: true });
|
|
19655
|
+
}
|
|
19656
|
+
return value;
|
|
19657
|
+
};
|
|
19658
|
+
var root_mkdir_native_disposeResources = (undefined && undefined.__disposeResources) || (function (SuppressedError) {
|
|
19659
|
+
return function (env) {
|
|
19660
|
+
function fail(e) {
|
|
19661
|
+
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
19662
|
+
env.hasError = true;
|
|
19663
|
+
}
|
|
19664
|
+
var r, s = 0;
|
|
19665
|
+
function next() {
|
|
19666
|
+
while (r = env.stack.pop()) {
|
|
19667
|
+
try {
|
|
19668
|
+
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
19669
|
+
if (r.dispose) {
|
|
19670
|
+
var result = r.dispose.call(r.value);
|
|
19671
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
19672
|
+
}
|
|
19673
|
+
else s |= 1;
|
|
19674
|
+
}
|
|
19675
|
+
catch (e) {
|
|
19676
|
+
fail(e);
|
|
19677
|
+
}
|
|
19678
|
+
}
|
|
19679
|
+
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
19680
|
+
if (env.hasError) throw env.error;
|
|
19681
|
+
}
|
|
19682
|
+
return next();
|
|
19683
|
+
};
|
|
19684
|
+
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
19685
|
+
var e = new Error(message);
|
|
19686
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
19687
|
+
});
|
|
19688
|
+
|
|
19689
|
+
|
|
19690
|
+
|
|
19691
|
+
|
|
19692
|
+
|
|
19693
|
+
|
|
19694
|
+
|
|
19695
|
+
|
|
19696
|
+
|
|
19697
|
+
|
|
19698
|
+
|
|
19699
|
+
|
|
19700
|
+
|
|
19701
|
+
|
|
19702
|
+
|
|
19703
|
+
|
|
19704
|
+
|
|
19705
|
+
function tryMkdirNativeParents(root, relativePath) {
|
|
19706
|
+
try {
|
|
19707
|
+
return mkdirOrdinaryNativeParents(root, relativePath);
|
|
19708
|
+
}
|
|
19709
|
+
catch (error) {
|
|
19710
|
+
if (hasNodeErrorCode(error, "ENOTDIR"))
|
|
19711
|
+
throw root_errors_directoryComponentNotDirectoryError(error);
|
|
19712
|
+
throw error;
|
|
19713
|
+
}
|
|
19714
|
+
}
|
|
19715
|
+
function mkdirOrdinaryNativeParents(root, relativePath) {
|
|
19716
|
+
if (getFsSafeTestHooks()?.beforeRootFallbackMutation)
|
|
19717
|
+
return false;
|
|
19718
|
+
const segments = relativePath.split(external_node_path_.sep === "\\" ? /[\\/]/ : "/");
|
|
19719
|
+
if (segments.length < 2 || segments.some(segment => !isSafePathSegment(segment, { allowDotPrefix: true }) || segment.endsWith(".")))
|
|
19720
|
+
return false;
|
|
19721
|
+
let rootStat;
|
|
19722
|
+
root_context_assertRootIdentityCurrentSync(root, stat => { rootStat = stat; });
|
|
19723
|
+
const target = external_node_path_.join(root.rootReal, ...segments);
|
|
19724
|
+
const parentPath = external_node_path_.dirname(target);
|
|
19725
|
+
try {
|
|
19726
|
+
const child = external_node_fs_.lstatSync(windows_path_alias_pathForWindowsFilesystem(target), { throwIfNoEntry: false });
|
|
19727
|
+
if (child && (!child.isDirectory() || realpath_realpathSync.native(windows_path_alias_pathForWindowsFilesystem(target)) !== target))
|
|
19728
|
+
return false;
|
|
19729
|
+
}
|
|
19730
|
+
catch {
|
|
19731
|
+
return false;
|
|
19732
|
+
}
|
|
19733
|
+
let parentIdentity;
|
|
19734
|
+
try {
|
|
19735
|
+
parentIdentity = directory_guard_inspectDirectoryIdentitySync(parentPath);
|
|
19736
|
+
}
|
|
19737
|
+
catch (error) {
|
|
19738
|
+
// Reuse this exact Root snapshot and failed parent observation without an
|
|
19739
|
+
// intervening await. All opened ancestors still receive fresh native fences.
|
|
19740
|
+
return hasNodeErrorCode(error, "ENOENT") ? mkdirMissingParents(root, segments, rootStat) : false;
|
|
19741
|
+
}
|
|
19742
|
+
try {
|
|
19743
|
+
if (realpath_realpathSync.native(windows_path_alias_pathForWindowsFilesystem(parentPath)) !== parentPath)
|
|
19744
|
+
return false;
|
|
19745
|
+
}
|
|
19746
|
+
catch {
|
|
19747
|
+
return false;
|
|
19748
|
+
}
|
|
19749
|
+
return mkdirExistingParent(root, segments, parentIdentity);
|
|
19750
|
+
}
|
|
19751
|
+
/** Ordinary missing suffixes need no policy callbacks or repeated path resolution. */
|
|
19752
|
+
function mkdirMissingParents(root, segments, rootStat) {
|
|
19753
|
+
const binding = native_getNativeBinding("openBeneath", "mkdirChildBeneath");
|
|
19754
|
+
if (!binding?.openBeneath || !binding.mkdirOpenChildBeneath)
|
|
19755
|
+
return false;
|
|
19756
|
+
let parentDepth = segments.length - 2;
|
|
19757
|
+
let parentPath;
|
|
19758
|
+
let parentIdentity;
|
|
19759
|
+
for (;;) {
|
|
19760
|
+
parentPath = external_node_path_.join(root.rootReal, ...segments.slice(0, parentDepth));
|
|
19761
|
+
try {
|
|
19762
|
+
parentIdentity = directory_guard_inspectDirectoryIdentitySync(parentPath, undefined, parentDepth === 0 ? rootStat : undefined);
|
|
19763
|
+
if (realpath_realpathSync.native(windows_path_alias_pathForWindowsFilesystem(parentPath)) !== parentPath)
|
|
19764
|
+
return false;
|
|
19765
|
+
break;
|
|
19766
|
+
}
|
|
19767
|
+
catch (error) {
|
|
19768
|
+
if (!hasNodeErrorCode(error, "ENOENT") || parentDepth === 0)
|
|
19769
|
+
return false;
|
|
19770
|
+
parentDepth--;
|
|
19771
|
+
}
|
|
19772
|
+
}
|
|
19773
|
+
try {
|
|
19774
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
19775
|
+
try {
|
|
19776
|
+
const rootOwner = root_mkdir_native_addDisposableResource(env_1, openExactNativeRootSync(binding, {
|
|
19777
|
+
rootPath: root.rootReal, rootIdentity: root.rootIdentity,
|
|
19778
|
+
}), false);
|
|
19779
|
+
const close = captureNativeFdClose(binding);
|
|
19780
|
+
const directories = [];
|
|
19781
|
+
const directoryOwner = root_mkdir_native_addDisposableResource(env_1, { [Symbol.dispose]() {
|
|
19782
|
+
const errors = [];
|
|
19783
|
+
for (const directory of directories.toReversed()) {
|
|
19784
|
+
try {
|
|
19785
|
+
close(directory.fd);
|
|
19786
|
+
}
|
|
19787
|
+
catch (error) {
|
|
19788
|
+
errors.push(error);
|
|
19789
|
+
}
|
|
19790
|
+
}
|
|
19791
|
+
if (errors.length)
|
|
19792
|
+
throw new AggregateError(errors, "mkdir directory close failed");
|
|
19793
|
+
} }, false);
|
|
19794
|
+
const flags = (nodeDirectorySearchOnlyFlags()?.flags ?? external_node_fs_.constants.O_RDONLY) |
|
|
19795
|
+
(external_node_fs_.constants.O_DIRECTORY ?? 0) | (external_node_fs_.constants.O_NOFOLLOW ?? 0);
|
|
19796
|
+
let current = rootOwner.fd;
|
|
19797
|
+
if (parentDepth > 0) {
|
|
19798
|
+
current = binding.openBeneath(rootOwner.fd, segments.slice(0, parentDepth).join("/"), flags).fd;
|
|
19799
|
+
directories.push({ fd: current, pathname: parentPath });
|
|
19800
|
+
strict_file_identity_inspectFileIdentitySync(() => external_node_fs_.fstatSync(current, { bigint: true }), parentIdentity);
|
|
19801
|
+
}
|
|
19802
|
+
const assertCurrent = () => {
|
|
19803
|
+
root_context_assertRootIdentityCurrentSync(root);
|
|
19804
|
+
for (const directory of directories)
|
|
19805
|
+
verifyMkdirDirectory(binding, directory.fd, directory.pathname);
|
|
19806
|
+
verifyMkdirDirectory(binding, rootOwner.fd, root.rootReal);
|
|
19807
|
+
};
|
|
19808
|
+
assertCurrent();
|
|
19809
|
+
for (const segment of segments.slice(parentDepth)) {
|
|
19810
|
+
const child = binding.mkdirOpenChildBeneath(current, segment, 0o777, flags);
|
|
19811
|
+
parentPath = external_node_path_.join(parentPath, segment);
|
|
19812
|
+
directories.push({ fd: child.fd, pathname: parentPath });
|
|
19813
|
+
// Retain every ancestor until the complete suffix is admitted. The
|
|
19814
|
+
// post-create fence also precedes the next synchronous child mutation.
|
|
19815
|
+
assertCurrent();
|
|
19816
|
+
current = child.fd;
|
|
19817
|
+
}
|
|
19818
|
+
return true;
|
|
19819
|
+
}
|
|
19820
|
+
catch (e_1) {
|
|
19821
|
+
env_1.error = e_1;
|
|
19822
|
+
env_1.hasError = true;
|
|
19823
|
+
}
|
|
19824
|
+
finally {
|
|
19825
|
+
root_mkdir_native_disposeResources(env_1);
|
|
19826
|
+
}
|
|
19827
|
+
}
|
|
19828
|
+
catch (error) {
|
|
19829
|
+
if (hasNodeErrorCode(error, "ENOTDIR"))
|
|
19830
|
+
throw root_errors_directoryComponentNotDirectoryError(error);
|
|
19831
|
+
throw error;
|
|
19832
|
+
}
|
|
19833
|
+
}
|
|
19834
|
+
function mkdirExistingParent(root, segments, parentIdentity) {
|
|
19835
|
+
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
19836
|
+
try {
|
|
19837
|
+
const target = external_node_path_.join(root.rootReal, ...segments);
|
|
19838
|
+
const parentPath = external_node_path_.dirname(target);
|
|
19839
|
+
const binding = native_getNativeBinding("openBeneath", "mkdirChildBeneath");
|
|
19840
|
+
if (!binding?.openBeneath || !binding.mkdirChildBeneath) {
|
|
19841
|
+
throw new errors_FsSafeError("helper-unavailable", "native confined creation is unavailable");
|
|
19842
|
+
}
|
|
19843
|
+
const rootOwner = root_mkdir_native_addDisposableResource(env_2, openExactNativeRootSync(binding, {
|
|
19844
|
+
rootPath: root.rootReal, rootIdentity: root.rootIdentity,
|
|
19845
|
+
}), false);
|
|
19846
|
+
verifyMkdirDirectory(binding, rootOwner.fd, root.rootReal);
|
|
19847
|
+
const flags = (nodeDirectorySearchOnlyFlags()?.flags ?? external_node_fs_.constants.O_RDONLY) |
|
|
19848
|
+
(external_node_fs_.constants.O_DIRECTORY ?? 0) | (external_node_fs_.constants.O_NOFOLLOW ?? 0);
|
|
19849
|
+
const close = captureNativeFdClose(binding);
|
|
19850
|
+
const parent = binding.openBeneath(rootOwner.fd, segments.slice(0, -1).join("/"), flags).fd;
|
|
19851
|
+
const parentOwner = root_mkdir_native_addDisposableResource(env_2, { [Symbol.dispose]() { close(parent); } }, false);
|
|
19852
|
+
strict_file_identity_inspectFileIdentitySync(() => external_node_fs_.fstatSync(parent, { bigint: true }), parentIdentity);
|
|
19853
|
+
verifyMkdirDirectory(binding, parent, parentPath);
|
|
19854
|
+
root_context_assertRootIdentityCurrentSync(root);
|
|
19855
|
+
const name = segments.at(-1);
|
|
19856
|
+
const child = binding.mkdirOpenChildBeneath
|
|
19857
|
+
? binding.mkdirOpenChildBeneath(parent, name, 0o777, flags).fd
|
|
19858
|
+
: (binding.mkdirChildBeneath(parent, name, 0o777), binding.openBeneath(parent, name, flags).fd);
|
|
19859
|
+
const childOwner = root_mkdir_native_addDisposableResource(env_2, { [Symbol.dispose]() { close(child); } }, false);
|
|
19860
|
+
root_context_assertRootIdentityCurrentSync(root);
|
|
19861
|
+
verifyMkdirDirectory(binding, child, target);
|
|
19862
|
+
directory_guard_inspectDirectoryIdentitySync(parentPath, parentIdentity);
|
|
19863
|
+
verifyMkdirDirectory(binding, parent, parentPath);
|
|
19864
|
+
verifyMkdirDirectory(binding, rootOwner.fd, root.rootReal);
|
|
19865
|
+
return true;
|
|
19866
|
+
}
|
|
19867
|
+
catch (e_2) {
|
|
19868
|
+
env_2.error = e_2;
|
|
19869
|
+
env_2.hasError = true;
|
|
19870
|
+
}
|
|
19871
|
+
finally {
|
|
19872
|
+
root_mkdir_native_disposeResources(env_2);
|
|
19873
|
+
}
|
|
19874
|
+
}
|
|
19875
|
+
|
|
19315
19876
|
;// CONCATENATED MODULE: ../../node_modules/@openclaw/fs-safe/dist/write-open-flags.js
|
|
19316
19877
|
|
|
19317
19878
|
|
|
@@ -22384,6 +22945,7 @@ var root_impl_disposeResources = (undefined && undefined.__disposeResources) ||
|
|
|
22384
22945
|
|
|
22385
22946
|
|
|
22386
22947
|
|
|
22948
|
+
|
|
22387
22949
|
|
|
22388
22950
|
|
|
22389
22951
|
function logWarn(message) {
|
|
@@ -22784,7 +23346,9 @@ async function openWritableFileInRoot(root, params, options) {
|
|
|
22784
23346
|
denyMutations: params.denyMutations,
|
|
22785
23347
|
mutationSymlinks: params.mutationSymlinks,
|
|
22786
23348
|
});
|
|
22787
|
-
const
|
|
23349
|
+
const creationProbe = requireNative && !guardedTarget && params.assertBeforeMutation === undefined && options?.createIfMissing !== false
|
|
23350
|
+
? probeNativeCreationPath(root, params.relativePath) : undefined;
|
|
23351
|
+
const { resolved } = creationProbe ?? guardedTarget?.resolvedPath ?? await resolveGuardedWritePathInRoot(root, {
|
|
22788
23352
|
relativePath: params.relativePath,
|
|
22789
23353
|
});
|
|
22790
23354
|
const resolveCurrent = async () => (await resolveGuardedWritePathInRoot(root, {
|
|
@@ -22813,27 +23377,30 @@ async function openWritableFileInRoot(root, params, options) {
|
|
|
22813
23377
|
let ioPath = nativeCreatesParents ? resolved : prepared?.targetPath ?? (params.mkdir === false ? resolved :
|
|
22814
23378
|
await prepareRootWriteTarget(root, resolved, params.assertBeforeMutation));
|
|
22815
23379
|
const operationTargetPath = ioPath;
|
|
22816
|
-
|
|
22817
|
-
|
|
22818
|
-
|
|
22819
|
-
|
|
22820
|
-
|
|
22821
|
-
|
|
22822
|
-
|
|
22823
|
-
|
|
22824
|
-
|
|
22825
|
-
|
|
22826
|
-
|
|
22827
|
-
|
|
22828
|
-
|
|
22829
|
-
|
|
22830
|
-
if (err instanceof errors_FsSafeError) {
|
|
22831
|
-
throw err;
|
|
23380
|
+
let observedMissing = Boolean(creationProbe);
|
|
23381
|
+
if (!creationProbe)
|
|
23382
|
+
try {
|
|
23383
|
+
assertFinalSymlinkRejected(ioPath, params.mutationSymlinks !== undefined);
|
|
23384
|
+
const resolvedRealPath = params.mutationSymlinks === undefined ? realpath_realpathSync.native(ioPath) : ioPath;
|
|
23385
|
+
const admittedRealPath = root_boundary_admitPathInsideRoot({
|
|
23386
|
+
rootPath: root.rootReal,
|
|
23387
|
+
candidatePath: resolvedRealPath,
|
|
23388
|
+
rootIdentity: root.rootIdentity,
|
|
23389
|
+
});
|
|
23390
|
+
if (!admittedRealPath) {
|
|
23391
|
+
throw root_errors_outsideWorkspaceError();
|
|
23392
|
+
}
|
|
23393
|
+
ioPath = admittedRealPath.path;
|
|
22832
23394
|
}
|
|
22833
|
-
|
|
22834
|
-
|
|
23395
|
+
catch (err) {
|
|
23396
|
+
if (err instanceof errors_FsSafeError) {
|
|
23397
|
+
throw err;
|
|
23398
|
+
}
|
|
23399
|
+
if (!path_isNotFoundPathError(err)) {
|
|
23400
|
+
throw err;
|
|
23401
|
+
}
|
|
23402
|
+
observedMissing = true;
|
|
22835
23403
|
}
|
|
22836
|
-
}
|
|
22837
23404
|
assertRootFallbackWritePath(params.expectedWritePath, ioPath);
|
|
22838
23405
|
const mode = params.mode ?? 0o600;
|
|
22839
23406
|
let handle;
|
|
@@ -22847,61 +23414,82 @@ async function openWritableFileInRoot(root, params, options) {
|
|
|
22847
23414
|
writePathSelection = guardedTarget
|
|
22848
23415
|
? await prepareGuardedRootWritePathSelection(guardedTarget, ioPath, operationTargetPath, preparedParent)
|
|
22849
23416
|
: undefined;
|
|
22850
|
-
|
|
22851
|
-
|
|
22852
|
-
|
|
22853
|
-
|
|
22854
|
-
|
|
22855
|
-
|
|
22856
|
-
|
|
22857
|
-
|
|
23417
|
+
const createNative = () => tryOpenCreateRootNative({
|
|
23418
|
+
originalPath: params.relativePath,
|
|
23419
|
+
root, directory: external_node_path_.dirname(ioPath), target: ioPath, mkdir: params.mkdir !== false, policy,
|
|
23420
|
+
selectedParent: creationProbe?.parent,
|
|
23421
|
+
resolveCurrent,
|
|
23422
|
+
assertBeforeMutation: params.assertBeforeMutation !== undefined || writePathSelection !== undefined ? () => {
|
|
23423
|
+
params.assertBeforeMutation?.();
|
|
23424
|
+
if (writePathSelection)
|
|
23425
|
+
assertRootWritePathSelectionSync(root, writePathSelection);
|
|
23426
|
+
} : undefined,
|
|
23427
|
+
flags: createFlags, existingFlags, mode,
|
|
23428
|
+
});
|
|
23429
|
+
let precreated;
|
|
23430
|
+
if (requireNative && observedMissing && !guardedTarget && params.assertBeforeMutation === undefined && options?.createIfMissing !== false) {
|
|
23431
|
+
try {
|
|
23432
|
+
precreated = await createNative();
|
|
22858
23433
|
}
|
|
22859
|
-
|
|
22860
|
-
|
|
23434
|
+
catch (error) {
|
|
23435
|
+
if (!hasNodeErrorCode(error, "EEXIST") || !isNativeCreateCollision(error))
|
|
23436
|
+
throw error;
|
|
22861
23437
|
}
|
|
22862
|
-
|
|
22863
|
-
|
|
22864
|
-
|
|
22865
|
-
|
|
22866
|
-
|
|
22867
|
-
|
|
22868
|
-
|
|
22869
|
-
|
|
22870
|
-
|
|
22871
|
-
|
|
22872
|
-
|
|
22873
|
-
|
|
22874
|
-
}))
|
|
22875
|
-
throw root_errors_outsideWorkspaceError();
|
|
22876
|
-
directory_guard_assertSyncDirectoryGuard(parentGuard);
|
|
22877
|
-
return { missing: true, targetPath: ioPath, parentGuard, writeSelection: writePathSelection };
|
|
23438
|
+
}
|
|
23439
|
+
if (precreated) {
|
|
23440
|
+
handle = precreated.handle;
|
|
23441
|
+
cleanupCreated = precreated.cleanupCreated;
|
|
23442
|
+
releaseCreationParent = precreated.releaseCreationParent;
|
|
23443
|
+
createdForWrite = true;
|
|
23444
|
+
}
|
|
23445
|
+
else {
|
|
23446
|
+
try {
|
|
23447
|
+
if (writePathSelection)
|
|
23448
|
+
assertRootWritePathSelectionSync(root, writePathSelection);
|
|
23449
|
+
handle = await promises_.open(ioPath, existingFlags, mode);
|
|
22878
23450
|
}
|
|
22879
|
-
|
|
22880
|
-
await
|
|
22881
|
-
|
|
22882
|
-
|
|
22883
|
-
|
|
22884
|
-
|
|
23451
|
+
catch (err) {
|
|
23452
|
+
if (await isNonRegularWriteOpenError(err, ioPath, existingFlags)) {
|
|
23453
|
+
throw new errors_FsSafeError("not-file", "path is not a regular file under root");
|
|
23454
|
+
}
|
|
23455
|
+
if (!path_isNotFoundPathError(err)) {
|
|
23456
|
+
throw err;
|
|
23457
|
+
}
|
|
23458
|
+
if (options?.createIfMissing === false) {
|
|
23459
|
+
if (nativeCreatesParents && !guardedTarget)
|
|
23460
|
+
await tryMkdirRootNative({
|
|
23461
|
+
originalPath: params.relativePath,
|
|
23462
|
+
root, directory: external_node_path_.dirname(ioPath), target: ioPath, mkdir: true, policy,
|
|
23463
|
+
resolveCurrent, assertBeforeMutation: params.assertBeforeMutation,
|
|
23464
|
+
});
|
|
23465
|
+
const parentGuard = writePathSelection?.parentGuard ??
|
|
23466
|
+
await directory_guard_createAsyncDirectoryGuard(external_node_path_.dirname(ioPath), { bigint: true });
|
|
23467
|
+
root_context_assertRootIdentityCurrentSync(root);
|
|
23468
|
+
if (!root_boundary_admitPathInsideRoot({
|
|
23469
|
+
rootPath: root.rootReal, candidatePath: parentGuard.realPath, rootIdentity: root.rootIdentity,
|
|
23470
|
+
}))
|
|
23471
|
+
throw root_errors_outsideWorkspaceError();
|
|
23472
|
+
directory_guard_assertSyncDirectoryGuard(parentGuard);
|
|
23473
|
+
return { missing: true, targetPath: ioPath, parentGuard, writeSelection: writePathSelection };
|
|
23474
|
+
}
|
|
23475
|
+
if (writePathSelection)
|
|
23476
|
+
await refreshRootWritePathSelection(writePathSelection);
|
|
23477
|
+
const nativeCreated = requireNative ? await createNative() : undefined;
|
|
23478
|
+
if (nativeCreated)
|
|
23479
|
+
handle = nativeCreated.handle;
|
|
23480
|
+
else {
|
|
22885
23481
|
params.assertBeforeMutation?.();
|
|
22886
23482
|
if (writePathSelection)
|
|
22887
23483
|
assertRootWritePathSelectionSync(root, writePathSelection);
|
|
22888
|
-
|
|
22889
|
-
|
|
22890
|
-
|
|
22891
|
-
|
|
22892
|
-
|
|
22893
|
-
|
|
22894
|
-
|
|
22895
|
-
|
|
22896
|
-
assertRootWritePathSelectionSync(root, writePathSelection);
|
|
22897
|
-
// Windows can follow a dangling symlink even with O_EXCL.
|
|
22898
|
-
if (!SUPPORTS_NOFOLLOW)
|
|
22899
|
-
assertFinalSymlinkRejected(ioPath, true);
|
|
22900
|
-
handle = await promises_.open(ioPath, createFlags, mode);
|
|
23484
|
+
// Windows can follow a dangling symlink even with O_EXCL.
|
|
23485
|
+
if (!SUPPORTS_NOFOLLOW)
|
|
23486
|
+
assertFinalSymlinkRejected(ioPath, true);
|
|
23487
|
+
handle = await promises_.open(ioPath, createFlags, mode);
|
|
23488
|
+
}
|
|
23489
|
+
cleanupCreated = nativeCreated?.cleanupCreated;
|
|
23490
|
+
releaseCreationParent = nativeCreated?.releaseCreationParent;
|
|
23491
|
+
createdForWrite = true;
|
|
22901
23492
|
}
|
|
22902
|
-
cleanupCreated = nativeCreated?.cleanupCreated;
|
|
22903
|
-
releaseCreationParent = nativeCreated?.releaseCreationParent;
|
|
22904
|
-
createdForWrite = true;
|
|
22905
23493
|
}
|
|
22906
23494
|
}
|
|
22907
23495
|
catch (err) {
|
|
@@ -23148,6 +23736,8 @@ async function mkdirPathInRoot(root, params) {
|
|
|
23148
23736
|
}
|
|
23149
23737
|
if (tryMkdirNativeDirectChild(root, params.relativePath))
|
|
23150
23738
|
return;
|
|
23739
|
+
if (tryMkdirNativeParents(root, params.relativePath))
|
|
23740
|
+
return;
|
|
23151
23741
|
}
|
|
23152
23742
|
const resolution = { relativePath: params.relativePath, allowRoot: params.allowRoot, ...policy };
|
|
23153
23743
|
const resolveCurrent = policy
|
|
@@ -46779,7 +47369,26 @@ function sortFindings(findings) {
|
|
|
46779
47369
|
return CATEGORY_ORDER.indexOf(a.category) - CATEGORY_ORDER.indexOf(b.category);
|
|
46780
47370
|
});
|
|
46781
47371
|
}
|
|
46782
|
-
|
|
47372
|
+
/**
|
|
47373
|
+
* Prints every field of the intent load report so text output carries the
|
|
47374
|
+
* same status, checked path, reason, and issues as the JSON `intent` object.
|
|
47375
|
+
*/ function renderIntentLoad(intentLoad, logger) {
|
|
47376
|
+
logger.info(`Intent: ${intentLoad.status}`);
|
|
47377
|
+
logger.info(` Checked path: ${intentLoad.checkedPath}`);
|
|
47378
|
+
if (intentLoad.reason !== undefined) {
|
|
47379
|
+
logger.info(` Reason: ${intentLoad.reason}`);
|
|
47380
|
+
}
|
|
47381
|
+
if (intentLoad.issues !== undefined && intentLoad.issues.length > 0) {
|
|
47382
|
+
logger.info(" Issues:");
|
|
47383
|
+
for (const issue of intentLoad.issues){
|
|
47384
|
+
logger.info(` ${issue.path}: ${issue.message}`);
|
|
47385
|
+
}
|
|
47386
|
+
if (intentLoad.omittedIssueCount !== undefined) {
|
|
47387
|
+
logger.info(` ...and ${intentLoad.omittedIssueCount} more`);
|
|
47388
|
+
}
|
|
47389
|
+
}
|
|
47390
|
+
}
|
|
47391
|
+
function renderHuman(summary, findings, logger, snapshotRef, intentLoad) {
|
|
46783
47392
|
if (snapshotRef) {
|
|
46784
47393
|
logger.info(`Evidence snapshot: ${snapshotRef}`);
|
|
46785
47394
|
}
|
|
@@ -46796,6 +47405,9 @@ function renderHuman(summary, findings, logger, snapshotRef) {
|
|
|
46796
47405
|
if (summary.crossHarnessEdges > 0) {
|
|
46797
47406
|
logger.info(` Cross-harness edges: ${summary.crossHarnessEdges}`);
|
|
46798
47407
|
}
|
|
47408
|
+
if (intentLoad !== undefined) {
|
|
47409
|
+
renderIntentLoad(intentLoad, logger);
|
|
47410
|
+
}
|
|
46799
47411
|
if (findings.length === 0) {
|
|
46800
47412
|
logger.success("No findings.");
|
|
46801
47413
|
return;
|
|
@@ -55803,6 +56415,25 @@ function schemas_preprocess(fn, schema) {
|
|
|
55803
56415
|
});
|
|
55804
56416
|
}
|
|
55805
56417
|
|
|
56418
|
+
;// CONCATENATED MODULE: ../doctor/src/entities/intent-load.ts
|
|
56419
|
+
/**
|
|
56420
|
+
* Outcome of attempting to load `.agentic-doctor/intent.json`.
|
|
56421
|
+
*
|
|
56422
|
+
* `absent` means no file exists at the checked path. Every other non-`loaded`
|
|
56423
|
+
* status means a file is present but was rejected, so declared intent is
|
|
56424
|
+
* treated as undeclared for the run.
|
|
56425
|
+
*/ const INTENT_LOAD_STATUSES = [
|
|
56426
|
+
"loaded",
|
|
56427
|
+
"absent",
|
|
56428
|
+
"invalid-json",
|
|
56429
|
+
"invalid-schema",
|
|
56430
|
+
"symlink-rejected",
|
|
56431
|
+
"read-failed"
|
|
56432
|
+
];
|
|
56433
|
+
function isIntentRejected(status) {
|
|
56434
|
+
return status !== "loaded" && status !== "absent";
|
|
56435
|
+
}
|
|
56436
|
+
|
|
55806
56437
|
;// CONCATENATED MODULE: ../doctor/src/lib/cross-harness-edges.ts
|
|
55807
56438
|
function resolveEdgeTargets(edge) {
|
|
55808
56439
|
return Array.isArray(edge.direction.to) ? edge.direction.to : [
|
|
@@ -55839,6 +56470,7 @@ function countCrossHarnessEdges(records) {
|
|
|
55839
56470
|
;// CONCATENATED MODULE: ../doctor/src/formatters/json-formatter.ts
|
|
55840
56471
|
|
|
55841
56472
|
|
|
56473
|
+
|
|
55842
56474
|
const HarnessNameSchema = classic_schemas_enum([
|
|
55843
56475
|
"claude",
|
|
55844
56476
|
"copilot",
|
|
@@ -55910,6 +56542,16 @@ const FindingSchema = classic_schemas_object({
|
|
|
55910
56542
|
evidenceCitation: CitationHandleSchema.optional(),
|
|
55911
56543
|
snapshotRef: classic_schemas_string().optional()
|
|
55912
56544
|
});
|
|
56545
|
+
const IntentLoadReportSchema = classic_schemas_object({
|
|
56546
|
+
status: classic_schemas_enum(INTENT_LOAD_STATUSES),
|
|
56547
|
+
checkedPath: classic_schemas_string(),
|
|
56548
|
+
reason: classic_schemas_string().optional(),
|
|
56549
|
+
issues: classic_schemas_array(classic_schemas_object({
|
|
56550
|
+
path: classic_schemas_string(),
|
|
56551
|
+
message: classic_schemas_string()
|
|
56552
|
+
})).optional(),
|
|
56553
|
+
omittedIssueCount: classic_schemas_number().int().positive().optional()
|
|
56554
|
+
});
|
|
55913
56555
|
const ReportInventoryItemSchema = classic_schemas_object({
|
|
55914
56556
|
id: classic_schemas_string(),
|
|
55915
56557
|
path: classic_schemas_string(),
|
|
@@ -55944,6 +56586,7 @@ const ReportJsonSchema = classic_schemas_object({
|
|
|
55944
56586
|
crossHarnessEdges: classic_schemas_number(),
|
|
55945
56587
|
inventory: classic_schemas_array(ReportInventoryItemSchema),
|
|
55946
56588
|
edges: classic_schemas_array(ReportEdgeSchema),
|
|
56589
|
+
intent: IntentLoadReportSchema.optional(),
|
|
55947
56590
|
findings: classic_schemas_array(FindingSchema),
|
|
55948
56591
|
snapshotRef: classic_schemas_string().optional()
|
|
55949
56592
|
});
|
|
@@ -55983,7 +56626,7 @@ function toReportEdges(records) {
|
|
|
55983
56626
|
}
|
|
55984
56627
|
return result;
|
|
55985
56628
|
}
|
|
55986
|
-
function toJson(summary, findings, records, snapshotRef) {
|
|
56629
|
+
function toJson(summary, findings, records, snapshotRef, intentLoad) {
|
|
55987
56630
|
const edges = toReportEdges(records);
|
|
55988
56631
|
const report = {
|
|
55989
56632
|
archetype: summary.archetype,
|
|
@@ -55993,6 +56636,9 @@ function toJson(summary, findings, records, snapshotRef) {
|
|
|
55993
56636
|
crossHarnessEdges: edges.filter((edge)=>edge.crossHarness).length,
|
|
55994
56637
|
inventory: toInventoryItems(records),
|
|
55995
56638
|
edges,
|
|
56639
|
+
...intentLoad !== undefined ? {
|
|
56640
|
+
intent: intentLoad
|
|
56641
|
+
} : {},
|
|
55996
56642
|
findings,
|
|
55997
56643
|
...snapshotRef !== undefined ? {
|
|
55998
56644
|
snapshotRef
|
|
@@ -56059,35 +56705,135 @@ const DeclaredIntentSchema = classic_schemas_object({
|
|
|
56059
56705
|
]),
|
|
56060
56706
|
snapshotRef: classic_schemas_string().optional()
|
|
56061
56707
|
});
|
|
56708
|
+
const MAX_SCHEMA_ISSUES = 20;
|
|
56709
|
+
const ErrorCodeSchema = classic_schemas_object({
|
|
56710
|
+
code: classic_schemas_string()
|
|
56711
|
+
});
|
|
56712
|
+
const ErrorCauseSchema = classic_schemas_object({
|
|
56713
|
+
cause: classic_schemas_unknown()
|
|
56714
|
+
});
|
|
56715
|
+
function intent_artifact_readErrorCode(value) {
|
|
56716
|
+
const parsed = ErrorCodeSchema.safeParse(value);
|
|
56717
|
+
return parsed.success ? parsed.data.code : undefined;
|
|
56718
|
+
}
|
|
56719
|
+
/**
|
|
56720
|
+
* Extracts fs-safe / errno codes from the error and, when present, its cause.
|
|
56721
|
+
* Each is parsed independently so a cause without a code never hides the
|
|
56722
|
+
* top-level code. Error messages are deliberately ignored so diagnostics
|
|
56723
|
+
* never depend on wording.
|
|
56724
|
+
*/ function readErrorCodes(error) {
|
|
56725
|
+
const cause = ErrorCauseSchema.safeParse(error);
|
|
56726
|
+
return [
|
|
56727
|
+
intent_artifact_readErrorCode(error),
|
|
56728
|
+
cause.success ? intent_artifact_readErrorCode(cause.data.cause) : undefined
|
|
56729
|
+
].filter((code)=>code !== undefined);
|
|
56730
|
+
}
|
|
56731
|
+
function classifyReadError(error, checkedPath) {
|
|
56732
|
+
const codes = readErrorCodes(error);
|
|
56733
|
+
const has = (code)=>codes.includes(code);
|
|
56734
|
+
// ENOTDIR: a path segment such as `.agentic-doctor` is a regular file,
|
|
56735
|
+
// so no intent file can exist at the checked path.
|
|
56736
|
+
if (has("not-found") || has("ENOENT") || has("ENOTDIR")) {
|
|
56737
|
+
return {
|
|
56738
|
+
status: "absent",
|
|
56739
|
+
checkedPath,
|
|
56740
|
+
reason: "No file exists at the checked path."
|
|
56741
|
+
};
|
|
56742
|
+
}
|
|
56743
|
+
if (has("symlink") || has("path-alias")) {
|
|
56744
|
+
return {
|
|
56745
|
+
status: "symlink-rejected",
|
|
56746
|
+
checkedPath,
|
|
56747
|
+
reason: "The checked path is or passes through a symbolic link. The intent file must be a regular file inside the repository."
|
|
56748
|
+
};
|
|
56749
|
+
}
|
|
56750
|
+
if (has("hardlink")) {
|
|
56751
|
+
return {
|
|
56752
|
+
status: "read-failed",
|
|
56753
|
+
checkedPath,
|
|
56754
|
+
reason: "The file is a hard link. The intent file must be a regular file with a single link."
|
|
56755
|
+
};
|
|
56756
|
+
}
|
|
56757
|
+
if (has("not-file") || has("EISDIR")) {
|
|
56758
|
+
return {
|
|
56759
|
+
status: "read-failed",
|
|
56760
|
+
checkedPath,
|
|
56761
|
+
reason: "The checked path is not a regular file."
|
|
56762
|
+
};
|
|
56763
|
+
}
|
|
56764
|
+
if (has("too-large")) {
|
|
56765
|
+
return {
|
|
56766
|
+
status: "read-failed",
|
|
56767
|
+
checkedPath,
|
|
56768
|
+
reason: `The file exceeds the ${MAX_INTENT_BYTES}-byte size limit.`
|
|
56769
|
+
};
|
|
56770
|
+
}
|
|
56771
|
+
const errnoCode = codes.find((code)=>/^E[A-Z]+$/.test(code));
|
|
56772
|
+
return {
|
|
56773
|
+
status: "read-failed",
|
|
56774
|
+
checkedPath,
|
|
56775
|
+
reason: errnoCode ? `The file could not be read (${errnoCode}).` : "The file could not be read."
|
|
56776
|
+
};
|
|
56777
|
+
}
|
|
56778
|
+
function toSchemaIssues(error) {
|
|
56779
|
+
const issues = error.issues.slice(0, MAX_SCHEMA_ISSUES).map((issue)=>({
|
|
56780
|
+
path: issue.path.length > 0 ? issue.path.map(String).join(".") : "(root)",
|
|
56781
|
+
message: issue.message
|
|
56782
|
+
}));
|
|
56783
|
+
const omittedIssueCount = error.issues.length - issues.length;
|
|
56784
|
+
return omittedIssueCount > 0 ? {
|
|
56785
|
+
issues,
|
|
56786
|
+
omittedIssueCount
|
|
56787
|
+
} : {
|
|
56788
|
+
issues
|
|
56789
|
+
};
|
|
56790
|
+
}
|
|
56062
56791
|
async function readIntentArtifact(repoRoot) {
|
|
56063
56792
|
const artifactRelPath = `${ARTIFACT_DIR}/${ARTIFACT_FILENAME}`;
|
|
56064
56793
|
const artifactPath = (0,external_node_path_.resolve)(repoRoot, ARTIFACT_DIR, ARTIFACT_FILENAME);
|
|
56065
56794
|
let raw;
|
|
56066
56795
|
try {
|
|
56067
56796
|
raw = await file_system_utils_readTextWithinRoot(repoRoot, artifactRelPath, MAX_INTENT_BYTES);
|
|
56068
|
-
} catch
|
|
56797
|
+
} catch (error) {
|
|
56069
56798
|
return {
|
|
56070
|
-
found: false
|
|
56799
|
+
found: false,
|
|
56800
|
+
report: classifyReadError(error, artifactPath)
|
|
56071
56801
|
};
|
|
56072
56802
|
}
|
|
56073
56803
|
let parsed;
|
|
56074
56804
|
try {
|
|
56075
56805
|
parsed = JSON.parse(raw);
|
|
56076
56806
|
} catch {
|
|
56807
|
+
// The parser message can quote file contents, so it is not surfaced.
|
|
56077
56808
|
return {
|
|
56078
|
-
found: false
|
|
56809
|
+
found: false,
|
|
56810
|
+
report: {
|
|
56811
|
+
status: "invalid-json",
|
|
56812
|
+
checkedPath: artifactPath,
|
|
56813
|
+
reason: "The file is not valid JSON."
|
|
56814
|
+
}
|
|
56079
56815
|
};
|
|
56080
56816
|
}
|
|
56081
56817
|
const result = DeclaredIntentSchema.safeParse(parsed);
|
|
56082
56818
|
if (!result.success) {
|
|
56083
56819
|
return {
|
|
56084
|
-
found: false
|
|
56820
|
+
found: false,
|
|
56821
|
+
report: {
|
|
56822
|
+
status: "invalid-schema",
|
|
56823
|
+
checkedPath: artifactPath,
|
|
56824
|
+
reason: "The file does not match the intent schema.",
|
|
56825
|
+
...toSchemaIssues(result.error)
|
|
56826
|
+
}
|
|
56085
56827
|
};
|
|
56086
56828
|
}
|
|
56087
56829
|
return {
|
|
56088
56830
|
found: true,
|
|
56089
56831
|
artifact: result.data,
|
|
56090
|
-
path: artifactPath
|
|
56832
|
+
path: artifactPath,
|
|
56833
|
+
report: {
|
|
56834
|
+
status: "loaded",
|
|
56835
|
+
checkedPath: artifactPath
|
|
56836
|
+
}
|
|
56091
56837
|
};
|
|
56092
56838
|
}
|
|
56093
56839
|
async function writeIntentArtifact(repoRoot, artifact) {
|
|
@@ -56966,12 +57712,19 @@ const CRITERIA = [
|
|
|
56966
57712
|
severity: "medium",
|
|
56967
57713
|
classification: "defect",
|
|
56968
57714
|
category: "governance",
|
|
56969
|
-
description: "No declared intent artifact found at .agentic-doctor/intent.json.
|
|
56970
|
-
checkMethod: "
|
|
56971
|
-
checkArgs: {
|
|
56972
|
-
|
|
56973
|
-
|
|
56974
|
-
|
|
57715
|
+
description: "No declared intent artifact found at .agentic-doctor/intent.json in the directory doctor ran from. All shipped checks still ran, and this finding alone does not fail the command. Doctor does not search parent or home directories, and declared intent does not change the detected archetype.",
|
|
57716
|
+
checkMethod: "intent.artifactAbsent",
|
|
57717
|
+
checkArgs: {}
|
|
57718
|
+
},
|
|
57719
|
+
{
|
|
57720
|
+
id: "invalid-intent-artifact",
|
|
57721
|
+
appliesToHarness: "all",
|
|
57722
|
+
severity: "medium",
|
|
57723
|
+
classification: "defect",
|
|
57724
|
+
category: "governance",
|
|
57725
|
+
description: "An intent artifact exists at .agentic-doctor/intent.json but was rejected, so doctor treated intent as undeclared. The intent status reports the checked path and the reason; fix the file and re-run doctor. This finding alone does not fail the command.",
|
|
57726
|
+
checkMethod: "intent.artifactRejected",
|
|
57727
|
+
checkArgs: {}
|
|
56975
57728
|
},
|
|
56976
57729
|
{
|
|
56977
57730
|
id: "malformed-claude-import",
|
|
@@ -57124,6 +57877,28 @@ function detectAmbiguities(records, classification) {
|
|
|
57124
57877
|
}
|
|
57125
57878
|
|
|
57126
57879
|
;// CONCATENATED MODULE: ../doctor/src/use-cases/evaluate-engine.ts
|
|
57880
|
+
|
|
57881
|
+
/**
|
|
57882
|
+
* The artifact is authoritative: a parsed intent means loaded, and a null
|
|
57883
|
+
* intent can never be loaded. The status only refines why intent is null.
|
|
57884
|
+
*/ function resolveIntentLoadStatus(ctx) {
|
|
57885
|
+
if (ctx.intent !== null) return "loaded";
|
|
57886
|
+
const status = ctx.intentLoadStatus;
|
|
57887
|
+
return status === undefined || status === "loaded" ? "absent" : status;
|
|
57888
|
+
}
|
|
57889
|
+
function makeIntentFinding(criterion) {
|
|
57890
|
+
return {
|
|
57891
|
+
id: makeId(criterion.id, "all:intent"),
|
|
57892
|
+
criterionId: criterion.id,
|
|
57893
|
+
targetId: "all:intent",
|
|
57894
|
+
severity: criterion.severity,
|
|
57895
|
+
category: criterion.category,
|
|
57896
|
+
classification: criterion.classification,
|
|
57897
|
+
intentGated: false,
|
|
57898
|
+
assumedIntent: true,
|
|
57899
|
+
description: criterion.description
|
|
57900
|
+
};
|
|
57901
|
+
}
|
|
57127
57902
|
function makeId(criterionId, targetId) {
|
|
57128
57903
|
return `${criterionId}:${targetId}`;
|
|
57129
57904
|
}
|
|
@@ -57147,25 +57922,19 @@ function checkFileExists(criterion, args, ctx) {
|
|
|
57147
57922
|
}
|
|
57148
57923
|
return [];
|
|
57149
57924
|
}
|
|
57150
|
-
function
|
|
57925
|
+
function checkIntentArtifactAbsent(criterion, ctx) {
|
|
57151
57926
|
const hasRecords = ctx.records.length > 0;
|
|
57152
|
-
const
|
|
57153
|
-
|
|
57154
|
-
|
|
57155
|
-
|
|
57156
|
-
|
|
57157
|
-
|
|
57158
|
-
|
|
57159
|
-
|
|
57160
|
-
|
|
57161
|
-
|
|
57162
|
-
|
|
57163
|
-
assumedIntent: true,
|
|
57164
|
-
description: criterion.description
|
|
57165
|
-
}
|
|
57166
|
-
];
|
|
57167
|
-
}
|
|
57168
|
-
return [];
|
|
57927
|
+
const isAbsent = resolveIntentLoadStatus(ctx) === "absent";
|
|
57928
|
+
return hasRecords && isAbsent ? [
|
|
57929
|
+
makeIntentFinding(criterion)
|
|
57930
|
+
] : [];
|
|
57931
|
+
}
|
|
57932
|
+
function checkIntentArtifactRejected(criterion, ctx) {
|
|
57933
|
+
const hasRecords = ctx.records.length > 0;
|
|
57934
|
+
const isRejected = isIntentRejected(resolveIntentLoadStatus(ctx));
|
|
57935
|
+
return hasRecords && isRejected ? [
|
|
57936
|
+
makeIntentFinding(criterion)
|
|
57937
|
+
] : [];
|
|
57169
57938
|
}
|
|
57170
57939
|
function checkEdgePresent(criterion, args, ctx) {
|
|
57171
57940
|
const fromRecords = ctx.records.filter((r)=>r.harness === args.fromHarness);
|
|
@@ -57282,9 +58051,9 @@ function evaluate(criteria, ctx) {
|
|
|
57282
58051
|
findings.push(...checkFileExists(criterion, criterion.checkArgs, ctx));
|
|
57283
58052
|
break;
|
|
57284
58053
|
}
|
|
57285
|
-
case "
|
|
58054
|
+
case "intent.artifactAbsent":
|
|
57286
58055
|
{
|
|
57287
|
-
findings.push(...
|
|
58056
|
+
findings.push(...checkIntentArtifactAbsent(criterion, ctx));
|
|
57288
58057
|
break;
|
|
57289
58058
|
}
|
|
57290
58059
|
case "inventory.edgePresent":
|
|
@@ -57312,6 +58081,11 @@ function evaluate(criteria, ctx) {
|
|
|
57312
58081
|
findings.push(...checkCapabilityDeclared(criterion, ctx));
|
|
57313
58082
|
break;
|
|
57314
58083
|
}
|
|
58084
|
+
case "intent.artifactRejected":
|
|
58085
|
+
{
|
|
58086
|
+
findings.push(...checkIntentArtifactRejected(criterion, ctx));
|
|
58087
|
+
break;
|
|
58088
|
+
}
|
|
57315
58089
|
default:
|
|
57316
58090
|
break;
|
|
57317
58091
|
}
|
|
@@ -57399,11 +58173,11 @@ const doctorCommand = defineCommand({
|
|
|
57399
58173
|
}
|
|
57400
58174
|
return;
|
|
57401
58175
|
}
|
|
57402
|
-
|
|
57403
|
-
|
|
57404
|
-
//
|
|
58176
|
+
let intentResult = await readIntentArtifact(repoPath);
|
|
58177
|
+
// Interactive elicitation only when no intent file exists and running in
|
|
58178
|
+
// a TTY. A present-but-rejected file is reported instead of prompting.
|
|
57405
58179
|
const isInteractive = !args.ci && process.stdin.isTTY === true;
|
|
57406
|
-
if (
|
|
58180
|
+
if (intentResult.report.status === "absent" && isInteractive) {
|
|
57407
58181
|
const questions = detectAmbiguities(records, classification);
|
|
57408
58182
|
for (const q of questions){
|
|
57409
58183
|
logger.info(`\n${q.hint}`);
|
|
@@ -57416,19 +58190,19 @@ const doctorCommand = defineCommand({
|
|
|
57416
58190
|
}
|
|
57417
58191
|
}
|
|
57418
58192
|
// After interactive prompts, re-read in case user pre-created the artifact
|
|
57419
|
-
|
|
57420
|
-
if (retried.found) intent = retried.artifact;
|
|
58193
|
+
intentResult = await readIntentArtifact(repoPath);
|
|
57421
58194
|
}
|
|
57422
58195
|
const findings = evaluate(CRITERIA, {
|
|
57423
58196
|
records,
|
|
57424
58197
|
classification,
|
|
57425
|
-
intent
|
|
58198
|
+
intent: intentResult.found ? intentResult.artifact : null,
|
|
58199
|
+
intentLoadStatus: intentResult.report.status
|
|
57426
58200
|
});
|
|
57427
58201
|
if (format === "json") {
|
|
57428
|
-
const report = toJson(summary, findings, records, snapshotRef);
|
|
58202
|
+
const report = toJson(summary, findings, records, snapshotRef, intentResult.report);
|
|
57429
58203
|
process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
|
|
57430
58204
|
} else {
|
|
57431
|
-
renderHuman(summary, findings, logger, snapshotRef);
|
|
58205
|
+
renderHuman(summary, findings, logger, snapshotRef, intentResult.report);
|
|
57432
58206
|
}
|
|
57433
58207
|
if (hasBlockingFindings(findings)) {
|
|
57434
58208
|
process.exitCode = 1;
|
|
@@ -70840,7 +71614,7 @@ function initializeFlow(effects) {
|
|
|
70840
71614
|
*/
|
|
70841
71615
|
|
|
70842
71616
|
|
|
70843
|
-
const
|
|
71617
|
+
const text_resolver = {
|
|
70844
71618
|
resolveAll: text_createResolver()
|
|
70845
71619
|
};
|
|
70846
71620
|
const text_string = initializeFactory('string');
|
|
@@ -79011,7 +79785,7 @@ const constructs_text = {
|
|
|
79011
79785
|
|
|
79012
79786
|
/** @satisfies {Extension['insideSpan']} */
|
|
79013
79787
|
const insideSpan = {
|
|
79014
|
-
null: [attention_attention,
|
|
79788
|
+
null: [attention_attention, text_resolver]
|
|
79015
79789
|
};
|
|
79016
79790
|
|
|
79017
79791
|
/** @satisfies {Extension['attentionMarkers']} */
|
|
@@ -110211,4 +110985,4 @@ if (installedChunkData !== 0) { // 0 means "already installed".'
|
|
|
110211
110985
|
// module factories are used so entry inlining is disabled
|
|
110212
110986
|
// startup
|
|
110213
110987
|
// Load entry module and return exports
|
|
110214
|
-
var __webpack_exports__ = __webpack_require__(
|
|
110988
|
+
var __webpack_exports__ = __webpack_require__(4517);
|