harness-engineering-agent 0.3.27 → 0.3.28

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.
Files changed (75) hide show
  1. package/README.md +0 -0
  2. package/dist/controller/contracts.d.ts +2 -0
  3. package/dist/controller/contracts.d.ts.map +1 -1
  4. package/dist/controller/contracts.js.map +1 -1
  5. package/dist/controller/failure-classification.d.ts +5 -0
  6. package/dist/controller/failure-classification.d.ts.map +1 -0
  7. package/dist/controller/failure-classification.js +6 -0
  8. package/dist/controller/failure-classification.js.map +1 -0
  9. package/dist/controller/index.d.ts +5 -0
  10. package/dist/controller/index.d.ts.map +1 -1
  11. package/dist/controller/index.js +5 -0
  12. package/dist/controller/index.js.map +1 -1
  13. package/dist/controller/route-resolver.d.ts.map +1 -1
  14. package/dist/controller/route-resolver.js +19 -8
  15. package/dist/controller/route-resolver.js.map +1 -1
  16. package/dist/controller/run-controller.d.ts.map +1 -1
  17. package/dist/controller/run-controller.js +80 -8
  18. package/dist/controller/run-controller.js.map +1 -1
  19. package/dist/controller/run-error-finalizer.d.ts +15 -0
  20. package/dist/controller/run-error-finalizer.d.ts.map +1 -1
  21. package/dist/controller/run-error-finalizer.js +103 -4
  22. package/dist/controller/run-error-finalizer.js.map +1 -1
  23. package/dist/controller/run-lease.d.ts +26 -0
  24. package/dist/controller/run-lease.d.ts.map +1 -0
  25. package/dist/controller/run-lease.js +63 -0
  26. package/dist/controller/run-lease.js.map +1 -0
  27. package/dist/controller/run-stage-projection.d.ts +51 -0
  28. package/dist/controller/run-stage-projection.d.ts.map +1 -0
  29. package/dist/controller/run-stage-projection.js +149 -0
  30. package/dist/controller/run-stage-projection.js.map +1 -0
  31. package/dist/controller/run-watchdog.d.ts +36 -0
  32. package/dist/controller/run-watchdog.d.ts.map +1 -0
  33. package/dist/controller/run-watchdog.js +124 -0
  34. package/dist/controller/run-watchdog.js.map +1 -0
  35. package/dist/controller/task-executor.d.ts.map +1 -1
  36. package/dist/controller/task-executor.js +22 -0
  37. package/dist/controller/task-executor.js.map +1 -1
  38. package/dist/domain/failure.d.ts +100 -0
  39. package/dist/domain/failure.d.ts.map +1 -1
  40. package/dist/domain/failure.js +9 -0
  41. package/dist/domain/failure.js.map +1 -1
  42. package/dist/domain/report.d.ts +200 -0
  43. package/dist/domain/report.d.ts.map +1 -1
  44. package/dist/domain/run.d.ts +200 -0
  45. package/dist/domain/run.d.ts.map +1 -1
  46. package/dist/plugin/create-harness-plugin.d.ts.map +1 -1
  47. package/dist/plugin/create-harness-plugin.js +35 -6
  48. package/dist/plugin/create-harness-plugin.js.map +1 -1
  49. package/dist/plugin/harness-chat-hook.d.ts +2 -1
  50. package/dist/plugin/harness-chat-hook.d.ts.map +1 -1
  51. package/dist/plugin/harness-chat-hook.js +15 -16
  52. package/dist/plugin/harness-chat-hook.js.map +1 -1
  53. package/dist/plugin/harness-delivery-envelope.d.ts +19 -0
  54. package/dist/plugin/harness-delivery-envelope.d.ts.map +1 -0
  55. package/dist/plugin/harness-delivery-envelope.js +105 -0
  56. package/dist/plugin/harness-delivery-envelope.js.map +1 -0
  57. package/dist/plugin/harness-escalate-tool.d.ts +2 -1
  58. package/dist/plugin/harness-escalate-tool.d.ts.map +1 -1
  59. package/dist/plugin/harness-escalate-tool.js.map +1 -1
  60. package/dist/plugin/harness-plugin-runtime.d.ts +1 -0
  61. package/dist/plugin/harness-plugin-runtime.d.ts.map +1 -1
  62. package/dist/plugin/harness-plugin-runtime.js +1 -0
  63. package/dist/plugin/harness-plugin-runtime.js.map +1 -1
  64. package/dist/plugin/harness-plugin-scheduler.d.ts.map +1 -1
  65. package/dist/plugin/harness-plugin-scheduler.js +12 -12
  66. package/dist/plugin/harness-plugin-scheduler.js.map +1 -1
  67. package/dist/plugin/harness-run-status-tool.d.ts +7 -0
  68. package/dist/plugin/harness-run-status-tool.d.ts.map +1 -0
  69. package/dist/plugin/harness-run-status-tool.js +33 -0
  70. package/dist/plugin/harness-run-status-tool.js.map +1 -0
  71. package/dist/store/filesystem-run-store.js +5 -0
  72. package/dist/store/filesystem-run-store.js.map +1 -1
  73. package/dist/store/run-event.d.ts +200 -0
  74. package/dist/store/run-event.d.ts.map +1 -1
  75. package/package.json +1 -1
@@ -369,6 +369,16 @@ export declare const RunSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.Zo
369
369
  confidence: z.ZodNumber;
370
370
  relatedEvidenceIds: z.ZodReadonly<z.ZodArray<z.core.$ZodBranded<z.ZodString, "EvidenceId">>>;
371
371
  rootCauseFingerprint: z.ZodOptional<z.ZodString>;
372
+ errorCode: z.ZodOptional<z.ZodString>;
373
+ lastPersistedStage: z.ZodOptional<z.ZodString>;
374
+ recoveryGuidance: z.ZodOptional<z.ZodObject<{
375
+ resumable: z.ZodBoolean;
376
+ action: z.ZodEnum<{
377
+ resume: "resume";
378
+ manual: "manual";
379
+ }>;
380
+ preconditions: z.ZodReadonly<z.ZodArray<z.ZodString>>;
381
+ }, z.core.$strip>>;
372
382
  category: z.ZodLiteral<"planner-contract">;
373
383
  }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
374
384
  schemaVersion: z.ZodLiteral<"1.0.0">;
@@ -381,6 +391,16 @@ export declare const RunSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.Zo
381
391
  confidence: z.ZodNumber;
382
392
  relatedEvidenceIds: z.ZodReadonly<z.ZodArray<z.core.$ZodBranded<z.ZodString, "EvidenceId">>>;
383
393
  rootCauseFingerprint: z.ZodOptional<z.ZodString>;
394
+ errorCode: z.ZodOptional<z.ZodString>;
395
+ lastPersistedStage: z.ZodOptional<z.ZodString>;
396
+ recoveryGuidance: z.ZodOptional<z.ZodObject<{
397
+ resumable: z.ZodBoolean;
398
+ action: z.ZodEnum<{
399
+ resume: "resume";
400
+ manual: "manual";
401
+ }>;
402
+ preconditions: z.ZodReadonly<z.ZodArray<z.ZodString>>;
403
+ }, z.core.$strip>>;
384
404
  category: z.ZodLiteral<"context-gap">;
385
405
  missingContext: z.ZodReadonly<z.ZodArray<z.ZodString>>;
386
406
  }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
@@ -394,6 +414,16 @@ export declare const RunSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.Zo
394
414
  confidence: z.ZodNumber;
395
415
  relatedEvidenceIds: z.ZodReadonly<z.ZodArray<z.core.$ZodBranded<z.ZodString, "EvidenceId">>>;
396
416
  rootCauseFingerprint: z.ZodOptional<z.ZodString>;
417
+ errorCode: z.ZodOptional<z.ZodString>;
418
+ lastPersistedStage: z.ZodOptional<z.ZodString>;
419
+ recoveryGuidance: z.ZodOptional<z.ZodObject<{
420
+ resumable: z.ZodBoolean;
421
+ action: z.ZodEnum<{
422
+ resume: "resume";
423
+ manual: "manual";
424
+ }>;
425
+ preconditions: z.ZodReadonly<z.ZodArray<z.ZodString>>;
426
+ }, z.core.$strip>>;
397
427
  category: z.ZodLiteral<"requirement-ambiguity">;
398
428
  blockingQuestionId: z.ZodString;
399
429
  }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
@@ -407,6 +437,16 @@ export declare const RunSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.Zo
407
437
  confidence: z.ZodNumber;
408
438
  relatedEvidenceIds: z.ZodReadonly<z.ZodArray<z.core.$ZodBranded<z.ZodString, "EvidenceId">>>;
409
439
  rootCauseFingerprint: z.ZodOptional<z.ZodString>;
440
+ errorCode: z.ZodOptional<z.ZodString>;
441
+ lastPersistedStage: z.ZodOptional<z.ZodString>;
442
+ recoveryGuidance: z.ZodOptional<z.ZodObject<{
443
+ resumable: z.ZodBoolean;
444
+ action: z.ZodEnum<{
445
+ resume: "resume";
446
+ manual: "manual";
447
+ }>;
448
+ preconditions: z.ZodReadonly<z.ZodArray<z.ZodString>>;
449
+ }, z.core.$strip>>;
410
450
  category: z.ZodLiteral<"dependency-blocked">;
411
451
  blockedDependency: z.ZodString;
412
452
  }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
@@ -420,6 +460,16 @@ export declare const RunSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.Zo
420
460
  confidence: z.ZodNumber;
421
461
  relatedEvidenceIds: z.ZodReadonly<z.ZodArray<z.core.$ZodBranded<z.ZodString, "EvidenceId">>>;
422
462
  rootCauseFingerprint: z.ZodOptional<z.ZodString>;
463
+ errorCode: z.ZodOptional<z.ZodString>;
464
+ lastPersistedStage: z.ZodOptional<z.ZodString>;
465
+ recoveryGuidance: z.ZodOptional<z.ZodObject<{
466
+ resumable: z.ZodBoolean;
467
+ action: z.ZodEnum<{
468
+ resume: "resume";
469
+ manual: "manual";
470
+ }>;
471
+ preconditions: z.ZodReadonly<z.ZodArray<z.ZodString>>;
472
+ }, z.core.$strip>>;
423
473
  category: z.ZodLiteral<"implementation-defect">;
424
474
  failingEvidenceId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "EvidenceId">>;
425
475
  }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
@@ -433,6 +483,16 @@ export declare const RunSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.Zo
433
483
  confidence: z.ZodNumber;
434
484
  relatedEvidenceIds: z.ZodReadonly<z.ZodArray<z.core.$ZodBranded<z.ZodString, "EvidenceId">>>;
435
485
  rootCauseFingerprint: z.ZodOptional<z.ZodString>;
486
+ errorCode: z.ZodOptional<z.ZodString>;
487
+ lastPersistedStage: z.ZodOptional<z.ZodString>;
488
+ recoveryGuidance: z.ZodOptional<z.ZodObject<{
489
+ resumable: z.ZodBoolean;
490
+ action: z.ZodEnum<{
491
+ resume: "resume";
492
+ manual: "manual";
493
+ }>;
494
+ preconditions: z.ZodReadonly<z.ZodArray<z.ZodString>>;
495
+ }, z.core.$strip>>;
436
496
  category: z.ZodLiteral<"verification-environment">;
437
497
  verificationCommandName: z.ZodString;
438
498
  }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
@@ -446,6 +506,16 @@ export declare const RunSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.Zo
446
506
  confidence: z.ZodNumber;
447
507
  relatedEvidenceIds: z.ZodReadonly<z.ZodArray<z.core.$ZodBranded<z.ZodString, "EvidenceId">>>;
448
508
  rootCauseFingerprint: z.ZodOptional<z.ZodString>;
509
+ errorCode: z.ZodOptional<z.ZodString>;
510
+ lastPersistedStage: z.ZodOptional<z.ZodString>;
511
+ recoveryGuidance: z.ZodOptional<z.ZodObject<{
512
+ resumable: z.ZodBoolean;
513
+ action: z.ZodEnum<{
514
+ resume: "resume";
515
+ manual: "manual";
516
+ }>;
517
+ preconditions: z.ZodReadonly<z.ZodArray<z.ZodString>>;
518
+ }, z.core.$strip>>;
449
519
  category: z.ZodLiteral<"scope-drift">;
450
520
  driftedPaths: z.ZodReadonly<z.ZodArray<z.ZodString>>;
451
521
  }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
@@ -459,6 +529,16 @@ export declare const RunSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.Zo
459
529
  confidence: z.ZodNumber;
460
530
  relatedEvidenceIds: z.ZodReadonly<z.ZodArray<z.core.$ZodBranded<z.ZodString, "EvidenceId">>>;
461
531
  rootCauseFingerprint: z.ZodOptional<z.ZodString>;
532
+ errorCode: z.ZodOptional<z.ZodString>;
533
+ lastPersistedStage: z.ZodOptional<z.ZodString>;
534
+ recoveryGuidance: z.ZodOptional<z.ZodObject<{
535
+ resumable: z.ZodBoolean;
536
+ action: z.ZodEnum<{
537
+ resume: "resume";
538
+ manual: "manual";
539
+ }>;
540
+ preconditions: z.ZodReadonly<z.ZodArray<z.ZodString>>;
541
+ }, z.core.$strip>>;
462
542
  category: z.ZodLiteral<"merge-conflict">;
463
543
  conflictingPaths: z.ZodReadonly<z.ZodArray<z.ZodString>>;
464
544
  }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
@@ -472,6 +552,16 @@ export declare const RunSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.Zo
472
552
  confidence: z.ZodNumber;
473
553
  relatedEvidenceIds: z.ZodReadonly<z.ZodArray<z.core.$ZodBranded<z.ZodString, "EvidenceId">>>;
474
554
  rootCauseFingerprint: z.ZodOptional<z.ZodString>;
555
+ errorCode: z.ZodOptional<z.ZodString>;
556
+ lastPersistedStage: z.ZodOptional<z.ZodString>;
557
+ recoveryGuidance: z.ZodOptional<z.ZodObject<{
558
+ resumable: z.ZodBoolean;
559
+ action: z.ZodEnum<{
560
+ resume: "resume";
561
+ manual: "manual";
562
+ }>;
563
+ preconditions: z.ZodReadonly<z.ZodArray<z.ZodString>>;
564
+ }, z.core.$strip>>;
475
565
  category: z.ZodLiteral<"model-failure">;
476
566
  provider: z.ZodString;
477
567
  }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
@@ -485,6 +575,16 @@ export declare const RunSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.Zo
485
575
  confidence: z.ZodNumber;
486
576
  relatedEvidenceIds: z.ZodReadonly<z.ZodArray<z.core.$ZodBranded<z.ZodString, "EvidenceId">>>;
487
577
  rootCauseFingerprint: z.ZodOptional<z.ZodString>;
578
+ errorCode: z.ZodOptional<z.ZodString>;
579
+ lastPersistedStage: z.ZodOptional<z.ZodString>;
580
+ recoveryGuidance: z.ZodOptional<z.ZodObject<{
581
+ resumable: z.ZodBoolean;
582
+ action: z.ZodEnum<{
583
+ resume: "resume";
584
+ manual: "manual";
585
+ }>;
586
+ preconditions: z.ZodReadonly<z.ZodArray<z.ZodString>>;
587
+ }, z.core.$strip>>;
488
588
  category: z.ZodLiteral<"acceptance-failure">;
489
589
  failingEvidenceId: z.core.$ZodBranded<z.ZodString, "EvidenceId">;
490
590
  }, z.core.$strip>>]>>>>;
@@ -1302,6 +1402,16 @@ export declare const RunSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.Zo
1302
1402
  confidence: z.ZodNumber;
1303
1403
  relatedEvidenceIds: z.ZodReadonly<z.ZodArray<z.core.$ZodBranded<z.ZodString, "EvidenceId">>>;
1304
1404
  rootCauseFingerprint: z.ZodOptional<z.ZodString>;
1405
+ errorCode: z.ZodOptional<z.ZodString>;
1406
+ lastPersistedStage: z.ZodOptional<z.ZodString>;
1407
+ recoveryGuidance: z.ZodOptional<z.ZodObject<{
1408
+ resumable: z.ZodBoolean;
1409
+ action: z.ZodEnum<{
1410
+ resume: "resume";
1411
+ manual: "manual";
1412
+ }>;
1413
+ preconditions: z.ZodReadonly<z.ZodArray<z.ZodString>>;
1414
+ }, z.core.$strip>>;
1305
1415
  category: z.ZodLiteral<"planner-contract">;
1306
1416
  }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
1307
1417
  schemaVersion: z.ZodLiteral<"1.0.0">;
@@ -1314,6 +1424,16 @@ export declare const RunSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.Zo
1314
1424
  confidence: z.ZodNumber;
1315
1425
  relatedEvidenceIds: z.ZodReadonly<z.ZodArray<z.core.$ZodBranded<z.ZodString, "EvidenceId">>>;
1316
1426
  rootCauseFingerprint: z.ZodOptional<z.ZodString>;
1427
+ errorCode: z.ZodOptional<z.ZodString>;
1428
+ lastPersistedStage: z.ZodOptional<z.ZodString>;
1429
+ recoveryGuidance: z.ZodOptional<z.ZodObject<{
1430
+ resumable: z.ZodBoolean;
1431
+ action: z.ZodEnum<{
1432
+ resume: "resume";
1433
+ manual: "manual";
1434
+ }>;
1435
+ preconditions: z.ZodReadonly<z.ZodArray<z.ZodString>>;
1436
+ }, z.core.$strip>>;
1317
1437
  category: z.ZodLiteral<"context-gap">;
1318
1438
  missingContext: z.ZodReadonly<z.ZodArray<z.ZodString>>;
1319
1439
  }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
@@ -1327,6 +1447,16 @@ export declare const RunSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.Zo
1327
1447
  confidence: z.ZodNumber;
1328
1448
  relatedEvidenceIds: z.ZodReadonly<z.ZodArray<z.core.$ZodBranded<z.ZodString, "EvidenceId">>>;
1329
1449
  rootCauseFingerprint: z.ZodOptional<z.ZodString>;
1450
+ errorCode: z.ZodOptional<z.ZodString>;
1451
+ lastPersistedStage: z.ZodOptional<z.ZodString>;
1452
+ recoveryGuidance: z.ZodOptional<z.ZodObject<{
1453
+ resumable: z.ZodBoolean;
1454
+ action: z.ZodEnum<{
1455
+ resume: "resume";
1456
+ manual: "manual";
1457
+ }>;
1458
+ preconditions: z.ZodReadonly<z.ZodArray<z.ZodString>>;
1459
+ }, z.core.$strip>>;
1330
1460
  category: z.ZodLiteral<"requirement-ambiguity">;
1331
1461
  blockingQuestionId: z.ZodString;
1332
1462
  }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
@@ -1340,6 +1470,16 @@ export declare const RunSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.Zo
1340
1470
  confidence: z.ZodNumber;
1341
1471
  relatedEvidenceIds: z.ZodReadonly<z.ZodArray<z.core.$ZodBranded<z.ZodString, "EvidenceId">>>;
1342
1472
  rootCauseFingerprint: z.ZodOptional<z.ZodString>;
1473
+ errorCode: z.ZodOptional<z.ZodString>;
1474
+ lastPersistedStage: z.ZodOptional<z.ZodString>;
1475
+ recoveryGuidance: z.ZodOptional<z.ZodObject<{
1476
+ resumable: z.ZodBoolean;
1477
+ action: z.ZodEnum<{
1478
+ resume: "resume";
1479
+ manual: "manual";
1480
+ }>;
1481
+ preconditions: z.ZodReadonly<z.ZodArray<z.ZodString>>;
1482
+ }, z.core.$strip>>;
1343
1483
  category: z.ZodLiteral<"dependency-blocked">;
1344
1484
  blockedDependency: z.ZodString;
1345
1485
  }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
@@ -1353,6 +1493,16 @@ export declare const RunSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.Zo
1353
1493
  confidence: z.ZodNumber;
1354
1494
  relatedEvidenceIds: z.ZodReadonly<z.ZodArray<z.core.$ZodBranded<z.ZodString, "EvidenceId">>>;
1355
1495
  rootCauseFingerprint: z.ZodOptional<z.ZodString>;
1496
+ errorCode: z.ZodOptional<z.ZodString>;
1497
+ lastPersistedStage: z.ZodOptional<z.ZodString>;
1498
+ recoveryGuidance: z.ZodOptional<z.ZodObject<{
1499
+ resumable: z.ZodBoolean;
1500
+ action: z.ZodEnum<{
1501
+ resume: "resume";
1502
+ manual: "manual";
1503
+ }>;
1504
+ preconditions: z.ZodReadonly<z.ZodArray<z.ZodString>>;
1505
+ }, z.core.$strip>>;
1356
1506
  category: z.ZodLiteral<"implementation-defect">;
1357
1507
  failingEvidenceId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "EvidenceId">>;
1358
1508
  }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
@@ -1366,6 +1516,16 @@ export declare const RunSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.Zo
1366
1516
  confidence: z.ZodNumber;
1367
1517
  relatedEvidenceIds: z.ZodReadonly<z.ZodArray<z.core.$ZodBranded<z.ZodString, "EvidenceId">>>;
1368
1518
  rootCauseFingerprint: z.ZodOptional<z.ZodString>;
1519
+ errorCode: z.ZodOptional<z.ZodString>;
1520
+ lastPersistedStage: z.ZodOptional<z.ZodString>;
1521
+ recoveryGuidance: z.ZodOptional<z.ZodObject<{
1522
+ resumable: z.ZodBoolean;
1523
+ action: z.ZodEnum<{
1524
+ resume: "resume";
1525
+ manual: "manual";
1526
+ }>;
1527
+ preconditions: z.ZodReadonly<z.ZodArray<z.ZodString>>;
1528
+ }, z.core.$strip>>;
1369
1529
  category: z.ZodLiteral<"verification-environment">;
1370
1530
  verificationCommandName: z.ZodString;
1371
1531
  }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
@@ -1379,6 +1539,16 @@ export declare const RunSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.Zo
1379
1539
  confidence: z.ZodNumber;
1380
1540
  relatedEvidenceIds: z.ZodReadonly<z.ZodArray<z.core.$ZodBranded<z.ZodString, "EvidenceId">>>;
1381
1541
  rootCauseFingerprint: z.ZodOptional<z.ZodString>;
1542
+ errorCode: z.ZodOptional<z.ZodString>;
1543
+ lastPersistedStage: z.ZodOptional<z.ZodString>;
1544
+ recoveryGuidance: z.ZodOptional<z.ZodObject<{
1545
+ resumable: z.ZodBoolean;
1546
+ action: z.ZodEnum<{
1547
+ resume: "resume";
1548
+ manual: "manual";
1549
+ }>;
1550
+ preconditions: z.ZodReadonly<z.ZodArray<z.ZodString>>;
1551
+ }, z.core.$strip>>;
1382
1552
  category: z.ZodLiteral<"scope-drift">;
1383
1553
  driftedPaths: z.ZodReadonly<z.ZodArray<z.ZodString>>;
1384
1554
  }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
@@ -1392,6 +1562,16 @@ export declare const RunSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.Zo
1392
1562
  confidence: z.ZodNumber;
1393
1563
  relatedEvidenceIds: z.ZodReadonly<z.ZodArray<z.core.$ZodBranded<z.ZodString, "EvidenceId">>>;
1394
1564
  rootCauseFingerprint: z.ZodOptional<z.ZodString>;
1565
+ errorCode: z.ZodOptional<z.ZodString>;
1566
+ lastPersistedStage: z.ZodOptional<z.ZodString>;
1567
+ recoveryGuidance: z.ZodOptional<z.ZodObject<{
1568
+ resumable: z.ZodBoolean;
1569
+ action: z.ZodEnum<{
1570
+ resume: "resume";
1571
+ manual: "manual";
1572
+ }>;
1573
+ preconditions: z.ZodReadonly<z.ZodArray<z.ZodString>>;
1574
+ }, z.core.$strip>>;
1395
1575
  category: z.ZodLiteral<"merge-conflict">;
1396
1576
  conflictingPaths: z.ZodReadonly<z.ZodArray<z.ZodString>>;
1397
1577
  }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
@@ -1405,6 +1585,16 @@ export declare const RunSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.Zo
1405
1585
  confidence: z.ZodNumber;
1406
1586
  relatedEvidenceIds: z.ZodReadonly<z.ZodArray<z.core.$ZodBranded<z.ZodString, "EvidenceId">>>;
1407
1587
  rootCauseFingerprint: z.ZodOptional<z.ZodString>;
1588
+ errorCode: z.ZodOptional<z.ZodString>;
1589
+ lastPersistedStage: z.ZodOptional<z.ZodString>;
1590
+ recoveryGuidance: z.ZodOptional<z.ZodObject<{
1591
+ resumable: z.ZodBoolean;
1592
+ action: z.ZodEnum<{
1593
+ resume: "resume";
1594
+ manual: "manual";
1595
+ }>;
1596
+ preconditions: z.ZodReadonly<z.ZodArray<z.ZodString>>;
1597
+ }, z.core.$strip>>;
1408
1598
  category: z.ZodLiteral<"model-failure">;
1409
1599
  provider: z.ZodString;
1410
1600
  }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
@@ -1418,6 +1608,16 @@ export declare const RunSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.Zo
1418
1608
  confidence: z.ZodNumber;
1419
1609
  relatedEvidenceIds: z.ZodReadonly<z.ZodArray<z.core.$ZodBranded<z.ZodString, "EvidenceId">>>;
1420
1610
  rootCauseFingerprint: z.ZodOptional<z.ZodString>;
1611
+ errorCode: z.ZodOptional<z.ZodString>;
1612
+ lastPersistedStage: z.ZodOptional<z.ZodString>;
1613
+ recoveryGuidance: z.ZodOptional<z.ZodObject<{
1614
+ resumable: z.ZodBoolean;
1615
+ action: z.ZodEnum<{
1616
+ resume: "resume";
1617
+ manual: "manual";
1618
+ }>;
1619
+ preconditions: z.ZodReadonly<z.ZodArray<z.ZodString>>;
1620
+ }, z.core.$strip>>;
1421
1621
  category: z.ZodLiteral<"acceptance-failure">;
1422
1622
  failingEvidenceId: z.core.$ZodBranded<z.ZodString, "EvidenceId">;
1423
1623
  }, z.core.$strip>>]>>>>;
@@ -1 +1 @@
1
- {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/domain/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAwBvB,eAAO,MAAM,uBAAuB;;;;;;;;;;;;mBAWvB,CAAA;AA2Ib,QAAA,MAAM,oBAAoB;;;;;;;;;qBASb,CAAA;AAE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AAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAC3D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AACnE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"create-harness-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/create-harness-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAOjD,OAAO,EAEL,KAAK,yBAAyB,EAE/B,MAAM,6BAA6B,CAAA;AAEpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAA;AAC3E,YAAY,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAE5E,eAAO,MAAM,mBAAmB,GAAI,eAAc,yBAA8B,KAAG,MA8FlF,CAAA;AAED,eAAO,MAAM,aAAa,QAAwB,CAAA"}
1
+ {"version":3,"file":"create-harness-plugin.d.ts","sourceRoot":"","sources":["../../src/plugin/create-harness-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAQjD,OAAO,EAEL,KAAK,yBAAyB,EAE/B,MAAM,6BAA6B,CAAA;AAMpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAA;AAC3E,YAAY,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAE5E,eAAO,MAAM,mBAAmB,GAAI,eAAc,yBAA8B,KAAG,MAiIlF,CAAA;AAED,eAAO,MAAM,aAAa,QAAwB,CAAA"}
@@ -4,6 +4,7 @@ import { applyHarnessAgentConfig } from "./harness-agent-config.js";
4
4
  import { handleHarnessChatMessage } from "./harness-chat-hook.js";
5
5
  import { createHarnessEscalateTool, HARNESS_ESCALATE_TOOL_NAME } from "./harness-escalate-tool.js";
6
6
  import { createRuntime, resolveHarnessResearchRole, } from "./harness-plugin-runtime.js";
7
+ import { createHarnessRunStatusTool, HARNESS_RUN_STATUS_TOOL_NAME, } from "./harness-run-status-tool.js";
7
8
  export { resolveHarnessProjectRoot } from "./harness-plugin-identifiers.js";
8
9
  export const createHarnessPlugin = (dependencies = {}) => {
9
10
  return async (input) => {
@@ -14,17 +15,31 @@ export const createHarnessPlugin = (dependencies = {}) => {
14
15
  runtime.projectRoot === undefined ||
15
16
  runtime.sessionGuards === undefined ||
16
17
  runtime.researchClients === undefined ||
17
- runtime.sessionAdapter === undefined) {
18
+ runtime.sessionAdapter === undefined ||
19
+ runtime.store === undefined) {
18
20
  return {};
19
21
  }
20
- const { config, coordinator, projectRoot, researchClients, sessionGuards, sessionAdapter } = runtime;
21
- const deliverInternalResult = async ({ sessionID, text, }) => {
22
+ const { config, coordinator, projectRoot, researchClients, sessionGuards, sessionAdapter, store, } = runtime;
23
+ const deliverInternalResult = async ({ sessionID, envelope, }) => {
22
24
  await input.client.session.promptAsync({
23
25
  path: { id: sessionID },
24
26
  query: { directory: projectRoot },
25
27
  body: {
26
28
  agent: "harness",
27
- parts: [{ type: "text", text, synthetic: true, metadata: { source: "harness" } }],
29
+ parts: [
30
+ {
31
+ type: "text",
32
+ text: envelope.userChannel,
33
+ synthetic: true,
34
+ metadata: { source: "harness", channel: "user" },
35
+ },
36
+ {
37
+ type: "text",
38
+ text: envelope.agentChannel,
39
+ synthetic: true,
40
+ metadata: { source: "harness", channel: "agent" },
41
+ },
42
+ ],
28
43
  },
29
44
  throwOnError: true,
30
45
  });
@@ -47,6 +62,7 @@ export const createHarnessPlugin = (dependencies = {}) => {
47
62
  guards: sessionGuards,
48
63
  deliverInternalResult,
49
64
  }),
65
+ [HARNESS_RUN_STATUS_TOOL_NAME]: createHarnessRunStatusTool({ store }),
50
66
  },
51
67
  "tool.execute.before": async (toolInput, output) => {
52
68
  const snapshot = sessionAdapterSnapshot(sessionAdapter, toolInput.sessionID);
@@ -71,14 +87,27 @@ export const createHarnessPlugin = (dependencies = {}) => {
71
87
  guards: sessionGuards,
72
88
  messageInput,
73
89
  output,
74
- deliverInternalResult: async ({ sessionID, text }) => {
90
+ deliverInternalResult: async ({ sessionID, envelope }) => {
75
91
  await input.client.session.promptAsync({
76
92
  path: { id: sessionID },
77
93
  query: { directory: projectRoot },
78
94
  body: {
79
95
  agent: "harness",
80
96
  ...(replyModel === undefined ? {} : { model: replyModel }),
81
- parts: [{ type: "text", text, synthetic: true, metadata: { source: "harness" } }],
97
+ parts: [
98
+ {
99
+ type: "text",
100
+ text: envelope.userChannel,
101
+ synthetic: true,
102
+ metadata: { source: "harness", channel: "user" },
103
+ },
104
+ {
105
+ type: "text",
106
+ text: envelope.agentChannel,
107
+ synthetic: true,
108
+ metadata: { source: "harness", channel: "agent" },
109
+ },
110
+ ],
82
111
  },
83
112
  throwOnError: true,
84
113
  });
@@ -1 +1 @@
1
- {"version":3,"file":"create-harness-plugin.js","sourceRoot":"","sources":["../../src/plugin/create-harness-plugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAA;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAA;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAA;AAClG,OAAO,EACL,aAAa,EAEb,0BAA0B,GAC3B,MAAM,6BAA6B,CAAA;AAEpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAA;AAG3E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,eAA0C,EAAE,EAAU,EAAE;IAC1F,OAAO,KAAK,EAAE,KAAK,EAAE,EAAE;QACrB,MAAM,OAAO,GAAG,MAAM,aA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J,CAAC;SACF,CAAA;IACH,CAAC,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,mBAAmB,EAAE,CAAA;AAElD,MAAM,sBAAsB,GAAG,CAC7B,cAAwF,EACxF,SAAiB,EACjB,EAAE,CAAC,cAAc,CAAC,UAAU,CAAC,SAAS,CAAC,CAAA"}
@@ -1,6 +1,7 @@
1
1
  import type { Part } from "@opencode-ai/sdk";
2
2
  import type { HarnessConfig } from "../config/index.js";
3
3
  import type { HarnessCoordinator } from "./harness-coordinator.js";
4
+ import { type HarnessDeliveryEnvelope } from "./harness-delivery-envelope.js";
4
5
  import { type HarnessRequestClassification } from "./harness-request-router.js";
5
6
  export type SessionGuards = {
6
7
  readonly inFlightAdvancements: Map<string, Promise<void>>;
@@ -12,7 +13,7 @@ export type SessionGuards = {
12
13
  };
13
14
  type InternalResultDelivery = (input: {
14
15
  readonly sessionID: string;
15
- readonly text: string;
16
+ readonly envelope: HarnessDeliveryEnvelope;
16
17
  }) => Promise<void>;
17
18
  export type HarnessAdmissionResult = "accepted" | "duplicate" | "busy";
18
19
  export declare const admitHarnessRequest: (input: {
@@ -1 +1 @@
1
- {"version":3,"file":"harness-chat-hook.d.ts","sourceRoot":"","sources":["../../src/plugin/harness-chat-hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAE5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAgBvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAClE,OAAO,EAEL,KAAK,4BAA4B,EAClC,MAAM,6BAA6B,CAAA;AAGpC,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;IACzD,QAAQ,CAAC,2BAA2B,EAAE,GAAG,CAAC,MAAM,EAAE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AM,CAAA;YAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;SACxB,CAAA;QACD,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,CAAA;KACvB,CAAA;CACF,KAAG,OAAO,CAAC,IAAI,CAsCf,CAAA"}
@@ -1,29 +1,24 @@
1
1
  import { HARNESS_PRIMARY_AGENT_NAME } from "../session/index.js";
2
2
  import { appendSyntheticTextPart, extractChatText, hasHarnessInternalResultPart, } from "./harness-chat-parts.js";
3
- import { createBackgroundAcknowledgement, createBackgroundBusyInstruction, createBackgroundDuplicateInstruction, createEnhancedPassthroughInstruction, createInternalCompletionMessage, createInternalFailureMessage, createPassthroughInstruction, } from "./harness-chat-protocol.js";
3
+ import { createBackgroundAcknowledgement, createEnhancedPassthroughInstruction, createPassthroughInstruction, } from "./harness-chat-protocol.js";
4
+ import { containsHarnessProtocolPayload, createBusyDuplicateEnvelope, createFailureDeliveryEnvelope, createSuccessDeliveryEnvelope, stripProtocolPayload, } from "./harness-delivery-envelope.js";
4
5
  import { classifyHarnessRequest, } from "./harness-request-router.js";
5
6
  import { sanitizeHarnessUserFacingError } from "./harness-user-facing-errors.js";
6
7
  export const admitHarnessRequest = (input) => {
7
8
  const admissionKey = createAdmissionKey(input.sessionID, input.messageID);
9
+ const deliverBusy = (envelope) => {
10
+ void input.deliverInternalResult({ sessionID: input.sessionID, envelope });
11
+ };
8
12
  if (input.guards.completedAdmissionKeys.has(admissionKey)) {
9
- void input.deliverInternalResult({
10
- sessionID: input.sessionID,
11
- text: createBackgroundDuplicateInstruction(input.guards.activeRunIdsBySession.get(input.sessionID)),
12
- });
13
+ deliverBusy(createBusyDuplicateEnvelope("duplicate", input.guards.activeRunIdsBySession.get(input.sessionID)));
13
14
  return "duplicate";
14
15
  }
15
16
  if (input.guards.inFlightAdmissions.has(admissionKey)) {
16
- void input.deliverInternalResult({
17
- sessionID: input.sessionID,
18
- text: createBackgroundDuplicateInstruction(input.guards.activeRunIdsBySession.get(input.sessionID)),
19
- });
17
+ deliverBusy(createBusyDuplicateEnvelope("duplicate", input.guards.activeRunIdsBySession.get(input.sessionID)));
20
18
  return "duplicate";
21
19
  }
22
20
  if (input.guards.inFlightAdmissionsBySession.has(input.sessionID)) {
23
- void input.deliverInternalResult({
24
- sessionID: input.sessionID,
25
- text: createBackgroundBusyInstruction(input.guards.activeRunIdsBySession.get(input.sessionID)),
26
- });
21
+ deliverBusy(createBusyDuplicateEnvelope("busy", input.guards.activeRunIdsBySession.get(input.sessionID)));
27
22
  return "busy";
28
23
  }
29
24
  const coordinationTask = input.coordinator.handle({
@@ -34,7 +29,7 @@ export const admitHarnessRequest = (input) => {
34
29
  const backgroundTask = coordinationTask.then(async (response) => {
35
30
  await input.deliverInternalResult({
36
31
  sessionID: input.sessionID,
37
- text: createInternalCompletionMessage(response),
32
+ envelope: createSuccessDeliveryEnvelope(response),
38
33
  });
39
34
  if (response.kind === "run") {
40
35
  input.guards.activeRunIdsBySession.set(input.sessionID, response.run.runId);
@@ -43,7 +38,7 @@ export const admitHarnessRequest = (input) => {
43
38
  }, async (error) => {
44
39
  await input.deliverInternalResult({
45
40
  sessionID: input.sessionID,
46
- text: createInternalFailureMessage(sanitizeHarnessUserFacingError(error)),
41
+ envelope: createFailureDeliveryEnvelope(sanitizeHarnessUserFacingError(error)),
47
42
  });
48
43
  });
49
44
  void backgroundTask.catch(() => undefined);
@@ -65,7 +60,11 @@ export const handleHarnessChatMessage = async (input) => {
65
60
  if (hasHarnessInternalResultPart(input.output.parts)) {
66
61
  return;
67
62
  }
68
- const inputText = extractChatText(input.output.parts);
63
+ const rawInputText = extractChatText(input.output.parts);
64
+ // 用户误粘贴的 HARNESS_* 协议标记与协议 JSON 静默降级为普通上下文,不回显解析错误
65
+ const inputText = containsHarnessProtocolPayload(rawInputText)
66
+ ? stripProtocolPayload(rawInputText)
67
+ : rawInputText;
69
68
  const requestClassification = classifyHarnessRequest(inputText);
70
69
  if (!requestClassification.shouldCoordinate) {
71
70
  const sessionID = input.messageInput.sessionID;
@@ -1 +1 @@
1
- {"version":3,"file":"harness-chat-hook.js","sourceRoot":"","sources":["../../src/plugin/harness-chat-hook.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAA;AAChE,OAAO,EACL,uBAAuB,EACvB,eAAe,EACf,4BAA4B,GAC7B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,+BAA+B,EAC/B,+BAA+B,EAC/B,oCAAoC,EACpC,oCAAoC,EACpC,+BAA+B,EAC/B,4BAA4B,EAC5B,4BAA4B,GAC7B,MAAM,4BAA4B,CAAA;AAEnC,OAAO,EACL,sBAAsB,GAEvB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,8BAA8B,EAAE,MAAM,iCAAiC,CAAA;AAkBhF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAQnC,EAA0B,EAAE;IAC3B,MAAM,YAAY,GAAG,kBAAkB,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,CAAA;IACzE,IAAI,KAAK,CAAC,MAAM,CAAC,sBAAsB,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;QAC1D,KAAK,KAAK,CAAC,qBAAqB,CAAC;YAC/B,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,IAAI,EAAE,oCAAoC,CACxC,KAAK,CAAC,MAAM,CAAC,qBAAqB,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CACxD;SACF,CAAC,CAAA;QACF,OAAO,WAAW,CAAA;IACpB,CAAC;IACD,IAAI,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;QACtD,KAAK,KAAK,CAAC,qBAAqB,CAAC;YAC/B,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,IAAI,EAAE,oCAAoC,CACxC,KAAK,CAAC,MAAM,CAAC,qBAAqB,CAAC,GAAG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AG,CAAC,SAAiB,EAAE,SAAiB,EAAU,EAAE,CAC1E,GAAG,SAAS,IAAI,SAAS,EAAE,CAAA"}
@@ -0,0 +1,19 @@
1
+ import type { HarnessCoordinatorResponse } from "./harness-coordinator.js";
2
+ export type HarnessDeliveryEnvelope = {
3
+ /** Agent 间私有通道:HARNESS_* 协议标记 + 原始回执 JSON,禁止进入用户可见通道 */
4
+ readonly agentChannel: string;
5
+ /** 用户可见通道:仅承载渲染后的自然语言摘要 */
6
+ readonly userChannel: string;
7
+ };
8
+ /** 回执投递双通道信封:协议负载与用户可见摘要分离。 */
9
+ export declare const createSuccessDeliveryEnvelope: (response: HarnessCoordinatorResponse) => HarnessDeliveryEnvelope;
10
+ export declare const createFailureDeliveryEnvelope: (message: string) => HarnessDeliveryEnvelope;
11
+ export declare const createProgressDeliveryEnvelope: (response: HarnessCoordinatorResponse) => HarnessDeliveryEnvelope;
12
+ export declare const createBusyDuplicateEnvelope: (deliveryStatus: "busy" | "duplicate", runId?: string) => HarnessDeliveryEnvelope;
13
+ /**
14
+ * 静默剥离用户消息中误粘贴的 HARNESS_* 协议标记与其后的协议 JSON 负载;
15
+ * 剥离结果按普通上下文处理,不向用户回显协议解析细节。
16
+ */
17
+ export declare const stripProtocolPayload: (inputText: string) => string;
18
+ export declare const containsHarnessProtocolPayload: (inputText: string) => boolean;
19
+ //# sourceMappingURL=harness-delivery-envelope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"harness-delivery-envelope.d.ts","sourceRoot":"","sources":["../../src/plugin/harness-delivery-envelope.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAA;AAE1E,MAAM,MAAM,uBAAuB,GAAG;IACpC,wDAAwD;IACxD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,2BAA2B;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAC7B,CAAA;AAED,+BAA+B;AAC/B,eAAO,MAAM,6BAA6B,GACxC,UAAU,0BAA0B,KACnC,uBAGD,CAAA;AAEF,eAAO,MAAM,6BAA6B,GAAI,SAAS,MAAM,KAAG,uBAG9D,CAAA;AAEF,eAAO,MAAM,8BAA8B,GACzC,UAAU,0BAA0B,KACnC,uBAGD,CAAA;AAOF,eAAO,MAAM,2BAA2B,GACtC,gBAAgB,MAAM,GAAG,WAAW,EACpC,QAAQ,MAAM,KACb,uBAGD,CAAA;AAiEF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,GAAI,WAAW,MAAM,KAAG,MAoBxD,CAAA;AAED,eAAO,MAAM,8BAA8B,GAAI,WAAW,MAAM,KAAG,OAClB,CAAA"}