mancode 0.6.5 → 0.6.6
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.en.md +80 -37
- package/README.md +52 -21
- package/dist/{chunk-E2K22WYH.js → chunk-D5ABGAF4.js} +164 -70
- package/dist/{chunk-E2K22WYH.js.map → chunk-D5ABGAF4.js.map} +1 -1
- package/dist/{chunk-WJ6WARGG.js → chunk-RMHUYJXB.js} +46 -47
- package/dist/chunk-RMHUYJXB.js.map +1 -0
- package/dist/cli.js +608 -442
- package/dist/cli.js.map +1 -1
- package/dist/{store-GSLSLZ7D.js → store-LLXL7QYG.js} +2 -2
- package/dist/{v3-adapter-T3IKK3LU.js → v3-adapter-KA2NOVI5.js} +2 -2
- package/package.json +3 -2
- package/dist/chunk-WJ6WARGG.js.map +0 -1
- /package/dist/{store-GSLSLZ7D.js.map → store-LLXL7QYG.js.map} +0 -0
- /package/dist/{v3-adapter-T3IKK3LU.js.map → v3-adapter-KA2NOVI5.js.map} +0 -0
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
} from "./chunk-IRZQYMHD.js";
|
|
27
27
|
|
|
28
28
|
// src/context/store.ts
|
|
29
|
-
import { lstat as
|
|
29
|
+
import { lstat as lstat7, readFile as readFile10, readdir as readdir7 } from "fs/promises";
|
|
30
30
|
import path12 from "path";
|
|
31
31
|
|
|
32
32
|
// src/runtime/git-ref-workflow-repair-store.ts
|
|
@@ -216,6 +216,28 @@ function scanSharedText(value) {
|
|
|
216
216
|
}
|
|
217
217
|
return removeNestedFindings(findings);
|
|
218
218
|
}
|
|
219
|
+
function redactSharedText(value) {
|
|
220
|
+
assertText(value, "shared text");
|
|
221
|
+
const findings = scanSharedText(value);
|
|
222
|
+
if (findings.length === 0) return { text: value, redactions: [] };
|
|
223
|
+
let redacted = "";
|
|
224
|
+
let cursor = 0;
|
|
225
|
+
const counts = /* @__PURE__ */ new Map();
|
|
226
|
+
for (const finding of findings) {
|
|
227
|
+
redacted += value.slice(cursor, finding.start);
|
|
228
|
+
redacted += `[REDACTED:${finding.kind}]`;
|
|
229
|
+
cursor = finding.end;
|
|
230
|
+
counts.set(finding.kind, (counts.get(finding.kind) ?? 0) + 1);
|
|
231
|
+
}
|
|
232
|
+
redacted += value.slice(cursor);
|
|
233
|
+
if (scanSharedText(redacted).length > 0) {
|
|
234
|
+
throw new Error("MANCODE_PRIVACY_BLOCKED");
|
|
235
|
+
}
|
|
236
|
+
return {
|
|
237
|
+
text: redacted,
|
|
238
|
+
redactions: [...counts.entries()].sort(([left], [right]) => left.localeCompare(right, "en")).map(([kind, count]) => ({ kind, count }))
|
|
239
|
+
};
|
|
240
|
+
}
|
|
219
241
|
function assertSharedTextSafe(value, label) {
|
|
220
242
|
assertText(value, label);
|
|
221
243
|
if (scanSharedText(value).length > 0) {
|
|
@@ -4156,9 +4178,55 @@ function parseTimestamp8(value, label) {
|
|
|
4156
4178
|
function parseTimestampOrNull(value, label) {
|
|
4157
4179
|
return value === null ? null : parseTimestamp8(value, label);
|
|
4158
4180
|
}
|
|
4181
|
+
function isActiveSoloHandoff(metadata) {
|
|
4182
|
+
return metadata.workflowMode === "man" && metadata.coordination === "single" && metadata.status === "planned" && metadata.governance.planDecision === "solo_handoff" && metadata.soloExecution?.state === "active" && metadata.soloExecution.planVersion === metadata.governance.planVersion;
|
|
4183
|
+
}
|
|
4184
|
+
function assertSoloHandoffSession(metadata, session) {
|
|
4185
|
+
if (metadata.governance.planDecision !== "solo_handoff") return;
|
|
4186
|
+
if (!isActiveSoloHandoff(metadata) || metadata.soloExecution?.assignedSessionId !== session.sessionId || metadata.ownerActorId !== session.actorId) {
|
|
4187
|
+
throw new Error("MANCODE_SOLO_HANDOFF_NOT_ACTIVE");
|
|
4188
|
+
}
|
|
4189
|
+
}
|
|
4159
4190
|
|
|
4160
4191
|
// src/context/aggregate.ts
|
|
4161
4192
|
var DIGEST_PATTERN9 = /^sha256:[a-f0-9]{64}$/;
|
|
4193
|
+
function assertDiagnosticCompletionGate(input, context) {
|
|
4194
|
+
const { metadata, requirements, review, verification } = input;
|
|
4195
|
+
if (metadata.governance.requirementsStatus !== "ready" || requirements.status !== "confirmed" || !requirementsAreReady(requirements)) {
|
|
4196
|
+
throw new Error("task completion requires ready confirmed requirements");
|
|
4197
|
+
}
|
|
4198
|
+
assertVerificationLedgerRequirements(verification, requirements);
|
|
4199
|
+
assertVerificationLedgerAgainstContext(verification, {
|
|
4200
|
+
requirementsDigest: requirements.contentDigest,
|
|
4201
|
+
planVersion: metadata.governance.planVersion,
|
|
4202
|
+
remediationRound: review.remediationRound
|
|
4203
|
+
});
|
|
4204
|
+
if (context.diagnosticOutcome === "manual_test_required") {
|
|
4205
|
+
if (verification.status !== "manual_required") {
|
|
4206
|
+
throw new Error(
|
|
4207
|
+
"diagnostic completion requires current manual-required evidence"
|
|
4208
|
+
);
|
|
4209
|
+
}
|
|
4210
|
+
for (const check of verification.checks.filter((item) => item.required)) {
|
|
4211
|
+
for (const evidence of [check.automated, check.manual]) {
|
|
4212
|
+
if (evidence === null) continue;
|
|
4213
|
+
if (evidence.status !== "passed" && !(evidence.status === "manual_required" && evidence.summary?.trim())) {
|
|
4214
|
+
throw new Error("diagnostic completion has unresolved verification");
|
|
4215
|
+
}
|
|
4216
|
+
}
|
|
4217
|
+
}
|
|
4218
|
+
} else {
|
|
4219
|
+
if (context.diagnosticOutcome !== "fixed" && context.diagnosticOutcome !== "verified" && context.diagnosticOutcome !== "no_repro") {
|
|
4220
|
+
throw new Error("MANCODE_MANBA_OUTCOME_REQUIRED");
|
|
4221
|
+
}
|
|
4222
|
+
if (verification.status !== "passed") {
|
|
4223
|
+
throw new Error(
|
|
4224
|
+
"task completion requires current required acceptance evidence"
|
|
4225
|
+
);
|
|
4226
|
+
}
|
|
4227
|
+
}
|
|
4228
|
+
assertTaskCompletionContext(metadata, context);
|
|
4229
|
+
}
|
|
4162
4230
|
function buildTaskAggregateManifest(input) {
|
|
4163
4231
|
assertTaskAggregateConsistency(input);
|
|
4164
4232
|
const latestCheckpoint = input.latestCheckpoint;
|
|
@@ -4280,6 +4348,10 @@ function assertTaskCompletionGate(input, context) {
|
|
|
4280
4348
|
if (metadata.transitionState !== "stable") {
|
|
4281
4349
|
throw new Error("workflows with a pending operation cannot complete");
|
|
4282
4350
|
}
|
|
4351
|
+
if (metadata.workflowMode === "manba") {
|
|
4352
|
+
assertDiagnosticCompletionGate(input, context);
|
|
4353
|
+
return;
|
|
4354
|
+
}
|
|
4283
4355
|
if (metadata.governance.planDecision === null) {
|
|
4284
4356
|
throw new Error("task completion requires a plan decision");
|
|
4285
4357
|
}
|
|
@@ -4287,8 +4359,7 @@ function assertTaskCompletionGate(input, context) {
|
|
|
4287
4359
|
assertExecutableImplementationScope(metadata.implementationScope);
|
|
4288
4360
|
}
|
|
4289
4361
|
if (metadata.governance.planDecision === "solo_handoff") {
|
|
4290
|
-
assertSoloHandoffCompletionGate(input
|
|
4291
|
-
return;
|
|
4362
|
+
assertSoloHandoffCompletionGate(input);
|
|
4292
4363
|
}
|
|
4293
4364
|
if (metadata.soloExecution?.state === "active") {
|
|
4294
4365
|
throw new Error(
|
|
@@ -4320,15 +4391,11 @@ function assertTaskCompletionGate(input, context) {
|
|
|
4320
4391
|
}
|
|
4321
4392
|
assertTaskCompletionContext(metadata, context);
|
|
4322
4393
|
}
|
|
4323
|
-
function assertSoloHandoffCompletionGate(input
|
|
4324
|
-
const { metadata
|
|
4394
|
+
function assertSoloHandoffCompletionGate(input) {
|
|
4395
|
+
const { metadata } = input;
|
|
4325
4396
|
if (metadata.workflowMode !== "man" || metadata.coordination !== "single" || metadata.soloExecution?.state !== "completed" || metadata.soloExecution.planVersion !== metadata.governance.planVersion || input.planDigest === null) {
|
|
4326
4397
|
throw new Error("task completion solo handoff assignment is invalid");
|
|
4327
4398
|
}
|
|
4328
|
-
if (metadata.governance.requirementsStatus !== "ready" || requirements.status !== "confirmed" || !requirementsAreReady(requirements)) {
|
|
4329
|
-
throw new Error("task completion requires ready confirmed requirements");
|
|
4330
|
-
}
|
|
4331
|
-
assertTaskCompletionContext(metadata, context);
|
|
4332
4399
|
}
|
|
4333
4400
|
function assertRequirementsCache(metadata, requirements) {
|
|
4334
4401
|
if (metadata.governance.requirementsDigest !== requirements.contentDigest) {
|
|
@@ -5292,17 +5359,25 @@ function allowedHandoffTransitions(from) {
|
|
|
5292
5359
|
}
|
|
5293
5360
|
|
|
5294
5361
|
// src/context/confirmed-decision.ts
|
|
5295
|
-
import { lstat as
|
|
5362
|
+
import { lstat as lstat5, mkdir as mkdir4, readFile as readFile6, readdir as readdir5, writeFile as writeFile4 } from "fs/promises";
|
|
5296
5363
|
import path8 from "path";
|
|
5297
5364
|
|
|
5298
5365
|
// src/context/privacy-guard.ts
|
|
5299
|
-
import { lstat as
|
|
5366
|
+
import { lstat as lstat4, readdir as readdir4 } from "fs/promises";
|
|
5300
5367
|
import path7 from "path";
|
|
5301
5368
|
import { performance } from "perf_hooks";
|
|
5302
5369
|
|
|
5303
5370
|
// src/runtime/local-lock.ts
|
|
5304
|
-
import { createHash } from "crypto";
|
|
5305
|
-
import {
|
|
5371
|
+
import { createHash, randomUUID } from "crypto";
|
|
5372
|
+
import {
|
|
5373
|
+
link,
|
|
5374
|
+
lstat as lstat2,
|
|
5375
|
+
mkdir as mkdir2,
|
|
5376
|
+
readFile as readFile3,
|
|
5377
|
+
rename,
|
|
5378
|
+
rm,
|
|
5379
|
+
writeFile as writeFile2
|
|
5380
|
+
} from "fs/promises";
|
|
5306
5381
|
import path4 from "path";
|
|
5307
5382
|
var ENTITY_LOCK_KEY_PATTERN = /^[a-z][a-z0-9_-]*:[^\0/\\]+$/;
|
|
5308
5383
|
var DEFAULT_LOCK_LEASE_MS = 3e4;
|
|
@@ -5310,32 +5385,27 @@ var MINIMUM_LOCK_LEASE_MS = 1e3;
|
|
|
5310
5385
|
var MAXIMUM_LOCK_LEASE_MS = 5 * 6e4;
|
|
5311
5386
|
async function acquireLocalLock(store, input) {
|
|
5312
5387
|
const owner = createLockOwner(store, input);
|
|
5313
|
-
const
|
|
5388
|
+
const target = lockPath(store, owner.entityLockKey);
|
|
5314
5389
|
await mkdir2(lockDirectory(store), { recursive: true });
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5390
|
+
const temporary = temporaryOwnerPath(target);
|
|
5391
|
+
try {
|
|
5392
|
+
await writeOwnerFile(temporary, owner);
|
|
5393
|
+
let acquired = false;
|
|
5394
|
+
for (let attempt = 0; attempt < 3; attempt += 1) {
|
|
5395
|
+
try {
|
|
5396
|
+
await link(temporary, target);
|
|
5397
|
+
acquired = true;
|
|
5398
|
+
break;
|
|
5399
|
+
} catch (error) {
|
|
5400
|
+
if (!isAlreadyExists2(error)) throw error;
|
|
5401
|
+
if (!await reclaimExpiredDeadLock(store, owner.entityLockKey, owner)) {
|
|
5402
|
+
throw new Error("MANCODE_LOCK_HELD");
|
|
5403
|
+
}
|
|
5325
5404
|
}
|
|
5326
5405
|
}
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
await writeFile2(
|
|
5331
|
-
path4.join(directory, "owner.json"),
|
|
5332
|
-
`${JSON.stringify(owner, null, 2)}
|
|
5333
|
-
`,
|
|
5334
|
-
{ encoding: "utf8", flag: "wx" }
|
|
5335
|
-
);
|
|
5336
|
-
} catch (error) {
|
|
5337
|
-
await rm(directory, { recursive: true, force: true });
|
|
5338
|
-
throw error;
|
|
5406
|
+
if (!acquired) throw new Error("MANCODE_LOCK_HELD");
|
|
5407
|
+
} finally {
|
|
5408
|
+
await rm(temporary, { force: true }).catch(() => void 0);
|
|
5339
5409
|
}
|
|
5340
5410
|
let released = false;
|
|
5341
5411
|
let currentOwner = owner;
|
|
@@ -5352,7 +5422,7 @@ async function acquireLocalLock(store, input) {
|
|
|
5352
5422
|
if (!sameLockOwner(current, currentOwner)) {
|
|
5353
5423
|
throw new Error("MANCODE_LOCK_OWNERSHIP_LOST");
|
|
5354
5424
|
}
|
|
5355
|
-
await atomicWriteLockOwner(
|
|
5425
|
+
await atomicWriteLockOwner(target, next);
|
|
5356
5426
|
currentOwner = next;
|
|
5357
5427
|
},
|
|
5358
5428
|
async release() {
|
|
@@ -5361,7 +5431,7 @@ async function acquireLocalLock(store, input) {
|
|
|
5361
5431
|
if (!sameLockOwner(current, currentOwner)) {
|
|
5362
5432
|
throw new Error("MANCODE_LOCK_OWNERSHIP_LOST");
|
|
5363
5433
|
}
|
|
5364
|
-
await rm(
|
|
5434
|
+
await rm(target, { recursive: true, force: false });
|
|
5365
5435
|
released = true;
|
|
5366
5436
|
}
|
|
5367
5437
|
};
|
|
@@ -5432,15 +5502,30 @@ async function acquireOperationEntityLocks(operationId, targets, options = {}) {
|
|
|
5432
5502
|
async function readLocalLock(store, entityLockKey) {
|
|
5433
5503
|
assertEntityLockKey(entityLockKey);
|
|
5434
5504
|
try {
|
|
5435
|
-
const
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
|
|
5505
|
+
const target = lockPath(store, entityLockKey);
|
|
5506
|
+
for (let attempt = 0; attempt < 3; attempt += 1) {
|
|
5507
|
+
const entry = await lstat2(target);
|
|
5508
|
+
if (!entry.isFile() && !entry.isDirectory()) {
|
|
5509
|
+
throw new Error("MANCODE_LOCK_CORRUPT");
|
|
5510
|
+
}
|
|
5511
|
+
let raw;
|
|
5512
|
+
try {
|
|
5513
|
+
raw = await readFile3(
|
|
5514
|
+
entry.isDirectory() ? path4.join(target, "owner.json") : target,
|
|
5515
|
+
"utf8"
|
|
5516
|
+
);
|
|
5517
|
+
} catch (error) {
|
|
5518
|
+
const current = await lstat2(target);
|
|
5519
|
+
if (entry.isDirectory() !== current.isDirectory()) continue;
|
|
5520
|
+
throw error;
|
|
5521
|
+
}
|
|
5522
|
+
const owner = parseLocalLockOwner(JSON.parse(raw));
|
|
5523
|
+
if (owner.storeId !== store.storeId || owner.entityLockKey !== entityLockKey) {
|
|
5524
|
+
throw new Error("MANCODE_LOCK_CORRUPT");
|
|
5525
|
+
}
|
|
5526
|
+
return owner;
|
|
5442
5527
|
}
|
|
5443
|
-
|
|
5528
|
+
throw new Error("MANCODE_LOCK_HELD");
|
|
5444
5529
|
} catch (error) {
|
|
5445
5530
|
if (isNotFound3(error)) return null;
|
|
5446
5531
|
if (error instanceof SyntaxError) throw new Error("MANCODE_LOCK_CORRUPT");
|
|
@@ -5548,18 +5633,24 @@ function processIsAlive(processId) {
|
|
|
5548
5633
|
return !(typeof error === "object" && error !== null && "code" in error && error.code === "ESRCH");
|
|
5549
5634
|
}
|
|
5550
5635
|
}
|
|
5551
|
-
async function atomicWriteLockOwner(
|
|
5552
|
-
const
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5636
|
+
async function atomicWriteLockOwner(target, owner) {
|
|
5637
|
+
const temporary = temporaryOwnerPath(target);
|
|
5638
|
+
try {
|
|
5639
|
+
await writeOwnerFile(temporary, owner);
|
|
5640
|
+
await rename(temporary, target);
|
|
5641
|
+
} finally {
|
|
5642
|
+
await rm(temporary, { force: true }).catch(() => void 0);
|
|
5643
|
+
}
|
|
5644
|
+
}
|
|
5645
|
+
function temporaryOwnerPath(target) {
|
|
5646
|
+
return `${target}.pending.${process.pid}.${randomUUID()}`;
|
|
5647
|
+
}
|
|
5648
|
+
async function writeOwnerFile(target, owner) {
|
|
5649
|
+
await writeFile2(target, `${JSON.stringify(owner, null, 2)}
|
|
5558
5650
|
`, {
|
|
5559
5651
|
encoding: "utf8",
|
|
5560
5652
|
flag: "wx"
|
|
5561
5653
|
});
|
|
5562
|
-
await rename(temporary, target);
|
|
5563
5654
|
}
|
|
5564
5655
|
function parseLeaseMs(value) {
|
|
5565
5656
|
if (value === void 0) return DEFAULT_LOCK_LEASE_MS;
|
|
@@ -6585,7 +6676,7 @@ async function acquireProjectWriteBarrier(runtime, operationId, now) {
|
|
|
6585
6676
|
}
|
|
6586
6677
|
|
|
6587
6678
|
// src/context/privacy-policy.ts
|
|
6588
|
-
import { lstat as
|
|
6679
|
+
import { lstat as lstat3, readFile as readFile5, readdir as readdir3 } from "fs/promises";
|
|
6589
6680
|
import path6 from "path";
|
|
6590
6681
|
|
|
6591
6682
|
// src/context/manifest.ts
|
|
@@ -7073,7 +7164,7 @@ async function assertNoPendingPrivacyPolicyOperation(root) {
|
|
|
7073
7164
|
let entries;
|
|
7074
7165
|
try {
|
|
7075
7166
|
const directory = path6.join(root, ".mancode", relative);
|
|
7076
|
-
const stat2 = await
|
|
7167
|
+
const stat2 = await lstat3(directory);
|
|
7077
7168
|
if (!stat2.isDirectory() || stat2.isSymbolicLink())
|
|
7078
7169
|
throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
|
|
7079
7170
|
entries = await readdir3(directory);
|
|
@@ -7122,12 +7213,12 @@ async function readPrivacyPolicyStatus(root) {
|
|
|
7122
7213
|
async function readPrivacyAuthorityFile(root, relative) {
|
|
7123
7214
|
let current = path6.join(path6.resolve(root), ".mancode");
|
|
7124
7215
|
for (const part of relative.split("/")) {
|
|
7125
|
-
const parent = await
|
|
7216
|
+
const parent = await lstat3(current);
|
|
7126
7217
|
if (!parent.isDirectory() || parent.isSymbolicLink())
|
|
7127
7218
|
throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
|
|
7128
7219
|
current = path6.join(current, part);
|
|
7129
7220
|
}
|
|
7130
|
-
const stat2 = await
|
|
7221
|
+
const stat2 = await lstat3(current);
|
|
7131
7222
|
if (!stat2.isFile() || stat2.isSymbolicLink() || stat2.size > 8 * 1024 * 1024)
|
|
7132
7223
|
throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
|
|
7133
7224
|
return readFile5(current, "utf8");
|
|
@@ -7283,7 +7374,7 @@ function assertPrivacyRecoveryActionsAllowed(snapshot, actions) {
|
|
|
7283
7374
|
}
|
|
7284
7375
|
async function hasProjectAuthority(root) {
|
|
7285
7376
|
try {
|
|
7286
|
-
const stat2 = await
|
|
7377
|
+
const stat2 = await lstat4(path7.join(root, ".mancode", "schema.json"));
|
|
7287
7378
|
if (!stat2.isFile() || stat2.isSymbolicLink())
|
|
7288
7379
|
throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
|
|
7289
7380
|
return true;
|
|
@@ -7291,7 +7382,7 @@ async function hasProjectAuthority(root) {
|
|
|
7291
7382
|
if (error === null || typeof error !== "object" || !("code" in error) || error.code !== "ENOENT")
|
|
7292
7383
|
throw error;
|
|
7293
7384
|
try {
|
|
7294
|
-
await
|
|
7385
|
+
await lstat4(path7.join(root, ".mancode", "shared", "config.json"));
|
|
7295
7386
|
} catch (configError) {
|
|
7296
7387
|
if (configError !== null && typeof configError === "object" && "code" in configError && configError.code === "ENOENT")
|
|
7297
7388
|
return false;
|
|
@@ -7351,7 +7442,7 @@ async function scanPrivacyActivation(root, ruleIds) {
|
|
|
7351
7442
|
}
|
|
7352
7443
|
async function collectSharedFiles(root, relative) {
|
|
7353
7444
|
const target = path7.join(root, ".mancode", relative);
|
|
7354
|
-
const stat2 = await
|
|
7445
|
+
const stat2 = await lstat4(target);
|
|
7355
7446
|
if (!stat2.isDirectory() || stat2.isSymbolicLink())
|
|
7356
7447
|
throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
|
|
7357
7448
|
const files = [];
|
|
@@ -7579,7 +7670,7 @@ async function ensureSafeDirectory(projectRoot, directory) {
|
|
|
7579
7670
|
}
|
|
7580
7671
|
}
|
|
7581
7672
|
async function assertSafeDirectory(directory) {
|
|
7582
|
-
const stat2 = await
|
|
7673
|
+
const stat2 = await lstat5(directory);
|
|
7583
7674
|
if (!stat2.isDirectory() || stat2.isSymbolicLink()) {
|
|
7584
7675
|
throw new Error("MANCODE_CONTEXT_PATH_UNSAFE");
|
|
7585
7676
|
}
|
|
@@ -7587,13 +7678,13 @@ async function assertSafeDirectory(directory) {
|
|
|
7587
7678
|
async function readSafeText(directory, filename) {
|
|
7588
7679
|
await assertSafeDirectory(directory);
|
|
7589
7680
|
const target = path8.join(directory, filename);
|
|
7590
|
-
const before = await
|
|
7681
|
+
const before = await lstat5(target);
|
|
7591
7682
|
if (!before.isFile() || before.isSymbolicLink()) {
|
|
7592
7683
|
throw new Error("MANCODE_CONTEXT_PATH_UNSAFE");
|
|
7593
7684
|
}
|
|
7594
7685
|
const content = await readFile6(target, "utf8");
|
|
7595
7686
|
await assertSafeDirectory(directory);
|
|
7596
|
-
const after = await
|
|
7687
|
+
const after = await lstat5(target);
|
|
7597
7688
|
if (!after.isFile() || after.isSymbolicLink() || before.dev !== after.dev || before.ino !== after.ino) {
|
|
7598
7689
|
throw new Error("MANCODE_CONTEXT_PATH_UNSAFE");
|
|
7599
7690
|
}
|
|
@@ -8151,7 +8242,7 @@ function parseUlidOrNull9(value, label) {
|
|
|
8151
8242
|
}
|
|
8152
8243
|
|
|
8153
8244
|
// src/context/task-locator.ts
|
|
8154
|
-
import { lstat as
|
|
8245
|
+
import { lstat as lstat6, readFile as readFile9, realpath } from "fs/promises";
|
|
8155
8246
|
import path11 from "path";
|
|
8156
8247
|
async function locateTask(projectRoot, requested) {
|
|
8157
8248
|
const root = path11.resolve(projectRoot);
|
|
@@ -8198,7 +8289,7 @@ async function locateExplicitTask(projectRoot, taskRef) {
|
|
|
8198
8289
|
}
|
|
8199
8290
|
async function isDirectoryWithoutSymlink(target) {
|
|
8200
8291
|
try {
|
|
8201
|
-
const entry = await
|
|
8292
|
+
const entry = await lstat6(target);
|
|
8202
8293
|
return entry.isDirectory() && !entry.isSymbolicLink();
|
|
8203
8294
|
} catch {
|
|
8204
8295
|
return false;
|
|
@@ -8652,7 +8743,7 @@ async function readTextWithin(root, relativePath) {
|
|
|
8652
8743
|
await assertSafeDirectoryAt(current);
|
|
8653
8744
|
}
|
|
8654
8745
|
const target = path12.join(absoluteRoot, ...segments);
|
|
8655
|
-
const before = await
|
|
8746
|
+
const before = await lstat7(target);
|
|
8656
8747
|
if (!before.isFile() || before.isSymbolicLink()) {
|
|
8657
8748
|
throw new Error("MANCODE_CONTEXT_PATH_UNSAFE");
|
|
8658
8749
|
}
|
|
@@ -8661,7 +8752,7 @@ async function readTextWithin(root, relativePath) {
|
|
|
8661
8752
|
absoluteRoot,
|
|
8662
8753
|
parentSegments.length === 0 ? "." : path12.join(...parentSegments)
|
|
8663
8754
|
);
|
|
8664
|
-
const after = await
|
|
8755
|
+
const after = await lstat7(target);
|
|
8665
8756
|
if (!after.isFile() || after.isSymbolicLink() || before.dev !== after.dev || before.ino !== after.ino) {
|
|
8666
8757
|
throw new Error("MANCODE_CONTEXT_PATH_UNSAFE");
|
|
8667
8758
|
}
|
|
@@ -8688,7 +8779,7 @@ async function assertSafeDirectoryWithin(root, relativeDirectory) {
|
|
|
8688
8779
|
return current;
|
|
8689
8780
|
}
|
|
8690
8781
|
async function assertSafeDirectoryAt(target) {
|
|
8691
|
-
const stat2 = await
|
|
8782
|
+
const stat2 = await lstat7(target);
|
|
8692
8783
|
if (!stat2.isDirectory() || stat2.isSymbolicLink()) {
|
|
8693
8784
|
throw new Error("MANCODE_CONTEXT_PATH_UNSAFE");
|
|
8694
8785
|
}
|
|
@@ -8729,6 +8820,7 @@ export {
|
|
|
8729
8820
|
listGitRefWorkflowRepairJournalSummaries,
|
|
8730
8821
|
listUnfinishedGitRefWorkflowRepairs,
|
|
8731
8822
|
scanSharedText,
|
|
8823
|
+
redactSharedText,
|
|
8732
8824
|
assertSharedTextSafe,
|
|
8733
8825
|
assertSafeSharedRelativePath,
|
|
8734
8826
|
parseCapabilityLevel,
|
|
@@ -8775,6 +8867,8 @@ export {
|
|
|
8775
8867
|
workflowMetadataDigest,
|
|
8776
8868
|
assertWorkflowMetadataTransition,
|
|
8777
8869
|
assertParentWorkflowRelation,
|
|
8870
|
+
isActiveSoloHandoff,
|
|
8871
|
+
assertSoloHandoffSession,
|
|
8778
8872
|
buildTaskAggregateManifest,
|
|
8779
8873
|
taskAggregateDigest,
|
|
8780
8874
|
parseTaskAggregateManifest,
|
|
@@ -8836,4 +8930,4 @@ export {
|
|
|
8836
8930
|
V3ContextStore,
|
|
8837
8931
|
storedTaskAggregateDigest
|
|
8838
8932
|
};
|
|
8839
|
-
//# sourceMappingURL=chunk-
|
|
8933
|
+
//# sourceMappingURL=chunk-D5ABGAF4.js.map
|