pi-crew 0.10.4 → 0.10.5
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/CHANGELOG.md +40 -0
- package/dist/index.mjs +782 -784
- package/package.json +1 -1
- package/src/runtime/background-runner.ts +32 -7
- package/src/runtime/run-tracker.ts +9 -8
package/dist/index.mjs
CHANGED
|
@@ -7409,32 +7409,32 @@ function EscapeKey(key) {
|
|
|
7409
7409
|
function IsDefined2(value) {
|
|
7410
7410
|
return value !== void 0;
|
|
7411
7411
|
}
|
|
7412
|
-
function Create(errorType, schema,
|
|
7412
|
+
function Create(errorType, schema, path103, value, errors2 = []) {
|
|
7413
7413
|
return {
|
|
7414
7414
|
type: errorType,
|
|
7415
7415
|
schema,
|
|
7416
|
-
path:
|
|
7416
|
+
path: path103,
|
|
7417
7417
|
value,
|
|
7418
|
-
message: GetErrorFunction()({ errorType, path:
|
|
7418
|
+
message: GetErrorFunction()({ errorType, path: path103, schema, value, errors: errors2 }),
|
|
7419
7419
|
errors: errors2
|
|
7420
7420
|
};
|
|
7421
7421
|
}
|
|
7422
|
-
function* FromAny3(schema, references,
|
|
7422
|
+
function* FromAny3(schema, references, path103, value) {
|
|
7423
7423
|
}
|
|
7424
|
-
function* FromArgument3(schema, references,
|
|
7424
|
+
function* FromArgument3(schema, references, path103, value) {
|
|
7425
7425
|
}
|
|
7426
|
-
function* FromArray8(schema, references,
|
|
7426
|
+
function* FromArray8(schema, references, path103, value) {
|
|
7427
7427
|
if (!IsArray2(value)) {
|
|
7428
|
-
return yield Create(ValueErrorType.Array, schema,
|
|
7428
|
+
return yield Create(ValueErrorType.Array, schema, path103, value);
|
|
7429
7429
|
}
|
|
7430
7430
|
if (IsDefined2(schema.minItems) && !(value.length >= schema.minItems)) {
|
|
7431
|
-
yield Create(ValueErrorType.ArrayMinItems, schema,
|
|
7431
|
+
yield Create(ValueErrorType.ArrayMinItems, schema, path103, value);
|
|
7432
7432
|
}
|
|
7433
7433
|
if (IsDefined2(schema.maxItems) && !(value.length <= schema.maxItems)) {
|
|
7434
|
-
yield Create(ValueErrorType.ArrayMaxItems, schema,
|
|
7434
|
+
yield Create(ValueErrorType.ArrayMaxItems, schema, path103, value);
|
|
7435
7435
|
}
|
|
7436
7436
|
for (let i = 0; i < value.length; i++) {
|
|
7437
|
-
yield* Visit6(schema.items, references, `${
|
|
7437
|
+
yield* Visit6(schema.items, references, `${path103}/${i}`, value[i]);
|
|
7438
7438
|
}
|
|
7439
7439
|
if (schema.uniqueItems === true && !(function() {
|
|
7440
7440
|
const set = /* @__PURE__ */ new Set();
|
|
@@ -7448,116 +7448,116 @@ function* FromArray8(schema, references, path104, value) {
|
|
|
7448
7448
|
}
|
|
7449
7449
|
return true;
|
|
7450
7450
|
})()) {
|
|
7451
|
-
yield Create(ValueErrorType.ArrayUniqueItems, schema,
|
|
7451
|
+
yield Create(ValueErrorType.ArrayUniqueItems, schema, path103, value);
|
|
7452
7452
|
}
|
|
7453
7453
|
if (!(IsDefined2(schema.contains) || IsDefined2(schema.minContains) || IsDefined2(schema.maxContains))) {
|
|
7454
7454
|
return;
|
|
7455
7455
|
}
|
|
7456
7456
|
const containsSchema = IsDefined2(schema.contains) ? schema.contains : Never();
|
|
7457
|
-
const containsCount = value.reduce((acc, value2, index) => Visit6(containsSchema, references, `${
|
|
7457
|
+
const containsCount = value.reduce((acc, value2, index) => Visit6(containsSchema, references, `${path103}${index}`, value2).next().done === true ? acc + 1 : acc, 0);
|
|
7458
7458
|
if (containsCount === 0) {
|
|
7459
|
-
yield Create(ValueErrorType.ArrayContains, schema,
|
|
7459
|
+
yield Create(ValueErrorType.ArrayContains, schema, path103, value);
|
|
7460
7460
|
}
|
|
7461
7461
|
if (IsNumber2(schema.minContains) && containsCount < schema.minContains) {
|
|
7462
|
-
yield Create(ValueErrorType.ArrayMinContains, schema,
|
|
7462
|
+
yield Create(ValueErrorType.ArrayMinContains, schema, path103, value);
|
|
7463
7463
|
}
|
|
7464
7464
|
if (IsNumber2(schema.maxContains) && containsCount > schema.maxContains) {
|
|
7465
|
-
yield Create(ValueErrorType.ArrayMaxContains, schema,
|
|
7465
|
+
yield Create(ValueErrorType.ArrayMaxContains, schema, path103, value);
|
|
7466
7466
|
}
|
|
7467
7467
|
}
|
|
7468
|
-
function* FromAsyncIterator5(schema, references,
|
|
7468
|
+
function* FromAsyncIterator5(schema, references, path103, value) {
|
|
7469
7469
|
if (!IsAsyncIterator2(value))
|
|
7470
|
-
yield Create(ValueErrorType.AsyncIterator, schema,
|
|
7470
|
+
yield Create(ValueErrorType.AsyncIterator, schema, path103, value);
|
|
7471
7471
|
}
|
|
7472
|
-
function* FromBigInt3(schema, references,
|
|
7472
|
+
function* FromBigInt3(schema, references, path103, value) {
|
|
7473
7473
|
if (!IsBigInt2(value))
|
|
7474
|
-
return yield Create(ValueErrorType.BigInt, schema,
|
|
7474
|
+
return yield Create(ValueErrorType.BigInt, schema, path103, value);
|
|
7475
7475
|
if (IsDefined2(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) {
|
|
7476
|
-
yield Create(ValueErrorType.BigIntExclusiveMaximum, schema,
|
|
7476
|
+
yield Create(ValueErrorType.BigIntExclusiveMaximum, schema, path103, value);
|
|
7477
7477
|
}
|
|
7478
7478
|
if (IsDefined2(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) {
|
|
7479
|
-
yield Create(ValueErrorType.BigIntExclusiveMinimum, schema,
|
|
7479
|
+
yield Create(ValueErrorType.BigIntExclusiveMinimum, schema, path103, value);
|
|
7480
7480
|
}
|
|
7481
7481
|
if (IsDefined2(schema.maximum) && !(value <= schema.maximum)) {
|
|
7482
|
-
yield Create(ValueErrorType.BigIntMaximum, schema,
|
|
7482
|
+
yield Create(ValueErrorType.BigIntMaximum, schema, path103, value);
|
|
7483
7483
|
}
|
|
7484
7484
|
if (IsDefined2(schema.minimum) && !(value >= schema.minimum)) {
|
|
7485
|
-
yield Create(ValueErrorType.BigIntMinimum, schema,
|
|
7485
|
+
yield Create(ValueErrorType.BigIntMinimum, schema, path103, value);
|
|
7486
7486
|
}
|
|
7487
7487
|
if (IsDefined2(schema.multipleOf) && !(value % schema.multipleOf === BigInt(0))) {
|
|
7488
|
-
yield Create(ValueErrorType.BigIntMultipleOf, schema,
|
|
7488
|
+
yield Create(ValueErrorType.BigIntMultipleOf, schema, path103, value);
|
|
7489
7489
|
}
|
|
7490
7490
|
}
|
|
7491
|
-
function* FromBoolean3(schema, references,
|
|
7491
|
+
function* FromBoolean3(schema, references, path103, value) {
|
|
7492
7492
|
if (!IsBoolean2(value))
|
|
7493
|
-
yield Create(ValueErrorType.Boolean, schema,
|
|
7493
|
+
yield Create(ValueErrorType.Boolean, schema, path103, value);
|
|
7494
7494
|
}
|
|
7495
|
-
function* FromConstructor5(schema, references,
|
|
7496
|
-
yield* Visit6(schema.returns, references,
|
|
7495
|
+
function* FromConstructor5(schema, references, path103, value) {
|
|
7496
|
+
yield* Visit6(schema.returns, references, path103, value.prototype);
|
|
7497
7497
|
}
|
|
7498
|
-
function* FromDate3(schema, references,
|
|
7498
|
+
function* FromDate3(schema, references, path103, value) {
|
|
7499
7499
|
if (!IsDate2(value))
|
|
7500
|
-
return yield Create(ValueErrorType.Date, schema,
|
|
7500
|
+
return yield Create(ValueErrorType.Date, schema, path103, value);
|
|
7501
7501
|
if (IsDefined2(schema.exclusiveMaximumTimestamp) && !(value.getTime() < schema.exclusiveMaximumTimestamp)) {
|
|
7502
|
-
yield Create(ValueErrorType.DateExclusiveMaximumTimestamp, schema,
|
|
7502
|
+
yield Create(ValueErrorType.DateExclusiveMaximumTimestamp, schema, path103, value);
|
|
7503
7503
|
}
|
|
7504
7504
|
if (IsDefined2(schema.exclusiveMinimumTimestamp) && !(value.getTime() > schema.exclusiveMinimumTimestamp)) {
|
|
7505
|
-
yield Create(ValueErrorType.DateExclusiveMinimumTimestamp, schema,
|
|
7505
|
+
yield Create(ValueErrorType.DateExclusiveMinimumTimestamp, schema, path103, value);
|
|
7506
7506
|
}
|
|
7507
7507
|
if (IsDefined2(schema.maximumTimestamp) && !(value.getTime() <= schema.maximumTimestamp)) {
|
|
7508
|
-
yield Create(ValueErrorType.DateMaximumTimestamp, schema,
|
|
7508
|
+
yield Create(ValueErrorType.DateMaximumTimestamp, schema, path103, value);
|
|
7509
7509
|
}
|
|
7510
7510
|
if (IsDefined2(schema.minimumTimestamp) && !(value.getTime() >= schema.minimumTimestamp)) {
|
|
7511
|
-
yield Create(ValueErrorType.DateMinimumTimestamp, schema,
|
|
7511
|
+
yield Create(ValueErrorType.DateMinimumTimestamp, schema, path103, value);
|
|
7512
7512
|
}
|
|
7513
7513
|
if (IsDefined2(schema.multipleOfTimestamp) && !(value.getTime() % schema.multipleOfTimestamp === 0)) {
|
|
7514
|
-
yield Create(ValueErrorType.DateMultipleOfTimestamp, schema,
|
|
7514
|
+
yield Create(ValueErrorType.DateMultipleOfTimestamp, schema, path103, value);
|
|
7515
7515
|
}
|
|
7516
7516
|
}
|
|
7517
|
-
function* FromFunction5(schema, references,
|
|
7517
|
+
function* FromFunction5(schema, references, path103, value) {
|
|
7518
7518
|
if (!IsFunction2(value))
|
|
7519
|
-
yield Create(ValueErrorType.Function, schema,
|
|
7519
|
+
yield Create(ValueErrorType.Function, schema, path103, value);
|
|
7520
7520
|
}
|
|
7521
|
-
function* FromImport2(schema, references,
|
|
7521
|
+
function* FromImport2(schema, references, path103, value) {
|
|
7522
7522
|
const definitions = globalThis.Object.values(schema.$defs);
|
|
7523
7523
|
const target = schema.$defs[schema.$ref];
|
|
7524
|
-
yield* Visit6(target, [...references, ...definitions],
|
|
7524
|
+
yield* Visit6(target, [...references, ...definitions], path103, value);
|
|
7525
7525
|
}
|
|
7526
|
-
function* FromInteger3(schema, references,
|
|
7526
|
+
function* FromInteger3(schema, references, path103, value) {
|
|
7527
7527
|
if (!IsInteger(value))
|
|
7528
|
-
return yield Create(ValueErrorType.Integer, schema,
|
|
7528
|
+
return yield Create(ValueErrorType.Integer, schema, path103, value);
|
|
7529
7529
|
if (IsDefined2(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) {
|
|
7530
|
-
yield Create(ValueErrorType.IntegerExclusiveMaximum, schema,
|
|
7530
|
+
yield Create(ValueErrorType.IntegerExclusiveMaximum, schema, path103, value);
|
|
7531
7531
|
}
|
|
7532
7532
|
if (IsDefined2(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) {
|
|
7533
|
-
yield Create(ValueErrorType.IntegerExclusiveMinimum, schema,
|
|
7533
|
+
yield Create(ValueErrorType.IntegerExclusiveMinimum, schema, path103, value);
|
|
7534
7534
|
}
|
|
7535
7535
|
if (IsDefined2(schema.maximum) && !(value <= schema.maximum)) {
|
|
7536
|
-
yield Create(ValueErrorType.IntegerMaximum, schema,
|
|
7536
|
+
yield Create(ValueErrorType.IntegerMaximum, schema, path103, value);
|
|
7537
7537
|
}
|
|
7538
7538
|
if (IsDefined2(schema.minimum) && !(value >= schema.minimum)) {
|
|
7539
|
-
yield Create(ValueErrorType.IntegerMinimum, schema,
|
|
7539
|
+
yield Create(ValueErrorType.IntegerMinimum, schema, path103, value);
|
|
7540
7540
|
}
|
|
7541
7541
|
if (IsDefined2(schema.multipleOf) && !(value % schema.multipleOf === 0)) {
|
|
7542
|
-
yield Create(ValueErrorType.IntegerMultipleOf, schema,
|
|
7542
|
+
yield Create(ValueErrorType.IntegerMultipleOf, schema, path103, value);
|
|
7543
7543
|
}
|
|
7544
7544
|
}
|
|
7545
|
-
function* FromIntersect10(schema, references,
|
|
7545
|
+
function* FromIntersect10(schema, references, path103, value) {
|
|
7546
7546
|
let hasError = false;
|
|
7547
7547
|
for (const inner of schema.allOf) {
|
|
7548
|
-
for (const error of Visit6(inner, references,
|
|
7548
|
+
for (const error of Visit6(inner, references, path103, value)) {
|
|
7549
7549
|
hasError = true;
|
|
7550
7550
|
yield error;
|
|
7551
7551
|
}
|
|
7552
7552
|
}
|
|
7553
7553
|
if (hasError) {
|
|
7554
|
-
return yield Create(ValueErrorType.Intersect, schema,
|
|
7554
|
+
return yield Create(ValueErrorType.Intersect, schema, path103, value);
|
|
7555
7555
|
}
|
|
7556
7556
|
if (schema.unevaluatedProperties === false) {
|
|
7557
7557
|
const keyCheck = new RegExp(KeyOfPattern(schema));
|
|
7558
7558
|
for (const valueKey of Object.getOwnPropertyNames(value)) {
|
|
7559
7559
|
if (!keyCheck.test(valueKey)) {
|
|
7560
|
-
yield Create(ValueErrorType.IntersectUnevaluatedProperties, schema, `${
|
|
7560
|
+
yield Create(ValueErrorType.IntersectUnevaluatedProperties, schema, `${path103}/${valueKey}`, value);
|
|
7561
7561
|
}
|
|
7562
7562
|
}
|
|
7563
7563
|
}
|
|
@@ -7565,59 +7565,59 @@ function* FromIntersect10(schema, references, path104, value) {
|
|
|
7565
7565
|
const keyCheck = new RegExp(KeyOfPattern(schema));
|
|
7566
7566
|
for (const valueKey of Object.getOwnPropertyNames(value)) {
|
|
7567
7567
|
if (!keyCheck.test(valueKey)) {
|
|
7568
|
-
const next = Visit6(schema.unevaluatedProperties, references, `${
|
|
7568
|
+
const next = Visit6(schema.unevaluatedProperties, references, `${path103}/${valueKey}`, value[valueKey]).next();
|
|
7569
7569
|
if (!next.done)
|
|
7570
7570
|
yield next.value;
|
|
7571
7571
|
}
|
|
7572
7572
|
}
|
|
7573
7573
|
}
|
|
7574
7574
|
}
|
|
7575
|
-
function* FromIterator5(schema, references,
|
|
7575
|
+
function* FromIterator5(schema, references, path103, value) {
|
|
7576
7576
|
if (!IsIterator2(value))
|
|
7577
|
-
yield Create(ValueErrorType.Iterator, schema,
|
|
7577
|
+
yield Create(ValueErrorType.Iterator, schema, path103, value);
|
|
7578
7578
|
}
|
|
7579
|
-
function* FromLiteral4(schema, references,
|
|
7579
|
+
function* FromLiteral4(schema, references, path103, value) {
|
|
7580
7580
|
if (!(value === schema.const))
|
|
7581
|
-
yield Create(ValueErrorType.Literal, schema,
|
|
7581
|
+
yield Create(ValueErrorType.Literal, schema, path103, value);
|
|
7582
7582
|
}
|
|
7583
|
-
function* FromNever3(schema, references,
|
|
7584
|
-
yield Create(ValueErrorType.Never, schema,
|
|
7583
|
+
function* FromNever3(schema, references, path103, value) {
|
|
7584
|
+
yield Create(ValueErrorType.Never, schema, path103, value);
|
|
7585
7585
|
}
|
|
7586
|
-
function* FromNot3(schema, references,
|
|
7587
|
-
if (Visit6(schema.not, references,
|
|
7588
|
-
yield Create(ValueErrorType.Not, schema,
|
|
7586
|
+
function* FromNot3(schema, references, path103, value) {
|
|
7587
|
+
if (Visit6(schema.not, references, path103, value).next().done === true)
|
|
7588
|
+
yield Create(ValueErrorType.Not, schema, path103, value);
|
|
7589
7589
|
}
|
|
7590
|
-
function* FromNull3(schema, references,
|
|
7590
|
+
function* FromNull3(schema, references, path103, value) {
|
|
7591
7591
|
if (!IsNull2(value))
|
|
7592
|
-
yield Create(ValueErrorType.Null, schema,
|
|
7592
|
+
yield Create(ValueErrorType.Null, schema, path103, value);
|
|
7593
7593
|
}
|
|
7594
|
-
function* FromNumber3(schema, references,
|
|
7594
|
+
function* FromNumber3(schema, references, path103, value) {
|
|
7595
7595
|
if (!TypeSystemPolicy.IsNumberLike(value))
|
|
7596
|
-
return yield Create(ValueErrorType.Number, schema,
|
|
7596
|
+
return yield Create(ValueErrorType.Number, schema, path103, value);
|
|
7597
7597
|
if (IsDefined2(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) {
|
|
7598
|
-
yield Create(ValueErrorType.NumberExclusiveMaximum, schema,
|
|
7598
|
+
yield Create(ValueErrorType.NumberExclusiveMaximum, schema, path103, value);
|
|
7599
7599
|
}
|
|
7600
7600
|
if (IsDefined2(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) {
|
|
7601
|
-
yield Create(ValueErrorType.NumberExclusiveMinimum, schema,
|
|
7601
|
+
yield Create(ValueErrorType.NumberExclusiveMinimum, schema, path103, value);
|
|
7602
7602
|
}
|
|
7603
7603
|
if (IsDefined2(schema.maximum) && !(value <= schema.maximum)) {
|
|
7604
|
-
yield Create(ValueErrorType.NumberMaximum, schema,
|
|
7604
|
+
yield Create(ValueErrorType.NumberMaximum, schema, path103, value);
|
|
7605
7605
|
}
|
|
7606
7606
|
if (IsDefined2(schema.minimum) && !(value >= schema.minimum)) {
|
|
7607
|
-
yield Create(ValueErrorType.NumberMinimum, schema,
|
|
7607
|
+
yield Create(ValueErrorType.NumberMinimum, schema, path103, value);
|
|
7608
7608
|
}
|
|
7609
7609
|
if (IsDefined2(schema.multipleOf) && !(value % schema.multipleOf === 0)) {
|
|
7610
|
-
yield Create(ValueErrorType.NumberMultipleOf, schema,
|
|
7610
|
+
yield Create(ValueErrorType.NumberMultipleOf, schema, path103, value);
|
|
7611
7611
|
}
|
|
7612
7612
|
}
|
|
7613
|
-
function* FromObject9(schema, references,
|
|
7613
|
+
function* FromObject9(schema, references, path103, value) {
|
|
7614
7614
|
if (!TypeSystemPolicy.IsObjectLike(value))
|
|
7615
|
-
return yield Create(ValueErrorType.Object, schema,
|
|
7615
|
+
return yield Create(ValueErrorType.Object, schema, path103, value);
|
|
7616
7616
|
if (IsDefined2(schema.minProperties) && !(Object.getOwnPropertyNames(value).length >= schema.minProperties)) {
|
|
7617
|
-
yield Create(ValueErrorType.ObjectMinProperties, schema,
|
|
7617
|
+
yield Create(ValueErrorType.ObjectMinProperties, schema, path103, value);
|
|
7618
7618
|
}
|
|
7619
7619
|
if (IsDefined2(schema.maxProperties) && !(Object.getOwnPropertyNames(value).length <= schema.maxProperties)) {
|
|
7620
|
-
yield Create(ValueErrorType.ObjectMaxProperties, schema,
|
|
7620
|
+
yield Create(ValueErrorType.ObjectMaxProperties, schema, path103, value);
|
|
7621
7621
|
}
|
|
7622
7622
|
const requiredKeys = Array.isArray(schema.required) ? schema.required : [];
|
|
7623
7623
|
const knownKeys = Object.getOwnPropertyNames(schema.properties);
|
|
@@ -7625,12 +7625,12 @@ function* FromObject9(schema, references, path104, value) {
|
|
|
7625
7625
|
for (const requiredKey of requiredKeys) {
|
|
7626
7626
|
if (unknownKeys.includes(requiredKey))
|
|
7627
7627
|
continue;
|
|
7628
|
-
yield Create(ValueErrorType.ObjectRequiredProperty, schema.properties[requiredKey], `${
|
|
7628
|
+
yield Create(ValueErrorType.ObjectRequiredProperty, schema.properties[requiredKey], `${path103}/${EscapeKey(requiredKey)}`, void 0);
|
|
7629
7629
|
}
|
|
7630
7630
|
if (schema.additionalProperties === false) {
|
|
7631
7631
|
for (const valueKey of unknownKeys) {
|
|
7632
7632
|
if (!knownKeys.includes(valueKey)) {
|
|
7633
|
-
yield Create(ValueErrorType.ObjectAdditionalProperties, schema, `${
|
|
7633
|
+
yield Create(ValueErrorType.ObjectAdditionalProperties, schema, `${path103}/${EscapeKey(valueKey)}`, value[valueKey]);
|
|
7634
7634
|
}
|
|
7635
7635
|
}
|
|
7636
7636
|
}
|
|
@@ -7638,235 +7638,235 @@ function* FromObject9(schema, references, path104, value) {
|
|
|
7638
7638
|
for (const valueKey of unknownKeys) {
|
|
7639
7639
|
if (knownKeys.includes(valueKey))
|
|
7640
7640
|
continue;
|
|
7641
|
-
yield* Visit6(schema.additionalProperties, references, `${
|
|
7641
|
+
yield* Visit6(schema.additionalProperties, references, `${path103}/${EscapeKey(valueKey)}`, value[valueKey]);
|
|
7642
7642
|
}
|
|
7643
7643
|
}
|
|
7644
7644
|
for (const knownKey of knownKeys) {
|
|
7645
7645
|
const property = schema.properties[knownKey];
|
|
7646
7646
|
if (schema.required && schema.required.includes(knownKey)) {
|
|
7647
|
-
yield* Visit6(property, references, `${
|
|
7647
|
+
yield* Visit6(property, references, `${path103}/${EscapeKey(knownKey)}`, value[knownKey]);
|
|
7648
7648
|
if (ExtendsUndefinedCheck(schema) && !(knownKey in value)) {
|
|
7649
|
-
yield Create(ValueErrorType.ObjectRequiredProperty, property, `${
|
|
7649
|
+
yield Create(ValueErrorType.ObjectRequiredProperty, property, `${path103}/${EscapeKey(knownKey)}`, void 0);
|
|
7650
7650
|
}
|
|
7651
7651
|
} else {
|
|
7652
7652
|
if (TypeSystemPolicy.IsExactOptionalProperty(value, knownKey)) {
|
|
7653
|
-
yield* Visit6(property, references, `${
|
|
7653
|
+
yield* Visit6(property, references, `${path103}/${EscapeKey(knownKey)}`, value[knownKey]);
|
|
7654
7654
|
}
|
|
7655
7655
|
}
|
|
7656
7656
|
}
|
|
7657
7657
|
}
|
|
7658
|
-
function* FromPromise5(schema, references,
|
|
7658
|
+
function* FromPromise5(schema, references, path103, value) {
|
|
7659
7659
|
if (!IsPromise(value))
|
|
7660
|
-
yield Create(ValueErrorType.Promise, schema,
|
|
7660
|
+
yield Create(ValueErrorType.Promise, schema, path103, value);
|
|
7661
7661
|
}
|
|
7662
|
-
function* FromRecord5(schema, references,
|
|
7662
|
+
function* FromRecord5(schema, references, path103, value) {
|
|
7663
7663
|
if (!TypeSystemPolicy.IsRecordLike(value))
|
|
7664
|
-
return yield Create(ValueErrorType.Object, schema,
|
|
7664
|
+
return yield Create(ValueErrorType.Object, schema, path103, value);
|
|
7665
7665
|
if (IsDefined2(schema.minProperties) && !(Object.getOwnPropertyNames(value).length >= schema.minProperties)) {
|
|
7666
|
-
yield Create(ValueErrorType.ObjectMinProperties, schema,
|
|
7666
|
+
yield Create(ValueErrorType.ObjectMinProperties, schema, path103, value);
|
|
7667
7667
|
}
|
|
7668
7668
|
if (IsDefined2(schema.maxProperties) && !(Object.getOwnPropertyNames(value).length <= schema.maxProperties)) {
|
|
7669
|
-
yield Create(ValueErrorType.ObjectMaxProperties, schema,
|
|
7669
|
+
yield Create(ValueErrorType.ObjectMaxProperties, schema, path103, value);
|
|
7670
7670
|
}
|
|
7671
7671
|
const [patternKey, patternSchema] = Object.entries(schema.patternProperties)[0];
|
|
7672
7672
|
const regex = new RegExp(patternKey);
|
|
7673
7673
|
for (const [propertyKey, propertyValue] of Object.entries(value)) {
|
|
7674
7674
|
if (regex.test(propertyKey))
|
|
7675
|
-
yield* Visit6(patternSchema, references, `${
|
|
7675
|
+
yield* Visit6(patternSchema, references, `${path103}/${EscapeKey(propertyKey)}`, propertyValue);
|
|
7676
7676
|
}
|
|
7677
7677
|
if (typeof schema.additionalProperties === "object") {
|
|
7678
7678
|
for (const [propertyKey, propertyValue] of Object.entries(value)) {
|
|
7679
7679
|
if (!regex.test(propertyKey))
|
|
7680
|
-
yield* Visit6(schema.additionalProperties, references, `${
|
|
7680
|
+
yield* Visit6(schema.additionalProperties, references, `${path103}/${EscapeKey(propertyKey)}`, propertyValue);
|
|
7681
7681
|
}
|
|
7682
7682
|
}
|
|
7683
7683
|
if (schema.additionalProperties === false) {
|
|
7684
7684
|
for (const [propertyKey, propertyValue] of Object.entries(value)) {
|
|
7685
7685
|
if (regex.test(propertyKey))
|
|
7686
7686
|
continue;
|
|
7687
|
-
return yield Create(ValueErrorType.ObjectAdditionalProperties, schema, `${
|
|
7687
|
+
return yield Create(ValueErrorType.ObjectAdditionalProperties, schema, `${path103}/${EscapeKey(propertyKey)}`, propertyValue);
|
|
7688
7688
|
}
|
|
7689
7689
|
}
|
|
7690
7690
|
}
|
|
7691
|
-
function* FromRef6(schema, references,
|
|
7692
|
-
yield* Visit6(Deref(schema, references), references,
|
|
7691
|
+
function* FromRef6(schema, references, path103, value) {
|
|
7692
|
+
yield* Visit6(Deref(schema, references), references, path103, value);
|
|
7693
7693
|
}
|
|
7694
|
-
function* FromRegExp3(schema, references,
|
|
7694
|
+
function* FromRegExp3(schema, references, path103, value) {
|
|
7695
7695
|
if (!IsString2(value))
|
|
7696
|
-
return yield Create(ValueErrorType.String, schema,
|
|
7696
|
+
return yield Create(ValueErrorType.String, schema, path103, value);
|
|
7697
7697
|
if (IsDefined2(schema.minLength) && !(value.length >= schema.minLength)) {
|
|
7698
|
-
yield Create(ValueErrorType.StringMinLength, schema,
|
|
7698
|
+
yield Create(ValueErrorType.StringMinLength, schema, path103, value);
|
|
7699
7699
|
}
|
|
7700
7700
|
if (IsDefined2(schema.maxLength) && !(value.length <= schema.maxLength)) {
|
|
7701
|
-
yield Create(ValueErrorType.StringMaxLength, schema,
|
|
7701
|
+
yield Create(ValueErrorType.StringMaxLength, schema, path103, value);
|
|
7702
7702
|
}
|
|
7703
7703
|
const regex = new RegExp(schema.source, schema.flags);
|
|
7704
7704
|
if (!regex.test(value)) {
|
|
7705
|
-
return yield Create(ValueErrorType.RegExp, schema,
|
|
7705
|
+
return yield Create(ValueErrorType.RegExp, schema, path103, value);
|
|
7706
7706
|
}
|
|
7707
7707
|
}
|
|
7708
|
-
function* FromString3(schema, references,
|
|
7708
|
+
function* FromString3(schema, references, path103, value) {
|
|
7709
7709
|
if (!IsString2(value))
|
|
7710
|
-
return yield Create(ValueErrorType.String, schema,
|
|
7710
|
+
return yield Create(ValueErrorType.String, schema, path103, value);
|
|
7711
7711
|
if (IsDefined2(schema.minLength) && !(value.length >= schema.minLength)) {
|
|
7712
|
-
yield Create(ValueErrorType.StringMinLength, schema,
|
|
7712
|
+
yield Create(ValueErrorType.StringMinLength, schema, path103, value);
|
|
7713
7713
|
}
|
|
7714
7714
|
if (IsDefined2(schema.maxLength) && !(value.length <= schema.maxLength)) {
|
|
7715
|
-
yield Create(ValueErrorType.StringMaxLength, schema,
|
|
7715
|
+
yield Create(ValueErrorType.StringMaxLength, schema, path103, value);
|
|
7716
7716
|
}
|
|
7717
7717
|
if (IsString2(schema.pattern)) {
|
|
7718
7718
|
const regex = new RegExp(schema.pattern);
|
|
7719
7719
|
if (!regex.test(value)) {
|
|
7720
|
-
yield Create(ValueErrorType.StringPattern, schema,
|
|
7720
|
+
yield Create(ValueErrorType.StringPattern, schema, path103, value);
|
|
7721
7721
|
}
|
|
7722
7722
|
}
|
|
7723
7723
|
if (IsString2(schema.format)) {
|
|
7724
7724
|
if (!format_exports.Has(schema.format)) {
|
|
7725
|
-
yield Create(ValueErrorType.StringFormatUnknown, schema,
|
|
7725
|
+
yield Create(ValueErrorType.StringFormatUnknown, schema, path103, value);
|
|
7726
7726
|
} else {
|
|
7727
7727
|
const format2 = format_exports.Get(schema.format);
|
|
7728
7728
|
if (!format2(value)) {
|
|
7729
|
-
yield Create(ValueErrorType.StringFormat, schema,
|
|
7729
|
+
yield Create(ValueErrorType.StringFormat, schema, path103, value);
|
|
7730
7730
|
}
|
|
7731
7731
|
}
|
|
7732
7732
|
}
|
|
7733
7733
|
}
|
|
7734
|
-
function* FromSymbol3(schema, references,
|
|
7734
|
+
function* FromSymbol3(schema, references, path103, value) {
|
|
7735
7735
|
if (!IsSymbol2(value))
|
|
7736
|
-
yield Create(ValueErrorType.Symbol, schema,
|
|
7736
|
+
yield Create(ValueErrorType.Symbol, schema, path103, value);
|
|
7737
7737
|
}
|
|
7738
|
-
function* FromTemplateLiteral5(schema, references,
|
|
7738
|
+
function* FromTemplateLiteral5(schema, references, path103, value) {
|
|
7739
7739
|
if (!IsString2(value))
|
|
7740
|
-
return yield Create(ValueErrorType.String, schema,
|
|
7740
|
+
return yield Create(ValueErrorType.String, schema, path103, value);
|
|
7741
7741
|
const regex = new RegExp(schema.pattern);
|
|
7742
7742
|
if (!regex.test(value)) {
|
|
7743
|
-
yield Create(ValueErrorType.StringPattern, schema,
|
|
7743
|
+
yield Create(ValueErrorType.StringPattern, schema, path103, value);
|
|
7744
7744
|
}
|
|
7745
7745
|
}
|
|
7746
|
-
function* FromThis2(schema, references,
|
|
7747
|
-
yield* Visit6(Deref(schema, references), references,
|
|
7746
|
+
function* FromThis2(schema, references, path103, value) {
|
|
7747
|
+
yield* Visit6(Deref(schema, references), references, path103, value);
|
|
7748
7748
|
}
|
|
7749
|
-
function* FromTuple7(schema, references,
|
|
7749
|
+
function* FromTuple7(schema, references, path103, value) {
|
|
7750
7750
|
if (!IsArray2(value))
|
|
7751
|
-
return yield Create(ValueErrorType.Tuple, schema,
|
|
7751
|
+
return yield Create(ValueErrorType.Tuple, schema, path103, value);
|
|
7752
7752
|
if (schema.items === void 0 && !(value.length === 0)) {
|
|
7753
|
-
return yield Create(ValueErrorType.TupleLength, schema,
|
|
7753
|
+
return yield Create(ValueErrorType.TupleLength, schema, path103, value);
|
|
7754
7754
|
}
|
|
7755
7755
|
if (!(value.length === schema.maxItems)) {
|
|
7756
|
-
return yield Create(ValueErrorType.TupleLength, schema,
|
|
7756
|
+
return yield Create(ValueErrorType.TupleLength, schema, path103, value);
|
|
7757
7757
|
}
|
|
7758
7758
|
if (!schema.items) {
|
|
7759
7759
|
return;
|
|
7760
7760
|
}
|
|
7761
7761
|
for (let i = 0; i < schema.items.length; i++) {
|
|
7762
|
-
yield* Visit6(schema.items[i], references, `${
|
|
7762
|
+
yield* Visit6(schema.items[i], references, `${path103}/${i}`, value[i]);
|
|
7763
7763
|
}
|
|
7764
7764
|
}
|
|
7765
|
-
function* FromUndefined3(schema, references,
|
|
7765
|
+
function* FromUndefined3(schema, references, path103, value) {
|
|
7766
7766
|
if (!IsUndefined2(value))
|
|
7767
|
-
yield Create(ValueErrorType.Undefined, schema,
|
|
7767
|
+
yield Create(ValueErrorType.Undefined, schema, path103, value);
|
|
7768
7768
|
}
|
|
7769
|
-
function* FromUnion12(schema, references,
|
|
7769
|
+
function* FromUnion12(schema, references, path103, value) {
|
|
7770
7770
|
if (Check(schema, references, value))
|
|
7771
7771
|
return;
|
|
7772
|
-
const errors2 = schema.anyOf.map((variant) => new ValueErrorIterator(Visit6(variant, references,
|
|
7773
|
-
yield Create(ValueErrorType.Union, schema,
|
|
7772
|
+
const errors2 = schema.anyOf.map((variant) => new ValueErrorIterator(Visit6(variant, references, path103, value)));
|
|
7773
|
+
yield Create(ValueErrorType.Union, schema, path103, value, errors2);
|
|
7774
7774
|
}
|
|
7775
|
-
function* FromUint8Array3(schema, references,
|
|
7775
|
+
function* FromUint8Array3(schema, references, path103, value) {
|
|
7776
7776
|
if (!IsUint8Array2(value))
|
|
7777
|
-
return yield Create(ValueErrorType.Uint8Array, schema,
|
|
7777
|
+
return yield Create(ValueErrorType.Uint8Array, schema, path103, value);
|
|
7778
7778
|
if (IsDefined2(schema.maxByteLength) && !(value.length <= schema.maxByteLength)) {
|
|
7779
|
-
yield Create(ValueErrorType.Uint8ArrayMaxByteLength, schema,
|
|
7779
|
+
yield Create(ValueErrorType.Uint8ArrayMaxByteLength, schema, path103, value);
|
|
7780
7780
|
}
|
|
7781
7781
|
if (IsDefined2(schema.minByteLength) && !(value.length >= schema.minByteLength)) {
|
|
7782
|
-
yield Create(ValueErrorType.Uint8ArrayMinByteLength, schema,
|
|
7782
|
+
yield Create(ValueErrorType.Uint8ArrayMinByteLength, schema, path103, value);
|
|
7783
7783
|
}
|
|
7784
7784
|
}
|
|
7785
|
-
function* FromUnknown3(schema, references,
|
|
7785
|
+
function* FromUnknown3(schema, references, path103, value) {
|
|
7786
7786
|
}
|
|
7787
|
-
function* FromVoid3(schema, references,
|
|
7787
|
+
function* FromVoid3(schema, references, path103, value) {
|
|
7788
7788
|
if (!TypeSystemPolicy.IsVoidLike(value))
|
|
7789
|
-
yield Create(ValueErrorType.Void, schema,
|
|
7789
|
+
yield Create(ValueErrorType.Void, schema, path103, value);
|
|
7790
7790
|
}
|
|
7791
|
-
function* FromKind2(schema, references,
|
|
7791
|
+
function* FromKind2(schema, references, path103, value) {
|
|
7792
7792
|
const check = type_exports2.Get(schema[Kind]);
|
|
7793
7793
|
if (!check(schema, value))
|
|
7794
|
-
yield Create(ValueErrorType.Kind, schema,
|
|
7794
|
+
yield Create(ValueErrorType.Kind, schema, path103, value);
|
|
7795
7795
|
}
|
|
7796
|
-
function* Visit6(schema, references,
|
|
7796
|
+
function* Visit6(schema, references, path103, value) {
|
|
7797
7797
|
const references_ = IsDefined2(schema.$id) ? [...references, schema] : references;
|
|
7798
7798
|
const schema_ = schema;
|
|
7799
7799
|
switch (schema_[Kind]) {
|
|
7800
7800
|
case "Any":
|
|
7801
|
-
return yield* FromAny3(schema_, references_,
|
|
7801
|
+
return yield* FromAny3(schema_, references_, path103, value);
|
|
7802
7802
|
case "Argument":
|
|
7803
|
-
return yield* FromArgument3(schema_, references_,
|
|
7803
|
+
return yield* FromArgument3(schema_, references_, path103, value);
|
|
7804
7804
|
case "Array":
|
|
7805
|
-
return yield* FromArray8(schema_, references_,
|
|
7805
|
+
return yield* FromArray8(schema_, references_, path103, value);
|
|
7806
7806
|
case "AsyncIterator":
|
|
7807
|
-
return yield* FromAsyncIterator5(schema_, references_,
|
|
7807
|
+
return yield* FromAsyncIterator5(schema_, references_, path103, value);
|
|
7808
7808
|
case "BigInt":
|
|
7809
|
-
return yield* FromBigInt3(schema_, references_,
|
|
7809
|
+
return yield* FromBigInt3(schema_, references_, path103, value);
|
|
7810
7810
|
case "Boolean":
|
|
7811
|
-
return yield* FromBoolean3(schema_, references_,
|
|
7811
|
+
return yield* FromBoolean3(schema_, references_, path103, value);
|
|
7812
7812
|
case "Constructor":
|
|
7813
|
-
return yield* FromConstructor5(schema_, references_,
|
|
7813
|
+
return yield* FromConstructor5(schema_, references_, path103, value);
|
|
7814
7814
|
case "Date":
|
|
7815
|
-
return yield* FromDate3(schema_, references_,
|
|
7815
|
+
return yield* FromDate3(schema_, references_, path103, value);
|
|
7816
7816
|
case "Function":
|
|
7817
|
-
return yield* FromFunction5(schema_, references_,
|
|
7817
|
+
return yield* FromFunction5(schema_, references_, path103, value);
|
|
7818
7818
|
case "Import":
|
|
7819
|
-
return yield* FromImport2(schema_, references_,
|
|
7819
|
+
return yield* FromImport2(schema_, references_, path103, value);
|
|
7820
7820
|
case "Integer":
|
|
7821
|
-
return yield* FromInteger3(schema_, references_,
|
|
7821
|
+
return yield* FromInteger3(schema_, references_, path103, value);
|
|
7822
7822
|
case "Intersect":
|
|
7823
|
-
return yield* FromIntersect10(schema_, references_,
|
|
7823
|
+
return yield* FromIntersect10(schema_, references_, path103, value);
|
|
7824
7824
|
case "Iterator":
|
|
7825
|
-
return yield* FromIterator5(schema_, references_,
|
|
7825
|
+
return yield* FromIterator5(schema_, references_, path103, value);
|
|
7826
7826
|
case "Literal":
|
|
7827
|
-
return yield* FromLiteral4(schema_, references_,
|
|
7827
|
+
return yield* FromLiteral4(schema_, references_, path103, value);
|
|
7828
7828
|
case "Never":
|
|
7829
|
-
return yield* FromNever3(schema_, references_,
|
|
7829
|
+
return yield* FromNever3(schema_, references_, path103, value);
|
|
7830
7830
|
case "Not":
|
|
7831
|
-
return yield* FromNot3(schema_, references_,
|
|
7831
|
+
return yield* FromNot3(schema_, references_, path103, value);
|
|
7832
7832
|
case "Null":
|
|
7833
|
-
return yield* FromNull3(schema_, references_,
|
|
7833
|
+
return yield* FromNull3(schema_, references_, path103, value);
|
|
7834
7834
|
case "Number":
|
|
7835
|
-
return yield* FromNumber3(schema_, references_,
|
|
7835
|
+
return yield* FromNumber3(schema_, references_, path103, value);
|
|
7836
7836
|
case "Object":
|
|
7837
|
-
return yield* FromObject9(schema_, references_,
|
|
7837
|
+
return yield* FromObject9(schema_, references_, path103, value);
|
|
7838
7838
|
case "Promise":
|
|
7839
|
-
return yield* FromPromise5(schema_, references_,
|
|
7839
|
+
return yield* FromPromise5(schema_, references_, path103, value);
|
|
7840
7840
|
case "Record":
|
|
7841
|
-
return yield* FromRecord5(schema_, references_,
|
|
7841
|
+
return yield* FromRecord5(schema_, references_, path103, value);
|
|
7842
7842
|
case "Ref":
|
|
7843
|
-
return yield* FromRef6(schema_, references_,
|
|
7843
|
+
return yield* FromRef6(schema_, references_, path103, value);
|
|
7844
7844
|
case "RegExp":
|
|
7845
|
-
return yield* FromRegExp3(schema_, references_,
|
|
7845
|
+
return yield* FromRegExp3(schema_, references_, path103, value);
|
|
7846
7846
|
case "String":
|
|
7847
|
-
return yield* FromString3(schema_, references_,
|
|
7847
|
+
return yield* FromString3(schema_, references_, path103, value);
|
|
7848
7848
|
case "Symbol":
|
|
7849
|
-
return yield* FromSymbol3(schema_, references_,
|
|
7849
|
+
return yield* FromSymbol3(schema_, references_, path103, value);
|
|
7850
7850
|
case "TemplateLiteral":
|
|
7851
|
-
return yield* FromTemplateLiteral5(schema_, references_,
|
|
7851
|
+
return yield* FromTemplateLiteral5(schema_, references_, path103, value);
|
|
7852
7852
|
case "This":
|
|
7853
|
-
return yield* FromThis2(schema_, references_,
|
|
7853
|
+
return yield* FromThis2(schema_, references_, path103, value);
|
|
7854
7854
|
case "Tuple":
|
|
7855
|
-
return yield* FromTuple7(schema_, references_,
|
|
7855
|
+
return yield* FromTuple7(schema_, references_, path103, value);
|
|
7856
7856
|
case "Undefined":
|
|
7857
|
-
return yield* FromUndefined3(schema_, references_,
|
|
7857
|
+
return yield* FromUndefined3(schema_, references_, path103, value);
|
|
7858
7858
|
case "Union":
|
|
7859
|
-
return yield* FromUnion12(schema_, references_,
|
|
7859
|
+
return yield* FromUnion12(schema_, references_, path103, value);
|
|
7860
7860
|
case "Uint8Array":
|
|
7861
|
-
return yield* FromUint8Array3(schema_, references_,
|
|
7861
|
+
return yield* FromUint8Array3(schema_, references_, path103, value);
|
|
7862
7862
|
case "Unknown":
|
|
7863
|
-
return yield* FromUnknown3(schema_, references_,
|
|
7863
|
+
return yield* FromUnknown3(schema_, references_, path103, value);
|
|
7864
7864
|
case "Void":
|
|
7865
|
-
return yield* FromVoid3(schema_, references_,
|
|
7865
|
+
return yield* FromVoid3(schema_, references_, path103, value);
|
|
7866
7866
|
default:
|
|
7867
7867
|
if (!type_exports2.Has(schema_[Kind]))
|
|
7868
7868
|
throw new ValueErrorsUnknownTypeError(schema);
|
|
7869
|
-
return yield* FromKind2(schema_, references_,
|
|
7869
|
+
return yield* FromKind2(schema_, references_, path103, value);
|
|
7870
7870
|
}
|
|
7871
7871
|
}
|
|
7872
7872
|
function Errors(...args) {
|
|
@@ -9107,50 +9107,50 @@ var init_convert2 = __esm({
|
|
|
9107
9107
|
});
|
|
9108
9108
|
|
|
9109
9109
|
// node_modules/@sinclair/typebox/build/esm/value/transform/decode.mjs
|
|
9110
|
-
function Default3(schema,
|
|
9110
|
+
function Default3(schema, path103, value) {
|
|
9111
9111
|
try {
|
|
9112
9112
|
return IsTransform(schema) ? schema[TransformKind].Decode(value) : value;
|
|
9113
9113
|
} catch (error) {
|
|
9114
|
-
throw new TransformDecodeError(schema,
|
|
9114
|
+
throw new TransformDecodeError(schema, path103, value, error);
|
|
9115
9115
|
}
|
|
9116
9116
|
}
|
|
9117
|
-
function FromArray14(schema, references,
|
|
9118
|
-
return IsArray2(value) ? Default3(schema,
|
|
9117
|
+
function FromArray14(schema, references, path103, value) {
|
|
9118
|
+
return IsArray2(value) ? Default3(schema, path103, value.map((value2, index) => Visit11(schema.items, references, `${path103}/${index}`, value2))) : Default3(schema, path103, value);
|
|
9119
9119
|
}
|
|
9120
|
-
function FromIntersect15(schema, references,
|
|
9120
|
+
function FromIntersect15(schema, references, path103, value) {
|
|
9121
9121
|
if (!IsObject2(value) || IsValueType(value))
|
|
9122
|
-
return Default3(schema,
|
|
9122
|
+
return Default3(schema, path103, value);
|
|
9123
9123
|
const knownEntries = KeyOfPropertyEntries(schema);
|
|
9124
9124
|
const knownKeys = knownEntries.map((entry) => entry[0]);
|
|
9125
9125
|
const knownProperties = { ...value };
|
|
9126
9126
|
for (const [knownKey, knownSchema] of knownEntries)
|
|
9127
9127
|
if (knownKey in knownProperties) {
|
|
9128
|
-
knownProperties[knownKey] = Visit11(knownSchema, references, `${
|
|
9128
|
+
knownProperties[knownKey] = Visit11(knownSchema, references, `${path103}/${knownKey}`, knownProperties[knownKey]);
|
|
9129
9129
|
}
|
|
9130
9130
|
if (!IsTransform(schema.unevaluatedProperties)) {
|
|
9131
|
-
return Default3(schema,
|
|
9131
|
+
return Default3(schema, path103, knownProperties);
|
|
9132
9132
|
}
|
|
9133
9133
|
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
9134
9134
|
const unevaluatedProperties = schema.unevaluatedProperties;
|
|
9135
9135
|
const unknownProperties = { ...knownProperties };
|
|
9136
9136
|
for (const key of unknownKeys)
|
|
9137
9137
|
if (!knownKeys.includes(key)) {
|
|
9138
|
-
unknownProperties[key] = Default3(unevaluatedProperties, `${
|
|
9138
|
+
unknownProperties[key] = Default3(unevaluatedProperties, `${path103}/${key}`, unknownProperties[key]);
|
|
9139
9139
|
}
|
|
9140
|
-
return Default3(schema,
|
|
9140
|
+
return Default3(schema, path103, unknownProperties);
|
|
9141
9141
|
}
|
|
9142
|
-
function FromImport7(schema, references,
|
|
9142
|
+
function FromImport7(schema, references, path103, value) {
|
|
9143
9143
|
const additional = globalThis.Object.values(schema.$defs);
|
|
9144
9144
|
const target = schema.$defs[schema.$ref];
|
|
9145
|
-
const result4 = Visit11(target, [...references, ...additional],
|
|
9146
|
-
return Default3(schema,
|
|
9145
|
+
const result4 = Visit11(target, [...references, ...additional], path103, value);
|
|
9146
|
+
return Default3(schema, path103, result4);
|
|
9147
9147
|
}
|
|
9148
|
-
function FromNot5(schema, references,
|
|
9149
|
-
return Default3(schema,
|
|
9148
|
+
function FromNot5(schema, references, path103, value) {
|
|
9149
|
+
return Default3(schema, path103, Visit11(schema.not, references, path103, value));
|
|
9150
9150
|
}
|
|
9151
|
-
function FromObject15(schema, references,
|
|
9151
|
+
function FromObject15(schema, references, path103, value) {
|
|
9152
9152
|
if (!IsObject2(value))
|
|
9153
|
-
return Default3(schema,
|
|
9153
|
+
return Default3(schema, path103, value);
|
|
9154
9154
|
const knownKeys = KeyOfPropertyKeys(schema);
|
|
9155
9155
|
const knownProperties = { ...value };
|
|
9156
9156
|
for (const key of knownKeys) {
|
|
@@ -9158,90 +9158,90 @@ function FromObject15(schema, references, path104, value) {
|
|
|
9158
9158
|
continue;
|
|
9159
9159
|
if (IsUndefined2(knownProperties[key]) && (!IsUndefined3(schema.properties[key]) || TypeSystemPolicy.IsExactOptionalProperty(knownProperties, key)))
|
|
9160
9160
|
continue;
|
|
9161
|
-
knownProperties[key] = Visit11(schema.properties[key], references, `${
|
|
9161
|
+
knownProperties[key] = Visit11(schema.properties[key], references, `${path103}/${key}`, knownProperties[key]);
|
|
9162
9162
|
}
|
|
9163
9163
|
if (!IsSchema(schema.additionalProperties)) {
|
|
9164
|
-
return Default3(schema,
|
|
9164
|
+
return Default3(schema, path103, knownProperties);
|
|
9165
9165
|
}
|
|
9166
9166
|
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
9167
9167
|
const additionalProperties = schema.additionalProperties;
|
|
9168
9168
|
const unknownProperties = { ...knownProperties };
|
|
9169
9169
|
for (const key of unknownKeys)
|
|
9170
9170
|
if (!knownKeys.includes(key)) {
|
|
9171
|
-
unknownProperties[key] = Default3(additionalProperties, `${
|
|
9171
|
+
unknownProperties[key] = Default3(additionalProperties, `${path103}/${key}`, unknownProperties[key]);
|
|
9172
9172
|
}
|
|
9173
|
-
return Default3(schema,
|
|
9173
|
+
return Default3(schema, path103, unknownProperties);
|
|
9174
9174
|
}
|
|
9175
|
-
function FromRecord10(schema, references,
|
|
9175
|
+
function FromRecord10(schema, references, path103, value) {
|
|
9176
9176
|
if (!IsObject2(value))
|
|
9177
|
-
return Default3(schema,
|
|
9177
|
+
return Default3(schema, path103, value);
|
|
9178
9178
|
const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0];
|
|
9179
9179
|
const knownKeys = new RegExp(pattern);
|
|
9180
9180
|
const knownProperties = { ...value };
|
|
9181
9181
|
for (const key of Object.getOwnPropertyNames(value))
|
|
9182
9182
|
if (knownKeys.test(key)) {
|
|
9183
|
-
knownProperties[key] = Visit11(schema.patternProperties[pattern], references, `${
|
|
9183
|
+
knownProperties[key] = Visit11(schema.patternProperties[pattern], references, `${path103}/${key}`, knownProperties[key]);
|
|
9184
9184
|
}
|
|
9185
9185
|
if (!IsSchema(schema.additionalProperties)) {
|
|
9186
|
-
return Default3(schema,
|
|
9186
|
+
return Default3(schema, path103, knownProperties);
|
|
9187
9187
|
}
|
|
9188
9188
|
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
9189
9189
|
const additionalProperties = schema.additionalProperties;
|
|
9190
9190
|
const unknownProperties = { ...knownProperties };
|
|
9191
9191
|
for (const key of unknownKeys)
|
|
9192
9192
|
if (!knownKeys.test(key)) {
|
|
9193
|
-
unknownProperties[key] = Default3(additionalProperties, `${
|
|
9193
|
+
unknownProperties[key] = Default3(additionalProperties, `${path103}/${key}`, unknownProperties[key]);
|
|
9194
9194
|
}
|
|
9195
|
-
return Default3(schema,
|
|
9195
|
+
return Default3(schema, path103, unknownProperties);
|
|
9196
9196
|
}
|
|
9197
|
-
function FromRef11(schema, references,
|
|
9197
|
+
function FromRef11(schema, references, path103, value) {
|
|
9198
9198
|
const target = Deref(schema, references);
|
|
9199
|
-
return Default3(schema,
|
|
9199
|
+
return Default3(schema, path103, Visit11(target, references, path103, value));
|
|
9200
9200
|
}
|
|
9201
|
-
function FromThis7(schema, references,
|
|
9201
|
+
function FromThis7(schema, references, path103, value) {
|
|
9202
9202
|
const target = Deref(schema, references);
|
|
9203
|
-
return Default3(schema,
|
|
9203
|
+
return Default3(schema, path103, Visit11(target, references, path103, value));
|
|
9204
9204
|
}
|
|
9205
|
-
function FromTuple12(schema, references,
|
|
9206
|
-
return IsArray2(value) && IsArray2(schema.items) ? Default3(schema,
|
|
9205
|
+
function FromTuple12(schema, references, path103, value) {
|
|
9206
|
+
return IsArray2(value) && IsArray2(schema.items) ? Default3(schema, path103, schema.items.map((schema2, index) => Visit11(schema2, references, `${path103}/${index}`, value[index]))) : Default3(schema, path103, value);
|
|
9207
9207
|
}
|
|
9208
|
-
function FromUnion17(schema, references,
|
|
9208
|
+
function FromUnion17(schema, references, path103, value) {
|
|
9209
9209
|
for (const subschema of schema.anyOf) {
|
|
9210
9210
|
if (!Check(subschema, references, value))
|
|
9211
9211
|
continue;
|
|
9212
|
-
const decoded = Visit11(subschema, references,
|
|
9213
|
-
return Default3(schema,
|
|
9212
|
+
const decoded = Visit11(subschema, references, path103, value);
|
|
9213
|
+
return Default3(schema, path103, decoded);
|
|
9214
9214
|
}
|
|
9215
|
-
return Default3(schema,
|
|
9215
|
+
return Default3(schema, path103, value);
|
|
9216
9216
|
}
|
|
9217
|
-
function Visit11(schema, references,
|
|
9217
|
+
function Visit11(schema, references, path103, value) {
|
|
9218
9218
|
const references_ = Pushref(schema, references);
|
|
9219
9219
|
const schema_ = schema;
|
|
9220
9220
|
switch (schema[Kind]) {
|
|
9221
9221
|
case "Array":
|
|
9222
|
-
return FromArray14(schema_, references_,
|
|
9222
|
+
return FromArray14(schema_, references_, path103, value);
|
|
9223
9223
|
case "Import":
|
|
9224
|
-
return FromImport7(schema_, references_,
|
|
9224
|
+
return FromImport7(schema_, references_, path103, value);
|
|
9225
9225
|
case "Intersect":
|
|
9226
|
-
return FromIntersect15(schema_, references_,
|
|
9226
|
+
return FromIntersect15(schema_, references_, path103, value);
|
|
9227
9227
|
case "Not":
|
|
9228
|
-
return FromNot5(schema_, references_,
|
|
9228
|
+
return FromNot5(schema_, references_, path103, value);
|
|
9229
9229
|
case "Object":
|
|
9230
|
-
return FromObject15(schema_, references_,
|
|
9230
|
+
return FromObject15(schema_, references_, path103, value);
|
|
9231
9231
|
case "Record":
|
|
9232
|
-
return FromRecord10(schema_, references_,
|
|
9232
|
+
return FromRecord10(schema_, references_, path103, value);
|
|
9233
9233
|
case "Ref":
|
|
9234
|
-
return FromRef11(schema_, references_,
|
|
9234
|
+
return FromRef11(schema_, references_, path103, value);
|
|
9235
9235
|
case "Symbol":
|
|
9236
|
-
return Default3(schema_,
|
|
9236
|
+
return Default3(schema_, path103, value);
|
|
9237
9237
|
case "This":
|
|
9238
|
-
return FromThis7(schema_, references_,
|
|
9238
|
+
return FromThis7(schema_, references_, path103, value);
|
|
9239
9239
|
case "Tuple":
|
|
9240
|
-
return FromTuple12(schema_, references_,
|
|
9240
|
+
return FromTuple12(schema_, references_, path103, value);
|
|
9241
9241
|
case "Union":
|
|
9242
|
-
return FromUnion17(schema_, references_,
|
|
9242
|
+
return FromUnion17(schema_, references_, path103, value);
|
|
9243
9243
|
default:
|
|
9244
|
-
return Default3(schema_,
|
|
9244
|
+
return Default3(schema_, path103, value);
|
|
9245
9245
|
}
|
|
9246
9246
|
}
|
|
9247
9247
|
function TransformDecode(schema, references, value) {
|
|
@@ -9267,10 +9267,10 @@ var init_decode = __esm({
|
|
|
9267
9267
|
}
|
|
9268
9268
|
};
|
|
9269
9269
|
TransformDecodeError = class extends TypeBoxError {
|
|
9270
|
-
constructor(schema,
|
|
9270
|
+
constructor(schema, path103, value, error) {
|
|
9271
9271
|
super(error instanceof Error ? error.message : "Unknown error");
|
|
9272
9272
|
this.schema = schema;
|
|
9273
|
-
this.path =
|
|
9273
|
+
this.path = path103;
|
|
9274
9274
|
this.value = value;
|
|
9275
9275
|
this.error = error;
|
|
9276
9276
|
}
|
|
@@ -9279,25 +9279,25 @@ var init_decode = __esm({
|
|
|
9279
9279
|
});
|
|
9280
9280
|
|
|
9281
9281
|
// node_modules/@sinclair/typebox/build/esm/value/transform/encode.mjs
|
|
9282
|
-
function Default4(schema,
|
|
9282
|
+
function Default4(schema, path103, value) {
|
|
9283
9283
|
try {
|
|
9284
9284
|
return IsTransform(schema) ? schema[TransformKind].Encode(value) : value;
|
|
9285
9285
|
} catch (error) {
|
|
9286
|
-
throw new TransformEncodeError(schema,
|
|
9286
|
+
throw new TransformEncodeError(schema, path103, value, error);
|
|
9287
9287
|
}
|
|
9288
9288
|
}
|
|
9289
|
-
function FromArray15(schema, references,
|
|
9290
|
-
const defaulted = Default4(schema,
|
|
9291
|
-
return IsArray2(defaulted) ? defaulted.map((value2, index) => Visit12(schema.items, references, `${
|
|
9289
|
+
function FromArray15(schema, references, path103, value) {
|
|
9290
|
+
const defaulted = Default4(schema, path103, value);
|
|
9291
|
+
return IsArray2(defaulted) ? defaulted.map((value2, index) => Visit12(schema.items, references, `${path103}/${index}`, value2)) : defaulted;
|
|
9292
9292
|
}
|
|
9293
|
-
function FromImport8(schema, references,
|
|
9293
|
+
function FromImport8(schema, references, path103, value) {
|
|
9294
9294
|
const additional = globalThis.Object.values(schema.$defs);
|
|
9295
9295
|
const target = schema.$defs[schema.$ref];
|
|
9296
|
-
const result4 = Default4(schema,
|
|
9297
|
-
return Visit12(target, [...references, ...additional],
|
|
9296
|
+
const result4 = Default4(schema, path103, value);
|
|
9297
|
+
return Visit12(target, [...references, ...additional], path103, result4);
|
|
9298
9298
|
}
|
|
9299
|
-
function FromIntersect16(schema, references,
|
|
9300
|
-
const defaulted = Default4(schema,
|
|
9299
|
+
function FromIntersect16(schema, references, path103, value) {
|
|
9300
|
+
const defaulted = Default4(schema, path103, value);
|
|
9301
9301
|
if (!IsObject2(value) || IsValueType(value))
|
|
9302
9302
|
return defaulted;
|
|
9303
9303
|
const knownEntries = KeyOfPropertyEntries(schema);
|
|
@@ -9305,7 +9305,7 @@ function FromIntersect16(schema, references, path104, value) {
|
|
|
9305
9305
|
const knownProperties = { ...defaulted };
|
|
9306
9306
|
for (const [knownKey, knownSchema] of knownEntries)
|
|
9307
9307
|
if (knownKey in knownProperties) {
|
|
9308
|
-
knownProperties[knownKey] = Visit12(knownSchema, references, `${
|
|
9308
|
+
knownProperties[knownKey] = Visit12(knownSchema, references, `${path103}/${knownKey}`, knownProperties[knownKey]);
|
|
9309
9309
|
}
|
|
9310
9310
|
if (!IsTransform(schema.unevaluatedProperties)) {
|
|
9311
9311
|
return knownProperties;
|
|
@@ -9315,15 +9315,15 @@ function FromIntersect16(schema, references, path104, value) {
|
|
|
9315
9315
|
const properties = { ...knownProperties };
|
|
9316
9316
|
for (const key of unknownKeys)
|
|
9317
9317
|
if (!knownKeys.includes(key)) {
|
|
9318
|
-
properties[key] = Default4(unevaluatedProperties, `${
|
|
9318
|
+
properties[key] = Default4(unevaluatedProperties, `${path103}/${key}`, properties[key]);
|
|
9319
9319
|
}
|
|
9320
9320
|
return properties;
|
|
9321
9321
|
}
|
|
9322
|
-
function FromNot6(schema, references,
|
|
9323
|
-
return Default4(schema.not,
|
|
9322
|
+
function FromNot6(schema, references, path103, value) {
|
|
9323
|
+
return Default4(schema.not, path103, Default4(schema, path103, value));
|
|
9324
9324
|
}
|
|
9325
|
-
function FromObject16(schema, references,
|
|
9326
|
-
const defaulted = Default4(schema,
|
|
9325
|
+
function FromObject16(schema, references, path103, value) {
|
|
9326
|
+
const defaulted = Default4(schema, path103, value);
|
|
9327
9327
|
if (!IsObject2(defaulted))
|
|
9328
9328
|
return defaulted;
|
|
9329
9329
|
const knownKeys = KeyOfPropertyKeys(schema);
|
|
@@ -9333,7 +9333,7 @@ function FromObject16(schema, references, path104, value) {
|
|
|
9333
9333
|
continue;
|
|
9334
9334
|
if (IsUndefined2(knownProperties[key]) && (!IsUndefined3(schema.properties[key]) || TypeSystemPolicy.IsExactOptionalProperty(knownProperties, key)))
|
|
9335
9335
|
continue;
|
|
9336
|
-
knownProperties[key] = Visit12(schema.properties[key], references, `${
|
|
9336
|
+
knownProperties[key] = Visit12(schema.properties[key], references, `${path103}/${key}`, knownProperties[key]);
|
|
9337
9337
|
}
|
|
9338
9338
|
if (!IsSchema(schema.additionalProperties)) {
|
|
9339
9339
|
return knownProperties;
|
|
@@ -9343,12 +9343,12 @@ function FromObject16(schema, references, path104, value) {
|
|
|
9343
9343
|
const properties = { ...knownProperties };
|
|
9344
9344
|
for (const key of unknownKeys)
|
|
9345
9345
|
if (!knownKeys.includes(key)) {
|
|
9346
|
-
properties[key] = Default4(additionalProperties, `${
|
|
9346
|
+
properties[key] = Default4(additionalProperties, `${path103}/${key}`, properties[key]);
|
|
9347
9347
|
}
|
|
9348
9348
|
return properties;
|
|
9349
9349
|
}
|
|
9350
|
-
function FromRecord11(schema, references,
|
|
9351
|
-
const defaulted = Default4(schema,
|
|
9350
|
+
function FromRecord11(schema, references, path103, value) {
|
|
9351
|
+
const defaulted = Default4(schema, path103, value);
|
|
9352
9352
|
if (!IsObject2(value))
|
|
9353
9353
|
return defaulted;
|
|
9354
9354
|
const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0];
|
|
@@ -9356,7 +9356,7 @@ function FromRecord11(schema, references, path104, value) {
|
|
|
9356
9356
|
const knownProperties = { ...defaulted };
|
|
9357
9357
|
for (const key of Object.getOwnPropertyNames(value))
|
|
9358
9358
|
if (knownKeys.test(key)) {
|
|
9359
|
-
knownProperties[key] = Visit12(schema.patternProperties[pattern], references, `${
|
|
9359
|
+
knownProperties[key] = Visit12(schema.patternProperties[pattern], references, `${path103}/${key}`, knownProperties[key]);
|
|
9360
9360
|
}
|
|
9361
9361
|
if (!IsSchema(schema.additionalProperties)) {
|
|
9362
9362
|
return knownProperties;
|
|
@@ -9366,65 +9366,65 @@ function FromRecord11(schema, references, path104, value) {
|
|
|
9366
9366
|
const properties = { ...knownProperties };
|
|
9367
9367
|
for (const key of unknownKeys)
|
|
9368
9368
|
if (!knownKeys.test(key)) {
|
|
9369
|
-
properties[key] = Default4(additionalProperties, `${
|
|
9369
|
+
properties[key] = Default4(additionalProperties, `${path103}/${key}`, properties[key]);
|
|
9370
9370
|
}
|
|
9371
9371
|
return properties;
|
|
9372
9372
|
}
|
|
9373
|
-
function FromRef12(schema, references,
|
|
9373
|
+
function FromRef12(schema, references, path103, value) {
|
|
9374
9374
|
const target = Deref(schema, references);
|
|
9375
|
-
const resolved = Visit12(target, references,
|
|
9376
|
-
return Default4(schema,
|
|
9375
|
+
const resolved = Visit12(target, references, path103, value);
|
|
9376
|
+
return Default4(schema, path103, resolved);
|
|
9377
9377
|
}
|
|
9378
|
-
function FromThis8(schema, references,
|
|
9378
|
+
function FromThis8(schema, references, path103, value) {
|
|
9379
9379
|
const target = Deref(schema, references);
|
|
9380
|
-
const resolved = Visit12(target, references,
|
|
9381
|
-
return Default4(schema,
|
|
9380
|
+
const resolved = Visit12(target, references, path103, value);
|
|
9381
|
+
return Default4(schema, path103, resolved);
|
|
9382
9382
|
}
|
|
9383
|
-
function FromTuple13(schema, references,
|
|
9384
|
-
const value1 = Default4(schema,
|
|
9385
|
-
return IsArray2(schema.items) ? schema.items.map((schema2, index) => Visit12(schema2, references, `${
|
|
9383
|
+
function FromTuple13(schema, references, path103, value) {
|
|
9384
|
+
const value1 = Default4(schema, path103, value);
|
|
9385
|
+
return IsArray2(schema.items) ? schema.items.map((schema2, index) => Visit12(schema2, references, `${path103}/${index}`, value1[index])) : [];
|
|
9386
9386
|
}
|
|
9387
|
-
function FromUnion18(schema, references,
|
|
9387
|
+
function FromUnion18(schema, references, path103, value) {
|
|
9388
9388
|
for (const subschema of schema.anyOf) {
|
|
9389
9389
|
if (!Check(subschema, references, value))
|
|
9390
9390
|
continue;
|
|
9391
|
-
const value1 = Visit12(subschema, references,
|
|
9392
|
-
return Default4(schema,
|
|
9391
|
+
const value1 = Visit12(subschema, references, path103, value);
|
|
9392
|
+
return Default4(schema, path103, value1);
|
|
9393
9393
|
}
|
|
9394
9394
|
for (const subschema of schema.anyOf) {
|
|
9395
|
-
const value1 = Visit12(subschema, references,
|
|
9395
|
+
const value1 = Visit12(subschema, references, path103, value);
|
|
9396
9396
|
if (!Check(schema, references, value1))
|
|
9397
9397
|
continue;
|
|
9398
|
-
return Default4(schema,
|
|
9398
|
+
return Default4(schema, path103, value1);
|
|
9399
9399
|
}
|
|
9400
|
-
return Default4(schema,
|
|
9400
|
+
return Default4(schema, path103, value);
|
|
9401
9401
|
}
|
|
9402
|
-
function Visit12(schema, references,
|
|
9402
|
+
function Visit12(schema, references, path103, value) {
|
|
9403
9403
|
const references_ = Pushref(schema, references);
|
|
9404
9404
|
const schema_ = schema;
|
|
9405
9405
|
switch (schema[Kind]) {
|
|
9406
9406
|
case "Array":
|
|
9407
|
-
return FromArray15(schema_, references_,
|
|
9407
|
+
return FromArray15(schema_, references_, path103, value);
|
|
9408
9408
|
case "Import":
|
|
9409
|
-
return FromImport8(schema_, references_,
|
|
9409
|
+
return FromImport8(schema_, references_, path103, value);
|
|
9410
9410
|
case "Intersect":
|
|
9411
|
-
return FromIntersect16(schema_, references_,
|
|
9411
|
+
return FromIntersect16(schema_, references_, path103, value);
|
|
9412
9412
|
case "Not":
|
|
9413
|
-
return FromNot6(schema_, references_,
|
|
9413
|
+
return FromNot6(schema_, references_, path103, value);
|
|
9414
9414
|
case "Object":
|
|
9415
|
-
return FromObject16(schema_, references_,
|
|
9415
|
+
return FromObject16(schema_, references_, path103, value);
|
|
9416
9416
|
case "Record":
|
|
9417
|
-
return FromRecord11(schema_, references_,
|
|
9417
|
+
return FromRecord11(schema_, references_, path103, value);
|
|
9418
9418
|
case "Ref":
|
|
9419
|
-
return FromRef12(schema_, references_,
|
|
9419
|
+
return FromRef12(schema_, references_, path103, value);
|
|
9420
9420
|
case "This":
|
|
9421
|
-
return FromThis8(schema_, references_,
|
|
9421
|
+
return FromThis8(schema_, references_, path103, value);
|
|
9422
9422
|
case "Tuple":
|
|
9423
|
-
return FromTuple13(schema_, references_,
|
|
9423
|
+
return FromTuple13(schema_, references_, path103, value);
|
|
9424
9424
|
case "Union":
|
|
9425
|
-
return FromUnion18(schema_, references_,
|
|
9425
|
+
return FromUnion18(schema_, references_, path103, value);
|
|
9426
9426
|
default:
|
|
9427
|
-
return Default4(schema_,
|
|
9427
|
+
return Default4(schema_, path103, value);
|
|
9428
9428
|
}
|
|
9429
9429
|
}
|
|
9430
9430
|
function TransformEncode(schema, references, value) {
|
|
@@ -9450,10 +9450,10 @@ var init_encode = __esm({
|
|
|
9450
9450
|
}
|
|
9451
9451
|
};
|
|
9452
9452
|
TransformEncodeError = class extends TypeBoxError {
|
|
9453
|
-
constructor(schema,
|
|
9453
|
+
constructor(schema, path103, value, error) {
|
|
9454
9454
|
super(`${error instanceof Error ? error.message : "Unknown error"}`);
|
|
9455
9455
|
this.schema = schema;
|
|
9456
|
-
this.path =
|
|
9456
|
+
this.path = path103;
|
|
9457
9457
|
this.value = value;
|
|
9458
9458
|
this.error = error;
|
|
9459
9459
|
}
|
|
@@ -9853,18 +9853,18 @@ var init_pointer = __esm({
|
|
|
9853
9853
|
"node_modules/@sinclair/typebox/build/esm/value/pointer/pointer.mjs"() {
|
|
9854
9854
|
init_error2();
|
|
9855
9855
|
ValuePointerRootSetError = class extends TypeBoxError {
|
|
9856
|
-
constructor(value,
|
|
9856
|
+
constructor(value, path103, update) {
|
|
9857
9857
|
super("Cannot set root value");
|
|
9858
9858
|
this.value = value;
|
|
9859
|
-
this.path =
|
|
9859
|
+
this.path = path103;
|
|
9860
9860
|
this.update = update;
|
|
9861
9861
|
}
|
|
9862
9862
|
};
|
|
9863
9863
|
ValuePointerRootDeleteError = class extends TypeBoxError {
|
|
9864
|
-
constructor(value,
|
|
9864
|
+
constructor(value, path103) {
|
|
9865
9865
|
super("Cannot delete root value");
|
|
9866
9866
|
this.value = value;
|
|
9867
|
-
this.path =
|
|
9867
|
+
this.path = path103;
|
|
9868
9868
|
}
|
|
9869
9869
|
};
|
|
9870
9870
|
}
|
|
@@ -9923,82 +9923,82 @@ var init_equal = __esm({
|
|
|
9923
9923
|
});
|
|
9924
9924
|
|
|
9925
9925
|
// node_modules/@sinclair/typebox/build/esm/value/delta/delta.mjs
|
|
9926
|
-
function CreateUpdate(
|
|
9927
|
-
return { type: "update", path:
|
|
9926
|
+
function CreateUpdate(path103, value) {
|
|
9927
|
+
return { type: "update", path: path103, value };
|
|
9928
9928
|
}
|
|
9929
|
-
function CreateInsert(
|
|
9930
|
-
return { type: "insert", path:
|
|
9929
|
+
function CreateInsert(path103, value) {
|
|
9930
|
+
return { type: "insert", path: path103, value };
|
|
9931
9931
|
}
|
|
9932
|
-
function CreateDelete(
|
|
9933
|
-
return { type: "delete", path:
|
|
9932
|
+
function CreateDelete(path103) {
|
|
9933
|
+
return { type: "delete", path: path103 };
|
|
9934
9934
|
}
|
|
9935
9935
|
function AssertDiffable(value) {
|
|
9936
9936
|
if (globalThis.Object.getOwnPropertySymbols(value).length > 0)
|
|
9937
9937
|
throw new ValueDiffError(value, "Cannot diff objects with symbols");
|
|
9938
9938
|
}
|
|
9939
|
-
function* ObjectType4(
|
|
9939
|
+
function* ObjectType4(path103, current, next) {
|
|
9940
9940
|
AssertDiffable(current);
|
|
9941
9941
|
AssertDiffable(next);
|
|
9942
9942
|
if (!IsStandardObject(next))
|
|
9943
|
-
return yield CreateUpdate(
|
|
9943
|
+
return yield CreateUpdate(path103, next);
|
|
9944
9944
|
const currentKeys = globalThis.Object.getOwnPropertyNames(current);
|
|
9945
9945
|
const nextKeys = globalThis.Object.getOwnPropertyNames(next);
|
|
9946
9946
|
for (const key of nextKeys) {
|
|
9947
9947
|
if (HasPropertyKey2(current, key))
|
|
9948
9948
|
continue;
|
|
9949
|
-
yield CreateInsert(`${
|
|
9949
|
+
yield CreateInsert(`${path103}/${key}`, next[key]);
|
|
9950
9950
|
}
|
|
9951
9951
|
for (const key of currentKeys) {
|
|
9952
9952
|
if (!HasPropertyKey2(next, key))
|
|
9953
9953
|
continue;
|
|
9954
9954
|
if (Equal(current, next))
|
|
9955
9955
|
continue;
|
|
9956
|
-
yield* Visit15(`${
|
|
9956
|
+
yield* Visit15(`${path103}/${key}`, current[key], next[key]);
|
|
9957
9957
|
}
|
|
9958
9958
|
for (const key of currentKeys) {
|
|
9959
9959
|
if (HasPropertyKey2(next, key))
|
|
9960
9960
|
continue;
|
|
9961
|
-
yield CreateDelete(`${
|
|
9961
|
+
yield CreateDelete(`${path103}/${key}`);
|
|
9962
9962
|
}
|
|
9963
9963
|
}
|
|
9964
|
-
function* ArrayType4(
|
|
9964
|
+
function* ArrayType4(path103, current, next) {
|
|
9965
9965
|
if (!IsArray2(next))
|
|
9966
|
-
return yield CreateUpdate(
|
|
9966
|
+
return yield CreateUpdate(path103, next);
|
|
9967
9967
|
for (let i = 0; i < Math.min(current.length, next.length); i++) {
|
|
9968
|
-
yield* Visit15(`${
|
|
9968
|
+
yield* Visit15(`${path103}/${i}`, current[i], next[i]);
|
|
9969
9969
|
}
|
|
9970
9970
|
for (let i = 0; i < next.length; i++) {
|
|
9971
9971
|
if (i < current.length)
|
|
9972
9972
|
continue;
|
|
9973
|
-
yield CreateInsert(`${
|
|
9973
|
+
yield CreateInsert(`${path103}/${i}`, next[i]);
|
|
9974
9974
|
}
|
|
9975
9975
|
for (let i = current.length - 1; i >= 0; i--) {
|
|
9976
9976
|
if (i < next.length)
|
|
9977
9977
|
continue;
|
|
9978
|
-
yield CreateDelete(`${
|
|
9978
|
+
yield CreateDelete(`${path103}/${i}`);
|
|
9979
9979
|
}
|
|
9980
9980
|
}
|
|
9981
|
-
function* TypedArrayType2(
|
|
9981
|
+
function* TypedArrayType2(path103, current, next) {
|
|
9982
9982
|
if (!IsTypedArray(next) || current.length !== next.length || globalThis.Object.getPrototypeOf(current).constructor.name !== globalThis.Object.getPrototypeOf(next).constructor.name)
|
|
9983
|
-
return yield CreateUpdate(
|
|
9983
|
+
return yield CreateUpdate(path103, next);
|
|
9984
9984
|
for (let i = 0; i < Math.min(current.length, next.length); i++) {
|
|
9985
|
-
yield* Visit15(`${
|
|
9985
|
+
yield* Visit15(`${path103}/${i}`, current[i], next[i]);
|
|
9986
9986
|
}
|
|
9987
9987
|
}
|
|
9988
|
-
function* ValueType2(
|
|
9988
|
+
function* ValueType2(path103, current, next) {
|
|
9989
9989
|
if (current === next)
|
|
9990
9990
|
return;
|
|
9991
|
-
yield CreateUpdate(
|
|
9991
|
+
yield CreateUpdate(path103, next);
|
|
9992
9992
|
}
|
|
9993
|
-
function* Visit15(
|
|
9993
|
+
function* Visit15(path103, current, next) {
|
|
9994
9994
|
if (IsStandardObject(current))
|
|
9995
|
-
return yield* ObjectType4(
|
|
9995
|
+
return yield* ObjectType4(path103, current, next);
|
|
9996
9996
|
if (IsArray2(current))
|
|
9997
|
-
return yield* ArrayType4(
|
|
9997
|
+
return yield* ArrayType4(path103, current, next);
|
|
9998
9998
|
if (IsTypedArray(current))
|
|
9999
|
-
return yield* TypedArrayType2(
|
|
9999
|
+
return yield* TypedArrayType2(path103, current, next);
|
|
10000
10000
|
if (IsValueType(current))
|
|
10001
|
-
return yield* ValueType2(
|
|
10001
|
+
return yield* ValueType2(path103, current, next);
|
|
10002
10002
|
throw new ValueDiffError(current, "Unable to diff value");
|
|
10003
10003
|
}
|
|
10004
10004
|
function Diff(current, next) {
|
|
@@ -10114,9 +10114,9 @@ var init_equal2 = __esm({
|
|
|
10114
10114
|
function IsStandardObject2(value) {
|
|
10115
10115
|
return IsObject2(value) && !IsArray2(value);
|
|
10116
10116
|
}
|
|
10117
|
-
function ObjectType5(root,
|
|
10117
|
+
function ObjectType5(root, path103, current, next) {
|
|
10118
10118
|
if (!IsStandardObject2(current)) {
|
|
10119
|
-
pointer_exports.Set(root,
|
|
10119
|
+
pointer_exports.Set(root, path103, Clone2(next));
|
|
10120
10120
|
} else {
|
|
10121
10121
|
const currentKeys = Object.getOwnPropertyNames(current);
|
|
10122
10122
|
const nextKeys = Object.getOwnPropertyNames(next);
|
|
@@ -10131,43 +10131,43 @@ function ObjectType5(root, path104, current, next) {
|
|
|
10131
10131
|
}
|
|
10132
10132
|
}
|
|
10133
10133
|
for (const nextKey of nextKeys) {
|
|
10134
|
-
Visit16(root, `${
|
|
10134
|
+
Visit16(root, `${path103}/${nextKey}`, current[nextKey], next[nextKey]);
|
|
10135
10135
|
}
|
|
10136
10136
|
}
|
|
10137
10137
|
}
|
|
10138
|
-
function ArrayType5(root,
|
|
10138
|
+
function ArrayType5(root, path103, current, next) {
|
|
10139
10139
|
if (!IsArray2(current)) {
|
|
10140
|
-
pointer_exports.Set(root,
|
|
10140
|
+
pointer_exports.Set(root, path103, Clone2(next));
|
|
10141
10141
|
} else {
|
|
10142
10142
|
for (let index = 0; index < next.length; index++) {
|
|
10143
|
-
Visit16(root, `${
|
|
10143
|
+
Visit16(root, `${path103}/${index}`, current[index], next[index]);
|
|
10144
10144
|
}
|
|
10145
10145
|
current.splice(next.length);
|
|
10146
10146
|
}
|
|
10147
10147
|
}
|
|
10148
|
-
function TypedArrayType3(root,
|
|
10148
|
+
function TypedArrayType3(root, path103, current, next) {
|
|
10149
10149
|
if (IsTypedArray(current) && current.length === next.length) {
|
|
10150
10150
|
for (let i = 0; i < current.length; i++) {
|
|
10151
10151
|
current[i] = next[i];
|
|
10152
10152
|
}
|
|
10153
10153
|
} else {
|
|
10154
|
-
pointer_exports.Set(root,
|
|
10154
|
+
pointer_exports.Set(root, path103, Clone2(next));
|
|
10155
10155
|
}
|
|
10156
10156
|
}
|
|
10157
|
-
function ValueType3(root,
|
|
10157
|
+
function ValueType3(root, path103, current, next) {
|
|
10158
10158
|
if (current === next)
|
|
10159
10159
|
return;
|
|
10160
|
-
pointer_exports.Set(root,
|
|
10160
|
+
pointer_exports.Set(root, path103, next);
|
|
10161
10161
|
}
|
|
10162
|
-
function Visit16(root,
|
|
10162
|
+
function Visit16(root, path103, current, next) {
|
|
10163
10163
|
if (IsArray2(next))
|
|
10164
|
-
return ArrayType5(root,
|
|
10164
|
+
return ArrayType5(root, path103, current, next);
|
|
10165
10165
|
if (IsTypedArray(next))
|
|
10166
|
-
return TypedArrayType3(root,
|
|
10166
|
+
return TypedArrayType3(root, path103, current, next);
|
|
10167
10167
|
if (IsStandardObject2(next))
|
|
10168
|
-
return ObjectType5(root,
|
|
10168
|
+
return ObjectType5(root, path103, current, next);
|
|
10169
10169
|
if (IsValueType(next))
|
|
10170
|
-
return ValueType3(root,
|
|
10170
|
+
return ValueType3(root, path103, current, next);
|
|
10171
10171
|
}
|
|
10172
10172
|
function IsNonMutableValue(value) {
|
|
10173
10173
|
return IsTypedArray(value) || IsValueType(value);
|
|
@@ -10786,14 +10786,14 @@ function errorPathFromValidation(error) {
|
|
|
10786
10786
|
function validateConfigWithWarnings(raw) {
|
|
10787
10787
|
if (!value_exports2.Check(PiTeamsConfigSchema, raw)) {
|
|
10788
10788
|
return [...value_exports2.Errors(PiTeamsConfigSchema, raw)].map((error) => {
|
|
10789
|
-
const
|
|
10789
|
+
const path103 = errorPathFromValidation(error);
|
|
10790
10790
|
const message = error.message ?? "invalid value";
|
|
10791
10791
|
if (error.keyword === "additionalProperties") {
|
|
10792
|
-
const offendingKey =
|
|
10792
|
+
const offendingKey = path103.split("/").pop() ?? path103;
|
|
10793
10793
|
const suggestion = suggestConfigKey(offendingKey, KNOWN_TOP_LEVEL_KEYS);
|
|
10794
|
-
if (suggestion) return `${
|
|
10794
|
+
if (suggestion) return `${path103}: ${message} (did you mean '${suggestion}'?)`;
|
|
10795
10795
|
}
|
|
10796
|
-
return `${
|
|
10796
|
+
return `${path103}: ${message}`;
|
|
10797
10797
|
});
|
|
10798
10798
|
}
|
|
10799
10799
|
return [];
|
|
@@ -13306,16 +13306,16 @@ function parseGenericGitUrl(url) {
|
|
|
13306
13306
|
const { repo: repoWithoutRef, ref } = splitRef(url);
|
|
13307
13307
|
let repo = repoWithoutRef;
|
|
13308
13308
|
let host = "";
|
|
13309
|
-
let
|
|
13309
|
+
let path103 = "";
|
|
13310
13310
|
const scpLikeMatch = repoWithoutRef.match(/^git@([^:]+):(.+)$/);
|
|
13311
13311
|
if (scpLikeMatch) {
|
|
13312
13312
|
host = scpLikeMatch[1] ?? "";
|
|
13313
|
-
|
|
13313
|
+
path103 = scpLikeMatch[2] ?? "";
|
|
13314
13314
|
} else if (repoWithoutRef.startsWith("https://") || repoWithoutRef.startsWith("http://") || repoWithoutRef.startsWith("ssh://") || repoWithoutRef.startsWith("git://")) {
|
|
13315
13315
|
try {
|
|
13316
13316
|
const parsed = new URL(repoWithoutRef);
|
|
13317
13317
|
host = parsed.hostname;
|
|
13318
|
-
|
|
13318
|
+
path103 = parsed.pathname.replace(/^\/+/, "");
|
|
13319
13319
|
} catch {
|
|
13320
13320
|
return null;
|
|
13321
13321
|
}
|
|
@@ -13325,13 +13325,13 @@ function parseGenericGitUrl(url) {
|
|
|
13325
13325
|
return null;
|
|
13326
13326
|
}
|
|
13327
13327
|
host = repoWithoutRef.slice(0, slashIndex);
|
|
13328
|
-
|
|
13328
|
+
path103 = repoWithoutRef.slice(slashIndex + 1);
|
|
13329
13329
|
if (!host.includes(".") && host !== "localhost") {
|
|
13330
13330
|
return null;
|
|
13331
13331
|
}
|
|
13332
13332
|
repo = `https://${repoWithoutRef}`;
|
|
13333
13333
|
}
|
|
13334
|
-
const normalizedPath =
|
|
13334
|
+
const normalizedPath = path103.replace(/\.git$/, "").replace(/^\/+/, "");
|
|
13335
13335
|
if (!host || !normalizedPath || normalizedPath.split("/").length < 2) {
|
|
13336
13336
|
return null;
|
|
13337
13337
|
}
|
|
@@ -15428,13 +15428,13 @@ var init_errors3 = __esm({
|
|
|
15428
15428
|
}
|
|
15429
15429
|
};
|
|
15430
15430
|
errors = {
|
|
15431
|
-
fileRead(
|
|
15432
|
-
return new CrewError(ErrorCode.FileReadError, `Failed to read ${
|
|
15431
|
+
fileRead(path103, source) {
|
|
15432
|
+
return new CrewError(ErrorCode.FileReadError, `Failed to read ${path103}: ${source.code?.toLowerCase() ?? "unknown"}`).withContext(
|
|
15433
15433
|
"file system read operation"
|
|
15434
15434
|
);
|
|
15435
15435
|
},
|
|
15436
|
-
fileWrite(
|
|
15437
|
-
return new CrewError(ErrorCode.FileWriteError, `Failed to write ${
|
|
15436
|
+
fileWrite(path103, source) {
|
|
15437
|
+
return new CrewError(ErrorCode.FileWriteError, `Failed to write ${path103}: ${source.code?.toLowerCase() ?? "unknown"}`).withContext(
|
|
15438
15438
|
"file system write operation"
|
|
15439
15439
|
);
|
|
15440
15440
|
},
|
|
@@ -17783,9 +17783,9 @@ function closeWatcher(watcher) {
|
|
|
17783
17783
|
} catch {
|
|
17784
17784
|
}
|
|
17785
17785
|
}
|
|
17786
|
-
function watchWithErrorHandler(
|
|
17786
|
+
function watchWithErrorHandler(path103, listener, onError) {
|
|
17787
17787
|
try {
|
|
17788
|
-
const watcher = fs23.watch(
|
|
17788
|
+
const watcher = fs23.watch(path103, listener);
|
|
17789
17789
|
watcher.on("error", onError);
|
|
17790
17790
|
return watcher;
|
|
17791
17791
|
} catch (error) {
|
|
@@ -18786,7 +18786,7 @@ function makeTerminalEventProbe(deps) {
|
|
|
18786
18786
|
let partial = "";
|
|
18787
18787
|
let payload;
|
|
18788
18788
|
let fd = null;
|
|
18789
|
-
const ioOpen = deps.io?.open ?? ((
|
|
18789
|
+
const ioOpen = deps.io?.open ?? ((path103) => fs26.openSync(path103, "r"));
|
|
18790
18790
|
const ioSize = deps.io?.size ?? ((handle) => fs26.fstatSync(handle).size);
|
|
18791
18791
|
const ioRead = deps.io?.read ?? ((handle, start, end) => {
|
|
18792
18792
|
const length = end - start;
|
|
@@ -25686,23 +25686,23 @@ var init_syntax_highlight = __esm({
|
|
|
25686
25686
|
|
|
25687
25687
|
// src/ui/transcript-cache.ts
|
|
25688
25688
|
import * as fs39 from "node:fs";
|
|
25689
|
-
function cacheKey(
|
|
25690
|
-
return `${
|
|
25689
|
+
function cacheKey(path103, options) {
|
|
25690
|
+
return `${path103}:${options.full ? "full" : `tail:${options.maxTailBytes}`}`;
|
|
25691
25691
|
}
|
|
25692
|
-
function getTranscriptCacheEntry(
|
|
25692
|
+
function getTranscriptCacheEntry(path103, options = {}) {
|
|
25693
25693
|
const normalized = {
|
|
25694
25694
|
full: options.full === true,
|
|
25695
25695
|
maxTailBytes: options.maxTailBytes ?? DEFAULT_TAIL_BYTES
|
|
25696
25696
|
};
|
|
25697
|
-
return transcriptCache.get(cacheKey(
|
|
25697
|
+
return transcriptCache.get(cacheKey(path103, normalized)) ?? transcriptCache.get(path103);
|
|
25698
25698
|
}
|
|
25699
|
-
function readTranscriptText(
|
|
25699
|
+
function readTranscriptText(path103, stat2, options) {
|
|
25700
25700
|
if (options.full || stat2.size <= options.maxTailBytes) {
|
|
25701
|
-
const raw = fs39.readFileSync(
|
|
25701
|
+
const raw = fs39.readFileSync(path103);
|
|
25702
25702
|
return { raw, offset: 0, bytesRead: raw.length, truncated: false };
|
|
25703
25703
|
}
|
|
25704
25704
|
const bytesToRead = Math.min(stat2.size, options.maxTailBytes);
|
|
25705
|
-
const fd = fs39.openSync(
|
|
25705
|
+
const fd = fs39.openSync(path103, "r");
|
|
25706
25706
|
try {
|
|
25707
25707
|
const buffer = Buffer.alloc(bytesToRead);
|
|
25708
25708
|
fs39.readSync(fd, buffer, 0, bytesToRead, stat2.size - bytesToRead);
|
|
@@ -25718,9 +25718,9 @@ function readTranscriptText(path104, stat2, options) {
|
|
|
25718
25718
|
fs39.closeSync(fd);
|
|
25719
25719
|
}
|
|
25720
25720
|
}
|
|
25721
|
-
function appendTranscriptText(
|
|
25721
|
+
function appendTranscriptText(path103, previous, stat2, options) {
|
|
25722
25722
|
const deltaLength = stat2.size - previous.size;
|
|
25723
|
-
const fd = fs39.openSync(
|
|
25723
|
+
const fd = fs39.openSync(path103, "r");
|
|
25724
25724
|
let delta;
|
|
25725
25725
|
try {
|
|
25726
25726
|
delta = Buffer.alloc(deltaLength);
|
|
@@ -25751,16 +25751,16 @@ function appendTranscriptText(path104, previous, stat2, options) {
|
|
|
25751
25751
|
truncated: !options.full && offset > 0
|
|
25752
25752
|
};
|
|
25753
25753
|
}
|
|
25754
|
-
function readTranscriptLinesCached(
|
|
25754
|
+
function readTranscriptLinesCached(path103, parse4, now = Date.now(), options = {}) {
|
|
25755
25755
|
const normalized = {
|
|
25756
25756
|
full: options.full === true,
|
|
25757
25757
|
maxTailBytes: Math.max(1024, options.maxTailBytes ?? DEFAULT_TAIL_BYTES)
|
|
25758
25758
|
};
|
|
25759
|
-
const key = cacheKey(
|
|
25759
|
+
const key = cacheKey(path103, normalized);
|
|
25760
25760
|
const previous = transcriptCache.get(key);
|
|
25761
25761
|
let stat2;
|
|
25762
25762
|
try {
|
|
25763
|
-
stat2 = fs39.statSync(
|
|
25763
|
+
stat2 = fs39.statSync(path103);
|
|
25764
25764
|
} catch {
|
|
25765
25765
|
return previous?.lines ?? [];
|
|
25766
25766
|
}
|
|
@@ -25769,10 +25769,10 @@ function readTranscriptLinesCached(path104, parse4, now = Date.now(), options =
|
|
|
25769
25769
|
return previous.lines;
|
|
25770
25770
|
}
|
|
25771
25771
|
try {
|
|
25772
|
-
const read = previous && stat2.size > previous.size && stat2.mtimeMs >= previous.mtimeMs ? appendTranscriptText(
|
|
25772
|
+
const read = previous && stat2.size > previous.size && stat2.mtimeMs >= previous.mtimeMs ? appendTranscriptText(path103, previous, stat2, normalized) ?? readTranscriptText(path103, stat2, normalized) : readTranscriptText(path103, stat2, normalized);
|
|
25773
25773
|
const lines = parse4(read.raw.toString("utf-8"));
|
|
25774
25774
|
const entry = {
|
|
25775
|
-
path:
|
|
25775
|
+
path: path103,
|
|
25776
25776
|
mtimeMs: stat2.mtimeMs,
|
|
25777
25777
|
size: read.offset + read.raw.length,
|
|
25778
25778
|
offset: read.offset,
|
|
@@ -29424,7 +29424,6 @@ var init_i18n = __esm({
|
|
|
29424
29424
|
|
|
29425
29425
|
// src/runtime/run-tracker.ts
|
|
29426
29426
|
import * as fs49 from "node:fs";
|
|
29427
|
-
import * as path38 from "node:path";
|
|
29428
29427
|
function registerRunPromise(runId) {
|
|
29429
29428
|
detachRequests.delete(runId);
|
|
29430
29429
|
let resolve27;
|
|
@@ -29481,7 +29480,7 @@ async function waitForRun(runId, cwd, options = {}) {
|
|
|
29481
29480
|
if (current) return { ...current, detached: true };
|
|
29482
29481
|
}
|
|
29483
29482
|
if (attempt === 0) {
|
|
29484
|
-
const runDir =
|
|
29483
|
+
const runDir = createRunPaths(cwd, runId).stateRoot;
|
|
29485
29484
|
if (!fs49.existsSync(runDir)) {
|
|
29486
29485
|
throw new Error(`Run ${runId} not found. No run directory at ${runDir}`);
|
|
29487
29486
|
}
|
|
@@ -29501,7 +29500,6 @@ var init_run_tracker = __esm({
|
|
|
29501
29500
|
"src/runtime/run-tracker.ts"() {
|
|
29502
29501
|
"use strict";
|
|
29503
29502
|
init_state_store();
|
|
29504
|
-
init_paths();
|
|
29505
29503
|
init_process_status();
|
|
29506
29504
|
activeRunPromises = /* @__PURE__ */ new Map();
|
|
29507
29505
|
detachRequests = /* @__PURE__ */ new Set();
|
|
@@ -29634,12 +29632,12 @@ var init_crew_hooks = __esm({
|
|
|
29634
29632
|
|
|
29635
29633
|
// src/runtime/skill-effectiveness.ts
|
|
29636
29634
|
import { existsSync as existsSync27, mkdirSync as mkdirSync16, readFileSync as readFileSync31, writeFileSync as writeFileSync4 } from "node:fs";
|
|
29637
|
-
import { dirname as dirname21, join as
|
|
29635
|
+
import { dirname as dirname21, join as join35 } from "node:path";
|
|
29638
29636
|
function getSkillMetricsPath(cwd, runId) {
|
|
29639
|
-
return
|
|
29637
|
+
return join35(projectCrewRoot(cwd), `state/runs/${runId}/skill-metrics.jsonl`);
|
|
29640
29638
|
}
|
|
29641
29639
|
function getSkillActivationsPath(cwd, runId) {
|
|
29642
|
-
return
|
|
29640
|
+
return join35(projectCrewRoot(cwd), `state/runs/${runId}/skill-activations.jsonl`);
|
|
29643
29641
|
}
|
|
29644
29642
|
function ensureSkillMetricsDir(cwd, runId) {
|
|
29645
29643
|
const dir = dirname21(getSkillMetricsPath(cwd, runId));
|
|
@@ -29686,17 +29684,17 @@ function confidenceToThreshold(confidence) {
|
|
|
29686
29684
|
}
|
|
29687
29685
|
function recordSkillActivation(cwd, activation) {
|
|
29688
29686
|
ensureSkillMetricsDir(cwd, activation.runId);
|
|
29689
|
-
const
|
|
29687
|
+
const path103 = getSkillActivationsPath(cwd, activation.runId);
|
|
29690
29688
|
const line4 = JSON.stringify(activation) + "\n";
|
|
29691
|
-
writeFileSync4(
|
|
29689
|
+
writeFileSync4(path103, line4, { flag: "a", encoding: "utf-8" });
|
|
29692
29690
|
return activation;
|
|
29693
29691
|
}
|
|
29694
29692
|
function getSkillActivations(cwd, runId) {
|
|
29695
|
-
const
|
|
29696
|
-
if (!existsSync27(
|
|
29693
|
+
const path103 = getSkillActivationsPath(cwd, runId);
|
|
29694
|
+
if (!existsSync27(path103)) {
|
|
29697
29695
|
return [];
|
|
29698
29696
|
}
|
|
29699
|
-
const content = readFileSync31(
|
|
29697
|
+
const content = readFileSync31(path103, "utf-8");
|
|
29700
29698
|
if (!content.trim()) {
|
|
29701
29699
|
return [];
|
|
29702
29700
|
}
|
|
@@ -29875,7 +29873,7 @@ __export(skill_instructions_exports, {
|
|
|
29875
29873
|
resolveTaskSkillNames: () => resolveTaskSkillNames
|
|
29876
29874
|
});
|
|
29877
29875
|
import * as fs50 from "node:fs";
|
|
29878
|
-
import * as
|
|
29876
|
+
import * as path38 from "node:path";
|
|
29879
29877
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
29880
29878
|
import * as os11 from "node:os";
|
|
29881
29879
|
function isValidSkillName(name) {
|
|
@@ -29927,18 +29925,18 @@ function candidateSkillDirs(cwd) {
|
|
|
29927
29925
|
// F6 (v0.7.9): same five roots as discover-skills, in the same precedence
|
|
29928
29926
|
// order. The first hit wins, so a project `.pi/skills/foo/SKILL.md`
|
|
29929
29927
|
// overrides both the bundled `foo` and any legacy `<cwd>/skills/foo`.
|
|
29930
|
-
{ root:
|
|
29928
|
+
{ root: path38.resolve(cwd, ".pi", "skills"), source: "project-pi" },
|
|
29931
29929
|
{
|
|
29932
|
-
root:
|
|
29930
|
+
root: path38.resolve(cwd, ".agents", "skills"),
|
|
29933
29931
|
source: "project-agents"
|
|
29934
29932
|
},
|
|
29935
|
-
{ root:
|
|
29936
|
-
{ root:
|
|
29933
|
+
{ root: path38.resolve(cwd, "skills"), source: "project" },
|
|
29934
|
+
{ root: path38.join(getAgentDir(), "skills"), source: "user-pi" },
|
|
29937
29935
|
{
|
|
29938
|
-
root:
|
|
29936
|
+
root: path38.join(os11.homedir(), ".agents", "skills"),
|
|
29939
29937
|
source: "user-agents"
|
|
29940
29938
|
},
|
|
29941
|
-
{ root:
|
|
29939
|
+
{ root: path38.join(os11.homedir(), ".pi", "skills"), source: "user-pi" }
|
|
29942
29940
|
];
|
|
29943
29941
|
}
|
|
29944
29942
|
function rememberSkill(key, value) {
|
|
@@ -29984,7 +29982,7 @@ function cachedSkillFresh(value) {
|
|
|
29984
29982
|
}
|
|
29985
29983
|
function readSkillMarkdown(cwd, name) {
|
|
29986
29984
|
if (!isValidSkillName(name)) return void 0;
|
|
29987
|
-
const cacheKey2 = `${
|
|
29985
|
+
const cacheKey2 = `${path38.resolve(cwd)}:${name}`;
|
|
29988
29986
|
const cached2 = skillReadCache.get(cacheKey2);
|
|
29989
29987
|
if (cached2 && cachedSkillFresh(cached2)) {
|
|
29990
29988
|
skillCacheStats.hits++;
|
|
@@ -29995,7 +29993,7 @@ function readSkillMarkdown(cwd, name) {
|
|
|
29995
29993
|
skillCacheStats.currentSize = skillReadCache.size;
|
|
29996
29994
|
for (const entry of candidateSkillDirs(cwd)) {
|
|
29997
29995
|
try {
|
|
29998
|
-
const relative9 =
|
|
29996
|
+
const relative9 = path38.join(name, "SKILL.md");
|
|
29999
29997
|
const contained = resolveRealContainedPath(entry.root, relative9);
|
|
30000
29998
|
if (!fs50.existsSync(contained)) continue;
|
|
30001
29999
|
if (fs50.lstatSync(contained).isSymbolicLink()) continue;
|
|
@@ -30070,7 +30068,7 @@ Skill '${safeName}' was selected but no SKILL.md file was found. Continue with t
|
|
|
30070
30068
|
if (!pushSection(missing)) omittedCount += 1;
|
|
30071
30069
|
continue;
|
|
30072
30070
|
}
|
|
30073
|
-
skillPaths.push(
|
|
30071
|
+
skillPaths.push(path38.dirname(loaded.path));
|
|
30074
30072
|
const description = frontmatterDescription(loaded.content);
|
|
30075
30073
|
const source = loaded.source === "project" ? `project:skills/${safeName}` : `package:skills/${safeName}`;
|
|
30076
30074
|
const weighted = weightedSkills?.find((w) => w.skillId === name);
|
|
@@ -30085,7 +30083,7 @@ Skill '${safeName}' was selected but no SKILL.md file was found. Continue with t
|
|
|
30085
30083
|
// spec "small instruction + large local reference" pattern, e.g.
|
|
30086
30084
|
// effective-html's `references/html-effectiveness/`) leave the agent
|
|
30087
30085
|
// guessing the skill dir. No behavior change for corpus-less skills.
|
|
30088
|
-
`Path: ${
|
|
30086
|
+
`Path: ${path38.dirname(loaded.path)}`
|
|
30089
30087
|
].filter(Boolean).join("\n");
|
|
30090
30088
|
const rawContent = loaded.compacted;
|
|
30091
30089
|
const wrappedContent = `<!-- skill: ${safeName} -->
|
|
@@ -30129,7 +30127,7 @@ var init_skill_instructions = __esm({
|
|
|
30129
30127
|
init_safe_paths();
|
|
30130
30128
|
init_skill_effectiveness();
|
|
30131
30129
|
init_peer_dep();
|
|
30132
|
-
PACKAGE_SKILLS_DIR =
|
|
30130
|
+
PACKAGE_SKILLS_DIR = path38.resolve(path38.dirname(fileURLToPath4(import.meta.url)), "..", "..", "skills");
|
|
30133
30131
|
MAX_SKILL_CHARS = 1500;
|
|
30134
30132
|
MAX_TOTAL_CHARS = 6e3;
|
|
30135
30133
|
MAX_SKILL_NAME_CHARS = 80;
|
|
@@ -32133,7 +32131,7 @@ var init_agent_observability = __esm({
|
|
|
32133
32131
|
// src/skills/validate.ts
|
|
32134
32132
|
import * as fs53 from "node:fs";
|
|
32135
32133
|
import { createRequire as createRequire5 } from "node:module";
|
|
32136
|
-
import * as
|
|
32134
|
+
import * as path39 from "node:path";
|
|
32137
32135
|
function getYaml() {
|
|
32138
32136
|
if (!yamlModule) {
|
|
32139
32137
|
const require5 = createRequire5(import.meta.url);
|
|
@@ -32161,16 +32159,16 @@ function parseSkillFrontmatter(content) {
|
|
|
32161
32159
|
};
|
|
32162
32160
|
}
|
|
32163
32161
|
}
|
|
32164
|
-
function hard(
|
|
32165
|
-
return { path:
|
|
32162
|
+
function hard(path103, field, reason) {
|
|
32163
|
+
return { path: path103, field, reason, severity: "error" };
|
|
32166
32164
|
}
|
|
32167
|
-
function warn(
|
|
32168
|
-
return { path:
|
|
32165
|
+
function warn(path103, field, reason) {
|
|
32166
|
+
return { path: path103, field, reason, severity: "warn" };
|
|
32169
32167
|
}
|
|
32170
32168
|
function validateSkillFrontmatter(skillDir) {
|
|
32171
32169
|
const errors2 = [];
|
|
32172
|
-
const skillMdPath =
|
|
32173
|
-
const derivedName =
|
|
32170
|
+
const skillMdPath = path39.join(skillDir, "SKILL.md");
|
|
32171
|
+
const derivedName = path39.basename(skillDir);
|
|
32174
32172
|
let content;
|
|
32175
32173
|
try {
|
|
32176
32174
|
content = fs53.readFileSync(skillMdPath, "utf-8");
|
|
@@ -32306,23 +32304,23 @@ var init_validate = __esm({
|
|
|
32306
32304
|
// src/skills/discover-skills.ts
|
|
32307
32305
|
import * as fs54 from "node:fs";
|
|
32308
32306
|
import * as os12 from "node:os";
|
|
32309
|
-
import * as
|
|
32307
|
+
import * as path40 from "node:path";
|
|
32310
32308
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
32311
32309
|
function listSkillDirs(cwd) {
|
|
32312
32310
|
return [
|
|
32313
32311
|
{ root: PACKAGE_SKILLS_DIR2, source: "package" },
|
|
32314
|
-
{ root:
|
|
32312
|
+
{ root: path40.resolve(cwd, ".pi", "skills"), source: "project-pi" },
|
|
32315
32313
|
{
|
|
32316
|
-
root:
|
|
32314
|
+
root: path40.resolve(cwd, ".agents", "skills"),
|
|
32317
32315
|
source: "project-agents"
|
|
32318
32316
|
},
|
|
32319
|
-
{ root:
|
|
32320
|
-
{ root:
|
|
32317
|
+
{ root: path40.resolve(cwd, "skills"), source: "project" },
|
|
32318
|
+
{ root: path40.join(getAgentDir(), "skills"), source: "user-pi" },
|
|
32321
32319
|
{
|
|
32322
|
-
root:
|
|
32320
|
+
root: path40.join(os12.homedir(), ".agents", "skills"),
|
|
32323
32321
|
source: "user-agents"
|
|
32324
32322
|
},
|
|
32325
|
-
{ root:
|
|
32323
|
+
{ root: path40.join(os12.homedir(), ".pi", "skills"), source: "user-pi" }
|
|
32326
32324
|
];
|
|
32327
32325
|
}
|
|
32328
32326
|
function readDescription(content) {
|
|
@@ -32354,13 +32352,13 @@ function discoverSkills(cwd) {
|
|
|
32354
32352
|
})) {
|
|
32355
32353
|
if (!entry.isDirectory()) continue;
|
|
32356
32354
|
if (!isSafePathId(entry.name)) continue;
|
|
32357
|
-
const skillDirPath =
|
|
32355
|
+
const skillDirPath = path40.join(dir.root, entry.name);
|
|
32358
32356
|
try {
|
|
32359
32357
|
if (fs54.lstatSync(skillDirPath).isSymbolicLink()) continue;
|
|
32360
32358
|
} catch {
|
|
32361
32359
|
continue;
|
|
32362
32360
|
}
|
|
32363
|
-
const skillMdRelative =
|
|
32361
|
+
const skillMdRelative = path40.join(entry.name, "SKILL.md");
|
|
32364
32362
|
let skillMdPath;
|
|
32365
32363
|
try {
|
|
32366
32364
|
skillMdPath = resolveContainedPath(dir.root, skillMdRelative);
|
|
@@ -32386,7 +32384,7 @@ function discoverSkills(cwd) {
|
|
|
32386
32384
|
description = desc;
|
|
32387
32385
|
if (parseError) {
|
|
32388
32386
|
diagnostics.push({
|
|
32389
|
-
path:
|
|
32387
|
+
path: path40.dirname(skillMdPath),
|
|
32390
32388
|
field: "frontmatter",
|
|
32391
32389
|
reason: parseError,
|
|
32392
32390
|
severity: "error"
|
|
@@ -32408,7 +32406,7 @@ function discoverSkills(cwd) {
|
|
|
32408
32406
|
}
|
|
32409
32407
|
const filtered = [];
|
|
32410
32408
|
for (const skill of results) {
|
|
32411
|
-
const validation = validateSkillFrontmatter(
|
|
32409
|
+
const validation = validateSkillFrontmatter(path40.dirname(skill.path));
|
|
32412
32410
|
if (validation.ok) {
|
|
32413
32411
|
filtered.push(skill);
|
|
32414
32412
|
} else {
|
|
@@ -32427,7 +32425,7 @@ var init_discover_skills = __esm({
|
|
|
32427
32425
|
init_internal_error();
|
|
32428
32426
|
init_safe_paths();
|
|
32429
32427
|
init_validate();
|
|
32430
|
-
PACKAGE_SKILLS_DIR2 =
|
|
32428
|
+
PACKAGE_SKILLS_DIR2 = path40.resolve(path40.dirname(fileURLToPath5(import.meta.url)), "..", "..", "skills");
|
|
32431
32429
|
CACHE_TTL_MS = 3e4;
|
|
32432
32430
|
cache2 = null;
|
|
32433
32431
|
lastDiagnostics = [];
|
|
@@ -32535,9 +32533,9 @@ var init_capability_inventory = __esm({
|
|
|
32535
32533
|
|
|
32536
32534
|
// src/runtime/foreground-control.ts
|
|
32537
32535
|
import * as fs55 from "node:fs";
|
|
32538
|
-
import * as
|
|
32536
|
+
import * as path41 from "node:path";
|
|
32539
32537
|
function foregroundControlPath(manifest) {
|
|
32540
|
-
return
|
|
32538
|
+
return path41.join(manifest.stateRoot, "foreground-control.json");
|
|
32541
32539
|
}
|
|
32542
32540
|
function readLastRequest(controlPath) {
|
|
32543
32541
|
if (!fs55.existsSync(controlPath)) return void 0;
|
|
@@ -32566,7 +32564,7 @@ function readForegroundControlStatus(manifest, tasks) {
|
|
|
32566
32564
|
function writeForegroundInterruptRequest(manifest, reason = "User requested foreground interrupt.") {
|
|
32567
32565
|
const controlPath = foregroundControlPath(manifest);
|
|
32568
32566
|
const lockDir = `${controlPath}.lock`;
|
|
32569
|
-
const pidFile =
|
|
32567
|
+
const pidFile = path41.join(lockDir, "pid");
|
|
32570
32568
|
let requests = [];
|
|
32571
32569
|
const acquireLock = () => {
|
|
32572
32570
|
const timeout = 5e3;
|
|
@@ -32659,7 +32657,7 @@ function writeForegroundInterruptRequest(manifest, reason = "User requested fore
|
|
|
32659
32657
|
reason,
|
|
32660
32658
|
acknowledged: false
|
|
32661
32659
|
};
|
|
32662
|
-
fs55.mkdirSync(
|
|
32660
|
+
fs55.mkdirSync(path41.dirname(controlPath), { recursive: true });
|
|
32663
32661
|
atomicWriteFile(controlPath, `${JSON.stringify({ requests: [...requests, request] }, null, 2)}
|
|
32664
32662
|
`);
|
|
32665
32663
|
try {
|
|
@@ -32993,7 +32991,7 @@ var init_mcp_proxy = __esm({
|
|
|
32993
32991
|
|
|
32994
32992
|
// src/runtime/output/sidechain-output.ts
|
|
32995
32993
|
import * as fs56 from "node:fs";
|
|
32996
|
-
import * as
|
|
32994
|
+
import * as path42 from "node:path";
|
|
32997
32995
|
function queueJsonlLine(filePath, line4) {
|
|
32998
32996
|
const pending2 = pendingJsonlBatches.get(filePath);
|
|
32999
32997
|
if (pending2) {
|
|
@@ -33010,7 +33008,7 @@ function flushJsonlBatch(filePath) {
|
|
|
33010
33008
|
pendingJsonlBatches.delete(filePath);
|
|
33011
33009
|
clearTimeout(pending2.timer);
|
|
33012
33010
|
try {
|
|
33013
|
-
fs56.mkdirSync(
|
|
33011
|
+
fs56.mkdirSync(path42.dirname(filePath), { recursive: true });
|
|
33014
33012
|
fs56.appendFileSync(filePath, pending2.lines.join(""), "utf-8");
|
|
33015
33013
|
} catch (error) {
|
|
33016
33014
|
logInternalError("sidechain-output.flush", error, `path=${filePath}`);
|
|
@@ -33028,7 +33026,7 @@ function flushPendingSidechainWrites() {
|
|
|
33028
33026
|
}
|
|
33029
33027
|
function sidechainOutputPath(stateRoot, taskId) {
|
|
33030
33028
|
if (!isSafePathId(taskId)) throw new Error(`Invalid taskId: ${taskId}`);
|
|
33031
|
-
return
|
|
33029
|
+
return path42.join(stateRoot, "agents", taskId, "sidechain.output.jsonl");
|
|
33032
33030
|
}
|
|
33033
33031
|
function eventToSidechainType(event) {
|
|
33034
33032
|
if (!event || typeof event !== "object" || Array.isArray(event)) return void 0;
|
|
@@ -33052,12 +33050,12 @@ var init_sidechain_output = __esm({
|
|
|
33052
33050
|
|
|
33053
33051
|
// src/runtime/output/streaming-output.ts
|
|
33054
33052
|
import * as fs57 from "node:fs";
|
|
33055
|
-
import * as
|
|
33053
|
+
import * as path43 from "node:path";
|
|
33056
33054
|
function createStreamingOutput(manifest, taskId) {
|
|
33057
33055
|
if (!isSafePathId(taskId)) throw new Error(`Invalid taskId: ${taskId}`);
|
|
33058
|
-
const outputDir =
|
|
33056
|
+
const outputDir = path43.join(manifest.artifactsRoot, "streaming");
|
|
33059
33057
|
fs57.mkdirSync(outputDir, { recursive: true });
|
|
33060
|
-
const outputPath =
|
|
33058
|
+
const outputPath = path43.join(outputDir, `${taskId}.md`);
|
|
33061
33059
|
let buffer = "";
|
|
33062
33060
|
let closed = false;
|
|
33063
33061
|
return {
|
|
@@ -36329,8 +36327,8 @@ var require_utils = __commonJS({
|
|
|
36329
36327
|
}
|
|
36330
36328
|
return ind;
|
|
36331
36329
|
}
|
|
36332
|
-
function removeDotSegments(
|
|
36333
|
-
let input =
|
|
36330
|
+
function removeDotSegments(path103) {
|
|
36331
|
+
let input = path103;
|
|
36334
36332
|
const output = [];
|
|
36335
36333
|
let nextSlash = -1;
|
|
36336
36334
|
let len = 0;
|
|
@@ -36582,8 +36580,8 @@ var require_schemes = __commonJS({
|
|
|
36582
36580
|
wsComponent.secure = void 0;
|
|
36583
36581
|
}
|
|
36584
36582
|
if (wsComponent.resourceName) {
|
|
36585
|
-
const [
|
|
36586
|
-
wsComponent.path =
|
|
36583
|
+
const [path103, query] = wsComponent.resourceName.split("?");
|
|
36584
|
+
wsComponent.path = path103 && path103 !== "/" ? path103 : void 0;
|
|
36587
36585
|
wsComponent.query = query;
|
|
36588
36586
|
wsComponent.resourceName = void 0;
|
|
36589
36587
|
}
|
|
@@ -42339,7 +42337,7 @@ var init_scheduler = __esm({
|
|
|
42339
42337
|
// src/runtime/settings-store.ts
|
|
42340
42338
|
import * as fs59 from "node:fs";
|
|
42341
42339
|
import { homedir as homedir9 } from "node:os";
|
|
42342
|
-
import * as
|
|
42340
|
+
import * as path44 from "node:path";
|
|
42343
42341
|
function validateScheduledJob(job) {
|
|
42344
42342
|
if (!job || typeof job !== "object") return false;
|
|
42345
42343
|
const obj = job;
|
|
@@ -42376,10 +42374,10 @@ function sanitizeSettings(raw) {
|
|
|
42376
42374
|
return out;
|
|
42377
42375
|
}
|
|
42378
42376
|
function globalPath() {
|
|
42379
|
-
return
|
|
42377
|
+
return path44.join(homedir9(), ".pi", "crew-settings.json");
|
|
42380
42378
|
}
|
|
42381
42379
|
function projectPath(cwd) {
|
|
42382
|
-
return
|
|
42380
|
+
return path44.join(cwd, ".pi", "crew-settings.json");
|
|
42383
42381
|
}
|
|
42384
42382
|
function readSettingsFile(filePath) {
|
|
42385
42383
|
if (!fs59.existsSync(filePath)) return {};
|
|
@@ -42398,7 +42396,7 @@ function loadCrewSettings(cwd = process.cwd()) {
|
|
|
42398
42396
|
}
|
|
42399
42397
|
function updateCrewSettings(cwd, mutator) {
|
|
42400
42398
|
const p = projectPath(cwd);
|
|
42401
|
-
fs59.mkdirSync(
|
|
42399
|
+
fs59.mkdirSync(path44.dirname(p), { recursive: true });
|
|
42402
42400
|
return withFileLockSync(p, () => {
|
|
42403
42401
|
const fresh = loadCrewSettings(cwd);
|
|
42404
42402
|
const next = mutator(fresh);
|
|
@@ -43407,11 +43405,11 @@ function resolveSchemaKey(schema, key) {
|
|
|
43407
43405
|
childSchema: childSchemas[0]
|
|
43408
43406
|
};
|
|
43409
43407
|
}
|
|
43410
|
-
function findUnknownConfigKeyPaths(value, schema, depth = 0,
|
|
43408
|
+
function findUnknownConfigKeyPaths(value, schema, depth = 0, path103 = []) {
|
|
43411
43409
|
if (!isRecord2(value) || depth > MAX_CONFIG_KEY_DEPTH) return [];
|
|
43412
43410
|
const unknownPaths = [];
|
|
43413
43411
|
for (const [key, childValue] of Object.entries(value)) {
|
|
43414
|
-
const childPath = [...
|
|
43412
|
+
const childPath = [...path103, key];
|
|
43415
43413
|
const resolution = resolveSchemaKey(schema, key);
|
|
43416
43414
|
if (!resolution.allowed) {
|
|
43417
43415
|
unknownPaths.push(childPath);
|
|
@@ -43423,8 +43421,8 @@ function findUnknownConfigKeyPaths(value, schema, depth = 0, path104 = []) {
|
|
|
43423
43421
|
}
|
|
43424
43422
|
return unknownPaths;
|
|
43425
43423
|
}
|
|
43426
|
-
function isAgentOverrideKeyPath(
|
|
43427
|
-
return
|
|
43424
|
+
function isAgentOverrideKeyPath(path103) {
|
|
43425
|
+
return path103.length === 4 && path103[0] === "agents" && path103[1] === "overrides";
|
|
43428
43426
|
}
|
|
43429
43427
|
function extractConfigReferences(config) {
|
|
43430
43428
|
const agents = /* @__PURE__ */ new Set();
|
|
@@ -43901,7 +43899,7 @@ var init_validate_resources = __esm({
|
|
|
43901
43899
|
// src/extension/team-tool/doctor.ts
|
|
43902
43900
|
import { execFileSync as execFileSync4, spawnSync } from "node:child_process";
|
|
43903
43901
|
import * as fs61 from "node:fs";
|
|
43904
|
-
import * as
|
|
43902
|
+
import * as path45 from "node:path";
|
|
43905
43903
|
function relativeTimeAgo(iso) {
|
|
43906
43904
|
const ms = Date.now() - Date.parse(iso);
|
|
43907
43905
|
if (!Number.isFinite(ms)) return iso;
|
|
@@ -43913,13 +43911,13 @@ function relativeTimeAgo(iso) {
|
|
|
43913
43911
|
return `${Math.floor(hours / 24)}d ago`;
|
|
43914
43912
|
}
|
|
43915
43913
|
function scanRecentFsFailureCauses(cwd) {
|
|
43916
|
-
const runsRoot =
|
|
43914
|
+
const runsRoot = path45.join(projectCrewRoot(cwd), DEFAULT_PATHS.state.runsSubdir);
|
|
43917
43915
|
let recentRunIds;
|
|
43918
43916
|
try {
|
|
43919
43917
|
recentRunIds = fs61.readdirSync(runsRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => {
|
|
43920
43918
|
let mtimeMs = 0;
|
|
43921
43919
|
try {
|
|
43922
|
-
mtimeMs = fs61.statSync(
|
|
43920
|
+
mtimeMs = fs61.statSync(path45.join(runsRoot, entry.name)).mtimeMs;
|
|
43923
43921
|
} catch {
|
|
43924
43922
|
}
|
|
43925
43923
|
return { runId: entry.name, mtimeMs };
|
|
@@ -43932,7 +43930,7 @@ function scanRecentFsFailureCauses(cwd) {
|
|
|
43932
43930
|
for (const runId of recentRunIds) {
|
|
43933
43931
|
let tasks;
|
|
43934
43932
|
try {
|
|
43935
|
-
tasks = JSON.parse(fs61.readFileSync(
|
|
43933
|
+
tasks = JSON.parse(fs61.readFileSync(path45.join(runsRoot, runId, "tasks.json"), "utf-8"));
|
|
43936
43934
|
} catch {
|
|
43937
43935
|
continue;
|
|
43938
43936
|
}
|
|
@@ -44113,12 +44111,12 @@ function buildTeamDoctorReport(input) {
|
|
|
44113
44111
|
{
|
|
44114
44112
|
label: "project state root",
|
|
44115
44113
|
ok: true,
|
|
44116
|
-
detail:
|
|
44114
|
+
detail: path45.join(projectCrewRoot(input.cwd), DEFAULT_PATHS.state.runsSubdir)
|
|
44117
44115
|
},
|
|
44118
44116
|
{
|
|
44119
44117
|
label: "artifacts root",
|
|
44120
44118
|
ok: true,
|
|
44121
|
-
detail:
|
|
44119
|
+
detail: path45.join(projectCrewRoot(input.cwd), DEFAULT_PATHS.state.artifactsSubdir)
|
|
44122
44120
|
},
|
|
44123
44121
|
{
|
|
44124
44122
|
// bug-026 sub-issue B: INFORMATIONAL (ok always true) — a historical
|
|
@@ -44325,13 +44323,13 @@ function collectTerminalRunOrphanTabs(records) {
|
|
|
44325
44323
|
return tabs;
|
|
44326
44324
|
}
|
|
44327
44325
|
function readRecentRunManifests(cwd, limit) {
|
|
44328
|
-
const runsRoot =
|
|
44326
|
+
const runsRoot = path45.join(projectCrewRoot(cwd), DEFAULT_PATHS.state.runsSubdir);
|
|
44329
44327
|
let recentRunIds;
|
|
44330
44328
|
try {
|
|
44331
44329
|
recentRunIds = fs61.readdirSync(runsRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => {
|
|
44332
44330
|
let mtimeMs = 0;
|
|
44333
44331
|
try {
|
|
44334
|
-
mtimeMs = fs61.statSync(
|
|
44332
|
+
mtimeMs = fs61.statSync(path45.join(runsRoot, entry.name)).mtimeMs;
|
|
44335
44333
|
} catch {
|
|
44336
44334
|
}
|
|
44337
44335
|
return { runId: entry.name, mtimeMs };
|
|
@@ -44341,7 +44339,7 @@ function readRecentRunManifests(cwd, limit) {
|
|
|
44341
44339
|
}
|
|
44342
44340
|
const records = [];
|
|
44343
44341
|
for (const runId of recentRunIds) {
|
|
44344
|
-
const manifestPath =
|
|
44342
|
+
const manifestPath = path45.join(runsRoot, runId, "manifest.json");
|
|
44345
44343
|
let manifest;
|
|
44346
44344
|
try {
|
|
44347
44345
|
manifest = JSON.parse(fs61.readFileSync(manifestPath, "utf-8"));
|
|
@@ -44706,7 +44704,7 @@ var init_markers = __esm({
|
|
|
44706
44704
|
// src/worktree/cleanup.ts
|
|
44707
44705
|
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
44708
44706
|
import * as fs63 from "node:fs";
|
|
44709
|
-
import * as
|
|
44707
|
+
import * as path46 from "node:path";
|
|
44710
44708
|
function sanitizeBranchPart(value) {
|
|
44711
44709
|
return value.toLowerCase().replace(/[^a-z0-9._/-]+/g, "-").replace(/^-+|-+$/g, "") || "task";
|
|
44712
44710
|
}
|
|
@@ -44750,7 +44748,7 @@ function captureDiff(worktreePath) {
|
|
|
44750
44748
|
}
|
|
44751
44749
|
function cleanupRunWorktrees(manifest, options = {}) {
|
|
44752
44750
|
const sanitizedRunId = manifest.runId.replace(/[^a-zA-Z0-9._-]/g, "-").replace(/^-+|-+$/g, "") || "run";
|
|
44753
|
-
const worktreeRoot =
|
|
44751
|
+
const worktreeRoot = path46.join(projectCrewRoot(manifest.cwd), DEFAULT_PATHS.state.worktreesSubdir, sanitizedRunId);
|
|
44754
44752
|
const result4 = {
|
|
44755
44753
|
removed: [],
|
|
44756
44754
|
preserved: [],
|
|
@@ -44763,7 +44761,7 @@ function cleanupRunWorktrees(manifest, options = {}) {
|
|
|
44763
44761
|
if (options.signal?.aborted) break;
|
|
44764
44762
|
if (!entry.isDirectory()) continue;
|
|
44765
44763
|
if (options.signal?.aborted) break;
|
|
44766
|
-
const worktreePath =
|
|
44764
|
+
const worktreePath = path46.join(worktreeRoot, entry.name);
|
|
44767
44765
|
if (options.signal?.aborted) break;
|
|
44768
44766
|
const dirty = isDirty(worktreePath);
|
|
44769
44767
|
const branchName = `pi-crew/${manifest.runId}/${sanitizeBranchPart(entry.name)}`;
|
|
@@ -44983,15 +44981,15 @@ var init_cleanup = __esm({
|
|
|
44983
44981
|
|
|
44984
44982
|
// src/extension/import-index.ts
|
|
44985
44983
|
import * as fs64 from "node:fs";
|
|
44986
|
-
import * as
|
|
44984
|
+
import * as path47 from "node:path";
|
|
44987
44985
|
function readEntry(root, scope, runId) {
|
|
44988
44986
|
if (!isSafePathId(runId)) return void 0;
|
|
44989
44987
|
let bundlePath;
|
|
44990
44988
|
let summaryPath;
|
|
44991
44989
|
try {
|
|
44992
44990
|
const entryRoot = resolveRealContainedPath(root, runId);
|
|
44993
|
-
bundlePath = resolveRealContainedPath(root,
|
|
44994
|
-
summaryPath =
|
|
44991
|
+
bundlePath = resolveRealContainedPath(root, path47.join(runId, "run-export.json"));
|
|
44992
|
+
summaryPath = path47.join(entryRoot, "README.md");
|
|
44995
44993
|
} catch {
|
|
44996
44994
|
return void 0;
|
|
44997
44995
|
}
|
|
@@ -45018,15 +45016,15 @@ function collect(root, scope) {
|
|
|
45018
45016
|
if (!fs64.existsSync(root)) return [];
|
|
45019
45017
|
try {
|
|
45020
45018
|
if (fs64.lstatSync(root).isSymbolicLink()) return [];
|
|
45021
|
-
resolveRealContainedPath(
|
|
45019
|
+
resolveRealContainedPath(path47.dirname(root), path47.basename(root));
|
|
45022
45020
|
} catch {
|
|
45023
45021
|
return [];
|
|
45024
45022
|
}
|
|
45025
45023
|
return fs64.readdirSync(root).filter((entry) => isSafePathId(entry)).map((entry) => readEntry(root, scope, entry)).filter((entry) => entry !== void 0);
|
|
45026
45024
|
}
|
|
45027
45025
|
function listImportedRuns(cwd) {
|
|
45028
|
-
const projectRoot =
|
|
45029
|
-
const userRoot =
|
|
45026
|
+
const projectRoot = path47.join(projectCrewRoot(cwd), DEFAULT_PATHS.state.importsSubdir);
|
|
45027
|
+
const userRoot = path47.join(userCrewRoot(), DEFAULT_PATHS.state.importsSubdir);
|
|
45030
45028
|
return [...collect(userRoot, "user"), ...collect(projectRoot, "project")].sort(
|
|
45031
45029
|
(a, b) => (b.importedAt ?? "").localeCompare(a.importedAt ?? "")
|
|
45032
45030
|
);
|
|
@@ -45044,7 +45042,7 @@ var init_import_index = __esm({
|
|
|
45044
45042
|
import * as crypto4 from "node:crypto";
|
|
45045
45043
|
import * as fs65 from "node:fs";
|
|
45046
45044
|
import * as os13 from "node:os";
|
|
45047
|
-
import * as
|
|
45045
|
+
import * as path48 from "node:path";
|
|
45048
45046
|
function escapeRegex(str) {
|
|
45049
45047
|
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
45050
45048
|
}
|
|
@@ -45108,7 +45106,7 @@ function exportRunBundle(manifest, tasks) {
|
|
|
45108
45106
|
""
|
|
45109
45107
|
].join("\n")
|
|
45110
45108
|
});
|
|
45111
|
-
fs65.statSync(
|
|
45109
|
+
fs65.statSync(path48.dirname(json.path));
|
|
45112
45110
|
return { jsonPath: json.path, markdownPath: markdown.path };
|
|
45113
45111
|
}
|
|
45114
45112
|
var init_run_export = __esm({
|
|
@@ -45360,13 +45358,13 @@ var init_run_bundle_schema = __esm({
|
|
|
45360
45358
|
// src/extension/run-import.ts
|
|
45361
45359
|
import * as crypto5 from "node:crypto";
|
|
45362
45360
|
import * as fs66 from "node:fs";
|
|
45363
|
-
import * as
|
|
45361
|
+
import * as path49 from "node:path";
|
|
45364
45362
|
function importRoot(cwd, scope) {
|
|
45365
45363
|
const base = scope === "project" ? projectCrewRoot(cwd) : userCrewRoot();
|
|
45366
|
-
return
|
|
45364
|
+
return path49.join(base, DEFAULT_PATHS.state.importsSubdir);
|
|
45367
45365
|
}
|
|
45368
45366
|
function importRunBundle(cwd, bundlePath, scope = "project") {
|
|
45369
|
-
const resolvedPath =
|
|
45367
|
+
const resolvedPath = path49.isAbsolute(bundlePath) ? bundlePath : path49.resolve(cwd, bundlePath);
|
|
45370
45368
|
const allowedBases = [];
|
|
45371
45369
|
try {
|
|
45372
45370
|
allowedBases.push(userCrewRoot());
|
|
@@ -45417,7 +45415,7 @@ function importRunBundle(cwd, bundlePath, scope = "project") {
|
|
|
45417
45415
|
);
|
|
45418
45416
|
let conflictReport;
|
|
45419
45417
|
try {
|
|
45420
|
-
const existingManifestPath =
|
|
45418
|
+
const existingManifestPath = path49.join(importRoot(cwd, scope), runId, "run-export.json");
|
|
45421
45419
|
if (fs66.existsSync(existingManifestPath)) {
|
|
45422
45420
|
const existingRaw = JSON.parse(fs66.readFileSync(existingManifestPath, "utf-8"));
|
|
45423
45421
|
conflictReport = detectImportConflicts(
|
|
@@ -45433,13 +45431,13 @@ function importRunBundle(cwd, bundlePath, scope = "project") {
|
|
|
45433
45431
|
const importsRoot = importRoot(cwd, scope);
|
|
45434
45432
|
fs66.mkdirSync(importsRoot, { recursive: true });
|
|
45435
45433
|
if (fs66.lstatSync(importsRoot).isSymbolicLink()) throw new Error(`Invalid import root: ${importsRoot}`);
|
|
45436
|
-
resolveRealContainedPath(
|
|
45434
|
+
resolveRealContainedPath(path49.dirname(importsRoot), path49.basename(importsRoot));
|
|
45437
45435
|
const root = resolveContainedRelativePath(importsRoot, runId, "runId");
|
|
45438
45436
|
fs66.mkdirSync(root, { recursive: true });
|
|
45439
45437
|
if (fs66.lstatSync(root).isSymbolicLink()) throw new Error(`Invalid import directory: ${root}`);
|
|
45440
45438
|
resolveRealContainedPath(importsRoot, runId);
|
|
45441
|
-
const targetJson =
|
|
45442
|
-
const targetSummary =
|
|
45439
|
+
const targetJson = path49.join(root, "run-export.json");
|
|
45440
|
+
const targetSummary = path49.join(root, "README.md");
|
|
45443
45441
|
for (const target of [targetJson, targetSummary]) {
|
|
45444
45442
|
if (fs66.existsSync(target) && fs66.lstatSync(target).isSymbolicLink()) throw new Error(`Invalid import target: ${target}`);
|
|
45445
45443
|
}
|
|
@@ -45490,7 +45488,7 @@ var init_run_import = __esm({
|
|
|
45490
45488
|
|
|
45491
45489
|
// src/extension/run-maintenance.ts
|
|
45492
45490
|
import * as fs67 from "node:fs";
|
|
45493
|
-
import * as
|
|
45491
|
+
import * as path50 from "node:path";
|
|
45494
45492
|
function sweepStaleCorruptFiles(runsDir, maxAgeMs = DEFAULT_CORRUPT_FILE_TTL_MS, now = Date.now()) {
|
|
45495
45493
|
let deleted = 0;
|
|
45496
45494
|
let runDirs;
|
|
@@ -45501,7 +45499,7 @@ function sweepStaleCorruptFiles(runsDir, maxAgeMs = DEFAULT_CORRUPT_FILE_TTL_MS,
|
|
|
45501
45499
|
}
|
|
45502
45500
|
for (const dir of runDirs) {
|
|
45503
45501
|
if (!dir.isDirectory()) continue;
|
|
45504
|
-
const runDirPath =
|
|
45502
|
+
const runDirPath = path50.join(runsDir, dir.name);
|
|
45505
45503
|
let files;
|
|
45506
45504
|
try {
|
|
45507
45505
|
files = fs67.readdirSync(runDirPath);
|
|
@@ -45510,7 +45508,7 @@ function sweepStaleCorruptFiles(runsDir, maxAgeMs = DEFAULT_CORRUPT_FILE_TTL_MS,
|
|
|
45510
45508
|
}
|
|
45511
45509
|
for (const file of files) {
|
|
45512
45510
|
if (!file.includes(".corrupt-")) continue;
|
|
45513
|
-
const filePath =
|
|
45511
|
+
const filePath = path50.join(runDirPath, file);
|
|
45514
45512
|
try {
|
|
45515
45513
|
const mtime = fs67.statSync(filePath).mtimeMs;
|
|
45516
45514
|
if (now - mtime > maxAgeMs) {
|
|
@@ -45528,7 +45526,7 @@ function isFinished(run) {
|
|
|
45528
45526
|
}
|
|
45529
45527
|
function isSafeToPrune(cwd, run) {
|
|
45530
45528
|
try {
|
|
45531
|
-
const crewRoot = run.stateRoot.startsWith(userCrewRoot() +
|
|
45529
|
+
const crewRoot = run.stateRoot.startsWith(userCrewRoot() + path50.sep) ? userCrewRoot() : projectCrewRoot(cwd);
|
|
45532
45530
|
resolveRealContainedPath(crewRoot, run.stateRoot);
|
|
45533
45531
|
resolveRealContainedPath(crewRoot, run.artifactsRoot);
|
|
45534
45532
|
return true;
|
|
@@ -45538,8 +45536,8 @@ function isSafeToPrune(cwd, run) {
|
|
|
45538
45536
|
}
|
|
45539
45537
|
function appendPruneAudit(cwd, payload) {
|
|
45540
45538
|
try {
|
|
45541
|
-
const filePath =
|
|
45542
|
-
fs67.mkdirSync(
|
|
45539
|
+
const filePath = path50.join(projectCrewRoot(cwd), "audit", "prune.jsonl");
|
|
45540
|
+
fs67.mkdirSync(path50.dirname(filePath), { recursive: true });
|
|
45543
45541
|
fs67.appendFileSync(filePath, `${JSON.stringify(redactSecrets({ ...payload, auditedAt: (/* @__PURE__ */ new Date()).toISOString() }))}
|
|
45544
45542
|
`, "utf-8");
|
|
45545
45543
|
return filePath;
|
|
@@ -45585,7 +45583,7 @@ function pruneFinishedRuns(cwd, keep, options = {}) {
|
|
|
45585
45583
|
removed.push(run.runId);
|
|
45586
45584
|
}
|
|
45587
45585
|
if (!options.dryRun) {
|
|
45588
|
-
sweepStaleCorruptFiles(
|
|
45586
|
+
sweepStaleCorruptFiles(path50.join(projectCrewRoot(cwd), DEFAULT_PATHS.state.runsSubdir));
|
|
45589
45587
|
}
|
|
45590
45588
|
const auditPath = options.dryRun ? void 0 : appendPruneAudit(cwd, {
|
|
45591
45589
|
action: "prune",
|
|
@@ -45598,14 +45596,14 @@ function pruneFinishedRuns(cwd, keep, options = {}) {
|
|
|
45598
45596
|
}
|
|
45599
45597
|
function pruneUserLevelRuns(keep) {
|
|
45600
45598
|
const crewRoot = userCrewRoot();
|
|
45601
|
-
const runsRoot =
|
|
45599
|
+
const runsRoot = path50.join(crewRoot, DEFAULT_PATHS.state.runsSubdir);
|
|
45602
45600
|
if (!fs67.existsSync(runsRoot)) return { kept: [], removed: [] };
|
|
45603
45601
|
const MAX_DIRS = 500;
|
|
45604
45602
|
const finished = [];
|
|
45605
45603
|
const ghostRemoved = [];
|
|
45606
45604
|
const dirs = fs67.readdirSync(runsRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory() && isSafePathId(entry.name)).slice(0, MAX_DIRS).map((entry) => entry.name);
|
|
45607
45605
|
for (const dir of dirs) {
|
|
45608
|
-
const manifestPath =
|
|
45606
|
+
const manifestPath = path50.join(runsRoot, dir, DEFAULT_PATHS.state.manifestFile);
|
|
45609
45607
|
let manifest;
|
|
45610
45608
|
try {
|
|
45611
45609
|
manifest = JSON.parse(fs67.readFileSync(manifestPath, "utf-8"));
|
|
@@ -45614,7 +45612,7 @@ function pruneUserLevelRuns(keep) {
|
|
|
45614
45612
|
}
|
|
45615
45613
|
const isActive = manifest.status === "queued" || manifest.status === "running" || manifest.status === "planning";
|
|
45616
45614
|
if (isActive && manifest.cwd && !fs67.existsSync(manifest.cwd)) {
|
|
45617
|
-
fs67.rmSync(
|
|
45615
|
+
fs67.rmSync(path50.join(runsRoot, dir), {
|
|
45618
45616
|
recursive: true,
|
|
45619
45617
|
force: true
|
|
45620
45618
|
});
|
|
@@ -45664,7 +45662,7 @@ var init_run_maintenance = __esm({
|
|
|
45664
45662
|
|
|
45665
45663
|
// src/extension/team-tool/lifecycle-actions.ts
|
|
45666
45664
|
import * as fs68 from "node:fs";
|
|
45667
|
-
import * as
|
|
45665
|
+
import * as path51 from "node:path";
|
|
45668
45666
|
function handleWorktrees(params, ctx) {
|
|
45669
45667
|
if (!params.runId)
|
|
45670
45668
|
return result(
|
|
@@ -45895,7 +45893,7 @@ async function handleForget(params, ctx) {
|
|
|
45895
45893
|
logInternalError("team-tool.handleForget.killAsync", error, `runId=${loaded.manifest.runId},pid=${asyncPid}`);
|
|
45896
45894
|
}
|
|
45897
45895
|
}
|
|
45898
|
-
const crewRoot = loaded.manifest.stateRoot.startsWith(userCrewRoot() +
|
|
45896
|
+
const crewRoot = loaded.manifest.stateRoot.startsWith(userCrewRoot() + path51.sep) ? userCrewRoot() : projectCrewRoot(loaded.manifest.cwd);
|
|
45899
45897
|
const resolvedStateRoot = resolveRealContainedPath(crewRoot, loaded.manifest.stateRoot);
|
|
45900
45898
|
const resolvedArtifactsRoot = resolveRealContainedPath(crewRoot, loaded.manifest.artifactsRoot);
|
|
45901
45899
|
fs68.rmSync(resolvedStateRoot, { recursive: true, force: true });
|
|
@@ -45950,7 +45948,7 @@ function handleProjectCleanup(params, ctx) {
|
|
|
45950
45948
|
);
|
|
45951
45949
|
}
|
|
45952
45950
|
const lines = ["Project cleanup for pi-crew:"];
|
|
45953
|
-
const guidancePath =
|
|
45951
|
+
const guidancePath = path51.join(cwd, "AGENTS.md");
|
|
45954
45952
|
const guidanceResult = dryRun ? {
|
|
45955
45953
|
path: guidancePath,
|
|
45956
45954
|
modified: fs68.existsSync(guidancePath),
|
|
@@ -45982,7 +45980,7 @@ function handleProjectCleanup(params, ctx) {
|
|
|
45982
45980
|
lines.push(` - ERROR: could not resolve ${crewRoot} (skipped)`);
|
|
45983
45981
|
return result(lines.join("\n"), { action: "cleanup", status: "ok", scope }, false);
|
|
45984
45982
|
}
|
|
45985
|
-
if (!resolved.endsWith(
|
|
45983
|
+
if (!resolved.endsWith(path51.sep + ".crew") && !resolved.endsWith("/teams") && path51.basename(resolved) !== ".crew") {
|
|
45986
45984
|
lines.push(` - ERROR: refused to remove ${resolved} (does not look like a .crew dir) \u2014 skipped`);
|
|
45987
45985
|
} else {
|
|
45988
45986
|
if (!dryRun) {
|
|
@@ -46036,7 +46034,7 @@ function handleUserCleanup(params, ctx) {
|
|
|
46036
46034
|
} else {
|
|
46037
46035
|
lines.push(" - (not present \u2014 nothing to do)");
|
|
46038
46036
|
}
|
|
46039
|
-
const userConfigPath =
|
|
46037
|
+
const userConfigPath = path51.join(userPiRoot(), "pi-crew.json");
|
|
46040
46038
|
lines.push("pi-crew global config:");
|
|
46041
46039
|
if (!fs68.existsSync(userConfigPath)) {
|
|
46042
46040
|
lines.push(` - (not present at ${userConfigPath} \u2014 nothing to do)`);
|
|
@@ -46052,14 +46050,14 @@ function handleUserCleanup(params, ctx) {
|
|
|
46052
46050
|
}
|
|
46053
46051
|
lines.push(` - ${dryRun ? "would remove" : "removed"}: ${userConfigPath}`);
|
|
46054
46052
|
}
|
|
46055
|
-
const agentsDir =
|
|
46053
|
+
const agentsDir = path51.join(userPiRoot(), "agents");
|
|
46056
46054
|
lines.push("pi-crew test junk in agents dir:");
|
|
46057
46055
|
const bakJunk = [];
|
|
46058
46056
|
if (fs68.existsSync(agentsDir)) {
|
|
46059
46057
|
try {
|
|
46060
46058
|
for (const entry of fs68.readdirSync(agentsDir)) {
|
|
46061
46059
|
if (/^.*\.md\.bak-\d{17,}-[0-9a-f]+$/i.test(entry)) {
|
|
46062
|
-
bakJunk.push(
|
|
46060
|
+
bakJunk.push(path51.join(agentsDir, entry));
|
|
46063
46061
|
}
|
|
46064
46062
|
}
|
|
46065
46063
|
} catch {
|
|
@@ -46073,7 +46071,7 @@ function handleUserCleanup(params, ctx) {
|
|
|
46073
46071
|
try {
|
|
46074
46072
|
fs68.rmSync(junk, { force: true });
|
|
46075
46073
|
} catch (e) {
|
|
46076
|
-
lines.push(` - ERROR removing ${
|
|
46074
|
+
lines.push(` - ERROR removing ${path51.basename(junk)}: ${e.message}`);
|
|
46077
46075
|
}
|
|
46078
46076
|
}
|
|
46079
46077
|
}
|
|
@@ -46097,7 +46095,7 @@ function dirSize(dir) {
|
|
|
46097
46095
|
continue;
|
|
46098
46096
|
}
|
|
46099
46097
|
for (const entry of entries) {
|
|
46100
|
-
const full =
|
|
46098
|
+
const full = path51.join(cur, entry);
|
|
46101
46099
|
try {
|
|
46102
46100
|
const stat2 = fs68.statSync(full);
|
|
46103
46101
|
if (stat2.isDirectory()) stack.push(full);
|
|
@@ -46676,9 +46674,9 @@ var init_correlation = __esm({
|
|
|
46676
46674
|
|
|
46677
46675
|
// src/runtime/deadletter.ts
|
|
46678
46676
|
import * as fs69 from "node:fs";
|
|
46679
|
-
import * as
|
|
46677
|
+
import * as path52 from "node:path";
|
|
46680
46678
|
function deadletterPath(manifest) {
|
|
46681
|
-
return
|
|
46679
|
+
return path52.join(manifest.stateRoot, "deadletter.jsonl");
|
|
46682
46680
|
}
|
|
46683
46681
|
function appendDeadletter(manifest, entry) {
|
|
46684
46682
|
try {
|
|
@@ -46931,10 +46929,10 @@ var init_path_overlap = __esm({
|
|
|
46931
46929
|
|
|
46932
46930
|
// src/runtime/plan-replan.ts
|
|
46933
46931
|
import * as fs70 from "node:fs";
|
|
46934
|
-
import * as
|
|
46932
|
+
import * as path53 from "node:path";
|
|
46935
46933
|
function appendSteeringAdvisory(manifest, taskId) {
|
|
46936
46934
|
try {
|
|
46937
|
-
const steeringDir =
|
|
46935
|
+
const steeringDir = path53.join(manifest.artifactsRoot, "steering");
|
|
46938
46936
|
fs70.mkdirSync(steeringDir, { recursive: true });
|
|
46939
46937
|
const safePath = resolveRealContainedPath(steeringDir, `${taskId}.jsonl`);
|
|
46940
46938
|
try {
|
|
@@ -47399,28 +47397,28 @@ var init_run_worker = __esm({
|
|
|
47399
47397
|
import { createHash as createHash7 } from "node:crypto";
|
|
47400
47398
|
import * as fs71 from "node:fs";
|
|
47401
47399
|
import * as os15 from "node:os";
|
|
47402
|
-
import * as
|
|
47400
|
+
import * as path54 from "node:path";
|
|
47403
47401
|
function specsDir(cwd) {
|
|
47404
|
-
return
|
|
47402
|
+
return path54.join(projectCrewRoot(cwd), "state", "specs");
|
|
47405
47403
|
}
|
|
47406
47404
|
function userSpecsDir(cwd) {
|
|
47407
47405
|
const slugSource = (() => {
|
|
47408
47406
|
try {
|
|
47409
|
-
return fs71.realpathSync(
|
|
47407
|
+
return fs71.realpathSync(path54.resolve(cwd));
|
|
47410
47408
|
} catch {
|
|
47411
|
-
return
|
|
47409
|
+
return path54.resolve(cwd);
|
|
47412
47410
|
}
|
|
47413
47411
|
})();
|
|
47414
47412
|
const slug2 = createHash7("sha256").update(slugSource).digest("hex").slice(0, 16);
|
|
47415
|
-
return
|
|
47413
|
+
return path54.join(os15.homedir(), ".pi", "agent", "specs", slug2);
|
|
47416
47414
|
}
|
|
47417
47415
|
function recordPath(dir, id) {
|
|
47418
47416
|
assertSafeSpecId(id);
|
|
47419
|
-
return
|
|
47417
|
+
return path54.join(dir, `${id}.json`);
|
|
47420
47418
|
}
|
|
47421
47419
|
function sidecarPath(dir, id) {
|
|
47422
47420
|
assertSafeSpecId(id);
|
|
47423
|
-
return
|
|
47421
|
+
return path54.join(dir, `${id}.trusted`);
|
|
47424
47422
|
}
|
|
47425
47423
|
function assertSafeSpecId(id) {
|
|
47426
47424
|
if (!SPEC_ID_PATTERN.test(id)) throw new Error(`Invalid spec id: ${id}`);
|
|
@@ -47528,7 +47526,7 @@ var init_task_id = __esm({
|
|
|
47528
47526
|
});
|
|
47529
47527
|
|
|
47530
47528
|
// src/runtime/task-packet.ts
|
|
47531
|
-
import * as
|
|
47529
|
+
import * as path55 from "node:path";
|
|
47532
47530
|
function sanitizeTaskText(task) {
|
|
47533
47531
|
let sanitized = task;
|
|
47534
47532
|
sanitized = sanitized.replace(/[\u200B-\u200F\u2028-\u202F\u2060-\u206F\uFEFF]/g, "");
|
|
@@ -47578,7 +47576,7 @@ function buildTaskPacket(input) {
|
|
|
47578
47576
|
...input.specStrict === true ? { specStrict: true } : {},
|
|
47579
47577
|
scope,
|
|
47580
47578
|
scopePath,
|
|
47581
|
-
repo:
|
|
47579
|
+
repo: path55.basename(input.manifest.cwd) || input.manifest.cwd,
|
|
47582
47580
|
worktree: input.worktreePath,
|
|
47583
47581
|
branchPolicy: input.manifest.workspaceMode === "worktree" ? "Use the assigned task worktree and avoid modifying the leader checkout." : "Use the current checkout; do not create branches unless explicitly requested.",
|
|
47584
47582
|
acceptanceTests: [],
|
|
@@ -47730,7 +47728,7 @@ var init_team_runner_artifacts = __esm({
|
|
|
47730
47728
|
|
|
47731
47729
|
// src/runtime/workspace-tree.ts
|
|
47732
47730
|
import * as fs72 from "node:fs/promises";
|
|
47733
|
-
import * as
|
|
47731
|
+
import * as path56 from "node:path";
|
|
47734
47732
|
function formatBytes2(bytes) {
|
|
47735
47733
|
if (bytes < 1024) return `${bytes}B`;
|
|
47736
47734
|
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)}KB`;
|
|
@@ -47765,7 +47763,7 @@ function applyDirLimit(children, limit) {
|
|
|
47765
47763
|
return { visible, dropped: children.length - limit };
|
|
47766
47764
|
}
|
|
47767
47765
|
async function readChildren(rootPath, parent, excludedDirs) {
|
|
47768
|
-
const dirPath = parent.relativePath ?
|
|
47766
|
+
const dirPath = parent.relativePath ? path56.join(rootPath, parent.relativePath) : rootPath;
|
|
47769
47767
|
let names;
|
|
47770
47768
|
try {
|
|
47771
47769
|
names = await fs72.readdir(dirPath);
|
|
@@ -47776,7 +47774,7 @@ async function readChildren(rootPath, parent, excludedDirs) {
|
|
|
47776
47774
|
names.map(async (name) => {
|
|
47777
47775
|
if (name.startsWith(".")) return null;
|
|
47778
47776
|
const relativePath = parent.relativePath ? `${parent.relativePath}/${name}` : name;
|
|
47779
|
-
const absolutePath =
|
|
47777
|
+
const absolutePath = path56.join(rootPath, relativePath);
|
|
47780
47778
|
try {
|
|
47781
47779
|
const stat2 = await fs72.stat(absolutePath);
|
|
47782
47780
|
if (stat2.isDirectory() && excludedDirs.has(name)) return null;
|
|
@@ -47879,10 +47877,10 @@ function applyLineCap(lines, cap) {
|
|
|
47879
47877
|
return { lines: kept, elided: removable.length };
|
|
47880
47878
|
}
|
|
47881
47879
|
function treeCacheKey(cwd, options) {
|
|
47882
|
-
return `${
|
|
47880
|
+
return `${path56.resolve(cwd)}|${options?.maxDepth ?? ""}|${options?.dirLimit ?? ""}|${options?.lineCap ?? ""}`;
|
|
47883
47881
|
}
|
|
47884
47882
|
async function buildWorkspaceTree(cwd, options) {
|
|
47885
|
-
const rootPath =
|
|
47883
|
+
const rootPath = path56.resolve(cwd);
|
|
47886
47884
|
const cacheKey2 = treeCacheKey(cwd, options);
|
|
47887
47885
|
const cached2 = treeCache.get(cacheKey2);
|
|
47888
47886
|
if (cached2 && cached2.expiresAt > Date.now()) {
|
|
@@ -48334,9 +48332,9 @@ var init_task_display = __esm({
|
|
|
48334
48332
|
|
|
48335
48333
|
// src/extension/knowledge-injection.ts
|
|
48336
48334
|
import * as fs73 from "node:fs";
|
|
48337
|
-
import * as
|
|
48335
|
+
import * as path57 from "node:path";
|
|
48338
48336
|
function knowledgePath(cwd) {
|
|
48339
|
-
return
|
|
48337
|
+
return path57.join(projectCrewRoot(cwd), KNOWLEDGE_FILENAME);
|
|
48340
48338
|
}
|
|
48341
48339
|
function tokenizeHeader(header) {
|
|
48342
48340
|
const tokens = /* @__PURE__ */ new Set();
|
|
@@ -48606,7 +48604,7 @@ var init_knowledge_injection = __esm({
|
|
|
48606
48604
|
// src/runtime/agent-memory.ts
|
|
48607
48605
|
import * as fs74 from "node:fs";
|
|
48608
48606
|
import * as os16 from "node:os";
|
|
48609
|
-
import * as
|
|
48607
|
+
import * as path58 from "node:path";
|
|
48610
48608
|
function isUnsafeMemoryName(name) {
|
|
48611
48609
|
return !name || name.length > 128 || !/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(name);
|
|
48612
48610
|
}
|
|
@@ -48627,9 +48625,9 @@ function safeReadMemoryFile(filePath) {
|
|
|
48627
48625
|
}
|
|
48628
48626
|
function resolveMemoryDir(agentName, scope, cwd) {
|
|
48629
48627
|
if (isUnsafeMemoryName(agentName)) throw new Error(`Unsafe agent name for memory directory: ${agentName}`);
|
|
48630
|
-
if (scope === "user") return
|
|
48631
|
-
if (scope === "project") return
|
|
48632
|
-
return
|
|
48628
|
+
if (scope === "user") return path58.join(os16.homedir(), ".pi", "agent-memory", agentName);
|
|
48629
|
+
if (scope === "project") return path58.join(cwd, ".pi", "agent-memory", agentName);
|
|
48630
|
+
return path58.join(cwd, ".pi", "agent-memory-local", agentName);
|
|
48633
48631
|
}
|
|
48634
48632
|
function ensureMemoryDir(memoryDir) {
|
|
48635
48633
|
if (fs74.existsSync(memoryDir)) {
|
|
@@ -48640,7 +48638,7 @@ function ensureMemoryDir(memoryDir) {
|
|
|
48640
48638
|
}
|
|
48641
48639
|
function readMemoryIndex(memoryDir) {
|
|
48642
48640
|
if (isSymlink(memoryDir)) return void 0;
|
|
48643
|
-
const memPath =
|
|
48641
|
+
const memPath = path58.join(memoryDir, "MEMORY.md");
|
|
48644
48642
|
const content = safeReadMemoryFile(memPath);
|
|
48645
48643
|
if (content === void 0) return void 0;
|
|
48646
48644
|
const lines = content.split(/\r?\n/);
|
|
@@ -48718,7 +48716,7 @@ var init_context_retrieval = __esm({
|
|
|
48718
48716
|
// src/runtime/task-runner/retrieval-orchestrator.ts
|
|
48719
48717
|
import { spawn as spawn3 } from "node:child_process";
|
|
48720
48718
|
import * as fs75 from "node:fs";
|
|
48721
|
-
import * as
|
|
48719
|
+
import * as path59 from "node:path";
|
|
48722
48720
|
function getCachedDiscovered(cwd) {
|
|
48723
48721
|
const hit = discoveredCache.get(cwd);
|
|
48724
48722
|
if (hit && Date.now() - hit.at < DISCOVERED_TTL_MS) {
|
|
@@ -48857,18 +48855,18 @@ async function walkFilesFallback(cwd, keywords) {
|
|
|
48857
48855
|
}
|
|
48858
48856
|
for (const entry of entries) {
|
|
48859
48857
|
if (entry.name.startsWith(".") || entry.name === "node_modules") continue;
|
|
48860
|
-
const full =
|
|
48858
|
+
const full = path59.join(dir, entry.name);
|
|
48861
48859
|
if (entry.isDirectory()) {
|
|
48862
48860
|
await walk(full);
|
|
48863
48861
|
continue;
|
|
48864
48862
|
}
|
|
48865
48863
|
if (!entry.isFile()) continue;
|
|
48866
|
-
const ext =
|
|
48864
|
+
const ext = path59.extname(entry.name).toLowerCase();
|
|
48867
48865
|
if (!RELEVANT_EXTS.has(ext)) continue;
|
|
48868
48866
|
const content = "";
|
|
48869
48867
|
const score = scoreRelevance(full, content, keywords);
|
|
48870
48868
|
if (score > 0) {
|
|
48871
|
-
out.push({ path:
|
|
48869
|
+
out.push({ path: path59.relative(lowerCwd, full), score, reason: reasonFor(full, keywords) });
|
|
48872
48870
|
}
|
|
48873
48871
|
}
|
|
48874
48872
|
}
|
|
@@ -48891,7 +48889,7 @@ async function runRetrievalCycle(task, goal, cwd) {
|
|
|
48891
48889
|
discovered = cached2;
|
|
48892
48890
|
} else {
|
|
48893
48891
|
const stdout = await runRipgrep(["--files", "-g", "!node_modules", "-g", "!.git", cwd], cwd);
|
|
48894
|
-
discovered = stdout.split("\n").map((p) => p.trim()).filter((p) => p && RELEVANT_EXTS.has(
|
|
48892
|
+
discovered = stdout.split("\n").map((p) => p.trim()).filter((p) => p && RELEVANT_EXTS.has(path59.extname(p).toLowerCase())).map((p) => path59.relative(cwd, p));
|
|
48895
48893
|
storeDiscovered(cwd, discovered);
|
|
48896
48894
|
}
|
|
48897
48895
|
} else {
|
|
@@ -48903,7 +48901,7 @@ async function runRetrievalCycle(task, goal, cwd) {
|
|
|
48903
48901
|
}
|
|
48904
48902
|
const byPath = /* @__PURE__ */ new Map();
|
|
48905
48903
|
for (const relPath of discovered) {
|
|
48906
|
-
const absPath =
|
|
48904
|
+
const absPath = path59.isAbsolute(relPath) ? relPath : path59.join(cwd, relPath);
|
|
48907
48905
|
if (byPath.has(absPath)) continue;
|
|
48908
48906
|
const score = scoreRelevance(absPath, "", keywords);
|
|
48909
48907
|
if (score > 0) {
|
|
@@ -48920,7 +48918,7 @@ async function runRetrievalCycle(task, goal, cwd) {
|
|
|
48920
48918
|
evaluations.sort((a, b) => b.relevance - a.relevance);
|
|
48921
48919
|
const cap = Math.min(MAX_SUGGESTED_FILES, Math.max(MIN_SUGGESTED_FILES, evaluations.length));
|
|
48922
48920
|
const top = evaluations.slice(0, cap).map((e) => ({
|
|
48923
|
-
path:
|
|
48921
|
+
path: path59.isAbsolute(e.path) ? path59.relative(cwd, e.path) : e.path,
|
|
48924
48922
|
score: e.relevance,
|
|
48925
48923
|
reason: e.reason
|
|
48926
48924
|
}));
|
|
@@ -49285,12 +49283,12 @@ var init_prompt_builder = __esm({
|
|
|
49285
49283
|
|
|
49286
49284
|
// src/state/stores/ownership-map.ts
|
|
49287
49285
|
import * as fs76 from "node:fs";
|
|
49288
|
-
import * as
|
|
49286
|
+
import * as path60 from "node:path";
|
|
49289
49287
|
function emptyOwnershipMap() {
|
|
49290
49288
|
return { version: 1, entries: {} };
|
|
49291
49289
|
}
|
|
49292
49290
|
function ownershipMapPath(manifest) {
|
|
49293
|
-
return
|
|
49291
|
+
return path60.join(manifest.stateRoot, "ownership-map.json");
|
|
49294
49292
|
}
|
|
49295
49293
|
function readOwnershipMap(manifest) {
|
|
49296
49294
|
try {
|
|
@@ -49803,7 +49801,7 @@ var init_tail_read = __esm({
|
|
|
49803
49801
|
|
|
49804
49802
|
// src/runtime/task-runner/child-executor.ts
|
|
49805
49803
|
import * as fs80 from "node:fs";
|
|
49806
|
-
import * as
|
|
49804
|
+
import * as path61 from "node:path";
|
|
49807
49805
|
async function appendSteeringAsync(steeringDir, taskId, steers) {
|
|
49808
49806
|
try {
|
|
49809
49807
|
await fs80.promises.mkdir(steeringDir, { recursive: true });
|
|
@@ -50012,7 +50010,7 @@ async function runChildProcessTask(ctx) {
|
|
|
50012
50010
|
const taskDispatchStartedAtMs = Date.now();
|
|
50013
50011
|
for (let i = 0; i < attemptModels.length; i++) {
|
|
50014
50012
|
transcriptPath = `${manifest.artifactsRoot}/transcripts/${task.id}.attempt-${i}.jsonl`;
|
|
50015
|
-
await fs80.promises.mkdir(
|
|
50013
|
+
await fs80.promises.mkdir(path61.join(manifest.artifactsRoot, "transcripts"), {
|
|
50016
50014
|
recursive: true
|
|
50017
50015
|
});
|
|
50018
50016
|
const model = attemptModels[i];
|
|
@@ -50521,7 +50519,7 @@ var init_child_executor = __esm({
|
|
|
50521
50519
|
import { execFile, execFileSync as execFileSync6, spawnSync as spawnSync2 } from "node:child_process";
|
|
50522
50520
|
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
50523
50521
|
import * as fs81 from "node:fs";
|
|
50524
|
-
import * as
|
|
50522
|
+
import * as path62 from "node:path";
|
|
50525
50523
|
import { promisify } from "node:util";
|
|
50526
50524
|
function git2(cwd, args) {
|
|
50527
50525
|
return execFileSync6("git", args, {
|
|
@@ -50631,8 +50629,8 @@ async function assertCleanLeaderAsync(repoRoot) {
|
|
|
50631
50629
|
}
|
|
50632
50630
|
}
|
|
50633
50631
|
function linkNodeModulesIfPresent(repoRoot, worktreePath) {
|
|
50634
|
-
const source =
|
|
50635
|
-
const target =
|
|
50632
|
+
const source = path62.join(repoRoot, "node_modules");
|
|
50633
|
+
const target = path62.join(worktreePath, "node_modules");
|
|
50636
50634
|
let sourceStat;
|
|
50637
50635
|
try {
|
|
50638
50636
|
sourceStat = fs81.statSync(source);
|
|
@@ -50655,15 +50653,15 @@ function linkNodeModulesIfPresent(repoRoot, worktreePath) {
|
|
|
50655
50653
|
}
|
|
50656
50654
|
}
|
|
50657
50655
|
function normalizeSyntheticPath(worktreePath, rawPath) {
|
|
50658
|
-
const resolved =
|
|
50659
|
-
const relative9 =
|
|
50660
|
-
if (!relative9 || relative9.startsWith("..") ||
|
|
50661
|
-
return
|
|
50656
|
+
const resolved = path62.resolve(worktreePath, rawPath);
|
|
50657
|
+
const relative9 = path62.relative(worktreePath, resolved);
|
|
50658
|
+
if (!relative9 || relative9.startsWith("..") || path62.isAbsolute(relative9)) throw new Error(`synthetic path escapes worktree: ${rawPath}`);
|
|
50659
|
+
return path62.normalize(relative9);
|
|
50662
50660
|
}
|
|
50663
50661
|
function isAllowedSetupHook(hookPath) {
|
|
50664
50662
|
if (!hookPath || hookPath.trim().length === 0) return false;
|
|
50665
|
-
if (!
|
|
50666
|
-
const normalized =
|
|
50663
|
+
if (!path62.isAbsolute(hookPath)) {
|
|
50664
|
+
const normalized = path62.posix.normalize(hookPath);
|
|
50667
50665
|
return normalized === ".hooks" || normalized.startsWith(".hooks/");
|
|
50668
50666
|
}
|
|
50669
50667
|
const normalizedHookPath = hookPath.replace(/\\/g, "/");
|
|
@@ -50673,8 +50671,8 @@ function isAllowedSetupHook(hookPath) {
|
|
|
50673
50671
|
function isHookPathContainedInRepoRoot(repoRoot, hookPath) {
|
|
50674
50672
|
try {
|
|
50675
50673
|
const realRepoRoot = fs81.realpathSync(repoRoot);
|
|
50676
|
-
const realHookPath = fs81.realpathSync(
|
|
50677
|
-
return realHookPath.startsWith(realRepoRoot +
|
|
50674
|
+
const realHookPath = fs81.realpathSync(path62.dirname(hookPath));
|
|
50675
|
+
return realHookPath.startsWith(realRepoRoot + path62.sep) || realHookPath === realRepoRoot;
|
|
50678
50676
|
} catch {
|
|
50679
50677
|
return false;
|
|
50680
50678
|
}
|
|
@@ -50687,15 +50685,15 @@ function runSetupHook(manifest, task, repoRoot, worktreePath, branch) {
|
|
|
50687
50685
|
logInternalError("worktree.setupHook.rejected", new Error("hook path not allowed: " + rawHookPath), `cwd=${manifest.cwd}`);
|
|
50688
50686
|
return [];
|
|
50689
50687
|
}
|
|
50690
|
-
if (
|
|
50688
|
+
if (path62.isAbsolute(rawHookPath)) {
|
|
50691
50689
|
logInternalError(
|
|
50692
50690
|
"worktree.setupHook.homeHook",
|
|
50693
50691
|
new Error("Home directory hook used \u2014 ensure ~/.pi/hooks/ is trusted"),
|
|
50694
50692
|
`hookPath=${rawHookPath}`
|
|
50695
50693
|
);
|
|
50696
50694
|
}
|
|
50697
|
-
const hookPath =
|
|
50698
|
-
if (!
|
|
50695
|
+
const hookPath = path62.isAbsolute(rawHookPath) ? rawHookPath : path62.resolve(repoRoot, rawHookPath);
|
|
50696
|
+
if (!path62.isAbsolute(rawHookPath) && !isHookPathContainedInRepoRoot(repoRoot, hookPath)) {
|
|
50699
50697
|
logInternalError(
|
|
50700
50698
|
"worktree.setupHook.contained",
|
|
50701
50699
|
new Error("hook path escapes repoRoot after realpath resolution: " + hookPath),
|
|
@@ -50843,15 +50841,15 @@ async function pruneStaleWorktreesAsync(repoRoot) {
|
|
|
50843
50841
|
return p;
|
|
50844
50842
|
}
|
|
50845
50843
|
function normalizeSeedPaths(seedPaths, repoRoot) {
|
|
50846
|
-
const resolvedRepoRoot =
|
|
50844
|
+
const resolvedRepoRoot = path62.resolve(repoRoot);
|
|
50847
50845
|
const entries = Array.isArray(seedPaths) ? seedPaths : [];
|
|
50848
50846
|
const seen = /* @__PURE__ */ new Set();
|
|
50849
50847
|
const normalized = [];
|
|
50850
50848
|
for (const entry of entries) {
|
|
50851
50849
|
if (typeof entry !== "string" || entry.trim().length === 0) continue;
|
|
50852
|
-
const absolutePath =
|
|
50853
|
-
const relativePath =
|
|
50854
|
-
if (relativePath.startsWith("..") ||
|
|
50850
|
+
const absolutePath = path62.resolve(resolvedRepoRoot, entry);
|
|
50851
|
+
const relativePath = path62.relative(resolvedRepoRoot, absolutePath);
|
|
50852
|
+
if (relativePath.startsWith("..") || path62.isAbsolute(relativePath)) {
|
|
50855
50853
|
throw new Error(`seedPaths entries must stay inside repoRoot: ${entry}`);
|
|
50856
50854
|
}
|
|
50857
50855
|
try {
|
|
@@ -50865,7 +50863,7 @@ function normalizeSeedPaths(seedPaths, repoRoot) {
|
|
|
50865
50863
|
throw new Error(`seedPaths entries must be accessible: ${entry}`);
|
|
50866
50864
|
}
|
|
50867
50865
|
}
|
|
50868
|
-
const normalizedPath = relativePath.split(
|
|
50866
|
+
const normalizedPath = relativePath.split(path62.sep).join("/");
|
|
50869
50867
|
if (seen.has(normalizedPath)) continue;
|
|
50870
50868
|
seen.add(normalizedPath);
|
|
50871
50869
|
normalized.push(normalizedPath);
|
|
@@ -50875,8 +50873,8 @@ function normalizeSeedPaths(seedPaths, repoRoot) {
|
|
|
50875
50873
|
function overlaySeedPaths(repoRoot, worktreePath, seedPaths) {
|
|
50876
50874
|
const normalized = normalizeSeedPaths(seedPaths, repoRoot);
|
|
50877
50875
|
for (const seedPath of normalized) {
|
|
50878
|
-
const sourcePath =
|
|
50879
|
-
const destinationPath =
|
|
50876
|
+
const sourcePath = path62.join(repoRoot, seedPath);
|
|
50877
|
+
const destinationPath = path62.join(worktreePath, seedPath);
|
|
50880
50878
|
let sourceStat;
|
|
50881
50879
|
try {
|
|
50882
50880
|
sourceStat = fs81.lstatSync(sourcePath);
|
|
@@ -50892,7 +50890,7 @@ function overlaySeedPaths(repoRoot, worktreePath, seedPaths) {
|
|
|
50892
50890
|
logInternalError("worktree.seedPaths.invalid", new Error(`Seed path is neither file nor directory: ${seedPath}`));
|
|
50893
50891
|
continue;
|
|
50894
50892
|
}
|
|
50895
|
-
fs81.mkdirSync(
|
|
50893
|
+
fs81.mkdirSync(path62.dirname(destinationPath), { recursive: true });
|
|
50896
50894
|
fs81.rmSync(destinationPath, { force: true, recursive: true });
|
|
50897
50895
|
fs81.cpSync(sourcePath, destinationPath, {
|
|
50898
50896
|
dereference: true,
|
|
@@ -50925,7 +50923,7 @@ function snapshotDirtyWorktree(manifest, task, worktreePath, dirtyStatus) {
|
|
|
50925
50923
|
const rel = line4.slice(3).replace(/^"|"$/g, "");
|
|
50926
50924
|
if (!rel) continue;
|
|
50927
50925
|
try {
|
|
50928
|
-
const abs =
|
|
50926
|
+
const abs = path62.join(worktreePath, rel);
|
|
50929
50927
|
if (!fs81.existsSync(abs) || fs81.statSync(abs).isDirectory()) continue;
|
|
50930
50928
|
const buf = fs81.readFileSync(abs);
|
|
50931
50929
|
const originalSize = buf.byteLength;
|
|
@@ -50986,7 +50984,7 @@ async function prepareTaskWorkspaceAsync(manifest, task, stepSeedPaths) {
|
|
|
50986
50984
|
const loadedConfig = loadConfig(manifest.cwd);
|
|
50987
50985
|
if (loadedConfig.config.requireCleanWorktreeLeader !== false) await assertCleanLeaderAsync(repoRoot);
|
|
50988
50986
|
const sanitizedRunId = manifest.runId.replace(/[^a-zA-Z0-9._-]/g, "-").replace(/^-+|-+$/g, "") || "run";
|
|
50989
|
-
const worktreeRoot =
|
|
50987
|
+
const worktreeRoot = path62.join(projectCrewRoot(manifest.cwd), DEFAULT_PATHS.state.worktreesSubdir, sanitizedRunId);
|
|
50990
50988
|
fs81.mkdirSync(worktreeRoot, { recursive: true });
|
|
50991
50989
|
let resolvedWorktreeRoot = worktreeRoot;
|
|
50992
50990
|
try {
|
|
@@ -50999,7 +50997,7 @@ async function prepareTaskWorkspaceAsync(manifest, task, stepSeedPaths) {
|
|
|
50999
50997
|
}
|
|
51000
50998
|
}
|
|
51001
50999
|
const sanitizedTaskId = sanitizeBranchPart2(task.id);
|
|
51002
|
-
const worktreePath =
|
|
51000
|
+
const worktreePath = path62.join(resolvedWorktreeRoot, sanitizedTaskId);
|
|
51003
51001
|
const branch = `pi-crew/${sanitizeBranchPart2(manifest.runId)}/${sanitizeBranchPart2(task.id)}`;
|
|
51004
51002
|
let worktreeExists = false;
|
|
51005
51003
|
try {
|
|
@@ -51156,11 +51154,11 @@ async function prepareAgentWorktreeAsync(manifest, agentId) {
|
|
|
51156
51154
|
return void 0;
|
|
51157
51155
|
}
|
|
51158
51156
|
const sanitizedRunId = manifest.runId.replace(/[^a-zA-Z0-9._-]/g, "-").replace(/^-+|-+$/g, "") || "run";
|
|
51159
|
-
const worktreeRoot =
|
|
51157
|
+
const worktreeRoot = path62.join(projectCrewRoot(manifest.cwd), DEFAULT_PATHS.state.worktreesSubdir, sanitizedRunId);
|
|
51160
51158
|
fs81.mkdirSync(worktreeRoot, { recursive: true });
|
|
51161
51159
|
const sanitizedAgentId = sanitizeBranchPart2(agentId);
|
|
51162
51160
|
const stamp = `${Date.now()}-${randomBytes3(4).toString("hex")}`;
|
|
51163
|
-
const worktreePath =
|
|
51161
|
+
const worktreePath = path62.join(worktreeRoot, `${sanitizedAgentId}-${stamp}`);
|
|
51164
51162
|
const branch = `pi-crew/${sanitizedRunId}/${sanitizedAgentId}-${stamp}`;
|
|
51165
51163
|
await pruneStaleWorktreesAsync(repoRoot);
|
|
51166
51164
|
await gitAsync(repoRoot, ["worktree", "add", "-b", branch, worktreePath, "HEAD"]);
|
|
@@ -51724,7 +51722,7 @@ var init_tool_output_pruner = __esm({
|
|
|
51724
51722
|
|
|
51725
51723
|
// src/runtime/task-output-context.ts
|
|
51726
51724
|
import * as fs82 from "node:fs";
|
|
51727
|
-
import * as
|
|
51725
|
+
import * as path63 from "node:path";
|
|
51728
51726
|
function containedExists(filePath, baseDir) {
|
|
51729
51727
|
try {
|
|
51730
51728
|
const safePath = baseDir ? resolveRealContainedPath(baseDir, filePath) : filePath;
|
|
@@ -51738,11 +51736,11 @@ function safeTeeName(taskId, artifactName) {
|
|
|
51738
51736
|
return `${safe(taskId)}-${safe(artifactName)}.full.txt`;
|
|
51739
51737
|
}
|
|
51740
51738
|
function teePathForArtifact(artifactsRoot, taskId, artifactName) {
|
|
51741
|
-
return
|
|
51739
|
+
return path63.join(artifactsRoot, "tee", safeTeeName(taskId, artifactName));
|
|
51742
51740
|
}
|
|
51743
51741
|
function writeTeeFile(fullOutputPath, content) {
|
|
51744
51742
|
try {
|
|
51745
|
-
fs82.mkdirSync(
|
|
51743
|
+
fs82.mkdirSync(path63.dirname(fullOutputPath), { recursive: true });
|
|
51746
51744
|
atomicWriteFile(fullOutputPath, content);
|
|
51747
51745
|
return true;
|
|
51748
51746
|
} catch {
|
|
@@ -51787,15 +51785,15 @@ function readIfSmall(filePath, baseDir) {
|
|
|
51787
51785
|
}
|
|
51788
51786
|
function safeSharedName(name) {
|
|
51789
51787
|
const normalized = name.replaceAll("\\", "/").replace(/^\.\/+/, "");
|
|
51790
|
-
if (!normalized || normalized.split("/").some((segment) => segment === "..") ||
|
|
51788
|
+
if (!normalized || normalized.split("/").some((segment) => segment === "..") || path63.isAbsolute(normalized))
|
|
51791
51789
|
throw new Error(`Invalid shared artifact name: ${name}`);
|
|
51792
51790
|
return normalized;
|
|
51793
51791
|
}
|
|
51794
51792
|
function sharedPath(manifest, name) {
|
|
51795
|
-
const sharedRoot =
|
|
51796
|
-
const resolved =
|
|
51797
|
-
const relative9 =
|
|
51798
|
-
if (relative9.startsWith("..") ||
|
|
51793
|
+
const sharedRoot = path63.resolve(manifest.artifactsRoot, "shared");
|
|
51794
|
+
const resolved = path63.resolve(sharedRoot, safeSharedName(name));
|
|
51795
|
+
const relative9 = path63.relative(sharedRoot, resolved);
|
|
51796
|
+
if (relative9.startsWith("..") || path63.isAbsolute(relative9)) throw new Error(`Invalid shared artifact name: ${name}`);
|
|
51799
51797
|
return resolved;
|
|
51800
51798
|
}
|
|
51801
51799
|
function tryParseJson(text) {
|
|
@@ -51810,7 +51808,7 @@ function listTaskArtifacts(manifest, taskId) {
|
|
|
51810
51808
|
const produced = manifest.artifacts.filter((a) => a.producer === taskId);
|
|
51811
51809
|
if (produced.length === 0) return void 0;
|
|
51812
51810
|
return produced.map((a) => {
|
|
51813
|
-
const relative9 =
|
|
51811
|
+
const relative9 = path63.relative(manifest.artifactsRoot, a.path);
|
|
51814
51812
|
return relative9.startsWith("..") ? a.path : relative9;
|
|
51815
51813
|
});
|
|
51816
51814
|
}
|
|
@@ -51868,7 +51866,7 @@ function pruneSharedReads(reads, dependencies, artifactsRoot) {
|
|
|
51868
51866
|
for (const artifact of produced) {
|
|
51869
51867
|
if (typeof artifact !== "string") continue;
|
|
51870
51868
|
fileEdits.push({
|
|
51871
|
-
target:
|
|
51869
|
+
target: path63.resolve(artifactsRoot, artifact),
|
|
51872
51870
|
index: reads.length + depIndex
|
|
51873
51871
|
});
|
|
51874
51872
|
}
|
|
@@ -51925,7 +51923,7 @@ function collectDependencyOutputContext(manifest, tasks, task, step, cache3) {
|
|
|
51925
51923
|
const filePath = sharedPath(manifest, name);
|
|
51926
51924
|
const teePath = teePathForArtifact(manifest.artifactsRoot, task.id, name);
|
|
51927
51925
|
const teeResult = readIfSmallWithTee(filePath, {
|
|
51928
|
-
baseDir:
|
|
51926
|
+
baseDir: path63.resolve(manifest.artifactsRoot, "shared"),
|
|
51929
51927
|
tee: { fullOutputPath: teePath }
|
|
51930
51928
|
});
|
|
51931
51929
|
if (teeResult === void 0) return { name, path: filePath, content: "" };
|
|
@@ -52306,7 +52304,7 @@ var init_green_contract = __esm({
|
|
|
52306
52304
|
// src/runtime/verification/verification-gates.ts
|
|
52307
52305
|
import { spawn as spawn4 } from "node:child_process";
|
|
52308
52306
|
import * as fs84 from "node:fs";
|
|
52309
|
-
import * as
|
|
52307
|
+
import * as path64 from "node:path";
|
|
52310
52308
|
function isVerificationEnvSanitizeEnabled() {
|
|
52311
52309
|
if (getCrewEnv("PI_CREW_VERIFICATION_SANITIZE_ENV") === "0" || getCrewEnv("PI_TEAMS_VERIFICATION_SANITIZE_ENV") === "0") {
|
|
52312
52310
|
return false;
|
|
@@ -52462,7 +52460,7 @@ async function executeVerificationCommands(contract, cwd, runId, taskId, artifac
|
|
|
52462
52460
|
critical: true
|
|
52463
52461
|
// All verification commands are critical by default
|
|
52464
52462
|
}));
|
|
52465
|
-
const gatesDir =
|
|
52463
|
+
const gatesDir = path64.join(artifactsRoot, "verification-gates");
|
|
52466
52464
|
if (!fs84.existsSync(gatesDir)) {
|
|
52467
52465
|
fs84.mkdirSync(gatesDir, { recursive: true });
|
|
52468
52466
|
}
|
|
@@ -52629,13 +52627,13 @@ var init_capabilities = __esm({
|
|
|
52629
52627
|
});
|
|
52630
52628
|
|
|
52631
52629
|
// src/runtime/task-runner/prompt-pipeline.ts
|
|
52632
|
-
import * as
|
|
52630
|
+
import * as path65 from "node:path";
|
|
52633
52631
|
function artifactReference(artifactsRoot, artifact) {
|
|
52634
52632
|
if (!artifact) return void 0;
|
|
52635
|
-
const root =
|
|
52636
|
-
const target =
|
|
52637
|
-
const relative9 =
|
|
52638
|
-
if (!relative9 || relative9.startsWith("..") ||
|
|
52633
|
+
const root = path65.resolve(artifactsRoot);
|
|
52634
|
+
const target = path65.resolve(artifact.path);
|
|
52635
|
+
const relative9 = path65.relative(root, target);
|
|
52636
|
+
if (!relative9 || relative9.startsWith("..") || path65.isAbsolute(relative9)) return void 0;
|
|
52639
52637
|
return relative9.replaceAll("\\", "/");
|
|
52640
52638
|
}
|
|
52641
52639
|
function buildWorkerPromptPipeline(input) {
|
|
@@ -55409,7 +55407,7 @@ var init_workflow_serializer = __esm({
|
|
|
55409
55407
|
// src/extension/management.ts
|
|
55410
55408
|
import * as crypto6 from "node:crypto";
|
|
55411
55409
|
import * as fs86 from "node:fs";
|
|
55412
|
-
import * as
|
|
55410
|
+
import * as path66 from "node:path";
|
|
55413
55411
|
function invalidateResourceCaches() {
|
|
55414
55412
|
invalidateAgentDiscoveryCache();
|
|
55415
55413
|
invalidateTeamDiscoveryCache();
|
|
@@ -55420,9 +55418,9 @@ function result2(text, status = "ok", isError = false) {
|
|
|
55420
55418
|
}
|
|
55421
55419
|
function scopeDir(ctx, resource, scope) {
|
|
55422
55420
|
const base = scope === "user" ? userPiRoot() : projectCrewRoot(ctx.cwd);
|
|
55423
|
-
if (resource === "agent") return
|
|
55424
|
-
if (resource === "team") return
|
|
55425
|
-
return
|
|
55421
|
+
if (resource === "agent") return path66.join(base, "agents");
|
|
55422
|
+
if (resource === "team") return path66.join(base, "teams");
|
|
55423
|
+
return path66.join(base, "workflows");
|
|
55426
55424
|
}
|
|
55427
55425
|
function extensionFor(resource) {
|
|
55428
55426
|
if (resource === "agent") return ".md";
|
|
@@ -55437,7 +55435,7 @@ function backupFile(filePath) {
|
|
|
55437
55435
|
return backupPath;
|
|
55438
55436
|
}
|
|
55439
55437
|
function targetPath(ctx, resource, scope, name) {
|
|
55440
|
-
return
|
|
55438
|
+
return path66.join(scopeDir(ctx, resource, scope), `${name}${extensionFor(resource)}`);
|
|
55441
55439
|
}
|
|
55442
55440
|
function parseStringArray(value) {
|
|
55443
55441
|
if (typeof value === "string")
|
|
@@ -55553,7 +55551,7 @@ function walkTsFiles(dir) {
|
|
|
55553
55551
|
const results = [];
|
|
55554
55552
|
if (!fs86.existsSync(dir)) return results;
|
|
55555
55553
|
for (const entry of fs86.readdirSync(dir, { withFileTypes: true })) {
|
|
55556
|
-
const fullPath =
|
|
55554
|
+
const fullPath = path66.join(dir, entry.name);
|
|
55557
55555
|
if (entry.isDirectory()) {
|
|
55558
55556
|
results.push(...walkTsFiles(fullPath));
|
|
55559
55557
|
} else if (entry.name.endsWith(".ts") || entry.name.endsWith(".md")) {
|
|
@@ -55601,7 +55599,7 @@ function updateReferencesForRename(ctx, resource, oldName, newName, scope, dryRu
|
|
|
55601
55599
|
atomicWriteFile(workflow.filePath, serializeWorkflow({ ...workflow, steps: newSteps }));
|
|
55602
55600
|
}
|
|
55603
55601
|
}
|
|
55604
|
-
const testDir = scope === "user" ?
|
|
55602
|
+
const testDir = scope === "user" ? path66.join(projectCrewRoot(ctx.cwd), "test") : path66.join(ctx.cwd, "test", "fixtures");
|
|
55605
55603
|
if (fs86.existsSync(testDir)) {
|
|
55606
55604
|
for (const fixture of walkTsFiles(testDir)) {
|
|
55607
55605
|
const content = fs86.readFileSync(fixture, "utf-8");
|
|
@@ -55653,7 +55651,7 @@ function handleCreate(params, ctx) {
|
|
|
55653
55651
|
const scope = cfg.scope === "project" ? "project" : "user";
|
|
55654
55652
|
const filePath = targetPath(ctx, params.resource, scope, name);
|
|
55655
55653
|
if (fs86.existsSync(filePath)) return result2(`File already exists: ${filePath}`, "error", true);
|
|
55656
|
-
fs86.mkdirSync(
|
|
55654
|
+
fs86.mkdirSync(path66.dirname(filePath), { recursive: true });
|
|
55657
55655
|
let content;
|
|
55658
55656
|
if (params.resource === "agent") {
|
|
55659
55657
|
const agent = {
|
|
@@ -55878,7 +55876,7 @@ var init_management = __esm({
|
|
|
55878
55876
|
|
|
55879
55877
|
// src/extension/project-init.ts
|
|
55880
55878
|
import * as fs87 from "node:fs";
|
|
55881
|
-
import * as
|
|
55879
|
+
import * as path67 from "node:path";
|
|
55882
55880
|
function ensureDir(dir, createdDirs) {
|
|
55883
55881
|
if (!fs87.existsSync(dir)) {
|
|
55884
55882
|
fs87.mkdirSync(dir, { recursive: true });
|
|
@@ -55888,11 +55886,11 @@ function ensureDir(dir, createdDirs) {
|
|
|
55888
55886
|
}
|
|
55889
55887
|
}
|
|
55890
55888
|
function copyBuiltinDir(kind, targetDir, overwrite, copiedFiles, skippedFiles) {
|
|
55891
|
-
const sourceDir =
|
|
55889
|
+
const sourceDir = path67.join(packageRoot(), kind);
|
|
55892
55890
|
if (!fs87.existsSync(sourceDir)) return;
|
|
55893
55891
|
for (const entry of fs87.readdirSync(sourceDir)) {
|
|
55894
|
-
const source =
|
|
55895
|
-
const target =
|
|
55892
|
+
const source = path67.join(sourceDir, entry);
|
|
55893
|
+
const target = path67.join(targetDir, entry);
|
|
55896
55894
|
if (!fs87.statSync(source).isFile()) continue;
|
|
55897
55895
|
if (fs87.existsSync(target) && !overwrite) {
|
|
55898
55896
|
skippedFiles.push(target);
|
|
@@ -55907,22 +55905,22 @@ function initializeProject(cwd, options = {}) {
|
|
|
55907
55905
|
const copiedFiles = [];
|
|
55908
55906
|
const skippedFiles = [];
|
|
55909
55907
|
const crewRoot = projectCrewRoot(cwd);
|
|
55910
|
-
const usingLegacyPi =
|
|
55908
|
+
const usingLegacyPi = path67.basename(crewRoot) === "teams" && path67.basename(path67.dirname(crewRoot)) === ".pi";
|
|
55911
55909
|
const ignorePrefix = usingLegacyPi ? ".pi/teams" : ".crew";
|
|
55912
|
-
const agentsDir =
|
|
55913
|
-
const teamsDir =
|
|
55914
|
-
const workflowsDir =
|
|
55910
|
+
const agentsDir = path67.join(crewRoot, "agents");
|
|
55911
|
+
const teamsDir = path67.join(crewRoot, "teams");
|
|
55912
|
+
const workflowsDir = path67.join(crewRoot, "workflows");
|
|
55915
55913
|
const configScope = options.configScope ?? "global";
|
|
55916
|
-
const configPath3 = configScope === "project" ?
|
|
55914
|
+
const configPath3 = configScope === "project" ? path67.join(projectPiRoot(cwd), "pi-crew.json") : configScope === "global" ? configPath() : "";
|
|
55917
55915
|
ensureDir(agentsDir, createdDirs);
|
|
55918
55916
|
ensureDir(teamsDir, createdDirs);
|
|
55919
55917
|
ensureDir(workflowsDir, createdDirs);
|
|
55920
|
-
ensureDir(
|
|
55918
|
+
ensureDir(path67.join(crewRoot, "imports"), createdDirs);
|
|
55921
55919
|
let configCreated = false;
|
|
55922
55920
|
let configSkipped = false;
|
|
55923
55921
|
if (configPath3) {
|
|
55924
|
-
if (configScope === "project") ensureDir(
|
|
55925
|
-
else fs87.mkdirSync(
|
|
55922
|
+
if (configScope === "project") ensureDir(path67.dirname(configPath3), createdDirs);
|
|
55923
|
+
else fs87.mkdirSync(path67.dirname(configPath3), { recursive: true });
|
|
55926
55924
|
if (!fs87.existsSync(configPath3) || options.overwrite === true) {
|
|
55927
55925
|
fs87.writeFileSync(configPath3, `${JSON.stringify(DEFAULT_PI_CREW_CONFIG, null, 2)}
|
|
55928
55926
|
`, "utf-8");
|
|
@@ -55938,10 +55936,10 @@ function initializeProject(cwd, options = {}) {
|
|
|
55938
55936
|
}
|
|
55939
55937
|
const ignoreMethod = options.ignoreMethod ?? "gitignore";
|
|
55940
55938
|
const desired = [`${ignorePrefix}/state/`, `${ignorePrefix}/artifacts/`, `${ignorePrefix}/worktrees/`, `${ignorePrefix}/imports/`];
|
|
55941
|
-
const gitignorePath = ignoreMethod === "exclude" ?
|
|
55939
|
+
const gitignorePath = ignoreMethod === "exclude" ? path67.join(cwd, ".git", "info", "exclude") : path67.join(cwd, ".gitignore");
|
|
55942
55940
|
let gitignoreUpdated = false;
|
|
55943
55941
|
if (ignoreMethod === "exclude") {
|
|
55944
|
-
const infoDir =
|
|
55942
|
+
const infoDir = path67.dirname(gitignorePath);
|
|
55945
55943
|
if (!fs87.existsSync(infoDir)) {
|
|
55946
55944
|
fs87.mkdirSync(infoDir, { recursive: true });
|
|
55947
55945
|
}
|
|
@@ -56161,8 +56159,8 @@ var init_theme_discovery = __esm({
|
|
|
56161
56159
|
});
|
|
56162
56160
|
|
|
56163
56161
|
// src/extension/team-tool/handle-settings.ts
|
|
56164
|
-
function setNested(obj,
|
|
56165
|
-
const keys =
|
|
56162
|
+
function setNested(obj, path103, value) {
|
|
56163
|
+
const keys = path103.split(".");
|
|
56166
56164
|
let target = obj;
|
|
56167
56165
|
for (let i = 0; i < keys.length - 1; i++) {
|
|
56168
56166
|
if (!target[keys[i]] || typeof target[keys[i]] !== "object") {
|
|
@@ -56172,8 +56170,8 @@ function setNested(obj, path104, value) {
|
|
|
56172
56170
|
}
|
|
56173
56171
|
target[keys[keys.length - 1]] = value;
|
|
56174
56172
|
}
|
|
56175
|
-
function getNested(obj,
|
|
56176
|
-
const keys =
|
|
56173
|
+
function getNested(obj, path103) {
|
|
56174
|
+
const keys = path103.split(".");
|
|
56177
56175
|
let current = obj;
|
|
56178
56176
|
for (const key of keys) {
|
|
56179
56177
|
if (!current || typeof current !== "object") return void 0;
|
|
@@ -56639,9 +56637,9 @@ var init_handle_settings = __esm({
|
|
|
56639
56637
|
|
|
56640
56638
|
// src/extension/team-tool/workflow-manage.ts
|
|
56641
56639
|
import { existsSync as existsSync54, readFileSync as readFileSync61, rmSync as rmSync17, writeFileSync as writeFileSync9 } from "node:fs";
|
|
56642
|
-
import { dirname as dirname35, join as
|
|
56640
|
+
import { dirname as dirname35, join as join63 } from "node:path";
|
|
56643
56641
|
function allowedWorkflowDirs(cwd) {
|
|
56644
|
-
return [
|
|
56642
|
+
return [join63(projectCrewRoot(cwd), "workflows"), join63(userPiRoot(), "workflows"), join63(packageRoot(), "workflows")];
|
|
56645
56643
|
}
|
|
56646
56644
|
function validateScriptContent(content) {
|
|
56647
56645
|
for (const pattern of FORBIDDEN_PATTERNS) {
|
|
@@ -56653,7 +56651,7 @@ function validateScriptContent(content) {
|
|
|
56653
56651
|
}
|
|
56654
56652
|
function resolveWorkflowWritePath(cwd, name, scope = "project") {
|
|
56655
56653
|
assertSafePathId("workflowName", name);
|
|
56656
|
-
const base = scope === "user" ?
|
|
56654
|
+
const base = scope === "user" ? join63(userPiRoot(), "workflows") : join63(projectCrewRoot(cwd), "workflows");
|
|
56657
56655
|
return resolveRealContainedPath(base, `${name}.dwf.ts`);
|
|
56658
56656
|
}
|
|
56659
56657
|
function handleWorkflowCreate(params, ctx) {
|
|
@@ -57005,7 +57003,7 @@ var init_manage = __esm({
|
|
|
57005
57003
|
// src/runtime/orphan-worker-registry.ts
|
|
57006
57004
|
import { execFileSync as execFileSync7 } from "node:child_process";
|
|
57007
57005
|
import * as fs88 from "node:fs";
|
|
57008
|
-
import * as
|
|
57006
|
+
import * as path68 from "node:path";
|
|
57009
57007
|
function getProcessStartTime(pid) {
|
|
57010
57008
|
try {
|
|
57011
57009
|
process.kill(pid, 0);
|
|
@@ -57089,7 +57087,7 @@ function readRegistry() {
|
|
|
57089
57087
|
}
|
|
57090
57088
|
function writeRegistry(entries) {
|
|
57091
57089
|
const p = getRegistryPath();
|
|
57092
|
-
const dir =
|
|
57090
|
+
const dir = path68.dirname(p);
|
|
57093
57091
|
for (const entry of entries) {
|
|
57094
57092
|
if (!isValidId(entry.sessionId) || !isValidId(entry.runId)) {
|
|
57095
57093
|
logInternalError(
|
|
@@ -57245,7 +57243,7 @@ var init_orphan_worker_registry = __esm({
|
|
|
57245
57243
|
init_paths();
|
|
57246
57244
|
STALE_REGISTRATION_MS = 60 * 60 * 1e3;
|
|
57247
57245
|
GRACE_PERIOD_MS = 5 * 60 * 1e3;
|
|
57248
|
-
REGISTRY_PATH =
|
|
57246
|
+
REGISTRY_PATH = path68.join(userPiRoot(), "state", "orphan-workers.json");
|
|
57249
57247
|
}
|
|
57250
57248
|
});
|
|
57251
57249
|
|
|
@@ -57253,22 +57251,22 @@ var init_orphan_worker_registry = __esm({
|
|
|
57253
57251
|
import { spawn as spawn6 } from "node:child_process";
|
|
57254
57252
|
import * as fs89 from "node:fs";
|
|
57255
57253
|
import { createRequire as createRequire6 } from "node:module";
|
|
57256
|
-
import * as
|
|
57254
|
+
import * as path69 from "node:path";
|
|
57257
57255
|
import { fileURLToPath as fileURLToPath7, pathToFileURL as pathToFileURL2 } from "node:url";
|
|
57258
57256
|
function packageRootFromRuntime() {
|
|
57259
|
-
return
|
|
57257
|
+
return path69.resolve(path69.dirname(fileURLToPath7(import.meta.url)), "..", "..");
|
|
57260
57258
|
}
|
|
57261
57259
|
function jitiRegisterPathFromPackageJson(packageJsonPath) {
|
|
57262
|
-
return
|
|
57260
|
+
return path69.join(path69.dirname(packageJsonPath), "lib", "jiti-register.mjs");
|
|
57263
57261
|
}
|
|
57264
57262
|
function resolveJitiRegisterPath(packageRoot2 = packageRootFromRuntime(), exists = fs89.existsSync) {
|
|
57265
|
-
let current =
|
|
57266
|
-
const root =
|
|
57263
|
+
let current = path69.resolve(packageRoot2);
|
|
57264
|
+
const root = path69.parse(current).root;
|
|
57267
57265
|
while (true) {
|
|
57268
|
-
const candidate =
|
|
57266
|
+
const candidate = path69.join(current, "node_modules", "jiti", "lib", "jiti-register.mjs");
|
|
57269
57267
|
if (exists(candidate)) return candidate;
|
|
57270
57268
|
if (current === root) break;
|
|
57271
|
-
const parent =
|
|
57269
|
+
const parent = path69.dirname(current);
|
|
57272
57270
|
if (parent === current) break;
|
|
57273
57271
|
current = parent;
|
|
57274
57272
|
}
|
|
@@ -57276,8 +57274,8 @@ function resolveJitiRegisterPath(packageRoot2 = packageRootFromRuntime(), exists
|
|
|
57276
57274
|
const pkgPath = requireFromHere.resolve("jiti/package.json");
|
|
57277
57275
|
const candidates = [
|
|
57278
57276
|
jitiRegisterPathFromPackageJson(pkgPath),
|
|
57279
|
-
|
|
57280
|
-
|
|
57277
|
+
path69.join(path69.dirname(pkgPath), "register.mjs"),
|
|
57278
|
+
path69.join(path69.dirname(pkgPath), "dist", "register.mjs")
|
|
57281
57279
|
];
|
|
57282
57280
|
for (const c of candidates) if (exists(c)) return c;
|
|
57283
57281
|
} catch (error) {
|
|
@@ -57318,7 +57316,7 @@ function getBackgroundRunnerCommand(runnerPath, cwd, runId, loaderInput = resolv
|
|
|
57318
57316
|
if (!loader) throw new Error(buildLoaderUnavailableMessage(packageRootFromRuntime()));
|
|
57319
57317
|
const memoryLimit = "--max-old-space-size=512";
|
|
57320
57318
|
const reportOn = !(getCrewEnv("PI_CREW_BG_REPORT_ON_FATAL") === "0" || getCrewEnv("PI_TEAMS_BG_REPORT_ON_FATAL") === "0");
|
|
57321
|
-
const reportDir = reportDirectory ??
|
|
57319
|
+
const reportDir = reportDirectory ?? path69.dirname(runnerPath);
|
|
57322
57320
|
const reportFlags = reportOn ? ["--report-on-fatalerror", "--report-compact", `--report-directory=${reportDir}`] : [];
|
|
57323
57321
|
if (loader.kind === "jiti") {
|
|
57324
57322
|
return {
|
|
@@ -57346,8 +57344,8 @@ function buildBackgroundRunnerEnv(env) {
|
|
|
57346
57344
|
return { ...env, PI_CREW_ASYNC_RUN: "1" };
|
|
57347
57345
|
}
|
|
57348
57346
|
async function spawnBackgroundTeamRun(manifest) {
|
|
57349
|
-
const runnerPath =
|
|
57350
|
-
const logPath =
|
|
57347
|
+
const runnerPath = path69.join(packageRoot(), "src", "runtime", "background-runner.ts");
|
|
57348
|
+
const logPath = path69.join(manifest.stateRoot, "background.log");
|
|
57351
57349
|
fs89.mkdirSync(manifest.stateRoot, { recursive: true });
|
|
57352
57350
|
const filteredEnv = sanitizeEnvSecrets(process.env, {
|
|
57353
57351
|
allowList: BACKGROUND_RUNNER_ENV_ALLOWLIST
|
|
@@ -57560,10 +57558,10 @@ var init_goal_state_store = __esm({
|
|
|
57560
57558
|
}
|
|
57561
57559
|
/** Load a goal by id. Returns undefined if missing/corrupt. Throws on unsafe goalId (§0c C10). */
|
|
57562
57560
|
load(goalId) {
|
|
57563
|
-
const
|
|
57561
|
+
const path103 = goalFilePath(this.cwd, goalId);
|
|
57564
57562
|
try {
|
|
57565
|
-
if (!existsSync57(
|
|
57566
|
-
const raw = readFileSync63(
|
|
57563
|
+
if (!existsSync57(path103)) return void 0;
|
|
57564
|
+
const raw = readFileSync63(path103, "utf-8");
|
|
57567
57565
|
const parsed = JSON.parse(raw);
|
|
57568
57566
|
if (!parsed || typeof parsed !== "object" || typeof parsed.goalId !== "string") return void 0;
|
|
57569
57567
|
return parsed;
|
|
@@ -57574,11 +57572,11 @@ var init_goal_state_store = __esm({
|
|
|
57574
57572
|
/** Atomically persist a goal state. Emits a goal.state_changed event if eventsPath given. */
|
|
57575
57573
|
save(state2, eventsPath) {
|
|
57576
57574
|
assertSafePathId("goalId", state2.goalId);
|
|
57577
|
-
const
|
|
57575
|
+
const path103 = goalFilePath(this.cwd, state2.goalId);
|
|
57578
57576
|
const next = { ...state2, updatedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
57579
57577
|
try {
|
|
57580
|
-
mkdirSync35(dirname38(
|
|
57581
|
-
atomicWriteJson(
|
|
57578
|
+
mkdirSync35(dirname38(path103), { recursive: true });
|
|
57579
|
+
atomicWriteJson(path103, next);
|
|
57582
57580
|
if (eventsPath) {
|
|
57583
57581
|
appendEvent(eventsPath, {
|
|
57584
57582
|
type: "goal.state_changed",
|
|
@@ -57675,9 +57673,9 @@ var init_goal_state_store = __esm({
|
|
|
57675
57673
|
/** Remove a goal file (used by `goal clear`). Returns true if deleted. */
|
|
57676
57674
|
remove(goalId) {
|
|
57677
57675
|
try {
|
|
57678
|
-
const
|
|
57679
|
-
if (!existsSync57(
|
|
57680
|
-
unlinkSync8(
|
|
57676
|
+
const path103 = goalFilePath(this.cwd, goalId);
|
|
57677
|
+
if (!existsSync57(path103)) return false;
|
|
57678
|
+
unlinkSync8(path103);
|
|
57681
57679
|
return true;
|
|
57682
57680
|
} catch (error) {
|
|
57683
57681
|
logInternalError("goal-state-store.remove", error, `goalId=${goalId}`);
|
|
@@ -57712,11 +57710,11 @@ var init_goal_state_store = __esm({
|
|
|
57712
57710
|
// src/runtime/verification/verification-integrity.ts
|
|
57713
57711
|
import { createHash as createHash10 } from "node:crypto";
|
|
57714
57712
|
import * as fs90 from "node:fs";
|
|
57715
|
-
import * as
|
|
57713
|
+
import * as path70 from "node:path";
|
|
57716
57714
|
function snapshotManifests(cwd) {
|
|
57717
57715
|
const snapshot = {};
|
|
57718
57716
|
for (const rel of MANIFEST_FILES) {
|
|
57719
|
-
const abs =
|
|
57717
|
+
const abs = path70.join(cwd, rel);
|
|
57720
57718
|
let stat2;
|
|
57721
57719
|
try {
|
|
57722
57720
|
stat2 = fs90.statSync(abs);
|
|
@@ -57754,13 +57752,13 @@ var init_verification_integrity = __esm({
|
|
|
57754
57752
|
// src/runtime/workspace-lock.ts
|
|
57755
57753
|
import { createHash as createHash11 } from "node:crypto";
|
|
57756
57754
|
import { closeSync as closeSync17, existsSync as existsSync58, mkdirSync as mkdirSync36, openSync as openSync17, readdirSync as readdirSync26, readFileSync as readFileSync65, statSync as statSync46, unlinkSync as unlinkSync9, writeFileSync as writeFileSync10 } from "node:fs";
|
|
57757
|
-
import * as
|
|
57755
|
+
import * as path71 from "node:path";
|
|
57758
57756
|
function workspaceLockPath(cwd) {
|
|
57759
|
-
const absCwd =
|
|
57757
|
+
const absCwd = path71.resolve(cwd);
|
|
57760
57758
|
const crewRoot = projectCrewRoot(absCwd) ?? userCrewRoot();
|
|
57761
|
-
const locksDir =
|
|
57759
|
+
const locksDir = path71.join(crewRoot, "state", "workspace-locks");
|
|
57762
57760
|
const hash = createHash11("sha256").update(absCwd).digest("hex");
|
|
57763
|
-
return
|
|
57761
|
+
return path71.join(locksDir, `${hash}.lock`);
|
|
57764
57762
|
}
|
|
57765
57763
|
function readLock(lockPath2) {
|
|
57766
57764
|
if (!existsSync58(lockPath2)) return void 0;
|
|
@@ -60078,7 +60076,7 @@ var init_layout_primitives = __esm({
|
|
|
60078
60076
|
// src/runtime/stale-reconciler.ts
|
|
60079
60077
|
import * as fs93 from "node:fs";
|
|
60080
60078
|
import * as os17 from "node:os";
|
|
60081
|
-
import * as
|
|
60079
|
+
import * as path72 from "node:path";
|
|
60082
60080
|
function isPlanApprovalPending2(manifest) {
|
|
60083
60081
|
return manifest.status === "blocked" && manifest.planApproval?.required === true && manifest.planApproval.status === "pending";
|
|
60084
60082
|
}
|
|
@@ -60140,7 +60138,7 @@ function checkPidLiveness(pid, stateRoot) {
|
|
|
60140
60138
|
let heartbeatNote = "";
|
|
60141
60139
|
if (stateRoot) {
|
|
60142
60140
|
try {
|
|
60143
|
-
const heartbeatPath =
|
|
60141
|
+
const heartbeatPath = path72.join(stateRoot, "heartbeat.json");
|
|
60144
60142
|
if (fs93.existsSync(heartbeatPath)) {
|
|
60145
60143
|
const hb = JSON.parse(fs93.readFileSync(heartbeatPath, "utf-8"));
|
|
60146
60144
|
if (hb?.pid === pid && hb?.at) {
|
|
@@ -60347,22 +60345,22 @@ function reconcileOrphanedTempWorkspaces(now = Date.now(), options) {
|
|
|
60347
60345
|
const candidates = entries.filter((e) => e.isDirectory() && e.name.startsWith("pi-crew-")).sort((a, b) => a.name.localeCompare(b.name)).slice(0, scanBatch);
|
|
60348
60346
|
for (const entry of candidates) {
|
|
60349
60347
|
if (!entry.isDirectory() || !entry.name.startsWith("pi-crew-")) continue;
|
|
60350
|
-
const workspaceDir =
|
|
60351
|
-
const crewDir =
|
|
60348
|
+
const workspaceDir = path72.join(tmpDir, entry.name);
|
|
60349
|
+
const crewDir = path72.join(workspaceDir, ".crew");
|
|
60352
60350
|
if (!fs93.existsSync(crewDir)) continue;
|
|
60353
|
-
const stateRunsDir =
|
|
60351
|
+
const stateRunsDir = path72.join(crewDir, "state", "runs");
|
|
60354
60352
|
if (!fs93.existsSync(stateRunsDir)) continue;
|
|
60355
60353
|
let hasRunning = false;
|
|
60356
60354
|
try {
|
|
60357
60355
|
for (const runDir of fs93.readdirSync(stateRunsDir)) {
|
|
60358
|
-
const manifestPath =
|
|
60359
|
-
const tasksPath =
|
|
60356
|
+
const manifestPath = path72.join(stateRunsDir, runDir, "manifest.json");
|
|
60357
|
+
const tasksPath = path72.join(stateRunsDir, runDir, "tasks.json");
|
|
60360
60358
|
if (!fs93.existsSync(manifestPath) || !fs93.existsSync(tasksPath)) continue;
|
|
60361
60359
|
try {
|
|
60362
60360
|
const manifest = loadManifestWithRecovery(manifestPath, runDir);
|
|
60363
60361
|
if (!manifest) continue;
|
|
60364
60362
|
if (manifest.status !== "running") continue;
|
|
60365
|
-
const tasks = loadTasksWithRecovery(tasksPath,
|
|
60363
|
+
const tasks = loadTasksWithRecovery(tasksPath, path72.join(stateRunsDir, runDir, "events.jsonl"), runDir);
|
|
60366
60364
|
const result4 = reconcileStaleRun(manifest, tasks, now);
|
|
60367
60365
|
if (result4.repaired && result4.repairedTasks) {
|
|
60368
60366
|
atomicWriteJson(tasksPath, result4.repairedTasks);
|
|
@@ -60409,7 +60407,7 @@ function reconcileOrphanedTempWorkspaces(now = Date.now(), options) {
|
|
|
60409
60407
|
hasRunning = true;
|
|
60410
60408
|
logInternalError("stale-reconciler", new Error(`Skipping unreadable runs dir: ${stateRunsDir}: ${err2}`), void 0, "warn");
|
|
60411
60409
|
}
|
|
60412
|
-
const sentinelPath =
|
|
60410
|
+
const sentinelPath = path72.join(workspaceDir, ".cleanup-in-progress");
|
|
60413
60411
|
let canCleanup = !hasRunning;
|
|
60414
60412
|
const cleanupEnabled = options?.cleanupOrphanedTempDirs !== false;
|
|
60415
60413
|
let dirAge = 0;
|
|
@@ -60436,7 +60434,7 @@ function reconcileOrphanedTempWorkspaces(now = Date.now(), options) {
|
|
|
60436
60434
|
if (fs93.existsSync(stateRunsDir)) {
|
|
60437
60435
|
try {
|
|
60438
60436
|
for (const runDir of fs93.readdirSync(stateRunsDir)) {
|
|
60439
|
-
const manifestPath =
|
|
60437
|
+
const manifestPath = path72.join(stateRunsDir, runDir, "manifest.json");
|
|
60440
60438
|
if (!fs93.existsSync(manifestPath)) continue;
|
|
60441
60439
|
const manifest = loadManifestWithRecovery(manifestPath, runDir);
|
|
60442
60440
|
if (!manifest) continue;
|
|
@@ -60461,7 +60459,7 @@ function reconcileOrphanedTempWorkspaces(now = Date.now(), options) {
|
|
|
60461
60459
|
if (fs93.existsSync(stateRunsDir)) {
|
|
60462
60460
|
try {
|
|
60463
60461
|
for (const runDir of fs93.readdirSync(stateRunsDir)) {
|
|
60464
|
-
const manifestPath =
|
|
60462
|
+
const manifestPath = path72.join(stateRunsDir, runDir, "manifest.json");
|
|
60465
60463
|
if (!fs93.existsSync(manifestPath)) continue;
|
|
60466
60464
|
const manifest = loadManifestWithRecovery(manifestPath, runDir);
|
|
60467
60465
|
if (!manifest) continue;
|
|
@@ -60533,7 +60531,7 @@ __export(crash_recovery_exports, {
|
|
|
60533
60531
|
shouldRecoverTask: () => shouldRecoverTask
|
|
60534
60532
|
});
|
|
60535
60533
|
import * as fs94 from "node:fs";
|
|
60536
|
-
import * as
|
|
60534
|
+
import * as path73 from "node:path";
|
|
60537
60535
|
function isTerminalTask(task) {
|
|
60538
60536
|
return task.status === "completed" || task.status === "failed" || task.status === "cancelled" || task.status === "skipped" || task.status === "needs_attention";
|
|
60539
60537
|
}
|
|
@@ -60763,7 +60761,7 @@ function tryRemoveRunDirectories(entry) {
|
|
|
60763
60761
|
}
|
|
60764
60762
|
function heartbeatAgeMs2(entry, now) {
|
|
60765
60763
|
try {
|
|
60766
|
-
const mtime = fs94.statSync(
|
|
60764
|
+
const mtime = fs94.statSync(path73.join(entry.stateRoot, "heartbeat.json")).mtimeMs;
|
|
60767
60765
|
return Number.isFinite(mtime) ? now - mtime : Infinity;
|
|
60768
60766
|
} catch {
|
|
60769
60767
|
return Infinity;
|
|
@@ -63050,7 +63048,7 @@ var init_run = __esm({
|
|
|
63050
63048
|
|
|
63051
63049
|
// src/runtime/recovery/checkpoint.ts
|
|
63052
63050
|
import * as fs95 from "node:fs";
|
|
63053
|
-
import * as
|
|
63051
|
+
import * as path74 from "node:path";
|
|
63054
63052
|
var FileCheckpointStore;
|
|
63055
63053
|
var init_checkpoint = __esm({
|
|
63056
63054
|
"src/runtime/recovery/checkpoint.ts"() {
|
|
@@ -63065,10 +63063,10 @@ var init_checkpoint = __esm({
|
|
|
63065
63063
|
this.stateRoot = stateRoot;
|
|
63066
63064
|
}
|
|
63067
63065
|
checkpointDir() {
|
|
63068
|
-
return
|
|
63066
|
+
return path74.join(this.stateRoot, "checkpoints");
|
|
63069
63067
|
}
|
|
63070
63068
|
checkpointPath(taskId) {
|
|
63071
|
-
return
|
|
63069
|
+
return path74.join(this.checkpointDir(), `${taskId}.json`);
|
|
63072
63070
|
}
|
|
63073
63071
|
ensureDir() {
|
|
63074
63072
|
const dir = this.checkpointDir();
|
|
@@ -63121,7 +63119,7 @@ var init_checkpoint = __esm({
|
|
|
63121
63119
|
if (!fs95.existsSync(dir)) return [];
|
|
63122
63120
|
return fs95.readdirSync(dir).filter((f) => f.endsWith(".json")).map((f) => {
|
|
63123
63121
|
try {
|
|
63124
|
-
return JSON.parse(fs95.readFileSync(
|
|
63122
|
+
return JSON.parse(fs95.readFileSync(path74.join(dir, f), "utf-8"));
|
|
63125
63123
|
} catch {
|
|
63126
63124
|
return null;
|
|
63127
63125
|
}
|
|
@@ -63137,17 +63135,17 @@ var init_checkpoint = __esm({
|
|
|
63137
63135
|
// src/state/stores/run-cache.ts
|
|
63138
63136
|
import * as crypto7 from "node:crypto";
|
|
63139
63137
|
import * as fs96 from "node:fs";
|
|
63140
|
-
import * as
|
|
63138
|
+
import * as path75 from "node:path";
|
|
63141
63139
|
function computeRunCacheKey(goal, team, workflow, _cwd) {
|
|
63142
63140
|
const normalized = goal.trim().toLowerCase().replace(/\s+/g, " ");
|
|
63143
63141
|
return crypto7.createHash("sha256").update(normalized).update(team).update(workflow).update(_cwd).digest("hex").slice(0, 16);
|
|
63144
63142
|
}
|
|
63145
63143
|
function cacheDir(cwd) {
|
|
63146
|
-
return
|
|
63144
|
+
return path75.join(projectCrewRoot(cwd), "cache");
|
|
63147
63145
|
}
|
|
63148
63146
|
function getCachedRun(cwd, cacheKey2) {
|
|
63149
63147
|
const dir = cacheDir(cwd);
|
|
63150
|
-
const indexPath =
|
|
63148
|
+
const indexPath = path75.join(dir, "index.json");
|
|
63151
63149
|
if (!fs96.existsSync(indexPath)) return null;
|
|
63152
63150
|
try {
|
|
63153
63151
|
const index = JSON.parse(fs96.readFileSync(indexPath, "utf-8"));
|
|
@@ -63176,7 +63174,7 @@ function getCacheStats(cwd) {
|
|
|
63176
63174
|
if (!fs96.existsSync(dir)) return { entries: 0, sizeBytes: 0 };
|
|
63177
63175
|
let sizeBytes = 0;
|
|
63178
63176
|
let entries = 0;
|
|
63179
|
-
const indexPath =
|
|
63177
|
+
const indexPath = path75.join(dir, "index.json");
|
|
63180
63178
|
if (fs96.existsSync(indexPath)) {
|
|
63181
63179
|
try {
|
|
63182
63180
|
const index = JSON.parse(fs96.readFileSync(indexPath, "utf-8"));
|
|
@@ -63204,11 +63202,11 @@ var init_run_cache = __esm({
|
|
|
63204
63202
|
|
|
63205
63203
|
// src/state/stores/run-graph.ts
|
|
63206
63204
|
import * as fs97 from "node:fs";
|
|
63207
|
-
import * as
|
|
63205
|
+
import * as path76 from "node:path";
|
|
63208
63206
|
function loadRunGraph(cwd, runId) {
|
|
63209
63207
|
assertSafePathId("runId", runId);
|
|
63210
63208
|
const crewRoot = projectCrewRoot(cwd);
|
|
63211
|
-
const graphPath =
|
|
63209
|
+
const graphPath = path76.join(crewRoot, "graphs", `${runId}.json`);
|
|
63212
63210
|
if (!fs97.existsSync(graphPath)) return null;
|
|
63213
63211
|
try {
|
|
63214
63212
|
return JSON.parse(fs97.readFileSync(graphPath, "utf-8"));
|
|
@@ -63218,7 +63216,7 @@ function loadRunGraph(cwd, runId) {
|
|
|
63218
63216
|
}
|
|
63219
63217
|
function listRunGraphs(cwd) {
|
|
63220
63218
|
const crewRoot = projectCrewRoot(cwd);
|
|
63221
|
-
const graphsDir =
|
|
63219
|
+
const graphsDir = path76.join(crewRoot, "graphs");
|
|
63222
63220
|
if (!fs97.existsSync(graphsDir)) return [];
|
|
63223
63221
|
return fs97.readdirSync(graphsDir).filter((f) => f.endsWith(".json")).map((f) => f.replace(/\.json$/, ""));
|
|
63224
63222
|
}
|
|
@@ -63467,16 +63465,16 @@ var init_help = __esm({
|
|
|
63467
63465
|
|
|
63468
63466
|
// src/extension/team-onboard.ts
|
|
63469
63467
|
import * as fs98 from "node:fs";
|
|
63470
|
-
import * as
|
|
63468
|
+
import * as path77 from "node:path";
|
|
63471
63469
|
function loadRunSummaries(cwd, options = {}) {
|
|
63472
63470
|
const crewRoot = projectCrewRoot(cwd);
|
|
63473
|
-
const runsRoot =
|
|
63471
|
+
const runsRoot = path77.join(crewRoot, "state", "runs");
|
|
63474
63472
|
if (!fs98.existsSync(runsRoot)) return [];
|
|
63475
63473
|
const limit = options.limit ?? 5;
|
|
63476
63474
|
const teamFilter = options.team;
|
|
63477
63475
|
const entries = fs98.readdirSync(runsRoot).filter((e) => {
|
|
63478
63476
|
try {
|
|
63479
|
-
return fs98.statSync(
|
|
63477
|
+
return fs98.statSync(path77.join(runsRoot, e)).isDirectory();
|
|
63480
63478
|
} catch {
|
|
63481
63479
|
return false;
|
|
63482
63480
|
}
|
|
@@ -63484,7 +63482,7 @@ function loadRunSummaries(cwd, options = {}) {
|
|
|
63484
63482
|
const summaries = [];
|
|
63485
63483
|
for (const runId of entries) {
|
|
63486
63484
|
if (summaries.length >= limit) break;
|
|
63487
|
-
const manifestPath =
|
|
63485
|
+
const manifestPath = path77.join(runsRoot, runId, "manifest.json");
|
|
63488
63486
|
if (!fs98.existsSync(manifestPath)) continue;
|
|
63489
63487
|
try {
|
|
63490
63488
|
const raw = JSON.parse(fs98.readFileSync(manifestPath, "utf-8"));
|
|
@@ -63821,7 +63819,7 @@ var init_team_recommendation = __esm({
|
|
|
63821
63819
|
|
|
63822
63820
|
// src/extension/team-tool/explain.ts
|
|
63823
63821
|
import * as fs99 from "node:fs";
|
|
63824
|
-
import * as
|
|
63822
|
+
import * as path78 from "node:path";
|
|
63825
63823
|
function result3(text, details, isError) {
|
|
63826
63824
|
return { isError, text };
|
|
63827
63825
|
}
|
|
@@ -63875,7 +63873,7 @@ function buildTaskExplainContext(manifest, tasks, taskId) {
|
|
|
63875
63873
|
try {
|
|
63876
63874
|
const entries = fs99.readdirSync(artifactsPath);
|
|
63877
63875
|
for (const entry of entries) {
|
|
63878
|
-
const fullPath =
|
|
63876
|
+
const fullPath = path78.join(artifactsPath, entry);
|
|
63879
63877
|
try {
|
|
63880
63878
|
if (fs99.statSync(fullPath).isFile()) {
|
|
63881
63879
|
filesTouched.push(entry);
|
|
@@ -64038,11 +64036,11 @@ var init_explain = __esm({
|
|
|
64038
64036
|
// src/extension/team-tool/health-monitor.ts
|
|
64039
64037
|
import * as fs100 from "node:fs";
|
|
64040
64038
|
import * as os18 from "node:os";
|
|
64041
|
-
import * as
|
|
64039
|
+
import * as path79 from "node:path";
|
|
64042
64040
|
function readRunTasks(stateRoot) {
|
|
64043
|
-
const tasksPath =
|
|
64044
|
-
const eventsPath =
|
|
64045
|
-
const runId =
|
|
64041
|
+
const tasksPath = path79.join(stateRoot, "tasks.json");
|
|
64042
|
+
const eventsPath = path79.join(stateRoot, "events.jsonl");
|
|
64043
|
+
const runId = path79.basename(stateRoot);
|
|
64046
64044
|
return loadTasksWithRecovery(tasksPath, eventsPath, runId);
|
|
64047
64045
|
}
|
|
64048
64046
|
function detectStuckTasks(run, now) {
|
|
@@ -64079,13 +64077,13 @@ function scanZombieTempWorkspaces(tmpDir, now) {
|
|
|
64079
64077
|
const entries = fs100.readdirSync(tmpDir, { withFileTypes: true });
|
|
64080
64078
|
for (const entry of entries) {
|
|
64081
64079
|
if (!entry.isDirectory() || !entry.name.startsWith("pi-crew-")) continue;
|
|
64082
|
-
const workspaceDir =
|
|
64083
|
-
const stateRunsDir =
|
|
64080
|
+
const workspaceDir = path79.join(tmpDir, entry.name);
|
|
64081
|
+
const stateRunsDir = path79.join(workspaceDir, ".crew", "state", "runs");
|
|
64084
64082
|
if (!fs100.existsSync(stateRunsDir)) continue;
|
|
64085
64083
|
let runCount = 0;
|
|
64086
64084
|
try {
|
|
64087
64085
|
for (const runDir of fs100.readdirSync(stateRunsDir)) {
|
|
64088
|
-
const manifestPath =
|
|
64086
|
+
const manifestPath = path79.join(stateRunsDir, runDir, "manifest.json");
|
|
64089
64087
|
if (fs100.existsSync(manifestPath)) {
|
|
64090
64088
|
try {
|
|
64091
64089
|
const manifest = JSON.parse(fs100.readFileSync(manifestPath, "utf-8"));
|
|
@@ -64112,11 +64110,11 @@ function collectTempWorkspaceRuns(primaryRuns, tmpDir) {
|
|
|
64112
64110
|
const entries = fs100.readdirSync(tmpDir, { withFileTypes: true });
|
|
64113
64111
|
for (const entry of entries) {
|
|
64114
64112
|
if (!entry.isDirectory() || !entry.name.startsWith("pi-crew-")) continue;
|
|
64115
|
-
const stateRunsDir =
|
|
64113
|
+
const stateRunsDir = path79.join(tmpDir, entry.name, ".crew", "state", "runs");
|
|
64116
64114
|
if (!fs100.existsSync(stateRunsDir)) continue;
|
|
64117
64115
|
try {
|
|
64118
64116
|
for (const runDir of fs100.readdirSync(stateRunsDir)) {
|
|
64119
|
-
const manifestPath =
|
|
64117
|
+
const manifestPath = path79.join(stateRunsDir, runDir, "manifest.json");
|
|
64120
64118
|
if (!fs100.existsSync(manifestPath)) continue;
|
|
64121
64119
|
try {
|
|
64122
64120
|
const manifest = JSON.parse(fs100.readFileSync(manifestPath, "utf-8"));
|
|
@@ -64932,7 +64930,7 @@ var init_status = __esm({
|
|
|
64932
64930
|
});
|
|
64933
64931
|
|
|
64934
64932
|
// src/extension/team-tool/dispatch/status.ts
|
|
64935
|
-
import * as
|
|
64933
|
+
import * as path80 from "node:path";
|
|
64936
64934
|
async function handleStatusDomain(params, ctx) {
|
|
64937
64935
|
const action = params.action;
|
|
64938
64936
|
switch (action) {
|
|
@@ -65069,7 +65067,7 @@ Skill cache: ${skillStats.hits} hits, ${skillStats.misses} misses (${(skillStats
|
|
|
65069
65067
|
}
|
|
65070
65068
|
assertSafePathId("runId", params.runId);
|
|
65071
65069
|
assertSafePathId("taskId", params.taskId);
|
|
65072
|
-
const stateRoot =
|
|
65070
|
+
const stateRoot = path80.join(projectCrewRoot(ctx.cwd), "state", "runs", params.runId);
|
|
65073
65071
|
const store = new FileCheckpointStore(stateRoot);
|
|
65074
65072
|
const checkpoint = store.load(params.runId, params.taskId);
|
|
65075
65073
|
if (!checkpoint) {
|
|
@@ -65399,7 +65397,7 @@ var init_task_health = __esm({
|
|
|
65399
65397
|
|
|
65400
65398
|
// src/state/stores/health-store.ts
|
|
65401
65399
|
import * as fs101 from "node:fs";
|
|
65402
|
-
import * as
|
|
65400
|
+
import * as path81 from "node:path";
|
|
65403
65401
|
var HEALTH_DIR, HealthStore;
|
|
65404
65402
|
var init_health_store = __esm({
|
|
65405
65403
|
"src/state/stores/health-store.ts"() {
|
|
@@ -65413,7 +65411,7 @@ var init_health_store = __esm({
|
|
|
65413
65411
|
this.crewRoot = crewRoot;
|
|
65414
65412
|
}
|
|
65415
65413
|
healthDir() {
|
|
65416
|
-
return
|
|
65414
|
+
return path81.join(this.crewRoot, HEALTH_DIR);
|
|
65417
65415
|
}
|
|
65418
65416
|
saveSnapshot(manifest) {
|
|
65419
65417
|
const health = computeRunHealth(manifest);
|
|
@@ -65426,7 +65424,7 @@ var init_health_store = __esm({
|
|
|
65426
65424
|
};
|
|
65427
65425
|
const dir = this.healthDir();
|
|
65428
65426
|
fs101.mkdirSync(dir, { recursive: true });
|
|
65429
|
-
const file =
|
|
65427
|
+
const file = path81.join(dir, `${manifest.runId}.json`);
|
|
65430
65428
|
atomicWriteFile(file, JSON.stringify(snapshot, null, 2) + "\n");
|
|
65431
65429
|
return snapshot;
|
|
65432
65430
|
}
|
|
@@ -65443,7 +65441,7 @@ var init_health_store = __esm({
|
|
|
65443
65441
|
if (!fs101.existsSync(dir)) return [];
|
|
65444
65442
|
const snapshots = fs101.readdirSync(dir).filter((f) => f.endsWith(".json")).map((f) => {
|
|
65445
65443
|
try {
|
|
65446
|
-
return JSON.parse(fs101.readFileSync(
|
|
65444
|
+
return JSON.parse(fs101.readFileSync(path81.join(dir, f), "utf8"));
|
|
65447
65445
|
} catch {
|
|
65448
65446
|
return null;
|
|
65449
65447
|
}
|
|
@@ -65697,7 +65695,7 @@ var init_policy_engine = __esm({
|
|
|
65697
65695
|
|
|
65698
65696
|
// src/runtime/finalize-run.ts
|
|
65699
65697
|
import * as fs102 from "node:fs";
|
|
65700
|
-
import * as
|
|
65698
|
+
import * as path82 from "node:path";
|
|
65701
65699
|
function formatTaskProgress(task) {
|
|
65702
65700
|
return `- ${task.id}: ${task.status} (${task.role} -> ${task.agent})${task.taskPacket ? ` scope=${task.taskPacket.scope}` : ""}${task.verification ? ` green=${task.verification.observedGreenLevel}/${task.verification.requiredGreenLevel}` : ""}${task.error ? ` - ${task.error}` : ""}`;
|
|
65703
65701
|
}
|
|
@@ -65908,7 +65906,7 @@ async function finalizeRun(ctx) {
|
|
|
65908
65906
|
const missingOutputs = [];
|
|
65909
65907
|
for (const step of input.workflow.steps) {
|
|
65910
65908
|
if (step.output && typeof step.output === "string") {
|
|
65911
|
-
const outputPath =
|
|
65909
|
+
const outputPath = path82.join(manifest.artifactsRoot, step.output);
|
|
65912
65910
|
if (!fs102.existsSync(outputPath)) {
|
|
65913
65911
|
missingOutputs.push(step.output);
|
|
65914
65912
|
}
|
|
@@ -66037,7 +66035,7 @@ async function finalizeRun(ctx) {
|
|
|
66037
66035
|
});
|
|
66038
66036
|
manifest = finalManifest.manifest;
|
|
66039
66037
|
const finalTasks = finalManifest.tasks;
|
|
66040
|
-
const crewRoot =
|
|
66038
|
+
const crewRoot = path82.dirname(path82.dirname(path82.dirname(finalManifest.manifest.stateRoot)));
|
|
66041
66039
|
const healthStore = new HealthStore(crewRoot);
|
|
66042
66040
|
healthStore.saveSnapshot({
|
|
66043
66041
|
runId: finalManifest.manifest.runId,
|
|
@@ -67219,10 +67217,10 @@ __export(team_runner_exports, {
|
|
|
67219
67217
|
});
|
|
67220
67218
|
import { spawn as spawn7 } from "node:child_process";
|
|
67221
67219
|
import * as fs104 from "node:fs";
|
|
67222
|
-
import * as
|
|
67220
|
+
import * as path83 from "node:path";
|
|
67223
67221
|
import { fileURLToPath as fileURLToPath8 } from "node:url";
|
|
67224
67222
|
function startTeamRunHeartbeat(stateRoot, runId) {
|
|
67225
|
-
const heartbeatPath =
|
|
67223
|
+
const heartbeatPath = path83.join(stateRoot, "heartbeat.json");
|
|
67226
67224
|
const writeHeartbeat = () => {
|
|
67227
67225
|
try {
|
|
67228
67226
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -67258,7 +67256,7 @@ function perfScriptPath(scriptName) {
|
|
|
67258
67256
|
function startPerfSampler(manifest, team, signal) {
|
|
67259
67257
|
const marker = (msg) => {
|
|
67260
67258
|
try {
|
|
67261
|
-
fs104.appendFileSync(
|
|
67259
|
+
fs104.appendFileSync(path83.join(manifest.artifactsRoot, "perf-obs.log"), `[${(/* @__PURE__ */ new Date()).toISOString()}] ${msg}
|
|
67262
67260
|
`);
|
|
67263
67261
|
} catch {
|
|
67264
67262
|
}
|
|
@@ -67274,9 +67272,9 @@ function startPerfSampler(manifest, team, signal) {
|
|
|
67274
67272
|
return;
|
|
67275
67273
|
}
|
|
67276
67274
|
marker(`spawning sampler from ${samplerPath}`);
|
|
67277
|
-
const crewRoot =
|
|
67278
|
-
const outPath =
|
|
67279
|
-
const logPath =
|
|
67275
|
+
const crewRoot = path83.dirname(path83.dirname(path83.dirname(manifest.stateRoot)));
|
|
67276
|
+
const outPath = path83.join(manifest.artifactsRoot, "resources.jsonl");
|
|
67277
|
+
const logPath = path83.join(manifest.artifactsRoot, "perf-obs.log");
|
|
67280
67278
|
try {
|
|
67281
67279
|
const child = spawn7(
|
|
67282
67280
|
process.execPath,
|
|
@@ -67308,9 +67306,9 @@ function startPerfSampler(manifest, team, signal) {
|
|
|
67308
67306
|
function schedulePerfAnalyze(manifest, team, signal) {
|
|
67309
67307
|
if (team.observability !== true) return;
|
|
67310
67308
|
const analyzePath = perfScriptPath("analyze-run.mjs");
|
|
67311
|
-
const resourcesPath =
|
|
67309
|
+
const resourcesPath = path83.join(manifest.artifactsRoot, "resources.jsonl");
|
|
67312
67310
|
if (!analyzePath || !fs104.existsSync(resourcesPath)) return;
|
|
67313
|
-
const crewRoot =
|
|
67311
|
+
const crewRoot = path83.dirname(path83.dirname(path83.dirname(manifest.stateRoot)));
|
|
67314
67312
|
const timer = setTimeout(() => {
|
|
67315
67313
|
try {
|
|
67316
67314
|
const child = spawn7(
|
|
@@ -68212,12 +68210,12 @@ __export(gitignore_manager_exports, {
|
|
|
68212
68210
|
updateGitignore: () => updateGitignore
|
|
68213
68211
|
});
|
|
68214
68212
|
import * as fs105 from "node:fs";
|
|
68215
|
-
import * as
|
|
68213
|
+
import * as path84 from "node:path";
|
|
68216
68214
|
function resolveEntries(gitignorePath) {
|
|
68217
|
-
const repoRoot =
|
|
68215
|
+
const repoRoot = path84.dirname(gitignorePath);
|
|
68218
68216
|
try {
|
|
68219
|
-
if (fs105.existsSync(
|
|
68220
|
-
if (fs105.existsSync(
|
|
68217
|
+
if (fs105.existsSync(path84.join(repoRoot, ".crew"))) return CREW_GITIGNORE_ENTRIES;
|
|
68218
|
+
if (fs105.existsSync(path84.join(repoRoot, ".pi"))) return PI_TEAMS_GITIGNORE_ENTRIES;
|
|
68221
68219
|
} catch {
|
|
68222
68220
|
}
|
|
68223
68221
|
return CREW_GITIGNORE_ENTRIES;
|
|
@@ -68274,7 +68272,7 @@ __export(crew_init_exports, {
|
|
|
68274
68272
|
updateGitignore: () => updateGitignore
|
|
68275
68273
|
});
|
|
68276
68274
|
import * as fs106 from "node:fs";
|
|
68277
|
-
import * as
|
|
68275
|
+
import * as path85 from "node:path";
|
|
68278
68276
|
function buildCrewReadme() {
|
|
68279
68277
|
return `# .crew \u2014 pi-crew Runtime Directory
|
|
68280
68278
|
|
|
@@ -68344,7 +68342,7 @@ function safeDirname(p) {
|
|
|
68344
68342
|
return p.slice(0, idx);
|
|
68345
68343
|
}
|
|
68346
68344
|
function safeResolve(p, pathDep) {
|
|
68347
|
-
const dep = pathDep ??
|
|
68345
|
+
const dep = pathDep ?? path85;
|
|
68348
68346
|
if (dep && typeof dep.resolve === "function") return dep.resolve(p);
|
|
68349
68347
|
return p;
|
|
68350
68348
|
}
|
|
@@ -68431,9 +68429,9 @@ __export(parallel_research_exports, {
|
|
|
68431
68429
|
sourcePiProjects: () => sourcePiProjects
|
|
68432
68430
|
});
|
|
68433
68431
|
import * as fs107 from "node:fs";
|
|
68434
|
-
import * as
|
|
68432
|
+
import * as path86 from "node:path";
|
|
68435
68433
|
function sourcePiProjects(cwd) {
|
|
68436
|
-
const sourceDir =
|
|
68434
|
+
const sourceDir = path86.join(cwd, "Source");
|
|
68437
68435
|
try {
|
|
68438
68436
|
return fs107.readdirSync(sourceDir, { withFileTypes: true }).filter((entry) => entry.isDirectory() && entry.name.startsWith("pi-")).map((entry) => `Source/${entry.name}`).sort();
|
|
68439
68437
|
} catch {
|
|
@@ -70171,10 +70169,10 @@ var init_dwf_state_store = __esm({
|
|
|
70171
70169
|
}
|
|
70172
70170
|
/** Load the checkpoint for this run's stateRoot. Returns undefined if missing or corrupt (fresh run). */
|
|
70173
70171
|
load() {
|
|
70174
|
-
const
|
|
70172
|
+
const path103 = this.path;
|
|
70175
70173
|
try {
|
|
70176
|
-
if (!existsSync74(
|
|
70177
|
-
const raw = readFileSync79(
|
|
70174
|
+
if (!existsSync74(path103)) return void 0;
|
|
70175
|
+
const raw = readFileSync79(path103, "utf-8");
|
|
70178
70176
|
const parsed = JSON.parse(raw);
|
|
70179
70177
|
if (!parsed || typeof parsed !== "object" || typeof parsed.runId !== "string") return void 0;
|
|
70180
70178
|
return parsed;
|
|
@@ -70184,11 +70182,11 @@ var init_dwf_state_store = __esm({
|
|
|
70184
70182
|
}
|
|
70185
70183
|
/** Atomically persist a checkpoint state. Stamps `updatedAt` (callers need not set it). */
|
|
70186
70184
|
save(state2) {
|
|
70187
|
-
const
|
|
70185
|
+
const path103 = this.path;
|
|
70188
70186
|
const next = { ...state2, updatedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
70189
70187
|
try {
|
|
70190
|
-
mkdirSync42(dirname43(
|
|
70191
|
-
atomicWriteJson(
|
|
70188
|
+
mkdirSync42(dirname43(path103), { recursive: true });
|
|
70189
|
+
atomicWriteJson(path103, next);
|
|
70192
70190
|
} catch (error) {
|
|
70193
70191
|
logInternalError("dwf-state-store.save", error, `runId=${state2.runId}`);
|
|
70194
70192
|
throw error;
|
|
@@ -70196,10 +70194,10 @@ var init_dwf_state_store = __esm({
|
|
|
70196
70194
|
}
|
|
70197
70195
|
/** Remove the checkpoint file (after a clean completion). Best-effort; never throws. */
|
|
70198
70196
|
delete() {
|
|
70199
|
-
const
|
|
70197
|
+
const path103 = this.path;
|
|
70200
70198
|
try {
|
|
70201
|
-
if (!existsSync74(
|
|
70202
|
-
unlinkSync13(
|
|
70199
|
+
if (!existsSync74(path103)) return;
|
|
70200
|
+
unlinkSync13(path103);
|
|
70203
70201
|
} catch (error) {
|
|
70204
70202
|
logInternalError("dwf-state-store.delete", error);
|
|
70205
70203
|
}
|
|
@@ -71004,7 +71002,7 @@ __export(dynamic_workflow_runner_exports, {
|
|
|
71004
71002
|
runDynamicWorkflow: () => runDynamicWorkflow
|
|
71005
71003
|
});
|
|
71006
71004
|
import { readFileSync as readFileSync80 } from "node:fs";
|
|
71007
|
-
import { join as
|
|
71005
|
+
import { join as join82 } from "node:path";
|
|
71008
71006
|
import { transformSync } from "esbuild";
|
|
71009
71007
|
function assertStructuredCloneable(value, name) {
|
|
71010
71008
|
try {
|
|
@@ -71016,7 +71014,7 @@ function assertStructuredCloneable(value, name) {
|
|
|
71016
71014
|
}
|
|
71017
71015
|
function resolveScriptPath(workflow, cwd) {
|
|
71018
71016
|
const crewRoot = projectCrewRoot(cwd);
|
|
71019
|
-
const allowedBases = [
|
|
71017
|
+
const allowedBases = [join82(projectCrewRoot(cwd), "workflows"), join82(userPiRoot(), "workflows"), join82(packageRoot(), "workflows")];
|
|
71020
71018
|
for (const base of allowedBases) {
|
|
71021
71019
|
try {
|
|
71022
71020
|
const real = resolveRealContainedPath(base, workflow.filePath);
|
|
@@ -71194,7 +71192,7 @@ __export(run_exports, {
|
|
|
71194
71192
|
handleRun: () => handleRun2
|
|
71195
71193
|
});
|
|
71196
71194
|
import * as fs109 from "node:fs";
|
|
71197
|
-
import * as
|
|
71195
|
+
import * as path87 from "node:path";
|
|
71198
71196
|
async function executeTeamRun2(...args) {
|
|
71199
71197
|
const mod = await Promise.resolve().then(() => (init_team_runner(), team_runner_exports));
|
|
71200
71198
|
return mod.executeTeamRun(...args);
|
|
@@ -71301,7 +71299,7 @@ function formatRunResult(manifest, options) {
|
|
|
71301
71299
|
const summaryArtifact = manifest.artifacts?.find((a) => a.kind === "summary");
|
|
71302
71300
|
if (summaryArtifact) {
|
|
71303
71301
|
try {
|
|
71304
|
-
const sumPath =
|
|
71302
|
+
const sumPath = path87.join(manifest.artifactsRoot, summaryArtifact.path);
|
|
71305
71303
|
summaryContent = fs109.readFileSync(sumPath, "utf-8").trim().slice(0, 4e3);
|
|
71306
71304
|
} catch {
|
|
71307
71305
|
}
|
|
@@ -71908,7 +71906,7 @@ __export(team_tool_exports, {
|
|
|
71908
71906
|
uninstallCrewGlobalRegistry: () => uninstallCrewGlobalRegistry
|
|
71909
71907
|
});
|
|
71910
71908
|
import * as fs110 from "node:fs";
|
|
71911
|
-
import * as
|
|
71909
|
+
import * as path88 from "node:path";
|
|
71912
71910
|
async function executeTeamRun3(...args) {
|
|
71913
71911
|
const mod = await Promise.resolve().then(() => (init_team_runner(), team_runner_exports));
|
|
71914
71912
|
return mod.executeTeamRun(...args);
|
|
@@ -72048,7 +72046,7 @@ async function recoverCheckpointedTasks(manifest, tasks) {
|
|
|
72048
72046
|
};
|
|
72049
72047
|
}
|
|
72050
72048
|
if (task.checkpoint.phase === "child-stdout-final") {
|
|
72051
|
-
const transcriptsDir =
|
|
72049
|
+
const transcriptsDir = path88.join(manifest.artifactsRoot, "transcripts");
|
|
72052
72050
|
let transcriptPath;
|
|
72053
72051
|
if (fs110.existsSync(transcriptsDir)) {
|
|
72054
72052
|
const files = fs110.readdirSync(transcriptsDir).filter((f) => f.startsWith(`${task.id}.attempt-`) && f.endsWith(".jsonl"));
|
|
@@ -72058,7 +72056,7 @@ async function recoverCheckpointedTasks(manifest, tasks) {
|
|
|
72058
72056
|
const idxB = parseInt(b.match(/\.attempt-(\d+)\./)?.[1] ?? "0", 10);
|
|
72059
72057
|
return idxB - idxA;
|
|
72060
72058
|
});
|
|
72061
|
-
transcriptPath =
|
|
72059
|
+
transcriptPath = path88.join(transcriptsDir, files[0]);
|
|
72062
72060
|
}
|
|
72063
72061
|
}
|
|
72064
72062
|
if (!transcriptPath) return task;
|
|
@@ -72385,7 +72383,7 @@ function locateRunCwdUncached(runId, baseCwd) {
|
|
|
72385
72383
|
if (entry.name.startsWith(".")) {
|
|
72386
72384
|
if (!entry.name.startsWith(".crew") && !entry.name.startsWith(".pi") && !entry.name.startsWith(".tmp-crew")) continue;
|
|
72387
72385
|
}
|
|
72388
|
-
const candidate =
|
|
72386
|
+
const candidate = path88.join(baseCwd, entry.name);
|
|
72389
72387
|
if (loadRunManifestById(candidate, runId)) {
|
|
72390
72388
|
return candidate;
|
|
72391
72389
|
}
|
|
@@ -75023,8 +75021,8 @@ function formatValue2(value, id) {
|
|
|
75023
75021
|
if (typeof value === "object") return JSON.stringify(value);
|
|
75024
75022
|
return String(value);
|
|
75025
75023
|
}
|
|
75026
|
-
function getNestedValue(obj,
|
|
75027
|
-
const keys =
|
|
75024
|
+
function getNestedValue(obj, path103) {
|
|
75025
|
+
const keys = path103.split(".");
|
|
75028
75026
|
let current = obj;
|
|
75029
75027
|
for (const key of keys) {
|
|
75030
75028
|
if (!current || typeof current !== "object") return void 0;
|
|
@@ -75876,7 +75874,7 @@ var init_settings_overlay = __esm({
|
|
|
75876
75874
|
});
|
|
75877
75875
|
|
|
75878
75876
|
// src/extension/registration/commands/shared.ts
|
|
75879
|
-
import * as
|
|
75877
|
+
import * as path89 from "node:path";
|
|
75880
75878
|
async function handleTeamTool4(params, ctx) {
|
|
75881
75879
|
if (!_cachedHandleTeamTool) {
|
|
75882
75880
|
if (!_handleTeamToolPromise) {
|
|
@@ -76130,7 +76128,7 @@ async function handleHealthDashboardAction(ctx, selection2) {
|
|
|
76130
76128
|
return;
|
|
76131
76129
|
}
|
|
76132
76130
|
if (selection2.action === "health-diagnostic-export") {
|
|
76133
|
-
const diagDir =
|
|
76131
|
+
const diagDir = path89.join(loaded.manifest.artifactsRoot, "diagnostic");
|
|
76134
76132
|
const recent = listRecentDiagnostic(diagDir, 6e4);
|
|
76135
76133
|
if (recent) {
|
|
76136
76134
|
const confirmed = await openConfirm(ctx, {
|
|
@@ -76967,7 +76965,7 @@ var init_team_manager_command = __esm({
|
|
|
76967
76965
|
|
|
76968
76966
|
// src/extension/registration/commands/manage.ts
|
|
76969
76967
|
import * as fs112 from "node:fs";
|
|
76970
|
-
import * as
|
|
76968
|
+
import * as path90 from "node:path";
|
|
76971
76969
|
function registerManageCommands(pi, deps) {
|
|
76972
76970
|
pi.registerCommand("team-prune", {
|
|
76973
76971
|
description: "Prune old finished pi-crew runs, keeping the newest N",
|
|
@@ -77174,10 +77172,10 @@ function registerManageCommands(pi, deps) {
|
|
|
77174
77172
|
await notifyCommandResult(ctx, error instanceof Error ? error.message : String(error));
|
|
77175
77173
|
return;
|
|
77176
77174
|
}
|
|
77177
|
-
const skillsDir =
|
|
77175
|
+
const skillsDir = path90.resolve(
|
|
77178
77176
|
cwd,
|
|
77179
|
-
useProject ? "skills" :
|
|
77180
|
-
|
|
77177
|
+
useProject ? "skills" : path90.join(
|
|
77178
|
+
path90.dirname(
|
|
77181
77179
|
__require.resolve("../../../../package.json", {
|
|
77182
77180
|
paths: [__dirname]
|
|
77183
77181
|
})
|
|
@@ -77185,8 +77183,8 @@ function registerManageCommands(pi, deps) {
|
|
|
77185
77183
|
"skills"
|
|
77186
77184
|
)
|
|
77187
77185
|
);
|
|
77188
|
-
const skillDir =
|
|
77189
|
-
const skillPath =
|
|
77186
|
+
const skillDir = path90.join(skillsDir, template.id);
|
|
77187
|
+
const skillPath = path90.join(skillDir, "SKILL.md");
|
|
77190
77188
|
try {
|
|
77191
77189
|
fs112.mkdirSync(skillDir, { recursive: true });
|
|
77192
77190
|
atomicWriteFile(skillPath, instantiated.content);
|
|
@@ -77549,13 +77547,13 @@ var init_commands2 = __esm({
|
|
|
77549
77547
|
// src/runtime/subagent-manager.ts
|
|
77550
77548
|
import { randomUUID as randomUUID12 } from "node:crypto";
|
|
77551
77549
|
import * as fs115 from "node:fs";
|
|
77552
|
-
import * as
|
|
77550
|
+
import * as path93 from "node:path";
|
|
77553
77551
|
function isValidSubagentId(id) {
|
|
77554
77552
|
return /^[a-z0-9_]+$/i.test(id) && id.length <= 128;
|
|
77555
77553
|
}
|
|
77556
77554
|
function persistedSubagentPath(cwd, id) {
|
|
77557
77555
|
if (!isValidSubagentId(id)) throw new Error(`Invalid subagent id: ${id}`);
|
|
77558
|
-
return
|
|
77556
|
+
return path93.join(projectCrewRoot(cwd), DEFAULT_PATHS.state.subagentsSubdir, `${id}.json`);
|
|
77559
77557
|
}
|
|
77560
77558
|
function serializableRecord(record) {
|
|
77561
77559
|
const { promise: _promise, ...rest } = record;
|
|
@@ -77564,7 +77562,7 @@ function serializableRecord(record) {
|
|
|
77564
77562
|
function savePersistedSubagentRecord(cwd, record) {
|
|
77565
77563
|
try {
|
|
77566
77564
|
const filePath = persistedSubagentPath(cwd, record.id);
|
|
77567
|
-
fs115.mkdirSync(
|
|
77565
|
+
fs115.mkdirSync(path93.dirname(filePath), { recursive: true });
|
|
77568
77566
|
atomicWriteFile(filePath, `${JSON.stringify(redactSecrets(serializableRecord(record)), null, 2)}
|
|
77569
77567
|
`);
|
|
77570
77568
|
} catch (error) {
|
|
@@ -78111,13 +78109,13 @@ function line3(text, width) {
|
|
|
78111
78109
|
function border(left, fill, right, width) {
|
|
78112
78110
|
return `${left}${fill.repeat(Math.max(0, width - 2))}${right}`;
|
|
78113
78111
|
}
|
|
78114
|
-
function readTasks2(
|
|
78112
|
+
function readTasks2(path103) {
|
|
78115
78113
|
const parse4 = () => {
|
|
78116
|
-
const parsed = JSON.parse(fs117.readFileSync(
|
|
78114
|
+
const parsed = JSON.parse(fs117.readFileSync(path103, "utf-8"));
|
|
78117
78115
|
return Array.isArray(parsed) ? parsed : [];
|
|
78118
78116
|
};
|
|
78119
78117
|
try {
|
|
78120
|
-
return readJsonFileCoalesced(
|
|
78118
|
+
return readJsonFileCoalesced(path103, TASK_READ_TTL_MS3, parse4);
|
|
78121
78119
|
} catch {
|
|
78122
78120
|
return [];
|
|
78123
78121
|
}
|
|
@@ -78840,13 +78838,13 @@ __export(notification_sink_exports, {
|
|
|
78840
78838
|
createJsonlSink: () => createJsonlSink
|
|
78841
78839
|
});
|
|
78842
78840
|
import * as fs119 from "node:fs";
|
|
78843
|
-
import * as
|
|
78841
|
+
import * as path95 from "node:path";
|
|
78844
78842
|
function rotateOldFiles(dir, retentionDays, now = Date.now()) {
|
|
78845
78843
|
if (!fs119.existsSync(dir)) return;
|
|
78846
78844
|
const cutoff = now - retentionDays * 24 * 60 * 60 * 1e3;
|
|
78847
78845
|
for (const entry of fs119.readdirSync(dir, { withFileTypes: true })) {
|
|
78848
78846
|
if (!entry.isFile() || !entry.name.endsWith(".jsonl")) continue;
|
|
78849
|
-
const filePath =
|
|
78847
|
+
const filePath = path95.join(dir, entry.name);
|
|
78850
78848
|
try {
|
|
78851
78849
|
if (fs119.statSync(filePath).mtimeMs < cutoff) fs119.unlinkSync(filePath);
|
|
78852
78850
|
} catch (error) {
|
|
@@ -78855,7 +78853,7 @@ function rotateOldFiles(dir, retentionDays, now = Date.now()) {
|
|
|
78855
78853
|
}
|
|
78856
78854
|
}
|
|
78857
78855
|
function createJsonlSink(crewRoot, retentionDays = 7) {
|
|
78858
|
-
const dir =
|
|
78856
|
+
const dir = path95.join(crewRoot, "state", "notifications");
|
|
78859
78857
|
let lastRotateDate = "";
|
|
78860
78858
|
return {
|
|
78861
78859
|
write(notification) {
|
|
@@ -78871,7 +78869,7 @@ function createJsonlSink(crewRoot, retentionDays = 7) {
|
|
|
78871
78869
|
...notification,
|
|
78872
78870
|
timestamp
|
|
78873
78871
|
});
|
|
78874
|
-
fs119.appendFileSync(
|
|
78872
|
+
fs119.appendFileSync(path95.join(dir, `${date}.jsonl`), `${JSON.stringify(payload)}
|
|
78875
78873
|
`, "utf-8");
|
|
78876
78874
|
} catch (error) {
|
|
78877
78875
|
logInternalError("notification-sink.write", error);
|
|
@@ -80153,13 +80151,13 @@ __export(metric_sink_exports, {
|
|
|
80153
80151
|
createMetricFileSink: () => createMetricFileSink
|
|
80154
80152
|
});
|
|
80155
80153
|
import * as fs120 from "node:fs";
|
|
80156
|
-
import * as
|
|
80154
|
+
import * as path96 from "node:path";
|
|
80157
80155
|
function rotateOldFiles2(dir, retentionDays, now = Date.now()) {
|
|
80158
80156
|
if (!fs120.existsSync(dir)) return;
|
|
80159
80157
|
const maxAge = retentionDays * 24 * 60 * 60 * 1e3;
|
|
80160
80158
|
for (const file of fs120.readdirSync(dir)) {
|
|
80161
80159
|
if (!file.endsWith(".jsonl")) continue;
|
|
80162
|
-
const fullPath =
|
|
80160
|
+
const fullPath = path96.join(dir, file);
|
|
80163
80161
|
try {
|
|
80164
80162
|
if (now - fs120.statSync(fullPath).mtimeMs > maxAge) fs120.unlinkSync(fullPath);
|
|
80165
80163
|
} catch (error) {
|
|
@@ -80168,7 +80166,7 @@ function rotateOldFiles2(dir, retentionDays, now = Date.now()) {
|
|
|
80168
80166
|
}
|
|
80169
80167
|
}
|
|
80170
80168
|
function createMetricFileSink(opts) {
|
|
80171
|
-
const dir =
|
|
80169
|
+
const dir = path96.join(opts.crewRoot, "state", "metrics");
|
|
80172
80170
|
const retentionDays = opts.retentionDays ?? 7;
|
|
80173
80171
|
let fd;
|
|
80174
80172
|
let fdDate;
|
|
@@ -80183,7 +80181,7 @@ function createMetricFileSink(opts) {
|
|
|
80183
80181
|
}
|
|
80184
80182
|
fs120.mkdirSync(dir, { recursive: true });
|
|
80185
80183
|
rotateOldFiles2(dir, retentionDays);
|
|
80186
|
-
fd = fs120.openSync(
|
|
80184
|
+
fd = fs120.openSync(path96.join(dir, `${date}.jsonl`), "a");
|
|
80187
80185
|
fdDate = date;
|
|
80188
80186
|
return fd;
|
|
80189
80187
|
};
|
|
@@ -80242,7 +80240,7 @@ __export(heartbeat_watcher_exports, {
|
|
|
80242
80240
|
HeartbeatWatcher: () => HeartbeatWatcher
|
|
80243
80241
|
});
|
|
80244
80242
|
import * as fs121 from "node:fs";
|
|
80245
|
-
import * as
|
|
80243
|
+
import * as path97 from "node:path";
|
|
80246
80244
|
var HeartbeatWatcher;
|
|
80247
80245
|
var init_heartbeat_watcher = __esm({
|
|
80248
80246
|
"src/runtime/heartbeat/heartbeat-watcher.ts"() {
|
|
@@ -80324,9 +80322,9 @@ var init_heartbeat_watcher = __esm({
|
|
|
80324
80322
|
level = "stale";
|
|
80325
80323
|
}
|
|
80326
80324
|
if (level === "dead" && !isProcessAlive && loaded.manifest.artifactsRoot) {
|
|
80327
|
-
const resultsDir =
|
|
80328
|
-
const candidate =
|
|
80329
|
-
if (candidate.startsWith(resultsDir +
|
|
80325
|
+
const resultsDir = path97.resolve(loaded.manifest.artifactsRoot, "results");
|
|
80326
|
+
const candidate = path97.resolve(resultsDir, `${task.id}.txt`);
|
|
80327
|
+
if (candidate.startsWith(resultsDir + path97.sep) && fs121.existsSync(candidate)) {
|
|
80330
80328
|
level = "stale";
|
|
80331
80329
|
}
|
|
80332
80330
|
}
|
|
@@ -81501,20 +81499,20 @@ init_dock_footer();
|
|
|
81501
81499
|
// src/extension/crew-vibes/config.ts
|
|
81502
81500
|
init_env_vars();
|
|
81503
81501
|
import { existsSync as existsSync78, mkdirSync as mkdirSync45, readFileSync as readFileSync85, writeFileSync as writeFileSync11 } from "node:fs";
|
|
81504
|
-
import { dirname as dirname45, join as
|
|
81502
|
+
import { dirname as dirname45, join as join88 } from "node:path";
|
|
81505
81503
|
|
|
81506
81504
|
// src/extension/crew-vibes/font-detect.ts
|
|
81507
81505
|
import { existsSync as existsSync77, readFileSync as readFileSync84 } from "node:fs";
|
|
81508
81506
|
import { homedir as homedir13, platform } from "node:os";
|
|
81509
|
-
import { join as
|
|
81507
|
+
import { join as join87 } from "node:path";
|
|
81510
81508
|
function fontPath() {
|
|
81511
81509
|
const os20 = platform();
|
|
81512
81510
|
const home = homedir13();
|
|
81513
|
-
if (os20 === "darwin") return
|
|
81514
|
-
if (os20 === "linux") return
|
|
81511
|
+
if (os20 === "darwin") return join87(home, "Library", "Fonts", "crew-vibes.ttf");
|
|
81512
|
+
if (os20 === "linux") return join87(home, ".local", "share", "fonts", "crew-vibes.ttf");
|
|
81515
81513
|
if (os20 === "win32") {
|
|
81516
|
-
const local = process.env.LOCALAPPDATA ??
|
|
81517
|
-
return
|
|
81514
|
+
const local = process.env.LOCALAPPDATA ?? join87(home, "AppData", "Local");
|
|
81515
|
+
return join87(local, "Microsoft", "Windows", "Fonts", "crew-vibes.ttf");
|
|
81518
81516
|
}
|
|
81519
81517
|
return "";
|
|
81520
81518
|
}
|
|
@@ -81563,7 +81561,7 @@ function resolveHome() {
|
|
|
81563
81561
|
return getCrewEnv("PI_CREW_HOME")?.trim() || process.env.HOME || process.env.USERPROFILE || "";
|
|
81564
81562
|
}
|
|
81565
81563
|
function configPath2() {
|
|
81566
|
-
return
|
|
81564
|
+
return join88(resolveHome(), ".pi", "agent", "pi-crew-vibes.json");
|
|
81567
81565
|
}
|
|
81568
81566
|
var DEFAULT_CONFIG2 = {
|
|
81569
81567
|
enabled: true,
|
|
@@ -81676,17 +81674,17 @@ function normalizeConfig(raw) {
|
|
|
81676
81674
|
}
|
|
81677
81675
|
function loadConfig2() {
|
|
81678
81676
|
try {
|
|
81679
|
-
const
|
|
81680
|
-
if (!existsSync78(
|
|
81681
|
-
return normalizeConfig(JSON.parse(readFileSync85(
|
|
81677
|
+
const path103 = configPath2();
|
|
81678
|
+
if (!existsSync78(path103)) return normalizeConfig(void 0);
|
|
81679
|
+
return normalizeConfig(JSON.parse(readFileSync85(path103, "utf8")));
|
|
81682
81680
|
} catch {
|
|
81683
81681
|
return normalizeConfig(void 0);
|
|
81684
81682
|
}
|
|
81685
81683
|
}
|
|
81686
81684
|
function saveConfig(config) {
|
|
81687
|
-
const
|
|
81688
|
-
mkdirSync45(dirname45(
|
|
81689
|
-
writeFileSync11(
|
|
81685
|
+
const path103 = configPath2();
|
|
81686
|
+
mkdirSync45(dirname45(path103), { recursive: true });
|
|
81687
|
+
writeFileSync11(path103, `${JSON.stringify(normalizeConfig(config), null, 2)}
|
|
81690
81688
|
`);
|
|
81691
81689
|
}
|
|
81692
81690
|
|
|
@@ -82081,14 +82079,14 @@ function createCrewVibesFooter(deps) {
|
|
|
82081
82079
|
// src/extension/crew-vibes/provider-usage.ts
|
|
82082
82080
|
import { readFileSync as readFileSync86 } from "node:fs";
|
|
82083
82081
|
import { homedir as homedir14 } from "node:os";
|
|
82084
|
-
import { join as
|
|
82082
|
+
import { join as join89 } from "node:path";
|
|
82085
82083
|
function withTimeout(ms, fn) {
|
|
82086
82084
|
const controller = new AbortController();
|
|
82087
82085
|
const timeoutId = setTimeout(() => controller.abort(), ms);
|
|
82088
82086
|
return fn(controller.signal).finally(() => clearTimeout(timeoutId));
|
|
82089
82087
|
}
|
|
82090
82088
|
function piAuthPath() {
|
|
82091
|
-
return
|
|
82089
|
+
return join89(homedir14(), ".pi", "agent", "auth.json");
|
|
82092
82090
|
}
|
|
82093
82091
|
function loadAnthropicToken() {
|
|
82094
82092
|
const envToken = process.env.ANTHROPIC_OAUTH_TOKEN?.trim();
|
|
@@ -82133,8 +82131,8 @@ function tokenFromHostEntry(entry) {
|
|
|
82133
82131
|
return void 0;
|
|
82134
82132
|
}
|
|
82135
82133
|
function loadLegacyCopilotToken() {
|
|
82136
|
-
const configHome = process.env.XDG_CONFIG_HOME?.trim() ||
|
|
82137
|
-
const candidates = [
|
|
82134
|
+
const configHome = process.env.XDG_CONFIG_HOME?.trim() || join89(homedir14(), ".config");
|
|
82135
|
+
const candidates = [join89(configHome, "github-copilot", "hosts.json"), join89(homedir14(), ".github-copilot", "hosts.json")];
|
|
82138
82136
|
for (const hostsPath of candidates) {
|
|
82139
82137
|
try {
|
|
82140
82138
|
const data = JSON.parse(readFileSync86(hostsPath, "utf8"));
|
|
@@ -82998,13 +82996,13 @@ init_fs_watch();
|
|
|
82998
82996
|
init_paths();
|
|
82999
82997
|
init_safe_paths();
|
|
83000
82998
|
import * as fs113 from "node:fs";
|
|
83001
|
-
import * as
|
|
82999
|
+
import * as path91 from "node:path";
|
|
83002
83000
|
var DEFAULT_TTL_MS = 500;
|
|
83003
83001
|
var DEFAULT_STAT_TTL_MS = 250;
|
|
83004
83002
|
function manifestPathForRun(root, runId) {
|
|
83005
83003
|
if (!isSafePathId(runId)) return void 0;
|
|
83006
83004
|
try {
|
|
83007
|
-
return
|
|
83005
|
+
return path91.join(resolveRealContainedPath(root, runId), DEFAULT_PATHS.state.manifestFile);
|
|
83008
83006
|
} catch {
|
|
83009
83007
|
return void 0;
|
|
83010
83008
|
}
|
|
@@ -83017,7 +83015,7 @@ function parseManifest(filePath) {
|
|
|
83017
83015
|
}
|
|
83018
83016
|
}
|
|
83019
83017
|
function sameFilesystemPath(left, right) {
|
|
83020
|
-
if (
|
|
83018
|
+
if (path91.resolve(left) === path91.resolve(right)) return true;
|
|
83021
83019
|
try {
|
|
83022
83020
|
return fs113.realpathSync.native(left) === fs113.realpathSync.native(right);
|
|
83023
83021
|
} catch {
|
|
@@ -83028,13 +83026,13 @@ function validateManifestForRoot(root, runId, manifest) {
|
|
|
83028
83026
|
try {
|
|
83029
83027
|
if (!isSafePathId(runId)) return false;
|
|
83030
83028
|
const stateRoot = resolveContainedRelativePath(root, runId, "runId");
|
|
83031
|
-
const crewRoot =
|
|
83032
|
-
const artifactsRoot = resolveContainedRelativePath(
|
|
83033
|
-
if (manifest.runId !== runId || !sameFilesystemPath(manifest.stateRoot, stateRoot) || !sameFilesystemPath(manifest.tasksPath,
|
|
83029
|
+
const crewRoot = path91.dirname(path91.dirname(root));
|
|
83030
|
+
const artifactsRoot = resolveContainedRelativePath(path91.join(crewRoot, DEFAULT_PATHS.state.artifactsSubdir), runId, "runId");
|
|
83031
|
+
if (manifest.runId !== runId || !sameFilesystemPath(manifest.stateRoot, stateRoot) || !sameFilesystemPath(manifest.tasksPath, path91.join(stateRoot, DEFAULT_PATHS.state.tasksFile)) || !sameFilesystemPath(manifest.eventsPath, path91.join(stateRoot, DEFAULT_PATHS.state.eventsFile)) || !sameFilesystemPath(manifest.artifactsRoot, artifactsRoot))
|
|
83034
83032
|
return false;
|
|
83035
83033
|
if (fs113.existsSync(artifactsRoot)) {
|
|
83036
83034
|
if (fs113.lstatSync(artifactsRoot).isSymbolicLink()) return false;
|
|
83037
|
-
resolveRealContainedPath(
|
|
83035
|
+
resolveRealContainedPath(path91.dirname(artifactsRoot), path91.basename(artifactsRoot));
|
|
83038
83036
|
}
|
|
83039
83037
|
return true;
|
|
83040
83038
|
} catch {
|
|
@@ -83070,9 +83068,9 @@ function parseManifestIfChanged(root, runId, filePath, previous, forceStat = fal
|
|
|
83070
83068
|
}
|
|
83071
83069
|
function listRunRoots(cwd) {
|
|
83072
83070
|
const roots = /* @__PURE__ */ new Set();
|
|
83073
|
-
roots.add(
|
|
83071
|
+
roots.add(path91.join(userCrewRoot(), DEFAULT_PATHS.state.runsSubdir));
|
|
83074
83072
|
const projectRoot = findRepoRoot(cwd);
|
|
83075
|
-
if (projectRoot) roots.add(
|
|
83073
|
+
if (projectRoot) roots.add(path91.join(projectCrewRoot(cwd), DEFAULT_PATHS.state.runsSubdir));
|
|
83076
83074
|
return [...roots];
|
|
83077
83075
|
}
|
|
83078
83076
|
var DIR_LIST_CACHE_MAX_ROOTS = 64;
|
|
@@ -83139,7 +83137,7 @@ function createManifestCache(cwd, options = {}) {
|
|
|
83139
83137
|
if (!isSafePathId(runId)) return void 0;
|
|
83140
83138
|
const activeEntry = activeRunEntries().find((entry) => entry.runId === runId);
|
|
83141
83139
|
if (activeEntry) {
|
|
83142
|
-
const activeRoot =
|
|
83140
|
+
const activeRoot = path91.dirname(activeEntry.stateRoot);
|
|
83143
83141
|
const parsed = parseManifestIfChanged(activeRoot, runId, activeEntry.manifestPath, cached2, false, statTtlMs);
|
|
83144
83142
|
if (parsed) {
|
|
83145
83143
|
manifestIndex.set(runId, parsed);
|
|
@@ -83180,7 +83178,7 @@ function createManifestCache(cwd, options = {}) {
|
|
|
83180
83178
|
for (const entry of parsedEntries) {
|
|
83181
83179
|
if (entry.runId.length === 0) continue;
|
|
83182
83180
|
let cached3 = manifestIndex.get(entry.runId);
|
|
83183
|
-
const root =
|
|
83181
|
+
const root = path91.dirname(path91.dirname(entry.path));
|
|
83184
83182
|
const parsed = parseManifestIfChanged(root, entry.runId, entry.path, cached3, false, statTtlMs);
|
|
83185
83183
|
if (parsed) {
|
|
83186
83184
|
cached3 = parsed;
|
|
@@ -83228,7 +83226,7 @@ function createManifestCache(cwd, options = {}) {
|
|
|
83228
83226
|
for (const entry of parsedEntries) {
|
|
83229
83227
|
if (entry.runId.length === 0) continue;
|
|
83230
83228
|
let cached2 = manifestIndex.get(entry.runId);
|
|
83231
|
-
const root =
|
|
83229
|
+
const root = path91.dirname(path91.dirname(entry.path));
|
|
83232
83230
|
const parsed = parseManifestIfChanged(root, entry.runId, entry.path, cached2, false, statTtlMs);
|
|
83233
83231
|
if (parsed) {
|
|
83234
83232
|
cached2 = parsed;
|
|
@@ -83406,7 +83404,7 @@ init_dwf_phase_display();
|
|
|
83406
83404
|
init_run_event_bus();
|
|
83407
83405
|
import { createHash as createHash13 } from "node:crypto";
|
|
83408
83406
|
import * as fs114 from "node:fs";
|
|
83409
|
-
import * as
|
|
83407
|
+
import * as path92 from "node:path";
|
|
83410
83408
|
function isPlanUiEnabled() {
|
|
83411
83409
|
return getCrewEnv("PI_CREW_PLAN_UI") === "1";
|
|
83412
83410
|
}
|
|
@@ -83465,22 +83463,22 @@ function combineStamps(stamps) {
|
|
|
83465
83463
|
);
|
|
83466
83464
|
}
|
|
83467
83465
|
function mailboxStamp(manifest) {
|
|
83468
|
-
const root =
|
|
83469
|
-
const tasksRoot =
|
|
83466
|
+
const root = path92.join(manifest.stateRoot, "mailbox");
|
|
83467
|
+
const tasksRoot = path92.join(root, "tasks");
|
|
83470
83468
|
return combineStamps([
|
|
83471
|
-
stampFile(
|
|
83472
|
-
stampFile(
|
|
83473
|
-
stampFile(
|
|
83469
|
+
stampFile(path92.join(root, "inbox.jsonl")),
|
|
83470
|
+
stampFile(path92.join(root, "outbox.jsonl")),
|
|
83471
|
+
stampFile(path92.join(root, "delivery.json")),
|
|
83474
83472
|
stampFile(tasksRoot)
|
|
83475
83473
|
]);
|
|
83476
83474
|
}
|
|
83477
83475
|
async function mailboxStampAsync(manifest) {
|
|
83478
|
-
const root =
|
|
83479
|
-
const tasksRoot =
|
|
83476
|
+
const root = path92.join(manifest.stateRoot, "mailbox");
|
|
83477
|
+
const tasksRoot = path92.join(root, "tasks");
|
|
83480
83478
|
return combineStamps([
|
|
83481
|
-
await stampFileAsync(
|
|
83482
|
-
await stampFileAsync(
|
|
83483
|
-
await stampFileAsync(
|
|
83479
|
+
await stampFileAsync(path92.join(root, "inbox.jsonl")),
|
|
83480
|
+
await stampFileAsync(path92.join(root, "outbox.jsonl")),
|
|
83481
|
+
await stampFileAsync(path92.join(root, "delivery.json")),
|
|
83484
83482
|
await stampFileAsync(tasksRoot)
|
|
83485
83483
|
]);
|
|
83486
83484
|
}
|
|
@@ -83811,9 +83809,9 @@ function groupJoinsFrom(manifest, delivery, outboxTail) {
|
|
|
83811
83809
|
return parseGroupJoinLines(outboxTail.lines, delivery).slice(-5);
|
|
83812
83810
|
}
|
|
83813
83811
|
async function groupJoinsFromAsync(manifest) {
|
|
83814
|
-
const root =
|
|
83815
|
-
const delivery = await readDeliveryMessagesAsync(
|
|
83816
|
-
return (await readGroupJoinMailboxAsync(
|
|
83812
|
+
const root = path92.join(manifest.stateRoot, "mailbox");
|
|
83813
|
+
const delivery = await readDeliveryMessagesAsync(path92.join(root, "delivery.json"));
|
|
83814
|
+
return (await readGroupJoinMailboxAsync(path92.join(root, "outbox.jsonl"), delivery)).slice(-5);
|
|
83817
83815
|
}
|
|
83818
83816
|
function mergeKindCounts(a, b) {
|
|
83819
83817
|
return {
|
|
@@ -83826,17 +83824,17 @@ function mergeKindCounts(a, b) {
|
|
|
83826
83824
|
};
|
|
83827
83825
|
}
|
|
83828
83826
|
function mailboxFrom(manifest, agents, delivery, outboxTail) {
|
|
83829
|
-
const root =
|
|
83830
|
-
let inbox = readMailboxCounts(
|
|
83827
|
+
const root = path92.join(manifest.stateRoot, "mailbox");
|
|
83828
|
+
let inbox = readMailboxCounts(path92.join(root, "inbox.jsonl"), delivery);
|
|
83831
83829
|
let outbox = mailboxCountsFrom(outboxTail, delivery);
|
|
83832
|
-
const tasksRoot =
|
|
83830
|
+
const tasksRoot = path92.join(root, "tasks");
|
|
83833
83831
|
try {
|
|
83834
83832
|
for (const entry of fs114.readdirSync(tasksRoot, {
|
|
83835
83833
|
withFileTypes: true
|
|
83836
83834
|
})) {
|
|
83837
83835
|
if (!entry.isDirectory()) continue;
|
|
83838
|
-
const taskInbox = readMailboxCounts(
|
|
83839
|
-
const taskOutbox = readMailboxCounts(
|
|
83836
|
+
const taskInbox = readMailboxCounts(path92.join(tasksRoot, entry.name, "inbox.jsonl"), delivery);
|
|
83837
|
+
const taskOutbox = readMailboxCounts(path92.join(tasksRoot, entry.name, "outbox.jsonl"), delivery);
|
|
83840
83838
|
inbox = mergeKindCounts(inbox, taskInbox);
|
|
83841
83839
|
outbox = mergeKindCounts(outbox, taskOutbox);
|
|
83842
83840
|
}
|
|
@@ -83855,18 +83853,18 @@ function mailboxFrom(manifest, agents, delivery, outboxTail) {
|
|
|
83855
83853
|
};
|
|
83856
83854
|
}
|
|
83857
83855
|
async function mailboxFromAsync(manifest, agents) {
|
|
83858
|
-
const root =
|
|
83859
|
-
const delivery = await readDeliveryMessagesAsync(
|
|
83860
|
-
let inbox = await readMailboxCountsAsync(
|
|
83861
|
-
let outbox = await readMailboxCountsAsync(
|
|
83862
|
-
const tasksRoot =
|
|
83856
|
+
const root = path92.join(manifest.stateRoot, "mailbox");
|
|
83857
|
+
const delivery = await readDeliveryMessagesAsync(path92.join(root, "delivery.json"));
|
|
83858
|
+
let inbox = await readMailboxCountsAsync(path92.join(root, "inbox.jsonl"), delivery);
|
|
83859
|
+
let outbox = await readMailboxCountsAsync(path92.join(root, "outbox.jsonl"), delivery);
|
|
83860
|
+
const tasksRoot = path92.join(root, "tasks");
|
|
83863
83861
|
try {
|
|
83864
83862
|
const taskDirs = (await fs114.promises.readdir(tasksRoot, {
|
|
83865
83863
|
withFileTypes: true
|
|
83866
83864
|
})).filter((entry) => entry.isDirectory());
|
|
83867
83865
|
const [taskInboxes, taskOutboxes] = await Promise.all([
|
|
83868
|
-
Promise.all(taskDirs.map((entry) => readMailboxCountsAsync(
|
|
83869
|
-
Promise.all(taskDirs.map((entry) => readMailboxCountsAsync(
|
|
83866
|
+
Promise.all(taskDirs.map((entry) => readMailboxCountsAsync(path92.join(tasksRoot, entry.name, "inbox.jsonl"), delivery))),
|
|
83867
|
+
Promise.all(taskDirs.map((entry) => readMailboxCountsAsync(path92.join(tasksRoot, entry.name, "outbox.jsonl"), delivery)))
|
|
83870
83868
|
]);
|
|
83871
83869
|
for (const ti of taskInboxes) inbox = mergeKindCounts(inbox, ti);
|
|
83872
83870
|
for (const to of taskOutboxes) outbox = mergeKindCounts(outbox, to);
|
|
@@ -83977,7 +83975,7 @@ function signatureFor(input, stamps, sliceSignatures) {
|
|
|
83977
83975
|
}
|
|
83978
83976
|
function stampsFor(manifest, _agents) {
|
|
83979
83977
|
return {
|
|
83980
|
-
manifest: stampFile(
|
|
83978
|
+
manifest: stampFile(path92.join(manifest.stateRoot, "manifest.json")),
|
|
83981
83979
|
tasks: stampFile(manifest.tasksPath),
|
|
83982
83980
|
agents: stampFile(agentsPath(manifest)),
|
|
83983
83981
|
events: eventsStamp(manifest.eventsPath),
|
|
@@ -83987,7 +83985,7 @@ function stampsFor(manifest, _agents) {
|
|
|
83987
83985
|
}
|
|
83988
83986
|
async function stampsForAsync(manifest, _agents) {
|
|
83989
83987
|
const [manifestStamp, tasksStamp, agentsStamp, eventsStampValue, mailbox] = await Promise.all([
|
|
83990
|
-
stampFileAsync(
|
|
83988
|
+
stampFileAsync(path92.join(manifest.stateRoot, "manifest.json")),
|
|
83991
83989
|
stampFileAsync(manifest.tasksPath),
|
|
83992
83990
|
stampFileAsync(agentsPath(manifest)),
|
|
83993
83991
|
eventsStampAsync(manifest.eventsPath),
|
|
@@ -84050,9 +84048,9 @@ function createRunSnapshotCache(cwd, options = {}) {
|
|
|
84050
84048
|
if (previous) return previous;
|
|
84051
84049
|
throw new Error(`Run '${runId}' could not be parsed.`);
|
|
84052
84050
|
}
|
|
84053
|
-
const mailboxRoot =
|
|
84054
|
-
const delivery = readDeliveryMessages(
|
|
84055
|
-
const outboxTail = readTailContent(
|
|
84051
|
+
const mailboxRoot = path92.join(loaded.manifest.stateRoot, "mailbox");
|
|
84052
|
+
const delivery = readDeliveryMessages(path92.join(mailboxRoot, "delivery.json"));
|
|
84053
|
+
const outboxTail = readTailContent(path92.join(mailboxRoot, "outbox.jsonl"));
|
|
84056
84054
|
const mailbox = mailboxFrom(loaded.manifest, agents, delivery, outboxTail);
|
|
84057
84055
|
const groupJoins = groupJoinsFrom(loaded.manifest, delivery, outboxTail);
|
|
84058
84056
|
const recentEvents = safeRecentEvents(loaded.manifest.eventsPath, recentEventsLimit);
|
|
@@ -84148,7 +84146,7 @@ function createRunSnapshotCache(cwd, options = {}) {
|
|
|
84148
84146
|
function currentStamps(previous) {
|
|
84149
84147
|
const manifest = previous.snapshot.manifest;
|
|
84150
84148
|
return {
|
|
84151
|
-
manifest: stampFile(
|
|
84149
|
+
manifest: stampFile(path92.join(manifest.stateRoot, "manifest.json")),
|
|
84152
84150
|
tasks: stampFile(manifest.tasksPath),
|
|
84153
84151
|
agents: stampFile(agentsPath(manifest)),
|
|
84154
84152
|
events: eventsStamp(manifest.eventsPath),
|
|
@@ -84552,7 +84550,7 @@ function startForegroundRunImpl(pi, ctx, extensionCtx, runner, runId) {
|
|
|
84552
84550
|
// src/extension/registration/hook-registration.ts
|
|
84553
84551
|
init_config();
|
|
84554
84552
|
import * as fs118 from "node:fs";
|
|
84555
|
-
import * as
|
|
84553
|
+
import * as path94 from "node:path";
|
|
84556
84554
|
import { fileURLToPath as fileURLToPath9 } from "node:url";
|
|
84557
84555
|
|
|
84558
84556
|
// src/runtime/per-write-validator.ts
|
|
@@ -84571,9 +84569,9 @@ function validateJson(content, _filePath) {
|
|
|
84571
84569
|
var DEFAULT_VALIDATORS = /* @__PURE__ */ new Map([["json", validateJson]]);
|
|
84572
84570
|
var MAX_DEDUP_ENTRIES = 256;
|
|
84573
84571
|
var seenContent = /* @__PURE__ */ new Map();
|
|
84574
|
-
function rememberSeen(
|
|
84575
|
-
if (seenContent.has(
|
|
84576
|
-
seenContent.set(
|
|
84572
|
+
function rememberSeen(path103, content) {
|
|
84573
|
+
if (seenContent.has(path103)) seenContent.delete(path103);
|
|
84574
|
+
seenContent.set(path103, content);
|
|
84577
84575
|
while (seenContent.size > MAX_DEDUP_ENTRIES) {
|
|
84578
84576
|
const oldest = seenContent.keys().next().value;
|
|
84579
84577
|
if (oldest === void 0) break;
|
|
@@ -84655,8 +84653,8 @@ function installResourcesDiscoverHook(pi, ctx) {
|
|
|
84655
84653
|
try {
|
|
84656
84654
|
pi.on("resources_discover", () => {
|
|
84657
84655
|
const sessionCwd = ctx.currentCtx?.cwd ?? process.cwd();
|
|
84658
|
-
const skillDir =
|
|
84659
|
-
const extSkillDir =
|
|
84656
|
+
const skillDir = path94.resolve(sessionCwd, "skills");
|
|
84657
|
+
const extSkillDir = path94.resolve(path94.dirname(fileURLToPath9(import.meta.url)), "..", "..", "skills");
|
|
84660
84658
|
const paths = [];
|
|
84661
84659
|
if (fs118.existsSync(extSkillDir)) paths.push(extSkillDir);
|
|
84662
84660
|
if (skillDir !== extSkillDir && fs118.existsSync(skillDir)) {
|
|
@@ -84779,7 +84777,7 @@ init_env_vars();
|
|
|
84779
84777
|
init_run_maintenance();
|
|
84780
84778
|
init_broker_issuer();
|
|
84781
84779
|
import * as fs126 from "node:fs";
|
|
84782
|
-
import * as
|
|
84780
|
+
import * as path102 from "node:path";
|
|
84783
84781
|
|
|
84784
84782
|
// src/runtime/broker/crew-broker.ts
|
|
84785
84783
|
init_locks();
|
|
@@ -84800,7 +84798,7 @@ import { createHash as createHash14 } from "node:crypto";
|
|
|
84800
84798
|
import * as fsp2 from "node:fs/promises";
|
|
84801
84799
|
import * as net2 from "node:net";
|
|
84802
84800
|
import * as os19 from "node:os";
|
|
84803
|
-
import * as
|
|
84801
|
+
import * as path98 from "node:path";
|
|
84804
84802
|
var DEFAULT_PATH_HASH_LEN = 8;
|
|
84805
84803
|
var POSIX_SUN_PATH_BUDGET = 107;
|
|
84806
84804
|
function hashSessionId(sessionId, length = DEFAULT_PATH_HASH_LEN) {
|
|
@@ -84830,7 +84828,7 @@ function getPerUserSocketDir(platform2 = process.platform) {
|
|
|
84830
84828
|
if (platform2 === "win32") return "";
|
|
84831
84829
|
const base = process.env.XDG_RUNTIME_DIR || os19.tmpdir();
|
|
84832
84830
|
const uid = getCurrentUid();
|
|
84833
|
-
return
|
|
84831
|
+
return path98.join(base, `pi-crew-${uid}`);
|
|
84834
84832
|
}
|
|
84835
84833
|
function getBrokerSocketPath(sessionId, platform2 = process.platform) {
|
|
84836
84834
|
const hash = hashSessionId(sessionId);
|
|
@@ -84838,7 +84836,7 @@ function getBrokerSocketPath(sessionId, platform2 = process.platform) {
|
|
|
84838
84836
|
return `\\\\.\\pipe\\pi-crew-broker-${hash}`;
|
|
84839
84837
|
}
|
|
84840
84838
|
const perUserDir = getPerUserSocketDir(platform2);
|
|
84841
|
-
const sock =
|
|
84839
|
+
const sock = path98.join(perUserDir, `pi-crew-${hash}.sock`);
|
|
84842
84840
|
const encoded = Buffer.byteLength(sock, "utf8");
|
|
84843
84841
|
if (encoded > POSIX_SUN_PATH_BUDGET) {
|
|
84844
84842
|
throw new Error(
|
|
@@ -84849,7 +84847,7 @@ function getBrokerSocketPath(sessionId, platform2 = process.platform) {
|
|
|
84849
84847
|
}
|
|
84850
84848
|
async function prepareBrokerSocketDir(sockPath) {
|
|
84851
84849
|
if (process.platform === "win32") return;
|
|
84852
|
-
const dir =
|
|
84850
|
+
const dir = path98.dirname(sockPath);
|
|
84853
84851
|
await fsp2.mkdir(dir, { recursive: true, mode: 448 });
|
|
84854
84852
|
try {
|
|
84855
84853
|
await fsp2.chmod(dir, 448);
|
|
@@ -84896,7 +84894,7 @@ async function removeStaleBrokerSocket(sockPath, probeTimeoutMs = 250) {
|
|
|
84896
84894
|
// src/runtime/delegate-spawn.ts
|
|
84897
84895
|
init_child_pi();
|
|
84898
84896
|
import * as fs122 from "node:fs";
|
|
84899
|
-
import * as
|
|
84897
|
+
import * as path99 from "node:path";
|
|
84900
84898
|
function agentForRole(role) {
|
|
84901
84899
|
return {
|
|
84902
84900
|
name: role,
|
|
@@ -84924,7 +84922,7 @@ function usageTokensFromEvent(event) {
|
|
|
84924
84922
|
return seen ? total : void 0;
|
|
84925
84923
|
}
|
|
84926
84924
|
async function spawnDelegateGrandchild(input) {
|
|
84927
|
-
const artifactsRoot =
|
|
84925
|
+
const artifactsRoot = path99.join(input.cwd, ".crew", "artifacts", input.runId, input.parentTaskId, "nested", input.subId);
|
|
84928
84926
|
fs122.mkdirSync(artifactsRoot, { recursive: true });
|
|
84929
84927
|
const abort = new AbortController();
|
|
84930
84928
|
const timer = setTimeout(() => abort.abort(), input.timeoutSec * 1e3);
|
|
@@ -87088,7 +87086,7 @@ init_pi_ui_compat();
|
|
|
87088
87086
|
// src/ui/inline-panel/agent-transcript.ts
|
|
87089
87087
|
init_crew_agent_records();
|
|
87090
87088
|
import * as fs124 from "node:fs";
|
|
87091
|
-
import * as
|
|
87089
|
+
import * as path100 from "node:path";
|
|
87092
87090
|
var MAX_TRANSCRIPT_ITEMS = 500;
|
|
87093
87091
|
function normalizeUsage(raw) {
|
|
87094
87092
|
const usage = raw && typeof raw === "object" && !Array.isArray(raw) ? raw : void 0;
|
|
@@ -87109,7 +87107,7 @@ var cursors = /* @__PURE__ */ new Map();
|
|
|
87109
87107
|
var promptSeeded = /* @__PURE__ */ new Set();
|
|
87110
87108
|
function readWorkerPrompt(manifest, taskId) {
|
|
87111
87109
|
try {
|
|
87112
|
-
const file =
|
|
87110
|
+
const file = path100.join(manifest.artifactsRoot, "prompts", `${taskId}.md`);
|
|
87113
87111
|
const text = fs124.readFileSync(file, "utf-8").trim();
|
|
87114
87112
|
return text || void 0;
|
|
87115
87113
|
} catch {
|
|
@@ -88201,7 +88199,7 @@ init_artifact_store();
|
|
|
88201
88199
|
init_internal_error();
|
|
88202
88200
|
init_paths();
|
|
88203
88201
|
import * as fs125 from "node:fs";
|
|
88204
|
-
import * as
|
|
88202
|
+
import * as path101 from "node:path";
|
|
88205
88203
|
function collectArtifactDescriptors(runsDir) {
|
|
88206
88204
|
const descriptors = [];
|
|
88207
88205
|
let dirs;
|
|
@@ -88212,7 +88210,7 @@ function collectArtifactDescriptors(runsDir) {
|
|
|
88212
88210
|
}
|
|
88213
88211
|
for (const dir of dirs) {
|
|
88214
88212
|
if (!dir.isDirectory()) continue;
|
|
88215
|
-
const manifestPath =
|
|
88213
|
+
const manifestPath = path101.join(runsDir, dir.name, DEFAULT_PATHS.state.manifestFile);
|
|
88216
88214
|
try {
|
|
88217
88215
|
const manifest = JSON.parse(fs125.readFileSync(manifestPath, "utf-8"));
|
|
88218
88216
|
if (Array.isArray(manifest.artifacts)) {
|
|
@@ -88225,8 +88223,8 @@ function collectArtifactDescriptors(runsDir) {
|
|
|
88225
88223
|
}
|
|
88226
88224
|
function runArtifactCleanup(cwd) {
|
|
88227
88225
|
try {
|
|
88228
|
-
const userArtifactsRoot =
|
|
88229
|
-
const projectArtifactsRoot =
|
|
88226
|
+
const userArtifactsRoot = path101.join(userCrewRoot(), DEFAULT_PATHS.state.artifactsSubdir);
|
|
88227
|
+
const projectArtifactsRoot = path101.join(projectCrewRoot(cwd), DEFAULT_PATHS.state.artifactsSubdir);
|
|
88230
88228
|
cleanupOldArtifacts(userArtifactsRoot, {
|
|
88231
88229
|
maxAgeDays: DEFAULT_ARTIFACT_CLEANUP.maxAgeDays,
|
|
88232
88230
|
markerFile: CLEANUP_MARKER_FILE
|
|
@@ -88235,8 +88233,8 @@ function runArtifactCleanup(cwd) {
|
|
|
88235
88233
|
maxAgeDays: DEFAULT_ARTIFACT_CLEANUP.maxAgeDays,
|
|
88236
88234
|
markerFile: CLEANUP_MARKER_FILE
|
|
88237
88235
|
});
|
|
88238
|
-
pruneExpiredArtifacts(collectArtifactDescriptors(
|
|
88239
|
-
pruneExpiredArtifacts(collectArtifactDescriptors(
|
|
88236
|
+
pruneExpiredArtifacts(collectArtifactDescriptors(path101.join(userCrewRoot(), DEFAULT_PATHS.state.runsSubdir)));
|
|
88237
|
+
pruneExpiredArtifacts(collectArtifactDescriptors(path101.join(projectCrewRoot(cwd), DEFAULT_PATHS.state.runsSubdir)));
|
|
88240
88238
|
} catch (error) {
|
|
88241
88239
|
logInternalError("register.artifact-cleanup", error, `cwd=${cwd}`);
|
|
88242
88240
|
}
|
|
@@ -88820,7 +88818,7 @@ function setupRenderLoop(pi, ctx, extensionCtx, loadedConfig) {
|
|
|
88820
88818
|
try {
|
|
88821
88819
|
ctx.crewRunWatchers?.closeAll();
|
|
88822
88820
|
ctx.crewRunWatchers = void 0;
|
|
88823
|
-
const crewRunsDir =
|
|
88821
|
+
const crewRunsDir = path102.join(projectCrewRoot(extensionCtx.cwd), "state", "runs");
|
|
88824
88822
|
if (fs126.existsSync(crewRunsDir)) {
|
|
88825
88823
|
ctx.crewRunWatchers = new RunWatcherRegistry();
|
|
88826
88824
|
ctx.crewRunWatchers.setRootWatcher(crewRunsDir, crewRunWatcherOnChange, crewRunWatcherOnError);
|
|
@@ -88831,7 +88829,7 @@ function setupRenderLoop(pi, ctx, extensionCtx, loadedConfig) {
|
|
|
88831
88829
|
try {
|
|
88832
88830
|
ctx.userCrewWatchers?.closeAll();
|
|
88833
88831
|
ctx.userCrewWatchers = void 0;
|
|
88834
|
-
const userRunsDir =
|
|
88832
|
+
const userRunsDir = path102.join(userCrewRoot(), "state", "runs");
|
|
88835
88833
|
if (fs126.existsSync(userRunsDir)) {
|
|
88836
88834
|
ctx.userCrewWatchers = new RunWatcherRegistry();
|
|
88837
88835
|
ctx.userCrewWatchers.setRootWatcher(userRunsDir, crewRunWatcherOnChange, crewRunWatcherOnError);
|