pomaster 0.5.3 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.js CHANGED
@@ -6461,7 +6461,7 @@ var require_compile = __commonJS({
6461
6461
  const schOrFunc = root.refs[ref];
6462
6462
  if (schOrFunc)
6463
6463
  return schOrFunc;
6464
- let _sch = resolve3.call(this, root, ref);
6464
+ let _sch = resolve4.call(this, root, ref);
6465
6465
  if (_sch === void 0) {
6466
6466
  const schema2 = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref];
6467
6467
  const { schemaId } = this.opts;
@@ -6488,7 +6488,7 @@ var require_compile = __commonJS({
6488
6488
  function sameSchemaEnv(s1, s2) {
6489
6489
  return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
6490
6490
  }
6491
- function resolve3(root, ref) {
6491
+ function resolve4(root, ref) {
6492
6492
  let sch;
6493
6493
  while (typeof (sch = this.refs[ref]) == "string")
6494
6494
  ref = sch;
@@ -7313,7 +7313,7 @@ var require_fast_uri = __commonJS({
7313
7313
  }
7314
7314
  return uri;
7315
7315
  }
7316
- function resolve3(baseURI, relativeURI, options) {
7316
+ function resolve4(baseURI, relativeURI, options) {
7317
7317
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
7318
7318
  const {
7319
7319
  parsed: baseParsed,
@@ -7675,7 +7675,7 @@ var require_fast_uri = __commonJS({
7675
7675
  var fastUri = {
7676
7676
  SCHEMES,
7677
7677
  normalize,
7678
- resolve: resolve3,
7678
+ resolve: resolve4,
7679
7679
  resolveComponent,
7680
7680
  equal,
7681
7681
  serialize,
@@ -18526,8 +18526,286 @@ var init_evidence_spec_schema = __esm({
18526
18526
  }
18527
18527
  });
18528
18528
 
18529
+ // packages/schemas/dist/assets/22-design-tokens.schema.json
18530
+ var design_tokens_schema_default;
18531
+ var init_design_tokens_schema = __esm({
18532
+ "packages/schemas/dist/assets/22-design-tokens.schema.json"() {
18533
+ design_tokens_schema_default = {
18534
+ $schema: "http://json-schema.org/draft-07/schema#",
18535
+ $id: "https://pomaster.dev/schemas/design-tokens/v1-draft.json",
18536
+ title: "Design Tokens Contract\uFF08.pomaster/baseline/frontend/design-tokens.yaml \xB7 F-M1 \u6700\u5C0F\u5408\u540C\uFF0C09-10 R3 \u6279\uFF09",
18537
+ description: "Project Baseline \u539F\u6587 \xA716 design-tokens.yaml Contract \u7684\u673A\u5668\u5F62\u6001\uFF1A\u8BED\u4E49 token \u5355\u4E00\u5408\u540C\u9762\uFF08\u989C\u8272/\u5B57\u4F53/\u95F4\u8DDD/\u5706\u89D2/\u9634\u5F71/\u5C42\u7EA7/\u5BC6\u5EA6/\u5E03\u5C40/\u52A8\u6548/\u65AD\u70B9\u4E5D\u7EC4\uFF09\u2014\u2014UI \u53EA\u80FD\u4ECE\u672C\u5408\u540C\u7684\u8BED\u4E49 token \u4E0E\u6279\u51C6\u7EC4\u4EF6\u53D6\u5F97\u89C6\u89C9\u89C4\u5219\uFF0CAgent Context \u6D88\u8D39\u8BED\u4E49 token \u800C\u975E\u88F8\u6570\u503C\uFF08\xA717 \u8BBE\u8BA1\u539F\u5219\uFF09\u3002\n\u8D77\u6B65\u503C\u7EAA\u5F8B\uFF1A\u6570\u503C\u6765\u6E90\u4EC5\u4E24\u7C7B\u2014\u2014POMaster Default Design \u9884\u8BBE\u9ED8\u8BA4\u503C\uFF08origin=preset\uFF0Cadvisory \u6027\u8D28\uFF0COwner \u786E\u8BA4\u524D\u4E0D\u6784\u6210\u9879\u76EE\u4E8B\u5B9E\uFF09\u6216\u7559\u7A7A\uFF08\u8D77\u6B65\u503C UNKNOWN / null\uFF09\u5F85 Owner \u51B3\u7B56\uFF1B\u539F\u6587\u793A\u4F8B\u6570\u503C\u7981\u4F2A\u9020\u6210\u9879\u76EE\u4E8B\u5B9E\uFF08PRD \xA77.1 NON-AUTHORITATIVE\uFF09\u3002\n\u547D\u540D\u6536\u655B\u5B9A\u7A3F\uFF1A\u539F\u6587 \xA716 layout.section_gap vs \xA717 spacing.section_gap \u4E8C\u9009\u4E00\uFF0C\u5B9A\u7A3F = spacing.section_gap\uFF08\u95F4\u8DDD\u8BED\u4E49\u5F52 spacing \u7EC4\uFF1Blayout \u7EC4\u7559\u7ED9\u9875\u9762\u7ED3\u6784\u952E\uFF0C\u65AD\u70B9\u8BED\u4E49\u5F52 breakpoints \u7EC4\uFF09\u2014\u2014\u672C schema \u7684 layout \u7EC4\u952E\u96C6\u4E0D\u542B section_gap\u3002",
18538
+ "x-pomaster-file-role": "22-design-tokens.schema.json \u2014\u2014 Design Token \u5408\u540C\uFF08F-M1 \u6700\u5C0F\u5408\u540C\uFF0C09-10 R3 \u6279\uFF09\u3002\u843D\u76D8\u8F7D\u4F53 .pomaster/baseline/frontend/design-tokens.yaml\uFF08schema \u63CF\u8FF0\u5176 YAML \u540C\u6784\u5F62\u6001\u2014\u2014yaml \u88C5\u8F7D\u7ECF CLI baseline-tokens.ts \u8BFB\u53D6\u540E\u6821\u9A8C\uFF09\uFF1B\u540C\u65F6\u662F B6D \u6279\u64AD\u79CD\u5206\u6BCD\u589E\u91CF\uFF08seeds/manifest.json 26 \u4EF6\uFF09\u4E0E\u786E\u8BA4\u8D44\u4EA7\u6E05\u5355\u7B2C 25 \u6587\u4EF6\uFF08BASELINE_CONFIRM_TARGETS\u2014\u2014confirm digest \u5FEB\u7167/closeout \u6821\u9A8C/preset \u5FEB\u7167\u58F0\u660E\u4E09\u6D88\u8D39\u9762\u540C\u6E90\uFF0Cschema \u6821\u9A8C\u4E0E digest \u786E\u8BA4\u6B63\u4EA4\uFF1Adigest \u9762\u53EA\u770B\u5B57\u8282\uFF0C\u672C schema \u7BA1\u5F62\u72B6\uFF09\u3002",
18539
+ "x-pomaster-vocab-source": "Baseline PRD \u539F\u6587 \xA713-21\uFF08\xA716 \u5206\u7EC4\u9AA8\u67B6\u9010\u5B57 + \xA717 \u547D\u540D\u6536\u655B\u5B9A\u7A3F + \xA719 preset\u2192customize\u2192baseline \u901A\u8DEF + \xA775 UNKNOWN/\u6309\u9700\u589E\u957F\u5408\u6CD5\uFF09\u3002origin \u8BCD\u5F62\u95ED\u5305 preset|customized|owner \u4E3A\u672C\u6587\u4EF6\u672C\u5730\u95ED\u5305\uFF0820-sources-authority \u5F00\u653E\u7EF4\u5EA6\u8BCD\u5148\u4F8B\u540C\u6CD5\u2014\u2014\u96F6\u4E2D\u592E\u8BCD\u8868 PR\uFF1B\u8DE8\u5305\u6D88\u8D39\u65F6\u518D\u8D70\u8BCD\u6C47\u8868 PR \u5E73\u79FB\uFF09\u3002UNKNOWN \u8D77\u6B65\u8BCD\u5F62\u4E0E baseline/stack.yaml \u53F0\u8D26\u540C\u6E90\uFF08B6d \u64AD\u79CD\u7EAA\u5F8B\uFF09\u3002",
18540
+ "x-pomaster-contract": {
18541
+ local_origin_closure: "origin \u4E09\u503C\u672C\u5730\u95ED\u5305\uFF1Apreset\uFF08\u64AD\u79CD\u9AA8\u67B6/\u9884\u8BBE\u9ED8\u8BA4\uFF0Cadvisory\uFF09| customized\uFF08Owner \u5728 preset \u57FA\u7840\u4E0A\u5B9A\u5236\uFF09| owner\uFF08Owner \u5168\u6743\u81EA\u8457\uFF09\u3002meta.customized \u662F\u72EC\u7ACB\u673A\u5668\u4F4D\uFF08\u5E03\u5C14\uFF09\u2014\u2014origin \u8868\u6765\u6E90\uFF0Ccustomized \u8868\u5B9A\u5236\u4E8B\u5B9E\uFF1BP-D1 customize/diff/confirm \u5168\u6D41\u7A0B\uFF08\u542B per-token origin \u5143\u6570\u636E\uFF09\u5728\u540E\u7EED\u63D0\u6848\u6269\u4F4D\uFF0C\u672C\u5408\u540C\u53EA\u51BB\u7ED3 meta \u7EA7\u673A\u5668\u4F4D\u3002",
18542
+ advisory_preset_values: "origin=preset \u7684\u6570\u503C\u662F advisory\uFF08\u975E\u9879\u76EE\u4E8B\u5B9E\uFF09\uFF1A\u786E\u8BA4\uFF08baseline confirm\uFF09\u524D\u4E0D\u6784\u6210\u6743\u5A01\uFF1BP-D1 \u5B8C\u6574\u63D0\u6848\u524D\u672C\u5408\u540C\u4E0D\u5185\u7F6E\u4EFB\u4F55\u9884\u8BBE\u9ED8\u8BA4\u503C\u2014\u2014\u672C\u4ED3\u672A\u767B\u8BB0 POMaster Default Design \u6570\u503C\uFF0C\u64AD\u79CD\u9762\u5168\u53F6 UNKNOWN\u3002",
18543
+ confirm_target: "\u672C\u6587\u4EF6\u662F\u786E\u8BA4\u8D44\u4EA7\u6E05\u5355\u7B2C 25 \u6587\u4EF6\uFF1A\u4FEE\u6539/\u5220\u9664 = BASELINE_DRIFT\uFF08digest \u9762\u68C0\u51FA\uFF0C\u4E0E schema \u5F62\u72B6\u5224\u5377\u6B63\u4EA4\u2014\u2014\u5F62\u72B6\u8FDD\u89C4\u7531\u88C5\u8F7D\u9762 fail-closed \u62D2\u7EDD\uFF0C\u4E0D\u6DF7\u5165 digest \u6BD4\u5BF9\uFF09\u3002",
18544
+ not_governed_object: "\u672C\u5408\u540C\u4E0D\u662F governed object\uFF1A\u4E0D\u8FDB truth-index\u3001\u4E0D\u8D70 store \u4E8B\u52A1\u3001\u65E0 lifecycle/authority.owner \u4FE1\u5C01\u2014\u2014\u8BBE\u8BA1 token \u662F\u9879\u76EE\u5E73\u9762\u586B\u5199\u9762\uFF08\u4E0E 20-sources-authority registry \u540C\u57DF\uFF1A\u9879\u76EE\u53EF\u7F16\u8F91\u3001seed-once \u64AD\u79CD\u3001Owner \u5168\u6743\uFF09\u3002",
18545
+ groups_closed_keys_open: "\u4E5D\u7EC4\u8BCD\u5F62\u4E0E\u7EC4\u5185\u952E\u96C6\u6309 \xA716 \u9AA8\u67B6\u5C01\u95ED\uFF08\u952E\u96C6\u6F02\u79FB\u5373 schema \u5931\u8D25\u2014\u2014\u5355\u4E00\u8BCD\u5F62\u6E90\u7EAA\u5F8B\uFF0C\u4E0E stack.yaml \u952E\u96C6\u540C\u6CD5\uFF09\uFF1Btoken \u589E\u957F\u901A\u9053 = \u663E\u5F0F schema \u4FEE\u8BA2\uFF08\xA775\u300Cgrows only when the project earns the need\u300D\u2014\u2014\u7981 Owner \u5728\u7EC4\u5185\u81EA\u9020\u952E\u7ED5\u8FC7\u8BCD\u5F62\u6E90\uFF09\u3002"
18546
+ },
18547
+ type: "object",
18548
+ additionalProperties: false,
18549
+ required: ["meta"],
18550
+ properties: {
18551
+ meta: {
18552
+ type: "object",
18553
+ additionalProperties: false,
18554
+ required: ["origin", "customized"],
18555
+ properties: {
18556
+ origin: {
18557
+ enum: ["preset", "customized", "owner"],
18558
+ title: "\u6765\u6E90\u673A\u5668\u4F4D\uFF08\u672C\u5730\u4E09\u503C\u95ED\u5305\uFF09",
18559
+ description: "preset = \u64AD\u79CD\u9AA8\u67B6/\u9884\u8BBE\u9ED8\u8BA4\uFF08advisory\u2014\u2014Owner \u786E\u8BA4\u524D\u4E0D\u6784\u6210\u9879\u76EE\u4E8B\u5B9E\uFF09\uFF1Bcustomized = Owner \u5728 preset \u57FA\u7840\u4E0A\u5B9A\u5236\uFF1Bowner = Owner \u5168\u6743\u81EA\u8457\u3002"
18560
+ },
18561
+ customized: {
18562
+ type: "boolean",
18563
+ title: "Owner \u5B9A\u5236\u673A\u5668\u4F4D",
18564
+ description: "true = \u6587\u4EF6\u7ECF Owner \u5B9A\u5236\uFF08P-D1 customize/diff/confirm \u9762\u6D88\u8D39\uFF1B\u4E0E origin \u6B63\u4EA4\u2014\u2014origin \u8868\u6765\u6E90\uFF0Ccustomized \u8868\u5B9A\u5236\u4E8B\u5B9E\uFF09\u3002"
18565
+ }
18566
+ }
18567
+ },
18568
+ color: {
18569
+ $ref: "#/definitions/color_group",
18570
+ title: "\u989C\u8272\u8BED\u4E49 token\uFF08brand/surface/text/border/semantic\uFF09"
18571
+ },
18572
+ typography: {
18573
+ $ref: "#/definitions/typography_group",
18574
+ title: "\u5B57\u4F53\u8BED\u4E49 token\uFF08family/size/weight/line_height\uFF09"
18575
+ },
18576
+ spacing: {
18577
+ $ref: "#/definitions/spacing_group",
18578
+ title: "\u95F4\u8DDD token\uFF08xs..xxl + section_gap\u2014\u2014\u547D\u540D\u6536\u655B\u5B9A\u7A3F\u843D\u4F4D\uFF09"
18579
+ },
18580
+ radius: {
18581
+ $ref: "#/definitions/radius_group",
18582
+ title: "\u5706\u89D2 token\uFF08sm/md/lg\uFF09"
18583
+ },
18584
+ elevation: {
18585
+ $ref: "#/definitions/elevation_group",
18586
+ title: "\u9634\u5F71/\u5C42\u7EA7 token\uFF08card/popover/modal\uFF09"
18587
+ },
18588
+ density: {
18589
+ $ref: "#/definitions/density_group",
18590
+ title: "\u5BC6\u5EA6 token\uFF08\u63A7\u4EF6/\u8868\u683C\u884C\u9AD8\uFF09"
18591
+ },
18592
+ layout: {
18593
+ $ref: "#/definitions/layout_group",
18594
+ title: "\u5E03\u5C40\u7ED3\u6784 token\uFF08\u9875\u9762\u7EA7\uFF1B\u4E0D\u542B section_gap\u2014\u2014\u95F4\u8DDD\u8BED\u4E49\u5F52 spacing \u7EC4\uFF09"
18595
+ },
18596
+ motion: {
18597
+ $ref: "#/definitions/motion_group",
18598
+ title: "\u52A8\u6548\u65F6\u957F token\uFF08fast/normal/slow\uFF09"
18599
+ },
18600
+ breakpoints: {
18601
+ $ref: "#/definitions/breakpoints_group",
18602
+ title: "\u54CD\u5E94\u5F0F\u65AD\u70B9 token\uFF08sm/md/lg/xl\uFF09"
18603
+ }
18604
+ },
18605
+ definitions: {
18606
+ token_value: {
18607
+ description: "\u5355 token \u503C\uFF1A\u8D77\u6B65\u503C UNKNOWN\uFF08\u5B57\u7B26\u4E32\u5360\u4F4D\u2014\u2014\u4E0E baseline/stack.yaml \u540C\u6E90\u8BCD\u5F62\uFF09\u6216 null\uFF08\u7559\u7A7A\uFF09= \u5F85 Owner \u51B3\u7B56\uFF1BOwner \u56DE\u586B\u540E\u4E3A\u975E\u7A7A\u5B57\u7B26\u4E32\uFF08\u5982\u8272\u503C/\u5C3A\u5BF8\u8BCD\u5F62\uFF09\u6216\u6570\u503C\u3002\u793A\u4F8B\u6570\u503C\u7981\u5165\u64AD\u79CD\u9762\uFF08NON-AUTHORITATIVE\uFF09\u3002",
18608
+ anyOf: [
18609
+ {
18610
+ type: "string",
18611
+ minLength: 1,
18612
+ maxLength: 256
18613
+ },
18614
+ {
18615
+ type: "number"
18616
+ },
18617
+ {
18618
+ type: "null"
18619
+ }
18620
+ ]
18621
+ },
18622
+ color_group: {
18623
+ type: "object",
18624
+ additionalProperties: false,
18625
+ properties: {
18626
+ brand: {
18627
+ type: "object",
18628
+ additionalProperties: false,
18629
+ properties: {
18630
+ primary: { $ref: "#/definitions/token_value" },
18631
+ secondary: { $ref: "#/definitions/token_value" }
18632
+ },
18633
+ title: "\u54C1\u724C\u8272\uFF08primary/secondary\uFF09"
18634
+ },
18635
+ surface: {
18636
+ type: "object",
18637
+ additionalProperties: false,
18638
+ properties: {
18639
+ page: { $ref: "#/definitions/token_value" },
18640
+ container: { $ref: "#/definitions/token_value" },
18641
+ elevated: { $ref: "#/definitions/token_value" }
18642
+ },
18643
+ title: "\u8868\u9762\u8272\uFF08page/container/elevated\uFF09"
18644
+ },
18645
+ text: {
18646
+ type: "object",
18647
+ additionalProperties: false,
18648
+ properties: {
18649
+ primary: { $ref: "#/definitions/token_value" },
18650
+ secondary: { $ref: "#/definitions/token_value" },
18651
+ tertiary: { $ref: "#/definitions/token_value" },
18652
+ disabled: { $ref: "#/definitions/token_value" }
18653
+ },
18654
+ title: "\u6587\u672C\u8272\uFF08primary/secondary/tertiary/disabled\uFF09"
18655
+ },
18656
+ border: {
18657
+ type: "object",
18658
+ additionalProperties: false,
18659
+ properties: {
18660
+ default: { $ref: "#/definitions/token_value" },
18661
+ subtle: { $ref: "#/definitions/token_value" },
18662
+ strong: { $ref: "#/definitions/token_value" }
18663
+ },
18664
+ title: "\u8FB9\u6846\u8272\uFF08default/subtle/strong\uFF09"
18665
+ },
18666
+ semantic: {
18667
+ type: "object",
18668
+ additionalProperties: false,
18669
+ properties: {
18670
+ success: { $ref: "#/definitions/token_value" },
18671
+ warning: { $ref: "#/definitions/token_value" },
18672
+ error: { $ref: "#/definitions/token_value" },
18673
+ info: { $ref: "#/definitions/token_value" }
18674
+ },
18675
+ title: "\u8BED\u4E49\u72B6\u6001\u8272\uFF08success/warning/error/info\uFF09"
18676
+ }
18677
+ }
18678
+ },
18679
+ typography_group: {
18680
+ type: "object",
18681
+ additionalProperties: false,
18682
+ properties: {
18683
+ family: {
18684
+ type: "object",
18685
+ additionalProperties: false,
18686
+ properties: {
18687
+ sans: { $ref: "#/definitions/token_value" },
18688
+ mono: { $ref: "#/definitions/token_value" }
18689
+ },
18690
+ title: "\u5B57\u4F53\u65CF\uFF08sans/mono\uFF09"
18691
+ },
18692
+ size: {
18693
+ type: "object",
18694
+ additionalProperties: false,
18695
+ properties: {
18696
+ caption: { $ref: "#/definitions/token_value" },
18697
+ body: { $ref: "#/definitions/token_value" },
18698
+ body_large: { $ref: "#/definitions/token_value" },
18699
+ title_small: { $ref: "#/definitions/token_value" },
18700
+ title_medium: { $ref: "#/definitions/token_value" },
18701
+ title_large: { $ref: "#/definitions/token_value" }
18702
+ },
18703
+ title: "\u5B57\u53F7\uFF08caption/body/body_large/title_small/title_medium/title_large\uFF09"
18704
+ },
18705
+ weight: {
18706
+ type: "object",
18707
+ additionalProperties: false,
18708
+ properties: {
18709
+ regular: { $ref: "#/definitions/token_value" },
18710
+ medium: { $ref: "#/definitions/token_value" },
18711
+ semibold: { $ref: "#/definitions/token_value" }
18712
+ },
18713
+ title: "\u5B57\u91CD\uFF08regular/medium/semibold\uFF09"
18714
+ },
18715
+ line_height: {
18716
+ type: "object",
18717
+ additionalProperties: false,
18718
+ properties: {
18719
+ compact: { $ref: "#/definitions/token_value" },
18720
+ normal: { $ref: "#/definitions/token_value" },
18721
+ relaxed: { $ref: "#/definitions/token_value" }
18722
+ },
18723
+ title: "\u884C\u9AD8\uFF08compact/normal/relaxed\uFF09"
18724
+ }
18725
+ }
18726
+ },
18727
+ spacing_group: {
18728
+ type: "object",
18729
+ additionalProperties: false,
18730
+ properties: {
18731
+ xs: { $ref: "#/definitions/token_value" },
18732
+ sm: { $ref: "#/definitions/token_value" },
18733
+ md: { $ref: "#/definitions/token_value" },
18734
+ lg: { $ref: "#/definitions/token_value" },
18735
+ xl: { $ref: "#/definitions/token_value" },
18736
+ xxl: { $ref: "#/definitions/token_value" },
18737
+ section_gap: {
18738
+ $ref: "#/definitions/token_value",
18739
+ title: "\u8282\u95F4\u8DDD\uFF08\u547D\u540D\u6536\u655B\u5B9A\u7A3F\uFF1A\u539F\u6587 \xA717 spacing.section_gap \u9010\u5B57\uFF1B\xA716 layout.section_gap \u5E9F\u5F03\uFF09",
18740
+ description: "\u95F4\u8DDD\u8BED\u4E49\u5F52 spacing \u7EC4\uFF08\xA717 \u8BED\u4E49 token \u5148\u4F8B\uFF09\uFF1Blayout \u7EC4\u4E0D\u627F\u8F7D\u672C\u952E\u3002"
18741
+ }
18742
+ }
18743
+ },
18744
+ radius_group: {
18745
+ type: "object",
18746
+ additionalProperties: false,
18747
+ properties: {
18748
+ sm: { $ref: "#/definitions/token_value" },
18749
+ md: { $ref: "#/definitions/token_value" },
18750
+ lg: { $ref: "#/definitions/token_value" }
18751
+ }
18752
+ },
18753
+ elevation_group: {
18754
+ type: "object",
18755
+ additionalProperties: false,
18756
+ properties: {
18757
+ card: { $ref: "#/definitions/token_value" },
18758
+ popover: { $ref: "#/definitions/token_value" },
18759
+ modal: { $ref: "#/definitions/token_value" }
18760
+ }
18761
+ },
18762
+ density_group: {
18763
+ type: "object",
18764
+ additionalProperties: false,
18765
+ properties: {
18766
+ control_height: { $ref: "#/definitions/token_value" },
18767
+ compact_control_height: { $ref: "#/definitions/token_value" },
18768
+ table_row_height: { $ref: "#/definitions/token_value" },
18769
+ compact_table_row_height: { $ref: "#/definitions/token_value" }
18770
+ }
18771
+ },
18772
+ layout_group: {
18773
+ type: "object",
18774
+ additionalProperties: false,
18775
+ properties: {
18776
+ page_padding: { $ref: "#/definitions/token_value" },
18777
+ content_max_width: { $ref: "#/definitions/token_value" },
18778
+ sidebar_width: { $ref: "#/definitions/token_value" },
18779
+ header_height: { $ref: "#/definitions/token_value" }
18780
+ },
18781
+ title: "\u5E03\u5C40\u7ED3\u6784\u952E\uFF08page_padding/content_max_width/sidebar_width/header_height\u2014\u2014\xA716 \u952E\u96C6\u51CF section_gap\uFF09"
18782
+ },
18783
+ motion_group: {
18784
+ type: "object",
18785
+ additionalProperties: false,
18786
+ properties: {
18787
+ fast: { $ref: "#/definitions/token_value" },
18788
+ normal: { $ref: "#/definitions/token_value" },
18789
+ slow: { $ref: "#/definitions/token_value" }
18790
+ }
18791
+ },
18792
+ breakpoints_group: {
18793
+ type: "object",
18794
+ additionalProperties: false,
18795
+ properties: {
18796
+ sm: { $ref: "#/definitions/token_value" },
18797
+ md: { $ref: "#/definitions/token_value" },
18798
+ lg: { $ref: "#/definitions/token_value" },
18799
+ xl: { $ref: "#/definitions/token_value" }
18800
+ }
18801
+ }
18802
+ }
18803
+ };
18804
+ }
18805
+ });
18806
+
18529
18807
  // packages/schemas/dist/src/vocab.js
18530
- var IR_SCHEMA_DIALECT, LIFECYCLE_VALUES, CONFIDENCE_VALUES, EVIDENCE_VALUES, CHANGE_VALUES, LIFECYCLE_TRANSITIONS, SOURCE_TYPE_ALL_VALUES, SOURCE_TYPE_FORBIDDEN_VALUES, GOVERNED_ID_PREFIXES, ALIASES_V0, TRUTH_BODY_KINDS, CATALOG_ENFORCEMENT_VALUES, CATALOG_CLASSIFICATION_VALUES, CATALOG_LANE_VALUES, CATALOG_CHANGE_CLASS_VALUES, CATALOG_GOVERNANCE_PROFILE_VALUES, RECONCILE_DELTA_KINDS, VERDICT_VALUES, ORIGIN_VALUES, VERIFICATION_VERDICT_VALUES, PRODUCER_KIND_VALUES, ACTOR_TYPE_VALUES, RUN_TRIGGER_VALUES, DENOMINATOR_STATUS_VALUES, DISCOVERY_CHAIN_VALUES, DISCOVERY_CHAIN_TRANSITIONS, DISCOVERY_PROMOTION_BASIS_VALUES, BLUEPRINT_ENVELOPE_STATUS_VALUES, RESEARCH_FINDING_CONFIDENCE_VALUES, RESEARCH_EVIDENCE_LEVEL_VALUES, RESEARCH_AUTHORITY_EFFECT_VALUES, RESEARCH_MODE_VALUES, EXCEPTION_CLASSIFICATION_VALUES, KNOWLEDGE_KIND_VALUES, KNOWLEDGE_STATUS_VALUES, KNOWLEDGE_TRANSITIONS, KNOWLEDGE_PROMOTION_AUTHORITY_VALUES, KNOWLEDGE_CONFIDENCE_VALUES, EXECUTION_RUNTIME_VALUES, EXECUTION_IDENTITY_KIND_VALUES, EXECUTION_ROLE_VALUES, LOCK_KIND_VALUES, AGENT_ROLE_POOL_VALUES, RUNTIME_CAPABILITY_VALUES, RUNTIME_DEGRADATION_RULE_IDS, WORD_FORM_DOMAIN_VALUES, EQUIVALENCE_STATUS_VALUES, PORTABILITY_CANONICAL_SET_VALUES, PORTABILITY_RUNTIME_REBUILD_VALUES, PORTABILITY_FORBIDDEN_DEPENDENCY_VALUES, MEMORY_DRIFT, HARVEST_BUCKET_VALUES, HARVEST_PRIMARY_BUCKETS, HARVEST_SPECIAL_EXIT_VALUES, MEMORY_CLASS_VALUES, REVIEW_STATE_VALUES, HARVEST_SOURCE_VALUES, HARVEST_CONFIDENCE_VALUES, MEMORY_CLI_ERROR_VALUES, OWNER_ESCALATION_REQUIRED, PHASE_TIMELINE_VALUES, PRODUCTION_SIGNAL_SOURCE_VALUES, DIAGNOSIS_KIND_VALUES, BAND_PREDICATE_OPERATOR_VALUES, CONTROL_BAND_EVALUATION_STATUS_VALUES, CAPABILITY_OUTCOME_METRIC_STATUS_VALUES, CAPABILITY_OUTCOME_METRIC_KEY_VALUES, SELF_IMPROVEMENT_SIGNAL_VALUES, SELF_IMPROVEMENT_SIGNAL_PRD_LABELS, POMASTER_SELF_IMPROVEMENT_CANDIDATE, DETECTED_BY_TOOL_SIGNAL, PRODUCTION_CLI_ERROR_VALUES, RELATION_TYPE_VALUES, RELATION_ORIGIN_VALUES, RELATION_ENDPOINT_DOMAIN_VALUES, RELATION_CONFIDENCE_VALUES, SUBSTRATE_LAYER_VALUES, RESOLUTION_MATCH_CLASS_VALUES, OBJECT_FAMILY_VALUES, CATALOG_KIND_VALUES;
18808
+ var IR_SCHEMA_DIALECT, LIFECYCLE_VALUES, CONFIDENCE_VALUES, EVIDENCE_VALUES, CHANGE_VALUES, LIFECYCLE_TRANSITIONS, SOURCE_TYPE_ALL_VALUES, SOURCE_TYPE_FORBIDDEN_VALUES, BINDING_CLASS_VALUES, BINDING_STATUS_VALUES, GOVERNED_ID_PREFIXES, ALIASES_V0, TRUTH_BODY_KINDS, CATALOG_ENFORCEMENT_VALUES, CATALOG_CLASSIFICATION_VALUES, CATALOG_LANE_VALUES, CATALOG_CHANGE_CLASS_VALUES, CATALOG_GOVERNANCE_PROFILE_VALUES, RECONCILE_DELTA_KINDS, VERDICT_VALUES, ORIGIN_VALUES, VERIFICATION_VERDICT_VALUES, PRODUCER_KIND_VALUES, ACTOR_TYPE_VALUES, RUN_TRIGGER_VALUES, DENOMINATOR_STATUS_VALUES, DISCOVERY_CHAIN_VALUES, DISCOVERY_CHAIN_TRANSITIONS, DISCOVERY_PROMOTION_BASIS_VALUES, BLUEPRINT_ENVELOPE_STATUS_VALUES, RESEARCH_FINDING_CONFIDENCE_VALUES, RESEARCH_EVIDENCE_LEVEL_VALUES, RESEARCH_AUTHORITY_EFFECT_VALUES, RESEARCH_MODE_VALUES, EXCEPTION_CLASSIFICATION_VALUES, KNOWLEDGE_KIND_VALUES, KNOWLEDGE_STATUS_VALUES, KNOWLEDGE_TRANSITIONS, KNOWLEDGE_PROMOTION_AUTHORITY_VALUES, KNOWLEDGE_CONFIDENCE_VALUES, EXECUTION_RUNTIME_VALUES, EXECUTION_IDENTITY_KIND_VALUES, EXECUTION_ROLE_VALUES, LOCK_KIND_VALUES, AGENT_ROLE_POOL_VALUES, RUNTIME_CAPABILITY_VALUES, RUNTIME_DEGRADATION_RULE_IDS, WORD_FORM_DOMAIN_VALUES, EQUIVALENCE_STATUS_VALUES, PORTABILITY_CANONICAL_SET_VALUES, PORTABILITY_RUNTIME_REBUILD_VALUES, PORTABILITY_FORBIDDEN_DEPENDENCY_VALUES, MEMORY_DRIFT, HARVEST_BUCKET_VALUES, HARVEST_PRIMARY_BUCKETS, HARVEST_SPECIAL_EXIT_VALUES, MEMORY_CLASS_VALUES, REVIEW_STATE_VALUES, HARVEST_SOURCE_VALUES, HARVEST_CONFIDENCE_VALUES, MEMORY_CLI_ERROR_VALUES, OWNER_ESCALATION_REQUIRED, PHASE_TIMELINE_VALUES, PRODUCTION_SIGNAL_SOURCE_VALUES, DIAGNOSIS_KIND_VALUES, BAND_PREDICATE_OPERATOR_VALUES, CONTROL_BAND_EVALUATION_STATUS_VALUES, CAPABILITY_OUTCOME_METRIC_STATUS_VALUES, CAPABILITY_OUTCOME_METRIC_KEY_VALUES, SELF_IMPROVEMENT_SIGNAL_VALUES, SELF_IMPROVEMENT_SIGNAL_PRD_LABELS, POMASTER_SELF_IMPROVEMENT_CANDIDATE, DETECTED_BY_TOOL_SIGNAL, PRODUCTION_CLI_ERROR_VALUES, RELATION_TYPE_VALUES, RELATION_ORIGIN_VALUES, RELATION_ENDPOINT_DOMAIN_VALUES, RELATION_CONFIDENCE_VALUES, SUBSTRATE_LAYER_VALUES, RESOLUTION_MATCH_CLASS_VALUES, OBJECT_FAMILY_VALUES, CATALOG_KIND_VALUES;
18531
18809
  var init_vocab = __esm({
18532
18810
  "packages/schemas/dist/src/vocab.js"() {
18533
18811
  "use strict";
@@ -18572,6 +18850,12 @@ var init_vocab = __esm({
18572
18850
  "prototype_html_scrape",
18573
18851
  "ai_invention"
18574
18852
  ];
18853
+ BINDING_CLASS_VALUES = [
18854
+ "page_to_dir",
18855
+ "contract_operation_to_operationId",
18856
+ "capability_to_file"
18857
+ ];
18858
+ BINDING_STATUS_VALUES = ["confirmed", "derived", "stale"];
18575
18859
  GOVERNED_ID_PREFIXES = [
18576
18860
  "PAGE",
18577
18861
  "CAPABILITY",
@@ -19059,7 +19343,7 @@ function performanceBudgetPropertyNames() {
19059
19343
  }
19060
19344
  return Object.keys(properties).sort();
19061
19345
  }
19062
- var TRUTH_INDEX_ID, OBJECT_ENVELOPE_ID, GATE_RESULT_ID, KEYBINDING_ID, DENOMINATOR_ID, PRODUCER_ID, EVIDENCE_RECORDS_ID, DISCOVERY_STATE_CHAIN_ID, MSD_UNCERTAINTY_ID, RESEARCH_ARTIFACT_ID, EXCEPTION_LEDGER_ID, KNOWLEDGE_ENTRY_ID, EQUIVALENCE_REGISTRY_ID, MEMORY_HARVEST_ID, PRODUCTION_BAND_ID, EXECUTION_TRACE_ID, PERCEPTION_RECEIPTS_ID, DECISION_GRAPH_ID, SOFTWARE_GRAPH_RELATIONS_ID, SOURCES_AUTHORITY_ID, EVIDENCE_SPEC_ID, truthIndexSchema, objectEnvelopeSchema, gateResultSchema, keybindingSchema, denominatorSchema, producerSchema, evidenceRecordsSchema, discoveryStateChainSchema, msdUncertaintySchema, researchArtifactSchema, exceptionLedgerSchema, knowledgeEntrySchema, equivalenceRegistrySchema, memoryHarvestSchema, productionBandSchema, executionTraceSchema, perceptionReceiptsSchema, decisionGraphSchema, softwareGraphRelationsSchema, sourcesAuthoritySchema, evidenceSpecSchema, allSchemas, performanceBudgetDefinition, PERFORMANCE_BUDGET_FIELDS;
19346
+ var TRUTH_INDEX_ID, OBJECT_ENVELOPE_ID, GATE_RESULT_ID, KEYBINDING_ID, DENOMINATOR_ID, PRODUCER_ID, EVIDENCE_RECORDS_ID, DISCOVERY_STATE_CHAIN_ID, MSD_UNCERTAINTY_ID, RESEARCH_ARTIFACT_ID, EXCEPTION_LEDGER_ID, KNOWLEDGE_ENTRY_ID, EQUIVALENCE_REGISTRY_ID, MEMORY_HARVEST_ID, PRODUCTION_BAND_ID, EXECUTION_TRACE_ID, PERCEPTION_RECEIPTS_ID, DECISION_GRAPH_ID, SOFTWARE_GRAPH_RELATIONS_ID, SOURCES_AUTHORITY_ID, EVIDENCE_SPEC_ID, DESIGN_TOKENS_ID, truthIndexSchema, objectEnvelopeSchema, gateResultSchema, keybindingSchema, denominatorSchema, producerSchema, evidenceRecordsSchema, discoveryStateChainSchema, msdUncertaintySchema, researchArtifactSchema, exceptionLedgerSchema, knowledgeEntrySchema, equivalenceRegistrySchema, memoryHarvestSchema, productionBandSchema, executionTraceSchema, perceptionReceiptsSchema, decisionGraphSchema, softwareGraphRelationsSchema, sourcesAuthoritySchema, evidenceSpecSchema, designTokensSchema, allSchemas, performanceBudgetDefinition, PERFORMANCE_BUDGET_FIELDS;
19063
19347
  var init_src = __esm({
19064
19348
  "packages/schemas/dist/src/index.js"() {
19065
19349
  "use strict";
@@ -19084,6 +19368,7 @@ var init_src = __esm({
19084
19368
  init_software_graph_relations_schema();
19085
19369
  init_sources_authority_schema();
19086
19370
  init_evidence_spec_schema();
19371
+ init_design_tokens_schema();
19087
19372
  init_vocab();
19088
19373
  TRUTH_INDEX_ID = "https://pomaster.dev/schemas/truth-index/v1-draft.json";
19089
19374
  OBJECT_ENVELOPE_ID = "https://pomaster.dev/schemas/object-envelope/v1-draft.json";
@@ -19106,6 +19391,7 @@ var init_src = __esm({
19106
19391
  SOFTWARE_GRAPH_RELATIONS_ID = "https://pomaster.dev/schemas/software-graph-relations/v1-draft.json";
19107
19392
  SOURCES_AUTHORITY_ID = "https://pomaster.dev/schemas/sources-authority/v1-draft.json";
19108
19393
  EVIDENCE_SPEC_ID = "https://pomaster.dev/schemas/evidence-spec/v1-draft.json";
19394
+ DESIGN_TOKENS_ID = "https://pomaster.dev/schemas/design-tokens/v1-draft.json";
19109
19395
  truthIndexSchema = asSchema(truth_index_schema_default, TRUTH_INDEX_ID);
19110
19396
  objectEnvelopeSchema = asSchema(object_envelope_schema_default, OBJECT_ENVELOPE_ID);
19111
19397
  gateResultSchema = asSchema(gate_result_schema_default, GATE_RESULT_ID);
@@ -19127,6 +19413,7 @@ var init_src = __esm({
19127
19413
  softwareGraphRelationsSchema = asSchema(software_graph_relations_schema_default, SOFTWARE_GRAPH_RELATIONS_ID);
19128
19414
  sourcesAuthoritySchema = asSchema(sources_authority_schema_default, SOURCES_AUTHORITY_ID);
19129
19415
  evidenceSpecSchema = asSchema(evidence_spec_schema_default, EVIDENCE_SPEC_ID);
19416
+ designTokensSchema = asSchema(design_tokens_schema_default, DESIGN_TOKENS_ID);
19130
19417
  allSchemas = {
19131
19418
  truthIndex: truthIndexSchema,
19132
19419
  objectEnvelope: objectEnvelopeSchema,
@@ -19148,7 +19435,8 @@ var init_src = __esm({
19148
19435
  decisionGraph: decisionGraphSchema,
19149
19436
  softwareGraphRelations: softwareGraphRelationsSchema,
19150
19437
  sourcesAuthority: sourcesAuthoritySchema,
19151
- evidenceSpec: evidenceSpecSchema
19438
+ evidenceSpec: evidenceSpecSchema,
19439
+ designTokens: designTokensSchema
19152
19440
  };
19153
19441
  performanceBudgetDefinition = definitionOf(objectEnvelopeSchema, "PerformanceBudget");
19154
19442
  PERFORMANCE_BUDGET_FIELDS = performanceBudgetPropertyNames();
@@ -24576,7 +24864,7 @@ function assertAuthorityBoundaries(paths, raw, tx) {
24576
24864
  }
24577
24865
  }
24578
24866
  if (denies.length > 0) {
24579
- throw new GovernanceError("AUTHORITY_BOUNDARY_DENY", `\u6743\u5A01\u7EF4\u5EA6\u95F8\u963B\u65AD\uFF08D-4\uFF09\uFF1A\u672C\u4E8B\u52A1\u5B58\u5728\u975E\u6743\u5A01\u6765\u6E90\u9A71\u52A8\u7684\u89E6\u53CA\u7EF4\u5EA6\u2014\u2014${denies.length} \u9879\u8D8A\u754C\uFF1A${denies.join("\uFF1B")}`, "\u6539\u7531\u5BF9\u8BE5\u7EF4\u5EA6 authoritative \u7684\u6765\u6E90\u9A71\u52A8\u672C\u53D8\u66F4\uFF08sources/index.yaml \u53CC\u8F74\u7533\u62A5\uFF09\uFF1B\u6216\u7531 Owner \u4FEE\u8BA2 authority.json map/boundary_rules \u7684\u7EF4\u5EA6\u5F52\u5C5E\uFF08\u63A8\u7FFB\u8FB9\u754C=Owner \u88C1\u5B9A\uFF0C\u7559\u75D5 owner-adjudications \u53F0\u8D26\uFF09\u3002\u672C\u4E8B\u52A1\u96F6\u843D\u76D8\u3002", {
24867
+ throw new GovernanceError("AUTHORITY_BOUNDARY_DENY", `\u6743\u5A01\u7EF4\u5EA6\u95F8\u963B\u65AD\uFF08D-4\uFF09\uFF1A\u672C\u4E8B\u52A1\u5B58\u5728\u975E\u6743\u5A01\u6765\u6E90\u9A71\u52A8\u7684\u89E6\u53CA\u7EF4\u5EA6\u2014\u2014${denies.length} \u9879\u8D8A\u754C\uFF1A${denies.join("\uFF1B")}`, "\u6539\u7531\u5BF9\u8BE5\u7EF4\u5EA6 authoritative \u7684\u6765\u6E90\u9A71\u52A8\u672C\u53D8\u66F4\uFF08sources/index.yaml \u53CC\u8F74\u7533\u62A5\uFF09\uFF1B\u6216\u7531 Owner \u4FEE\u8BA2 authority.json map/boundary_rules \u7684\u7EF4\u5EA6\u5F52\u5C5E\uFF08\u63A8\u7FFB\u8FB9\u754C=Owner \u88C1\u5B9A\uFF1B\u7559\u75D5\u4F4D\u7F6E\u7531 Owner \u58F0\u660E\u2014\u2014\u4EA7\u54C1\u4ED3 corpus/master/cutover/owner-adjudications.md \u53F0\u8D26\uFF08\u96F6\u7A0B\u5E8F\u8BFB\u5199\uFF09\u6216\u6D88\u8D39\u9879\u76EE\u5185 Owner \u81EA\u9009\u7559\u75D5\u5904\uFF09\u3002\u672C\u4E8B\u52A1\u96F6\u843D\u76D8\u3002", {
24580
24868
  denies,
24581
24869
  boundary_rules_deny: faces.boundary_rules.filter((rule) => rule.effect === "deny").length,
24582
24870
  sources_registry_present: registry !== null
@@ -32534,17 +32822,17 @@ async function doctorProbes(store) {
32534
32822
  return { probes, ok };
32535
32823
  }
32536
32824
  function defaultRunner(command, args) {
32537
- return new Promise((resolve3) => {
32825
+ return new Promise((resolve4) => {
32538
32826
  try {
32539
32827
  const child = spawn(command, [...args], { shell: false, timeout: 1e4 });
32540
32828
  let stdout = "";
32541
32829
  child.stdout?.on("data", (chunk) => {
32542
32830
  stdout += chunk.toString("utf8");
32543
32831
  });
32544
- child.on("error", () => resolve3({ code: -1, stdout: "" }));
32545
- child.on("close", (code) => resolve3({ code: code ?? -1, stdout }));
32832
+ child.on("error", () => resolve4({ code: -1, stdout: "" }));
32833
+ child.on("close", (code) => resolve4({ code: code ?? -1, stdout }));
32546
32834
  } catch {
32547
- resolve3({ code: -1, stdout: "" });
32835
+ resolve4({ code: -1, stdout: "" });
32548
32836
  }
32549
32837
  });
32550
32838
  }
@@ -37116,7 +37404,7 @@ var init_adapter_types = __esm({
37116
37404
  });
37117
37405
 
37118
37406
  // packages/gauntlet-lite/dist/detectors.js
37119
- import { statSync as statSync4, readFileSync as readFileSync12 } from "node:fs";
37407
+ import { statSync as statSync4, readFileSync as readFileSync13 } from "node:fs";
37120
37408
  import { join as pathJoin } from "node:path";
37121
37409
  function platformDetectorFacts(projectRoot) {
37122
37410
  const isWindows = process.platform === "win32";
@@ -37135,7 +37423,7 @@ function platformDetectorFacts(projectRoot) {
37135
37423
  },
37136
37424
  readTextFile: (absolutePath) => {
37137
37425
  try {
37138
- return readFileSync12(absolutePath, "utf8");
37426
+ return readFileSync13(absolutePath, "utf8");
37139
37427
  } catch {
37140
37428
  return null;
37141
37429
  }
@@ -37786,7 +38074,7 @@ var init_normalize_common = __esm({
37786
38074
 
37787
38075
  // packages/gauntlet-lite/dist/pytest-leg.js
37788
38076
  import { spawnSync as spawnSync2 } from "node:child_process";
37789
- import { mkdtempSync, readFileSync as readFileSync13, rmSync as rmSync4 } from "node:fs";
38077
+ import { mkdtempSync, readFileSync as readFileSync14, rmSync as rmSync5 } from "node:fs";
37790
38078
  import { tmpdir } from "node:os";
37791
38079
  import { join as join9 } from "node:path";
37792
38080
  import { performance as performance2 } from "node:perf_hooks";
@@ -37824,11 +38112,11 @@ function runPytestLeg(plan, spawnFn = pytestSpawn) {
37824
38112
  let stdout = run.stdout;
37825
38113
  if (reportDir !== null) {
37826
38114
  try {
37827
- stdout = readFileSync13(join9(reportDir, "junit.xml"), "utf8");
38115
+ stdout = readFileSync14(join9(reportDir, "junit.xml"), "utf8");
37828
38116
  } catch {
37829
38117
  }
37830
38118
  try {
37831
- rmSync4(reportDir, { recursive: true, force: true });
38119
+ rmSync5(reportDir, { recursive: true, force: true });
37832
38120
  } catch {
37833
38121
  }
37834
38122
  }
@@ -38894,7 +39182,7 @@ var init_browser_adapter = __esm({
38894
39182
 
38895
39183
  // packages/gauntlet-lite/dist/playwright-leg.js
38896
39184
  import { spawnSync as spawnSync5 } from "node:child_process";
38897
- import { existsSync as existsSync12, readFileSync as readFileSync14, rmSync as rmSync5 } from "node:fs";
39185
+ import { existsSync as existsSync13, readFileSync as readFileSync15, rmSync as rmSync6 } from "node:fs";
38898
39186
  import { isAbsolute as pathIsAbsolute, join as pathJoin2, relative as pathRelative, resolve as pathResolve } from "node:path";
38899
39187
  import { performance as performance5 } from "node:perf_hooks";
38900
39188
  function isPlainObject2(value) {
@@ -39035,10 +39323,10 @@ function runPlaywrightLeg(plan, spawnFn = playwrightSpawn, executableProbe = pla
39035
39323
  };
39036
39324
  }
39037
39325
  try {
39038
- rmSync5(reportAbs, { force: true });
39326
+ rmSync6(reportAbs, { force: true });
39039
39327
  } catch {
39040
39328
  }
39041
- if (existsSync12(reportAbs)) {
39329
+ if (existsSync13(reportAbs)) {
39042
39330
  return {
39043
39331
  plan,
39044
39332
  kind: "pre_run_failed",
@@ -39057,7 +39345,7 @@ function runPlaywrightLeg(plan, spawnFn = playwrightSpawn, executableProbe = pla
39057
39345
  });
39058
39346
  let reportText = null;
39059
39347
  try {
39060
- reportText = readFileSync14(reportAbs, "utf8");
39348
+ reportText = readFileSync15(reportAbs, "utf8");
39061
39349
  } catch {
39062
39350
  reportText = null;
39063
39351
  }
@@ -40049,7 +40337,7 @@ var init_oasdiff_leg = __esm({
40049
40337
 
40050
40338
  // packages/gauntlet-lite/dist/schemathesis-leg.js
40051
40339
  import { spawnSync as spawnSync7 } from "node:child_process";
40052
- import { existsSync as existsSync13, readFileSync as readFileSync15, rmSync as rmSync6 } from "node:fs";
40340
+ import { existsSync as existsSync14, readFileSync as readFileSync16, rmSync as rmSync7 } from "node:fs";
40053
40341
  import { isAbsolute as pathIsAbsolute2, join as pathJoin3, relative as pathRelative2, resolve as pathResolve2 } from "node:path";
40054
40342
  import { performance as performance8 } from "node:perf_hooks";
40055
40343
  function pathEscapesProjectRoot2(projectRoot, absolutePath) {
@@ -40114,10 +40402,10 @@ function runSchemathesisLeg(plan, spawnFn = schemathesisSpawn, executableProbe =
40114
40402
  };
40115
40403
  }
40116
40404
  try {
40117
- rmSync6(reportAbs, { force: true });
40405
+ rmSync7(reportAbs, { force: true });
40118
40406
  } catch {
40119
40407
  }
40120
- if (existsSync13(reportAbs)) {
40408
+ if (existsSync14(reportAbs)) {
40121
40409
  return {
40122
40410
  plan,
40123
40411
  kind: "pre_run_failed",
@@ -40136,7 +40424,7 @@ function runSchemathesisLeg(plan, spawnFn = schemathesisSpawn, executableProbe =
40136
40424
  });
40137
40425
  let reportText = null;
40138
40426
  try {
40139
- reportText = readFileSync15(reportAbs, "utf8");
40427
+ reportText = readFileSync16(reportAbs, "utf8");
40140
40428
  } catch {
40141
40429
  reportText = null;
40142
40430
  }
@@ -40443,7 +40731,7 @@ var init_schemathesis_leg = __esm({
40443
40731
  });
40444
40732
 
40445
40733
  // packages/gauntlet-lite/dist/contract-adapter.js
40446
- import { readFileSync as readFileSync16 } from "node:fs";
40734
+ import { readFileSync as readFileSync17 } from "node:fs";
40447
40735
  import { join as pathJoin4 } from "node:path";
40448
40736
  import { performance as performance9 } from "node:perf_hooks";
40449
40737
  function readContractConfig(facts) {
@@ -40817,7 +41105,7 @@ function createContractAdapter(options = {}) {
40817
41105
  }
40818
41106
  let text;
40819
41107
  try {
40820
- text = readFileSync16(pathJoin4(plan.projectRoot, plan.openapiPath ?? ""), "utf8");
41108
+ text = readFileSync17(pathJoin4(plan.projectRoot, plan.openapiPath ?? ""), "utf8");
40821
41109
  } catch {
40822
41110
  return {
40823
41111
  plan,
@@ -41350,7 +41638,7 @@ var init_import_linter_leg = __esm({
41350
41638
  });
41351
41639
 
41352
41640
  // packages/gauntlet-lite/dist/architecture-adapter.js
41353
- import { readdirSync as readdirSync18, readFileSync as readFileSync17 } from "node:fs";
41641
+ import { readdirSync as readdirSync18, readFileSync as readFileSync18 } from "node:fs";
41354
41642
  import { join as pathJoin5, sep as pathSep } from "node:path";
41355
41643
  import { performance as performance12 } from "node:perf_hooks";
41356
41644
  function readArchitectureConfig(facts) {
@@ -41742,7 +42030,7 @@ function createArchitectureAdapter(options = {}) {
41742
42030
  filesCovered++;
41743
42031
  let text;
41744
42032
  try {
41745
- text = readFileSync17(pathJoin5(plan.projectRoot, relative3), "utf8");
42033
+ text = readFileSync18(pathJoin5(plan.projectRoot, relative3), "utf8");
41746
42034
  } catch {
41747
42035
  continue;
41748
42036
  }
@@ -41885,7 +42173,7 @@ var init_architecture_adapter = __esm({
41885
42173
 
41886
42174
  // packages/gauntlet-lite/dist/coverage-leg.js
41887
42175
  import { spawnSync as spawnSync10 } from "node:child_process";
41888
- import { existsSync as existsSync14, readFileSync as readFileSync18, rmSync as rmSync7 } from "node:fs";
42176
+ import { existsSync as existsSync15, readFileSync as readFileSync19, rmSync as rmSync8 } from "node:fs";
41889
42177
  import { join as pathJoin6, dirname as pathDirname, isAbsolute as pathIsAbsolute3, relative as pathRelative3, resolve as pathResolve3 } from "node:path";
41890
42178
  import { performance as performance13 } from "node:perf_hooks";
41891
42179
  function resolveCoverageProvisionalThresholdsForTier(tier) {
@@ -41946,10 +42234,10 @@ function runCoverageLeg(plan, spawnFn = coverageSpawn, executableProbe = platfor
41946
42234
  };
41947
42235
  }
41948
42236
  try {
41949
- rmSync7(reportAbs, { force: true });
42237
+ rmSync8(reportAbs, { force: true });
41950
42238
  } catch {
41951
42239
  }
41952
- if (existsSync14(reportAbs)) {
42240
+ if (existsSync15(reportAbs)) {
41953
42241
  return {
41954
42242
  plan,
41955
42243
  kind: "pre_run_failed",
@@ -41969,7 +42257,7 @@ function runCoverageLeg(plan, spawnFn = coverageSpawn, executableProbe = platfor
41969
42257
  });
41970
42258
  let reportText = null;
41971
42259
  try {
41972
- reportText = readFileSync18(reportAbs, "utf8");
42260
+ reportText = readFileSync19(reportAbs, "utf8");
41973
42261
  } catch {
41974
42262
  reportText = null;
41975
42263
  }
@@ -42534,7 +42822,7 @@ var init_crap = __esm({
42534
42822
  });
42535
42823
 
42536
42824
  // packages/gauntlet-lite/dist/coverage-adapter.js
42537
- import { readFileSync as readFileSync19 } from "node:fs";
42825
+ import { readFileSync as readFileSync20 } from "node:fs";
42538
42826
  import { join as pathJoin7 } from "node:path";
42539
42827
  import { performance as performance14 } from "node:perf_hooks";
42540
42828
  function isPlainObject3(value) {
@@ -43007,7 +43295,7 @@ function createCrapGateAdapter() {
43007
43295
  }
43008
43296
  const readOrNull = (relative3) => {
43009
43297
  try {
43010
- return readFileSync19(pathJoin7(plan.projectRoot, relative3), "utf8");
43298
+ return readFileSync20(pathJoin7(plan.projectRoot, relative3), "utf8");
43011
43299
  } catch {
43012
43300
  return null;
43013
43301
  }
@@ -43052,7 +43340,7 @@ var init_coverage_adapter = __esm({
43052
43340
 
43053
43341
  // packages/gauntlet-lite/dist/mutation-leg.js
43054
43342
  import { spawnSync as spawnSync11 } from "node:child_process";
43055
- import { existsSync as existsSync15, readFileSync as readFileSync20, rmSync as rmSync8 } from "node:fs";
43343
+ import { existsSync as existsSync16, readFileSync as readFileSync21, rmSync as rmSync9 } from "node:fs";
43056
43344
  import { join as pathJoin8, isAbsolute as pathIsAbsolute4, relative as pathRelative4, resolve as pathResolve4 } from "node:path";
43057
43345
  import { performance as performance15 } from "node:perf_hooks";
43058
43346
  function runMutationLeg(plan, spawnFn = mutationSpawn, executableProbe = platformExecutableProbe) {
@@ -43104,10 +43392,10 @@ function runMutationLeg(plan, spawnFn = mutationSpawn, executableProbe = platfor
43104
43392
  };
43105
43393
  }
43106
43394
  try {
43107
- rmSync8(reportAbs, { force: true });
43395
+ rmSync9(reportAbs, { force: true });
43108
43396
  } catch {
43109
43397
  }
43110
- if (existsSync15(reportAbs)) {
43398
+ if (existsSync16(reportAbs)) {
43111
43399
  return {
43112
43400
  plan,
43113
43401
  kind: "pre_run_failed",
@@ -43126,7 +43414,7 @@ function runMutationLeg(plan, spawnFn = mutationSpawn, executableProbe = platfor
43126
43414
  });
43127
43415
  let reportText = null;
43128
43416
  try {
43129
- reportText = readFileSync20(reportAbs, "utf8");
43417
+ reportText = readFileSync21(reportAbs, "utf8");
43130
43418
  } catch {
43131
43419
  reportText = null;
43132
43420
  }
@@ -43881,7 +44169,7 @@ var init_mutation_adapter = __esm({
43881
44169
 
43882
44170
  // packages/gauntlet-lite/dist/performance-leg.js
43883
44171
  import { spawnSync as spawnSync12 } from "node:child_process";
43884
- import { existsSync as existsSync16, readFileSync as readFileSync21, rmSync as rmSync9 } from "node:fs";
44172
+ import { existsSync as existsSync17, readFileSync as readFileSync22, rmSync as rmSync10 } from "node:fs";
43885
44173
  import { isAbsolute as pathIsAbsolute5, join as pathJoin9, relative as pathRelative5, resolve as pathResolve5 } from "node:path";
43886
44174
  import { performance as performance17 } from "node:perf_hooks";
43887
44175
  function performanceCapabilityNote(runner) {
@@ -44114,10 +44402,10 @@ function runPerformanceLeg(plan, spawnFn = performanceSpawn, executableProbe = p
44114
44402
  };
44115
44403
  }
44116
44404
  try {
44117
- rmSync9(reportAbs, { force: true });
44405
+ rmSync10(reportAbs, { force: true });
44118
44406
  } catch {
44119
44407
  }
44120
- if (existsSync16(reportAbs)) {
44408
+ if (existsSync17(reportAbs)) {
44121
44409
  return {
44122
44410
  plan,
44123
44411
  kind: "pre_run_failed",
@@ -44136,7 +44424,7 @@ function runPerformanceLeg(plan, spawnFn = performanceSpawn, executableProbe = p
44136
44424
  });
44137
44425
  let reportText = null;
44138
44426
  try {
44139
- reportText = readFileSync21(reportAbs, "utf8");
44427
+ reportText = readFileSync22(reportAbs, "utf8");
44140
44428
  } catch {
44141
44429
  reportText = null;
44142
44430
  }
@@ -44945,7 +45233,7 @@ var init_performance_adapter = __esm({
44945
45233
 
44946
45234
  // packages/gauntlet-lite/dist/security-leg.js
44947
45235
  import { spawnSync as spawnSync13 } from "node:child_process";
44948
- import { existsSync as existsSync17, readFileSync as readFileSync22, rmSync as rmSync10 } from "node:fs";
45236
+ import { existsSync as existsSync18, readFileSync as readFileSync23, rmSync as rmSync11 } from "node:fs";
44949
45237
  import { isAbsolute as pathIsAbsolute6, join as pathJoin10, relative as pathRelative6, resolve as pathResolve6 } from "node:path";
44950
45238
  import { performance as performance19 } from "node:perf_hooks";
44951
45239
  function securityCapabilityNote(runner) {
@@ -45000,10 +45288,10 @@ function runSecurityLeg(plan, spawnFn = securitySpawn, executableProbe = platfor
45000
45288
  };
45001
45289
  }
45002
45290
  try {
45003
- rmSync10(reportAbs, { force: true });
45291
+ rmSync11(reportAbs, { force: true });
45004
45292
  } catch {
45005
45293
  }
45006
- if (existsSync17(reportAbs)) {
45294
+ if (existsSync18(reportAbs)) {
45007
45295
  return {
45008
45296
  plan,
45009
45297
  kind: "pre_run_failed",
@@ -45022,7 +45310,7 @@ function runSecurityLeg(plan, spawnFn = securitySpawn, executableProbe = platfor
45022
45310
  });
45023
45311
  let reportText = null;
45024
45312
  try {
45025
- reportText = readFileSync22(reportAbs, "utf8");
45313
+ reportText = readFileSync23(reportAbs, "utf8");
45026
45314
  } catch {
45027
45315
  reportText = null;
45028
45316
  }
@@ -46954,7 +47242,7 @@ function readCliPackageVersion() {
46954
47242
  }
46955
47243
  function resolveCliVersion() {
46956
47244
  if (true) {
46957
- return "0.5.3";
47245
+ return "0.6.1";
46958
47246
  }
46959
47247
  return readCliPackageVersion();
46960
47248
  }
@@ -48650,10 +48938,10 @@ async function runContextCompile(rootDir, role, deps, inputs, options) {
48650
48938
  applicability: applicabilityViewOf(inputs),
48651
48939
  verificationRefs
48652
48940
  });
48653
- const { mkdirSync: mkdirSync4, writeFileSync: writeFileSync6 } = await import("node:fs");
48941
+ const { mkdirSync: mkdirSync4, writeFileSync: writeFileSync7 } = await import("node:fs");
48654
48942
  try {
48655
48943
  mkdirSync4(contextsDirPath(rootDir), { recursive: true });
48656
- writeFileSync6(`${contextsDirPath(rootDir)}/${fileName}`, `${JSON.stringify(document, null, 2)}
48944
+ writeFileSync7(`${contextsDirPath(rootDir)}/${fileName}`, `${JSON.stringify(document, null, 2)}
48657
48945
  `, "utf8");
48658
48946
  manifestPath = relativePath;
48659
48947
  persisted = true;
@@ -48939,7 +49227,7 @@ var COMMAND_PANORAMA_LINES = [
48939
49227
  "pomaster doctor",
48940
49228
  "pomaster portability bootstrap/check",
48941
49229
  "pomaster update --check/--yes",
48942
- "pomaster baseline set/confirm # set = \u5355\u952E\u540E\u8865\u9500\u8D26\uFF1Bconfirm = \u57FA\u7EBF\u786E\u8BA4 gate\uFF0814 unknowns \u9500\u8D26\u540E digest \u5FEB\u7167\u2014\u2014closeout \u963B\u65AD\u7801\u4E0E doctor/status \u786E\u8BA4\u6001\u7684\u6D88\u8D39\u6E90\uFF09",
49230
+ "pomaster baseline set/confirm # set = \u5355\u952E\u540E\u8865\u9500\u8D26\uFF1Bconfirm = \u57FA\u7EBF\u786E\u8BA4 gate\uFF08\u963B\u585E\u96C6\u6E05\u96F6\u540E digest \u5FEB\u7167\u2014\u2014closeout \u963B\u65AD\u7801\u4E0E doctor/status \u786E\u8BA4\u6001\u7684\u6D88\u8D39\u6E90\uFF09",
48943
49231
  "",
48944
49232
  "# \u2460 DISCOVERY \u2014\u2014 \u9700\u6C42\u62F7\u95EE/\u95EE\u9898\u95F8/\u51B3\u8BAE\u56FE\uFF08Brainstorm/Question Gate\uFF1BD-5\uFF0C\u88C1\u51B3 18\uFF09",
48945
49233
  "pomaster brainstorm start/question-gate/status/decide/promote",
@@ -48987,7 +49275,7 @@ var COMMAND_PANORAMA_LINES = [
48987
49275
  "pomaster handoff <task> --to <role>",
48988
49276
  "pomaster session attach/refresh/list",
48989
49277
  "pomaster lock acquire/heartbeat/release/steal/list",
48990
- "pomaster execution begin/end/list",
49278
+ "pomaster execution begin/end/list/audit",
48991
49279
  "pomaster trace show/list"
48992
49280
  ];
48993
49281
  var CAPABILITY_OVERVIEW = [
@@ -49447,7 +49735,7 @@ var SKILL_MANIFEST = [
49447
49735
  "pomaster agents status",
49448
49736
  "pomaster session attach/refresh/list",
49449
49737
  "pomaster lock acquire/heartbeat/release/steal/list",
49450
- "pomaster execution begin/end/list",
49738
+ "pomaster execution begin/end/list/audit",
49451
49739
  "pomaster trace show/list",
49452
49740
  "pomaster run <task>",
49453
49741
  "pomaster handoff <task> --to <role>"
@@ -49554,10 +49842,10 @@ var FACET_DIR = {
49554
49842
  };
49555
49843
  async function countSeededAssets(rootDir) {
49556
49844
  const { readdir: readdir3 } = await import("node:fs/promises");
49557
- const { join: join16 } = await import("node:path");
49845
+ const { join: join18 } = await import("node:path");
49558
49846
  const pomasterDir = toPosix(buildStorePaths(rootDir).pomasterDir);
49559
49847
  async function countFiles(relative3) {
49560
- const absolute = join16(pomasterDir, ...relative3.split("/"));
49848
+ const absolute = join18(pomasterDir, ...relative3.split("/"));
49561
49849
  let entries;
49562
49850
  try {
49563
49851
  entries = await readdir3(absolute, { withFileTypes: true });
@@ -49587,11 +49875,11 @@ function seededAssetsHumanLine(counts) {
49587
49875
  }
49588
49876
  async function countLegacySpecFiles(rootDir) {
49589
49877
  const { readdir: readdir3 } = await import("node:fs/promises");
49590
- const { join: join16 } = await import("node:path");
49878
+ const { join: join18 } = await import("node:path");
49591
49879
  const pomasterDir = toPosix(buildStorePaths(rootDir).pomasterDir);
49592
49880
  const legacyDirs = ["specs/hard/frontend", "specs/hard/backend"];
49593
49881
  async function countFiles(relative3) {
49594
- const absolute = join16(pomasterDir, ...relative3.split("/"));
49882
+ const absolute = join18(pomasterDir, ...relative3.split("/"));
49595
49883
  let entries;
49596
49884
  try {
49597
49885
  entries = await readdir3(absolute, { withFileTypes: true });
@@ -49945,6 +50233,156 @@ function specPreplantHumanLine(presentation) {
49945
50233
  init_dist();
49946
50234
  import { writeFile } from "node:fs/promises";
49947
50235
 
50236
+ // packages/cli/dist/fs-cas.js
50237
+ import { existsSync as existsSync10, linkSync as linkSync2, readFileSync as readFileSync10, renameSync as renameSync3, rmSync as rmSync4, writeFileSync as writeFileSync4 } from "node:fs";
50238
+ var nodeCasSwapFs = {
50239
+ writeFileSync: writeFileSync4,
50240
+ renameSync: renameSync3,
50241
+ readFileSync: readFileSync10,
50242
+ linkSync: linkSync2,
50243
+ existsSync: existsSync10,
50244
+ rmSync: rmSync4
50245
+ };
50246
+ var CLAIM_RETRY_DELAYS_MS = [20, 50, 100];
50247
+ function sleepSync2(ms) {
50248
+ if (ms <= 0)
50249
+ return;
50250
+ const buffer = new Int32Array(new SharedArrayBuffer(4));
50251
+ try {
50252
+ Atomics.wait(buffer, 0, 0, ms);
50253
+ } catch {
50254
+ const end = performance.now() + ms;
50255
+ while (performance.now() < end) {
50256
+ }
50257
+ }
50258
+ }
50259
+ function errnoOf(error) {
50260
+ if (typeof error !== "object" || error === null || !("code" in error))
50261
+ return null;
50262
+ const code = error.code;
50263
+ return typeof code === "string" ? code : null;
50264
+ }
50265
+ function isNotFoundError2(error) {
50266
+ return errnoOf(error) === "ENOENT";
50267
+ }
50268
+ function isTransientClaimError(error) {
50269
+ const code = errnoOf(error);
50270
+ return code === "EPERM" || code === "EACCES";
50271
+ }
50272
+ function classifyContentionOrFault(error, stepCause) {
50273
+ const code = errnoOf(error);
50274
+ if (code === "ENOENT" || code === "EPERM" || code === "EACCES") {
50275
+ return { kind: "contended", cause: `${stepCause}\uFF08${code}\uFF09\u2014\u2014\u5E76\u53D1\u4EA4\u9519/\u77AC\u65F6\u9501\uFF0C\u6574\u94FE\u91CD\u8BFB\u91CD\u7B97` };
50276
+ }
50277
+ return { kind: "fault", code: code ?? "UNKNOWN", cause: `${stepCause}\u2014\u2014\u6301\u7EED\u73AF\u5883\u6545\u969C\uFF08\u91CD\u8BD5\u65E0\u76CA\uFF09` };
50278
+ }
50279
+ function renameWithLiarDefense(fs, op, dst) {
50280
+ withBoundedRetry2(fs, () => {
50281
+ try {
50282
+ op();
50283
+ } catch (error) {
50284
+ if (isNotFoundError2(error) && fs.existsSync(dst))
50285
+ return;
50286
+ throw error;
50287
+ }
50288
+ });
50289
+ }
50290
+ function removeBestEffort2(fs, path) {
50291
+ try {
50292
+ fs.rmSync(path, { force: true });
50293
+ } catch {
50294
+ }
50295
+ }
50296
+ var casSequence = 0;
50297
+ function uniqueAdjacentPath2(target, tag) {
50298
+ casSequence += 1;
50299
+ return `${target}.${tag}-${process.pid}-${casSequence}`;
50300
+ }
50301
+ function withBoundedRetry2(fs, op) {
50302
+ for (let attempt = 0; ; attempt += 1) {
50303
+ try {
50304
+ op();
50305
+ return;
50306
+ } catch (error) {
50307
+ if (attempt >= CLAIM_RETRY_DELAYS_MS.length || !isTransientClaimError(error))
50308
+ throw error;
50309
+ sleepSync2(CLAIM_RETRY_DELAYS_MS[attempt]);
50310
+ }
50311
+ }
50312
+ }
50313
+ function casSwapFile(target, expected, next, fs = nodeCasSwapFs) {
50314
+ const tmp = uniqueAdjacentPath2(target, "r1tmp");
50315
+ try {
50316
+ fs.writeFileSync(tmp, next, "utf8");
50317
+ } catch (error) {
50318
+ removeBestEffort2(fs, tmp);
50319
+ return classifyContentionOrFault(error, "tmp \u843D\u76D8\u5931\u8D25\uFF08\u8BA4\u9886\u524D\u843D\u76D8\u4F4D\uFF09");
50320
+ }
50321
+ const claim = uniqueAdjacentPath2(target, "r1claim");
50322
+ try {
50323
+ renameWithLiarDefense(fs, () => fs.renameSync(target, claim), claim);
50324
+ } catch (error) {
50325
+ removeBestEffort2(fs, tmp);
50326
+ if (isNotFoundError2(error))
50327
+ return { kind: "absent" };
50328
+ if (isTransientClaimError(error)) {
50329
+ return {
50330
+ kind: "contended",
50331
+ cause: `\u8BA4\u9886 rename \u77AC\u65F6\u9501\u6709\u754C\u91CD\u8BD5\u8017\u5C3D\uFF08${errnoOf(error) ?? "UNKNOWN"}\uFF09\u2014\u2014\u76EE\u6807\u6301\u7EED\u88AB\u5E76\u53D1\u65B9\u9501\u4F4F`
50332
+ };
50333
+ }
50334
+ return {
50335
+ kind: "fault",
50336
+ code: errnoOf(error) ?? "UNKNOWN",
50337
+ cause: "\u8BA4\u9886 rename \u6301\u7EED\u73AF\u5883\u6545\u969C\uFF08\u91CD\u8BD5\u65E0\u76CA\uFF09"
50338
+ };
50339
+ }
50340
+ let claimedBytes = null;
50341
+ try {
50342
+ claimedBytes = fs.readFileSync(claim, "utf8");
50343
+ } catch {
50344
+ claimedBytes = null;
50345
+ }
50346
+ if (claimedBytes !== expected) {
50347
+ try {
50348
+ renameWithLiarDefense(fs, () => fs.renameSync(claim, target), target);
50349
+ } catch (error) {
50350
+ removeBestEffort2(fs, tmp);
50351
+ if (isNotFoundError2(error)) {
50352
+ return {
50353
+ kind: "contended",
50354
+ cause: "\u56DE\u88C5\u6B65\u8BA4\u9886\u6587\u4EF6\u88AB\u5E76\u53D1\u65B9\u4EA4\u9519\u53D6\u8D70\uFF08claim \u4F4D ENOENT \u4E14 target \u7F3A\u5E2D\uFF09\u2014\u2014\u4E16\u4EE3\u968F\u5BF9\u624B\u8BA4\u9886\u6536\u655B\uFF0C\u6574\u94FE\u91CD\u8BFB"
50355
+ };
50356
+ }
50357
+ if (isTransientClaimError(error)) {
50358
+ return {
50359
+ kind: "contended",
50360
+ cause: `\u56DE\u88C5\u5F52\u8FD8\u539F\u4F4D rename \u77AC\u65F6\u9501\u6709\u754C\u91CD\u8BD5\u8017\u5C3D\uFF08${errnoOf(error) ?? "UNKNOWN"}\uFF09\u2014\u2014claim \u539F\u6837\u7559\u76D8`
50361
+ };
50362
+ }
50363
+ return {
50364
+ kind: "fault",
50365
+ code: errnoOf(error) ?? "UNKNOWN",
50366
+ cause: "\u56DE\u88C5\u5F52\u8FD8\u539F\u4F4D rename \u6301\u7EED\u73AF\u5883\u6545\u969C\u2014\u2014claim \u539F\u6837\u7559\u76D8\uFF08\u8BA4\u9886\u5185\u5BB9\u672A\u53D7\u635F\uFF09"
50367
+ };
50368
+ }
50369
+ removeBestEffort2(fs, tmp);
50370
+ return { kind: "conflict" };
50371
+ }
50372
+ try {
50373
+ fs.linkSync(tmp, target);
50374
+ } catch (error) {
50375
+ removeBestEffort2(fs, tmp);
50376
+ if (errnoOf(error) === "EEXIST") {
50377
+ return { kind: "conflict" };
50378
+ }
50379
+ return classifyContentionOrFault(error, "link \u56DE\u88C5\u5931\u8D25\uFF08\u5B89\u88C5\u4F4D\uFF09\u2014\u2014claim \u539F\u6837\u7559\u76D8\uFF08\u8BA4\u9886\u5185\u5BB9\u672A\u53D7\u635F\uFF09");
50380
+ }
50381
+ removeBestEffort2(fs, tmp);
50382
+ removeBestEffort2(fs, claim);
50383
+ return { kind: "swapped" };
50384
+ }
50385
+
49948
50386
  // packages/cli/dist/interactive-keys.js
49949
50387
  var CHECKLIST_KEYS = {
49950
50388
  /** ↑ */
@@ -50051,9 +50489,9 @@ function deniedReasonToCode(reason) {
50051
50489
  }
50052
50490
  }
50053
50491
  function parseActorArgv(raw) {
50054
- const sep2 = raw.indexOf(":");
50055
- const type2 = sep2 === -1 ? "" : raw.slice(0, sep2);
50056
- const name = sep2 === -1 ? "" : raw.slice(sep2 + 1);
50492
+ const sep3 = raw.indexOf(":");
50493
+ const type2 = sep3 === -1 ? "" : raw.slice(0, sep3);
50494
+ const name = sep3 === -1 ? "" : raw.slice(sep3 + 1);
50057
50495
  if (!ACTOR_TYPE_VALUES.includes(type2) || name.length === 0) {
50058
50496
  return {
50059
50497
  error: {
@@ -50735,54 +51173,28 @@ async function observePackageStack(rootDir) {
50735
51173
  }
50736
51174
  return { source: "package.json", values };
50737
51175
  }
50738
- async function applyStackObservations(rootDir, observation, files) {
50739
- let observed = 0;
50740
- let skippedResolved = 0;
51176
+ async function registerStackObservationCandidates(rootDir, observation) {
50741
51177
  const lane = "frontend";
50742
51178
  const laneKeys = STACK_KEYS[lane];
50743
- const stackRelative = baselineStackRelative(lane);
50744
- const stackFile = await readTextFile(`${rootDir}/${stackRelative}`);
51179
+ const stackFile = await readTextFile(`${rootDir}/${baselineStackRelative(lane)}`);
50745
51180
  if (stackFile.kind !== "ok")
50746
- return { observed, skipped_resolved: skippedResolved };
51181
+ return { observed: 0, skipped_resolved: 0, candidates: [] };
50747
51182
  const parse = parseStackYaml(stackFile.text, laneKeys);
50748
51183
  if (!parse.ok)
50749
- return { observed, skipped_resolved: skippedResolved };
50750
- const lines = stackFile.text.split("\n");
50751
- const wordForms = /* @__PURE__ */ new Set();
50752
- let stackChanged = false;
51184
+ return { observed: 0, skipped_resolved: 0, candidates: [] };
51185
+ const candidates = [];
51186
+ let skippedResolved = 0;
50753
51187
  for (const key of laneKeys) {
50754
51188
  const value = observation.values.get(key);
50755
51189
  if (value === void 0)
50756
51190
  continue;
50757
- const current = parse.parsed.values.get(key) ?? "";
50758
- if (isResolved(current)) {
51191
+ if (isResolved(parse.parsed.values.get(key) ?? "")) {
50759
51192
  skippedResolved += 1;
50760
51193
  continue;
50761
51194
  }
50762
- const lineIndex = parse.parsed.lineOf.get(key);
50763
- if (lineIndex === void 0)
50764
- continue;
50765
- lines[lineIndex] = `${key}: ${value} # ${OBSERVED_ANNOTATION}`;
50766
- wordForms.add(unknownsWordForm(lane, key));
50767
- observed += 1;
50768
- stackChanged = true;
50769
- }
50770
- if (stackChanged) {
50771
- const nextStack = lines.join("\n");
50772
- if (nextStack !== stackFile.text) {
50773
- await writeFile(`${rootDir}/${stackRelative}`, nextStack, "utf8");
50774
- files.push({ file: stackRelative, action: "updated" });
50775
- }
50776
- const manifestFile = await readTextFile(`${rootDir}/${BASELINE_MANIFEST_RELATIVE}`);
50777
- if (manifestFile.kind === "ok") {
50778
- const { next } = removeUnknownEntries(manifestFile.text, wordForms);
50779
- if (next !== manifestFile.text) {
50780
- await writeFile(`${rootDir}/${BASELINE_MANIFEST_RELATIVE}`, next, "utf8");
50781
- files.push({ file: BASELINE_MANIFEST_RELATIVE, action: "updated" });
50782
- }
50783
- }
51195
+ candidates.push({ lane, key, value, source: "package.json" });
50784
51196
  }
50785
- return { observed, skipped_resolved: skippedResolved };
51197
+ return { observed: candidates.length, skipped_resolved: skippedResolved, candidates };
50786
51198
  }
50787
51199
  function isStackValueResolved(value) {
50788
51200
  return isResolved(value);
@@ -50798,8 +51210,227 @@ async function loadLaneStackValues(rootDir, lane) {
50798
51210
  function unknownsWordForm(lane, key) {
50799
51211
  return `baseline/${lane}/stack.yaml:${key}`;
50800
51212
  }
50801
- var UNKNOWN_ENTRY_LINE = /^\s*-\s*(.+?)\s*$/;
50802
- var UNKNOWN_ENTRY_COUNT = /^\s*-\s*baseline\/(?:frontend|backend)\/stack\.yaml:[A-Za-z0-9_-]+\s*$/;
51213
+ var FLAT_ENTRY_LINE = /^\s*-\s*(\S.*?)\s*$/;
51214
+ var STRUCTURED_ENTRY_KEY_LINE = /^(\s*)-\s*key\s*:\s*(.*?)\s*$/;
51215
+ var STRUCTURED_FIELD_LINE = /^(\s*)([A-Za-z][A-Za-z0-9_-]*)\s*:\s*(.*)$/;
51216
+ var STACK_WORD_FORM_PATTERN = /^baseline\/(frontend|backend)\/stack\.yaml:([A-Za-z0-9_-]+)$/;
51217
+ var BASELINE_UNKNOWN_APPLICABILITY_VALUES = ["BLOCKING", "NOT_APPLICABLE", "DEFERRED"];
51218
+ var MSD_UNKNOWN_CLASSIFICATION_VALUES = [
51219
+ "BLOCKER_CANDIDATE",
51220
+ "HARD_BLOCKER",
51221
+ "SOFT_UNCERTAINTY",
51222
+ "ASSUMPTION",
51223
+ "DEFERRED_DECISION",
51224
+ "DISCOVERY_REQUIRED",
51225
+ "SUSPECTED_ISSUE",
51226
+ "NON_BLOCKING_GAP",
51227
+ "FUTURE_CONSIDERATION",
51228
+ "OUT_OF_SCOPE"
51229
+ ];
51230
+ var STRUCTURED_ROW_FIELD_KEYS = [
51231
+ "applicability",
51232
+ "statement",
51233
+ "classification",
51234
+ "resolution",
51235
+ "blocker_triage",
51236
+ "assumption_risk",
51237
+ "requires_authority"
51238
+ ];
51239
+ function leadingSpaces(line) {
51240
+ const match = /^[ \t]*/.exec(line);
51241
+ return match === null ? 0 : match[0].length;
51242
+ }
51243
+ function parseUnknownLedger(text) {
51244
+ const lines = text.split("\n");
51245
+ const block = confirmedBlockRange(lines);
51246
+ const entries = [];
51247
+ let damage = null;
51248
+ const setDamage = (detail) => {
51249
+ if (damage === null)
51250
+ damage = detail;
51251
+ };
51252
+ const registered = /* @__PURE__ */ new Map();
51253
+ for (let i = 0; i < lines.length; i += 1) {
51254
+ if (insideConfirmedBlock(i, block))
51255
+ continue;
51256
+ const line = lines[i] ?? "";
51257
+ if (line.trim() === "" || line.startsWith("#"))
51258
+ continue;
51259
+ const structured = STRUCTURED_ENTRY_KEY_LINE.exec(line);
51260
+ if (structured !== null) {
51261
+ const dashIndent = leadingSpaces(structured[1] ?? "");
51262
+ const wordForm = (structured[2] ?? "").trim();
51263
+ let end = i + 1;
51264
+ let fieldIndent = null;
51265
+ const fields = /* @__PURE__ */ new Map();
51266
+ while (end < lines.length) {
51267
+ const candidate = lines[end] ?? "";
51268
+ if (candidate.trim() === "" || candidate.startsWith("#")) {
51269
+ let peek = end + 1;
51270
+ while (peek < lines.length && ((lines[peek] ?? "").trim() === "" || (lines[peek] ?? "").startsWith("#"))) {
51271
+ peek += 1;
51272
+ }
51273
+ if (peek >= lines.length || leadingSpaces(lines[peek] ?? "") <= dashIndent)
51274
+ break;
51275
+ end = peek;
51276
+ continue;
51277
+ }
51278
+ const indent = leadingSpaces(candidate);
51279
+ if (indent <= dashIndent)
51280
+ break;
51281
+ if (fieldIndent === null)
51282
+ fieldIndent = indent;
51283
+ if (indent === fieldIndent) {
51284
+ const field = STRUCTURED_FIELD_LINE.exec(candidate);
51285
+ if (field === null) {
51286
+ setDamage(`\u7ED3\u6784\u5316\u884C\uFF08${wordForm === "" ? "<key \u7F3A\u5E2D>" : wordForm}\uFF09\u5B57\u6BB5\u884C\u4E0D\u53EF\u8BC6\u522B: ${candidate.trim()}`);
51287
+ } else if (!STRUCTURED_ROW_FIELD_KEYS.includes(field[2] ?? "")) {
51288
+ setDamage(`\u7ED3\u6784\u5316\u884C\u5B57\u6BB5\u51FA\u952E\u96C6\u95ED\u5305: ${field[2]}\uFF08\u5408\u6CD5\u5B57\u6BB5: ${STRUCTURED_ROW_FIELD_KEYS.join(" / ")}\u2014\u2014\u95ED\u5305\u6F14\u8FDB\u8D70\u63D0\u6848\u4FEE\u8BA2\u7981\u53E6\u9020\u8BCD\u5F62\uFF09`);
51289
+ } else if (fields.has(field[2] ?? "")) {
51290
+ setDamage(`\u7ED3\u6784\u5316\u884C\u5B57\u6BB5\u91CD\u590D: ${field[2]}`);
51291
+ } else {
51292
+ fields.set(field[2] ?? "", stripTrailingComment(field[3] ?? "").trim());
51293
+ }
51294
+ } else if (indent < fieldIndent) {
51295
+ setDamage(`\u7ED3\u6784\u5316\u884C\uFF08${wordForm === "" ? "<key \u7F3A\u5E2D>" : wordForm}\uFF09\u5B57\u6BB5\u7F29\u8FDB\u4E0D\u4E00\u81F4: ${candidate.trim()}`);
51296
+ }
51297
+ end += 1;
51298
+ }
51299
+ let shapeDetail = null;
51300
+ const fail6 = (detail) => {
51301
+ if (shapeDetail === null)
51302
+ shapeDetail = detail;
51303
+ };
51304
+ if (wordForm === "") {
51305
+ fail6("\u7ED3\u6784\u5316\u884C key \u8BCD\u5F62\u7F3A\u5E2D\uFF08\u5FC5\u586B\uFF09");
51306
+ } else {
51307
+ const stackMatch = STACK_WORD_FORM_PATTERN.exec(wordForm);
51308
+ if (stackMatch !== null && !STACK_KEYS[stackMatch[1]].includes(stackMatch[2] ?? "")) {
51309
+ fail6(`\u7ED3\u6784\u5316\u884C\u952E\u51FA 14 \u952E\u95ED\u5305: ${wordForm}\uFF08frontend/backend \u4E24 lane \u952E\u96C6\u95ED\u5305\u5F3A\u5236\u2014\u2014\u5F00\u653E\u57DF\u952E\u540D\u624D\u4E0D\u8BBE\u95ED\u5305\uFF09`);
51310
+ }
51311
+ }
51312
+ let applicability = "BLOCKING";
51313
+ const rawApplicability = fields.get("applicability");
51314
+ if (rawApplicability !== void 0) {
51315
+ if (!BASELINE_UNKNOWN_APPLICABILITY_VALUES.includes(rawApplicability)) {
51316
+ fail6(`\u7ED3\u6784\u5316\u884C applicability \u51FA\u4E09\u503C\u95ED\u5305: ${rawApplicability}\uFF08\u5408\u6CD5\u8BCD\u5F62: ${BASELINE_UNKNOWN_APPLICABILITY_VALUES.join(" | ")}\uFF09`);
51317
+ } else {
51318
+ applicability = rawApplicability;
51319
+ }
51320
+ }
51321
+ const statement = fields.get("statement") ?? null;
51322
+ if (statement === null || statement.length === 0) {
51323
+ fail6("\u7ED3\u6784\u5316\u884C\u7F3A statement\uFF08MSD unknown_item \u540C\u6784\u5FC5\u586B\uFF1BminLength 1 \u7981\u7A7A\u6CDB\u5360\u4F4D\uFF09");
51324
+ }
51325
+ const classification = fields.get("classification") ?? null;
51326
+ if (classification === null) {
51327
+ fail6("\u7ED3\u6784\u5316\u884C\u7F3A classification\uFF08MSD unknown_item \u540C\u6784\u5FC5\u586B\uFF09");
51328
+ } else if (!MSD_UNKNOWN_CLASSIFICATION_VALUES.includes(classification)) {
51329
+ fail6(`\u7ED3\u6784\u5316\u884C classification \u51FA\u5341\u5206\u7C7B\u95ED\u5305: ${classification}\uFF0809-msd-uncertainty unknown_classification \u9010\u5B57\u590D\u7528\uFF0C\u96F6\u65B0\u503C\uFF09`);
51330
+ }
51331
+ if (shapeDetail !== null)
51332
+ setDamage(shapeDetail);
51333
+ entries.push({
51334
+ wordForm,
51335
+ structured: true,
51336
+ applicability,
51337
+ statement,
51338
+ classification,
51339
+ lineStart: i,
51340
+ lineEnd: end
51341
+ });
51342
+ const seenStructured = registered.get(wordForm) ?? { flat: 0, structured: 0 };
51343
+ seenStructured.structured += 1;
51344
+ registered.set(wordForm, seenStructured);
51345
+ i = end - 1;
51346
+ continue;
51347
+ }
51348
+ const flat = FLAT_ENTRY_LINE.exec(line);
51349
+ if (flat === null)
51350
+ continue;
51351
+ const flatWordForm = stripTrailingComment(flat[1] ?? "").trim();
51352
+ entries.push({
51353
+ wordForm: flatWordForm,
51354
+ structured: false,
51355
+ applicability: "BLOCKING",
51356
+ statement: null,
51357
+ classification: null,
51358
+ lineStart: i,
51359
+ lineEnd: i + 1
51360
+ });
51361
+ const seenFlat = registered.get(flatWordForm) ?? { flat: 0, structured: 0 };
51362
+ seenFlat.flat += 1;
51363
+ registered.set(flatWordForm, seenFlat);
51364
+ }
51365
+ for (const [wordForm, kinds] of registered) {
51366
+ if (kinds.structured > 1) {
51367
+ setDamage(`\u952E\u91CD\u590D\u7ED3\u6784\u5316\u767B\u8BB0: ${wordForm}\uFF08\u8C41\u514D\u8BED\u4E49\u4E0D\u53EF\u5224\u2014\u2014\u4FDD\u7559\u4E00\u884C\u7ED3\u6784\u5316\u767B\u8BB0\uFF09`);
51368
+ } else if (kinds.structured === 1 && kinds.flat > 0) {
51369
+ setDamage(`\u952E flat+\u7ED3\u6784\u5316\u91CD\u590D\u767B\u8BB0: ${wordForm}\uFF08flat \u884C\u7F3A\u7701 BLOCKING \u4E0E\u8C41\u514D\u767B\u8BB0\u51B2\u7A81\u2014\u2014\u5220 flat \u884C\u6216\u964D\u7EA7\u7ED3\u6784\u5316\u884C\uFF09`);
51370
+ }
51371
+ }
51372
+ return { entries, damage };
51373
+ }
51374
+ function insideConfirmedBlock(index, block) {
51375
+ return block !== null && index >= block.start && index < block.end;
51376
+ }
51377
+ function removeUnknownEntries(text, wordForms) {
51378
+ const ledger = parseUnknownLedger(text);
51379
+ if (ledger.entries.length === 0)
51380
+ return { next: text, removed: 0 };
51381
+ const removeLines = /* @__PURE__ */ new Set();
51382
+ let removed = 0;
51383
+ for (const entry of ledger.entries) {
51384
+ if (!wordForms.has(entry.wordForm))
51385
+ continue;
51386
+ removed += 1;
51387
+ for (let i = entry.lineStart; i < entry.lineEnd; i += 1)
51388
+ removeLines.add(i);
51389
+ }
51390
+ if (removed === 0)
51391
+ return { next: text, removed: 0 };
51392
+ const lines = text.split("\n");
51393
+ return { next: lines.filter((_, index) => !removeLines.has(index)).join("\n"), removed };
51394
+ }
51395
+ function countUnknownEntries(text) {
51396
+ return parseUnknownLedger(text).entries.length;
51397
+ }
51398
+ function stackValueResolvedAt(wordForm, stackValues) {
51399
+ const match = STACK_WORD_FORM_PATTERN.exec(wordForm);
51400
+ if (match === null)
51401
+ return false;
51402
+ const lane = match[1];
51403
+ const key = match[2] ?? "";
51404
+ if (!STACK_KEYS[lane].includes(key))
51405
+ return false;
51406
+ return isResolved(stackValues.get(lane)?.get(key) ?? "");
51407
+ }
51408
+ function computeBlockingSet(ledger, stackValues) {
51409
+ if (ledger.damage !== null)
51410
+ return { ok: false, detail: ledger.damage };
51411
+ const blocking = /* @__PURE__ */ new Set();
51412
+ const rowWordForms = /* @__PURE__ */ new Set();
51413
+ const counts = { BLOCKING: 0, NOT_APPLICABLE: 0, DEFERRED: 0 };
51414
+ for (const entry of ledger.entries) {
51415
+ counts[entry.applicability] += 1;
51416
+ rowWordForms.add(entry.wordForm);
51417
+ if (entry.structured && entry.applicability !== "BLOCKING" && !stackValueResolvedAt(entry.wordForm, stackValues)) {
51418
+ continue;
51419
+ }
51420
+ blocking.add(entry.wordForm);
51421
+ }
51422
+ for (const lane of BASELINE_LANES) {
51423
+ for (const key of STACK_KEYS[lane]) {
51424
+ const wordForm = unknownsWordForm(lane, key);
51425
+ if (rowWordForms.has(wordForm))
51426
+ continue;
51427
+ if (!isResolved(stackValues.get(lane)?.get(key) ?? "")) {
51428
+ blocking.add(wordForm);
51429
+ }
51430
+ }
51431
+ }
51432
+ return { ok: true, blocking: [...blocking], applicability_counts: counts };
51433
+ }
50803
51434
  function confirmedBlockRange(lines) {
50804
51435
  const start = lines.findIndex((line) => CONFIRMED_KEY_LINE.test(line));
50805
51436
  if (start < 0)
@@ -50816,30 +51447,6 @@ function confirmedBlockRange(lines) {
50816
51447
  }
50817
51448
  return { start, end };
50818
51449
  }
50819
- function insideConfirmedBlock(index, block) {
50820
- return block !== null && index >= block.start && index < block.end;
50821
- }
50822
- function removeUnknownEntries(text, wordForms) {
50823
- const lines = text.split("\n");
50824
- const block = confirmedBlockRange(lines);
50825
- let removed = 0;
50826
- const kept = lines.filter((line, index) => {
50827
- if (insideConfirmedBlock(index, block))
50828
- return true;
50829
- const match = UNKNOWN_ENTRY_LINE.exec(line);
50830
- if (match !== null && wordForms.has(match[1] ?? "")) {
50831
- removed += 1;
50832
- return false;
50833
- }
50834
- return true;
50835
- });
50836
- return { next: kept.join("\n"), removed };
50837
- }
50838
- function countUnknownEntries(text) {
50839
- const lines = text.split("\n");
50840
- const block = confirmedBlockRange(lines);
50841
- return lines.filter((line, index) => !insideConfirmedBlock(index, block) && UNKNOWN_ENTRY_COUNT.test(line)).length;
50842
- }
50843
51450
  var BASELINE_CONFIRMED_PLACEHOLDER = /^confirmed\s*:/m;
50844
51451
  async function readTextFile(absolutePath) {
50845
51452
  try {
@@ -50874,7 +51481,13 @@ async function resolveRemainingQuestions(rootDir) {
50874
51481
  for (const lane of BASELINE_LANES) {
50875
51482
  const relative3 = baselineStackRelative(lane);
50876
51483
  const file = await readTextFile(`${rootDir}/${relative3}`);
50877
- const laneQuestions = STACK_QUESTIONS.filter((q) => q.lane === lane && !(lane === "frontend" && observation !== null && observation.values.has(q.key)));
51484
+ const laneQuestions = STACK_QUESTIONS.filter((q) => q.lane === lane).map((question) => {
51485
+ const observedValue = lane === "frontend" && observation !== null ? observation.values.get(question.key) : void 0;
51486
+ return observedValue === void 0 ? question : {
51487
+ ...question,
51488
+ observed: { lane, key: question.key, value: observedValue, source: "package.json" }
51489
+ };
51490
+ });
50878
51491
  if (file.kind === "absent") {
50879
51492
  questions.push(...laneQuestions);
50880
51493
  continue;
@@ -50894,9 +51507,14 @@ async function resolveRemainingQuestions(rootDir) {
50894
51507
  }
50895
51508
  return { kind: "ready", questions };
50896
51509
  }
51510
+ function observationCandidateLine(question) {
51511
+ return question.observed === void 0 ? null : ` \u89C2\u5BDF\u5019\u9009: ${question.observed.value} ${OBSERVED_ANNOTATION}\uFF08\u9009\u578B\u8BE5\u503C\u5373\u91C7\u7EB3\uFF1B\u672A\u91C7\u7EB3\u4FDD\u6301 UNKNOWN\uFF09`;
51512
+ }
50897
51513
  function renderQuestionFrame(question, cursor, buffer, progress, error) {
51514
+ const candidateLine = observationCandidateLine(question);
50898
51515
  const lines = [
50899
51516
  `? ${question.label}\uFF08${question.lane}.${question.key}\uFF1B\u2191\u2193\u9009\u62E9 / \u76F4\u63A5\u952E\u5165\u81EA\u5B9A\u4E49\u503C / \u56DE\u8F66\u786E\u8BA4 / Ctrl+C \u4E2D\u6B62\uFF09[${progress}]`,
51517
+ ...candidateLine === null ? [] : [candidateLine],
50900
51518
  ...question.options.map((option, i) => i === cursor ? `\u25C9 ${option}` : ` \u25EF ${option}`),
50901
51519
  `${cursor === question.options.length ? "" : " "}\u270E \u81EA\u5B9A\u4E49: ${buffer}`
50902
51520
  ];
@@ -50956,6 +51574,9 @@ async function promptQuestionNumbered(question, position, total, io) {
50956
51574
  const customIndex = question.options.length + 1;
50957
51575
  const renderBlock = () => {
50958
51576
  io.write(`[${position}/${total}] ${question.label}\uFF08${question.lane}.${question.key}\uFF09\uFF1A`);
51577
+ const candidateLine = observationCandidateLine(question);
51578
+ if (candidateLine !== null)
51579
+ io.write(candidateLine);
50959
51580
  question.options.forEach((option, i) => io.write(` ${i + 1}. ${option}`));
50960
51581
  io.write(` ${customIndex}. <\u76F4\u63A5\u952E\u5165\u81EA\u5B9A\u4E49\u503C>`);
50961
51582
  io.write("\u7F16\u53F7\u6216\u81EA\u5B9A\u4E49\u503C\uFF08\u5FC5\u7B54\u2014\u2014\u7A7A\u8F93\u5165\u4E0D\u4F5C\u9009\u62E9\uFF09\uFF1A");
@@ -51084,78 +51705,79 @@ function failBaselineSet(code, message, hint, input) {
51084
51705
  confirmation_invalidated: false
51085
51706
  }, [{ code, message, hint }], [`baseline set: FAILED \u2014 ${code}`, ` ${message}`, ` hint: ${hint}`]);
51086
51707
  }
51087
- async function runBaselineSet(rootDir, input) {
51088
- if (!BASELINE_LANES.includes(input.lane)) {
51089
- return failBaselineSet("SCHEMA_INVALID", `\u975E\u6CD5 lane \u8BCD\u5F62\uFF1A${input.lane}\uFF1B\u5408\u6CD5\u8BCD\u5F62\uFF1A${BASELINE_LANES.join(" | ")}`, "\u793A\u4F8B\uFF1Apomaster baseline set --lane frontend --key framework --value vue3", input);
51090
- }
51091
- const lane = input.lane;
51092
- const keys = STACK_KEYS[lane];
51093
- if (!keys.includes(input.key)) {
51094
- return failBaselineSet("SCHEMA_INVALID", `\u975E\u6CD5\u952E\u8BCD\u5F62\uFF1A${input.key}\uFF1B${lane} \u952E\u96C6\u95ED\u5305\uFF1A${keys.join(" | ")}`, `\u952E\u96C6\u4E0E ${baselineStackRelative(lane)} \u64AD\u79CD\u952E\u5E8F\u4E00\u4E00\u5BF9\u5E94\uFF08baseline-seeds \u9489\u5B9A\uFF09\u3002`, input);
51095
- }
51096
- if (input.value === "UNKNOWN") {
51097
- return failBaselineSet("SCHEMA_INVALID", "UNKNOWN \u662F\u8D77\u6B65\u7F3A\u5E2D\u8BCD\u5F62\uFF0C\u4E0D\u53EF\u4F5C\u4E3A\u9009\u578B\u503C", "\u663E\u5F0F\u9009\u578B\u503C\u7ECF init \u95EE\u5377\u6216\u672C\u547D\u4EE4\u5199\u5165\uFF1B\u56DE\u9000/\u64A4\u9500\u5DF2\u9500\u8D26\u952E\u8D70\u6CBB\u7406\u901A\u8DEF\u3002", input);
51098
- }
51099
- if (!STACK_VALUE_PATTERN.test(input.value)) {
51100
- return failBaselineSet("SCHEMA_INVALID", `\u503C\u8BCD\u5F62\u975E\u6CD5\uFF1A${input.value}\uFF08\u5141\u8BB8 [A-Za-z0-9] \u8D77\u59CB\u3001[A-Za-z0-9 _./+#()-]\u3001\u2264${STACK_VALUE_MAX_LENGTH} \u5B57\u7B26\uFF09`, "\u793A\u4F8B\uFF1A--value vue3\u3001--value 'Spring Boot'\u3001--value none", input);
51101
- }
51708
+ var BASELINE_SET_TX_ATTEMPTS = 4;
51709
+ var BASELINE_SET_TX_BACKOFF_MS = [20, 50, 100];
51710
+ function settled(outcome) {
51711
+ return { kind: "settled", outcome };
51712
+ }
51713
+ async function baselineSetAttempt(rootDir, input, lane, attempt, casFs = nodeCasSwapFs) {
51102
51714
  const stackRelative = baselineStackRelative(lane);
51103
51715
  const stackFile = await readTextFile(`${rootDir}/${stackRelative}`);
51104
51716
  if (stackFile.kind !== "ok") {
51717
+ if (stackFile.kind === "absent") {
51718
+ if (attempt > 0) {
51719
+ return { kind: "contended", viaStackAbsent: true };
51720
+ }
51721
+ const manifestProbe = await readTextFile(`${rootDir}/${BASELINE_MANIFEST_RELATIVE}`);
51722
+ if (manifestProbe.kind === "ok") {
51723
+ return { kind: "contended", viaStackAbsent: true };
51724
+ }
51725
+ }
51105
51726
  const error = baselineFileError(stackRelative, stackFile);
51106
- return failBaselineSet(error.code, error.message, error.hint, input);
51727
+ return settled(failBaselineSet(error.code, error.message, error.hint, input));
51107
51728
  }
51108
51729
  const manifestFile = await readTextFile(`${rootDir}/${BASELINE_MANIFEST_RELATIVE}`);
51109
51730
  if (manifestFile.kind !== "ok") {
51731
+ if (attempt > 0 && manifestFile.kind === "absent") {
51732
+ return { kind: "contended" };
51733
+ }
51110
51734
  const error = baselineFileError(BASELINE_MANIFEST_RELATIVE, manifestFile);
51111
- return failBaselineSet(error.code, error.message, error.hint, input);
51735
+ return settled(failBaselineSet(error.code, error.message, error.hint, input));
51112
51736
  }
51113
51737
  const parse = parseStackYaml(stackFile.text, STACK_KEYS[lane]);
51114
51738
  if (!parse.ok) {
51115
- return failBaselineSet("INVALID_STATE", `${stackRelative} \u7ED3\u6784\u4E0D\u53EF\u89E3\u6790: ${parse.detail}`, "\u4FEE\u590D\u6216\u4ECE git \u6062\u590D\u8BE5\u6587\u4EF6\u540E\u91CD\u8BD5\uFF1B\u672C\u547D\u4EE4\u4E0D\u731C\u6D4B\u91CD\u5199\u9879\u76EE\u57FA\u7EBF\u6587\u4EF6\u3002", input);
51739
+ return settled(failBaselineSet("INVALID_STATE", `${stackRelative} \u7ED3\u6784\u4E0D\u53EF\u89E3\u6790: ${parse.detail}`, "\u4FEE\u590D\u6216\u4ECE git \u6062\u590D\u8BE5\u6587\u4EF6\u540E\u91CD\u8BD5\uFF1B\u672C\u547D\u4EE4\u4E0D\u731C\u6D4B\u91CD\u5199\u9879\u76EE\u57FA\u7EBF\u6587\u4EF6\u3002", input));
51116
51740
  }
51117
51741
  const confirmedWordFormPresent = BASELINE_CONFIRMED_PLACEHOLDER.test(manifestFile.text);
51118
51742
  const recordParse = parseConfirmedBlock(manifestFile.text);
51119
51743
  const recordValid = recordParse.kind === "ok";
51120
51744
  if (recordValid || confirmedWordFormPresent) {
51121
51745
  if (input.change === void 0) {
51122
- return failBaselineSet("BASELINE_ALREADY_CONFIRMED", recordValid ? recordParse.record.pending !== void 0 ? `baseline \u786E\u8BA4\u8BB0\u5F55\u5728\u5EA7\u4E14\u53D8\u66F4\u6279\u5728\u9014\uFF08pending-change\uFF1Bchange_ref=${recordParse.record.pending.change_ref}\uFF09\u2014\u2014\u7EE7\u7EED\u4FEE\u6539\u987B\u643A\u540C ref\uFF0C\u6216\u643A\u540C ref confirm \u7EC8\u7ED3` : "baseline \u5DF2\u786E\u8BA4\uFF08manifest \u5728\u5EA7\u786E\u8BA4\u8BB0\u5F55\uFF09\uFF1B\u786E\u8BA4\u540E\u9879\u76EE\u67B6\u6784\u4E0D\u5141\u8BB8\u76F4\u63A5\u4FEE\u6539" : "baseline \u786E\u8BA4\u8BB0\u5F55\u5728\u5EA7\uFF08\u7ED3\u6784\u635F\u574F\uFF09\u2014\u2014\u9879\u76EE\u67B6\u6784\u4E0D\u5141\u8BB8\u76F4\u63A5\u4FEE\u6539\uFF08\u635F\u574F\u5757\u4FEE\u590D\u8D70 confirm \u91CD\u5EFA\uFF09", "\u4FEE\u6539\u8D70\u6CBB\u7406\u901A\u8DEF\uFF1A\u5148\u7ACB CHANGE.* \u5BF9\u8C61\uFF0C\u518D pomaster baseline set --change <CHANGE-id>\uFF08\u5199\u5165\u8F6C pending-change\uFF09\uFF0C\u5B8C\u6210\u540E\u643A\u540C ref pomaster baseline confirm \u91CD\u786E\u8BA4\u3002", input);
51746
+ return settled(failBaselineSet("BASELINE_ALREADY_CONFIRMED", recordValid ? recordParse.record.pending !== void 0 ? `baseline \u786E\u8BA4\u8BB0\u5F55\u5728\u5EA7\u4E14\u53D8\u66F4\u6279\u5728\u9014\uFF08pending-change\uFF1Bchange_ref=${recordParse.record.pending.change_ref}\uFF09\u2014\u2014\u7EE7\u7EED\u4FEE\u6539\u987B\u643A\u540C ref\uFF0C\u6216\u643A\u540C ref confirm \u7EC8\u7ED3` : "baseline \u5DF2\u786E\u8BA4\uFF08manifest \u5728\u5EA7\u786E\u8BA4\u8BB0\u5F55\uFF09\uFF1B\u786E\u8BA4\u540E\u9879\u76EE\u67B6\u6784\u4E0D\u5141\u8BB8\u76F4\u63A5\u4FEE\u6539" : "baseline \u786E\u8BA4\u8BB0\u5F55\u5728\u5EA7\uFF08\u7ED3\u6784\u635F\u574F\uFF09\u2014\u2014\u9879\u76EE\u67B6\u6784\u4E0D\u5141\u8BB8\u76F4\u63A5\u4FEE\u6539\uFF08\u635F\u574F\u5757\u4FEE\u590D\u8D70 confirm \u91CD\u5EFA\uFF09", "\u4FEE\u6539\u8D70\u6CBB\u7406\u901A\u8DEF\uFF1A\u5148\u7ACB CHANGE.* \u5BF9\u8C61\uFF0C\u518D pomaster baseline set --change <CHANGE-id>\uFF08\u5199\u5165\u8F6C pending-change\uFF09\uFF0C\u5B8C\u6210\u540E\u643A\u540C ref pomaster baseline confirm \u91CD\u786E\u8BA4\u3002", input));
51123
51747
  }
51124
51748
  if (!recordValid) {
51125
- return failBaselineSet("INVALID_STATE", "manifest \u786E\u8BA4\u8BB0\u5F55\u7ED3\u6784\u635F\u574F\u2014\u2014set \u4E0D\u5728\u635F\u574F\u8BB0\u5F55\u4E0A\u6388\u6743\u5199\u76D8", "\u5148 pomaster baseline confirm \u91CD\u5EFA\u786E\u8BA4\u8BB0\u5F55\uFF08\u635F\u574F\u5757\u4FEE\u590D\u4E0D\u9700\u8981\u901A\u9053\uFF09\uFF0C\u518D\u8D70\u6CBB\u7406\u901A\u8DEF set --change\u3002", input);
51749
+ return settled(failBaselineSet("INVALID_STATE", "manifest \u786E\u8BA4\u8BB0\u5F55\u7ED3\u6784\u635F\u574F\u2014\u2014set \u4E0D\u5728\u635F\u574F\u8BB0\u5F55\u4E0A\u6388\u6743\u5199\u76D8", "\u5148 pomaster baseline confirm \u91CD\u5EFA\u786E\u8BA4\u8BB0\u5F55\uFF08\u635F\u574F\u5757\u4FEE\u590D\u4E0D\u9700\u8981\u901A\u9053\uFF09\uFF0C\u518D\u8D70\u6CBB\u7406\u901A\u8DEF set --change\u3002", input));
51126
51750
  }
51127
51751
  if (recordParse.record.pending !== void 0 && input.change !== recordParse.record.pending.change_ref) {
51128
- return failBaselineSet("SCHEMA_INVALID", `pending-change \u53D8\u66F4\u6279\u7531 ${recordParse.record.pending.change_ref} \u6301\u6709\u2014\u2014\u540C\u6279\u8FDE\u6539\u987B\u643A\u540C ref\uFF08\u6279\u5185 ${recordParse.record.pending.batch.length} \u952E\uFF09`, `\u7EE7\u7EED\u4FEE\u6539: pomaster baseline set --change ${recordParse.record.pending.change_ref}\uFF1B\u7EC8\u7ED3: pomaster baseline confirm --change ${recordParse.record.pending.change_ref}\u3002`, input);
51752
+ return settled(failBaselineSet("SCHEMA_INVALID", `pending-change \u53D8\u66F4\u6279\u7531 ${recordParse.record.pending.change_ref} \u6301\u6709\u2014\u2014\u540C\u6279\u8FDE\u6539\u987B\u643A\u540C ref\uFF08\u6279\u5185 ${recordParse.record.pending.batch.length} \u952E\uFF09`, `\u7EE7\u7EED\u4FEE\u6539: pomaster baseline set --change ${recordParse.record.pending.change_ref}\uFF1B\u7EC8\u7ED3: pomaster baseline confirm --change ${recordParse.record.pending.change_ref}\u3002`, input));
51129
51753
  }
51130
51754
  const changeError = await validateBaselineChangeRef(rootDir, input.change);
51131
51755
  if (changeError !== null) {
51132
- return failBaselineSet(changeError.code, changeError.message, changeError.hint, input);
51756
+ return settled(failBaselineSet(changeError.code, changeError.message, changeError.hint, input));
51133
51757
  }
51134
51758
  } else if (input.change !== void 0) {
51135
- return failBaselineSet("SCHEMA_INVALID", `--change \u4EC5\u5728\u5DF2\u786E\u8BA4\u57FA\u7EBF\u4E0A\u88AB\u6D88\u8D39\uFF08\u6CBB\u7406\u901A\u8DEF\u6388\u6743\u786E\u8BA4\u5FEB\u7167\u5185\u6587\u4EF6\u7684\u4FEE\u6539\uFF09\uFF1B\u5F53\u524D baseline \u65E0\u786E\u8BA4\u8BB0\u5F55`, "\u76F4\u63A5 set \u5373\u53EF\uFF08\u540E\u8865\u9500\u8D26\u901A\u8DEF\u4E0D\u8981\u6C42\u6388\u6743\uFF09\uFF1B\u786E\u8BA4\u8D70 pomaster baseline confirm\u3002", input);
51759
+ return settled(failBaselineSet("SCHEMA_INVALID", `--change \u4EC5\u5728\u5DF2\u786E\u8BA4\u57FA\u7EBF\u4E0A\u88AB\u6D88\u8D39\uFF08\u6CBB\u7406\u901A\u8DEF\u6388\u6743\u786E\u8BA4\u5FEB\u7167\u5185\u6587\u4EF6\u7684\u4FEE\u6539\uFF09\uFF1B\u5F53\u524D baseline \u65E0\u786E\u8BA4\u8BB0\u5F55`, "\u76F4\u63A5 set \u5373\u53EF\uFF08\u540E\u8865\u9500\u8D26\u901A\u8DEF\u4E0D\u8981\u6C42\u6388\u6743\uFF09\uFF1B\u786E\u8BA4\u8D70 pomaster baseline confirm\u3002", input));
51136
51760
  }
51137
51761
  const current = parse.parsed.values.get(input.key) ?? "";
51138
51762
  const fileReports = [];
51139
51763
  let change = "NO_CHANGE";
51140
51764
  let confirmationInvalidated = false;
51141
51765
  let nextManifest = manifestFile.text;
51766
+ let nextStack = stackFile.text;
51767
+ let stackTouched = false;
51142
51768
  let pendingRecord;
51143
51769
  if (current !== input.value) {
51770
+ stackTouched = true;
51144
51771
  if (isResolved(current) && !recordValid) {
51145
- return failBaselineSet("BASELINE_KEY_ALREADY_SET", `${stackRelative}:${input.key} \u5DF2\u9500\u8D26\u4E3A ${current}\uFF1Bset \u4E0D\u505A\u6539\u578B`, "answered \u7A33\u5B9A\u8BED\u4E49\uFF1A\u5DF2\u7B54\u952E\u7684\u6539\u578B\u8D70\u6CBB\u7406\u901A\u8DEF\u2014\u2014\u786E\u8BA4\u540E\u6301\u6709\u6548 --change \u91CD\u653E\u672C\u547D\u4EE4\uFF08\u5199\u5165\u8F6C pending-change\uFF09\uFF0C\u6216\u7ECF\u9879\u76EE\u81EA\u6709\u8BC4\u5BA1\u624B\u5DE5\u4FEE\u6539\u3002", input);
51772
+ return settled(failBaselineSet("BASELINE_KEY_ALREADY_SET", `${stackRelative}:${input.key} \u5DF2\u9500\u8D26\u4E3A ${current}\uFF1Bset \u4E0D\u505A\u6539\u578B`, "answered \u7A33\u5B9A\u8BED\u4E49\uFF1A\u5DF2\u7B54\u952E\u7684\u6539\u578B\u8D70\u6CBB\u7406\u901A\u8DEF\u2014\u2014\u786E\u8BA4\u540E\u6301\u6709\u6548 --change \u91CD\u653E\u672C\u547D\u4EE4\uFF08\u5199\u5165\u8F6C pending-change\uFF09\uFF0C\u6216\u7ECF\u9879\u76EE\u81EA\u6709\u8BC4\u5BA1\u624B\u5DE5\u4FEE\u6539\u3002", input));
51146
51773
  }
51147
51774
  const lines = stackFile.text.split("\n");
51148
51775
  const lineIndex = parse.parsed.lineOf.get(input.key);
51149
51776
  if (lineIndex === void 0) {
51150
- return failBaselineSet("INVALID_STATE", `${stackRelative} \u7F3A\u5C11\u952E\u884C\uFF1A${input.key}`, "\u57FA\u7EBF\u6587\u4EF6\u7ED3\u6784\u6F02\u79FB\u2014\u2014\u6062\u590D\u64AD\u79CD\u5F62\u6001\u6216\u624B\u5DE5\u5BF9\u9F50\u952E\u96C6\u540E\u91CD\u8BD5\u3002", input);
51777
+ return settled(failBaselineSet("INVALID_STATE", `${stackRelative} \u7F3A\u5C11\u952E\u884C\uFF1A${input.key}`, "\u57FA\u7EBF\u6587\u4EF6\u7ED3\u6784\u6F02\u79FB\u2014\u2014\u6062\u590D\u64AD\u79CD\u5F62\u6001\u6216\u624B\u5DE5\u5BF9\u9F50\u952E\u96C6\u540E\u91CD\u8BD5\u3002", input));
51151
51778
  }
51152
51779
  lines[lineIndex] = `${input.key}: ${input.value}`;
51153
- const nextStack = lines.join("\n");
51154
- if (nextStack !== stackFile.text) {
51155
- await writeFile(`${rootDir}/${stackRelative}`, nextStack, "utf8");
51156
- change = "UPDATED";
51157
- }
51158
- fileReports.push({ file: stackRelative, action: "updated" });
51780
+ nextStack = lines.join("\n");
51159
51781
  if (recordValid && input.change !== void 0 && nextStack !== stackFile.text) {
51160
51782
  const prior = recordParse.record.pending;
51161
51783
  const entry = unknownsWordForm(lane, input.key);
@@ -51163,19 +51785,42 @@ async function runBaselineSet(rootDir, input) {
51163
51785
  pendingRecord = { ...recordParse.record, pending: { change_ref: input.change, batch } };
51164
51786
  confirmationInvalidated = true;
51165
51787
  }
51166
- } else {
51167
- fileReports.push({ file: stackRelative, action: "unchanged" });
51168
51788
  }
51169
51789
  const { next: afterLedger, removed } = removeUnknownEntries(nextManifest, /* @__PURE__ */ new Set([unknownsWordForm(lane, input.key)]));
51170
51790
  nextManifest = afterLedger;
51171
51791
  if (pendingRecord !== void 0) {
51172
51792
  nextManifest = upsertConfirmedBlock(nextManifest, pendingRecord);
51173
51793
  }
51794
+ let manifestCommitted = false;
51174
51795
  if (nextManifest !== manifestFile.text) {
51175
- await writeFile(`${rootDir}/${BASELINE_MANIFEST_RELATIVE}`, nextManifest, "utf8");
51176
- fileReports.push({ file: BASELINE_MANIFEST_RELATIVE, action: "updated" });
51796
+ const cas = casSwapFile(`${rootDir}/${BASELINE_MANIFEST_RELATIVE}`, manifestFile.text, nextManifest, casFs);
51797
+ if (cas.kind === "fault") {
51798
+ return settled(failBaselineSet("BASELINE_WRITE_CONFLICT", `baseline \u63D0\u4EA4\u9047\u6301\u7EED\u6587\u4EF6\u7CFB\u7EDF\u6545\u969C\uFF08${BASELINE_MANIFEST_RELATIVE}\uFF1A${cas.cause}\uFF1Berrno=${cas.code}\uFF09\u2014\u2014\u975E\u5E76\u53D1\u4EA4\u9519\uFF0C\u91CD\u8BD5\u65E0\u76CA`, "\u5148\u5904\u7F6E\u6587\u4EF6\u7CFB\u7EDF\u6545\u969C\uFF08\u78C1\u76D8\u7A7A\u95F4/\u6743\u9650/\u6740\u8F6F\u9501\uFF09\uFF0C\u518D\u91CD\u8DD1\u672C\u547D\u4EE4\uFF1A\u91CD\u8DD1\u5728\u65B0\u9C9C\u76D8\u9762\u4E0A\u91CD\u653E\u540C\u4E00\u5224\u5377\u94FE\uFF08\u5E76\u53D1\u4FEE\u6539\u6309\u4E32\u884C\u91CD\u8BD5\u6536\u655B\uFF09\u3002", input));
51799
+ }
51800
+ if (cas.kind !== "swapped") {
51801
+ return cas.kind === "contended" ? { kind: "contended", viaCasCause: `manifest\uFF1A${cas.cause}` } : { kind: "contended" };
51802
+ }
51803
+ manifestCommitted = true;
51804
+ change = "UPDATED";
51805
+ }
51806
+ if (nextStack !== stackFile.text) {
51807
+ const cas = casSwapFile(`${rootDir}/${stackRelative}`, stackFile.text, nextStack, casFs);
51808
+ if (cas.kind === "fault") {
51809
+ return settled(failBaselineSet("BASELINE_WRITE_CONFLICT", `baseline \u63D0\u4EA4\u9047\u6301\u7EED\u6587\u4EF6\u7CFB\u7EDF\u6545\u969C\uFF08${stackRelative}\uFF1A${cas.cause}\uFF1Berrno=${cas.code}\uFF09\u2014\u2014\u975E\u5E76\u53D1\u4EA4\u9519\uFF0C\u91CD\u8BD5\u65E0\u76CA`, "\u5148\u5904\u7F6E\u6587\u4EF6\u7CFB\u7EDF\u6545\u969C\uFF08\u78C1\u76D8\u7A7A\u95F4/\u6743\u9650/\u6740\u8F6F\u9501\uFF09\uFF0C\u518D\u91CD\u8DD1\u672C\u547D\u4EE4\uFF1A\u91CD\u8DD1\u5728\u65B0\u9C9C\u76D8\u9762\u4E0A\u91CD\u653E\u540C\u4E00\u5224\u5377\u94FE\uFF08\u5E76\u53D1\u4FEE\u6539\u6309\u4E32\u884C\u91CD\u8BD5\u6536\u655B\uFF09\u3002", input));
51810
+ }
51811
+ if (cas.kind !== "swapped") {
51812
+ return cas.kind === "contended" ? { kind: "contended", viaCasCause: `stack\uFF1A${cas.cause}` } : { kind: "contended" };
51813
+ }
51177
51814
  change = "UPDATED";
51178
51815
  }
51816
+ if (stackTouched) {
51817
+ fileReports.push({ file: stackRelative, action: "updated" });
51818
+ } else {
51819
+ fileReports.push({ file: stackRelative, action: "unchanged" });
51820
+ }
51821
+ if (manifestCommitted) {
51822
+ fileReports.push({ file: BASELINE_MANIFEST_RELATIVE, action: "updated" });
51823
+ }
51179
51824
  const result2 = {
51180
51825
  change,
51181
51826
  lane,
@@ -51190,7 +51835,43 @@ async function runBaselineSet(rootDir, input) {
51190
51835
  ...fileReports.map((report) => ` ${report.action.padEnd(10)} ${report.file}${removed > 0 && report.file === BASELINE_MANIFEST_RELATIVE ? `\uFF08\u9500\u8D26 ${removed} \u6761\uFF09` : ""}`),
51191
51836
  ` unknowns remaining: ${result2.unknowns_remaining}`
51192
51837
  ];
51193
- return okOutcome("baseline set", result2, human);
51838
+ return settled(okOutcome("baseline set", result2, human));
51839
+ }
51840
+ async function runBaselineSet(rootDir, input, casFs = nodeCasSwapFs) {
51841
+ if (!BASELINE_LANES.includes(input.lane)) {
51842
+ return failBaselineSet("SCHEMA_INVALID", `\u975E\u6CD5 lane \u8BCD\u5F62\uFF1A${input.lane}\uFF1B\u5408\u6CD5\u8BCD\u5F62\uFF1A${BASELINE_LANES.join(" | ")}`, "\u793A\u4F8B\uFF1Apomaster baseline set --lane frontend --key framework --value vue3", input);
51843
+ }
51844
+ const lane = input.lane;
51845
+ const keys = STACK_KEYS[lane];
51846
+ if (!keys.includes(input.key)) {
51847
+ return failBaselineSet("SCHEMA_INVALID", `\u975E\u6CD5\u952E\u8BCD\u5F62\uFF1A${input.key}\uFF1B${lane} \u952E\u96C6\u95ED\u5305\uFF1A${keys.join(" | ")}`, `\u952E\u96C6\u4E0E ${baselineStackRelative(lane)} \u64AD\u79CD\u952E\u5E8F\u4E00\u4E00\u5BF9\u5E94\uFF08baseline-seeds \u9489\u5B9A\uFF09\u3002`, input);
51848
+ }
51849
+ if (input.value === "UNKNOWN") {
51850
+ return failBaselineSet("SCHEMA_INVALID", "UNKNOWN \u662F\u8D77\u6B65\u7F3A\u5E2D\u8BCD\u5F62\uFF0C\u4E0D\u53EF\u4F5C\u4E3A\u9009\u578B\u503C", "\u663E\u5F0F\u9009\u578B\u503C\u7ECF init \u95EE\u5377\u6216\u672C\u547D\u4EE4\u5199\u5165\uFF1B\u56DE\u9000/\u64A4\u9500\u5DF2\u9500\u8D26\u952E\u8D70\u6CBB\u7406\u901A\u8DEF\u3002", input);
51851
+ }
51852
+ if (!STACK_VALUE_PATTERN.test(input.value)) {
51853
+ return failBaselineSet("SCHEMA_INVALID", `\u503C\u8BCD\u5F62\u975E\u6CD5\uFF1A${input.value}\uFF08\u5141\u8BB8 [A-Za-z0-9] \u8D77\u59CB\u3001[A-Za-z0-9 _./+#()-]\u3001\u2264${STACK_VALUE_MAX_LENGTH} \u5B57\u7B26\uFF09`, "\u793A\u4F8B\uFF1A--value vue3\u3001--value 'Spring Boot'\u3001--value none", input);
51854
+ }
51855
+ let lastContendedViaStackAbsent = false;
51856
+ let lastContendedCasCause = null;
51857
+ for (let attempt = 0; ; attempt += 1) {
51858
+ if (attempt >= BASELINE_SET_TX_ATTEMPTS) {
51859
+ if (lastContendedViaStackAbsent) {
51860
+ return failBaselineSet("BASELINE_WRITE_CONFLICT", `baseline \u5199\u5165\u94FE\u672A\u6536\u655B\uFF08${BASELINE_SET_TX_ATTEMPTS} \u8F6E\u6709\u754C\u91CD\u8BD5\u5185 ${baselineStackRelative(lane)} \u6301\u7EED\u7F3A\u5E2D\uFF09\uFF1A\u53EF\u80FD\u4E3A\u5E76\u53D1 CAS \u8BA4\u9886\u7A97\u53E3\u672A\u6536\u655B\uFF0C\u4E5F\u53EF\u80FD\u4E3A\u8BE5\u6587\u4EF6\u88AB\u771F\u5B9E\u5220\u9664\u2014\u2014\u7F3A\u5E2D\u4E0D\u731C\u6D4B\u91CD\u5199`, "\u7A0D\u540E\u91CD\u8DD1\u672C\u547D\u4EE4\u5373\u53EF\uFF1A\u8BA4\u9886\u7A97\u53E3\u6536\u655B\u540E\u91CD\u8DD1\u5728\u65B0\u9C9C\u76D8\u9762\u4E0A\u6309\u4E32\u884C\u8BED\u4E49\u843D\u76D8\uFF1B\u82E5\u91CD\u8DD1\u4ECD\u62A5\u672C\u9519\u8BEF\uFF0C\u8BE5\u6587\u4EF6\u5F88\u53EF\u80FD\u5DF2\u88AB\u771F\u5B9E\u5220\u9664\u2014\u2014\u4ECE git \u6062\u590D\u6216\u91CD\u8DD1 pomaster init \u64AD\u79CD\uFF08seed-once-missing-only\uFF09\u3002", input);
51861
+ }
51862
+ const causeNote = lastContendedCasCause === null ? "" : `\uFF08\u6700\u8FD1\u8BA4\u9886\u4EA4\u9519\u6210\u56E0\uFF1A${lastContendedCasCause}\uFF09`;
51863
+ return failBaselineSet("BASELINE_WRITE_CONFLICT", `baseline \u5E76\u53D1\u5199\u5165\u51B2\u7A81\uFF08${BASELINE_SET_TX_ATTEMPTS} \u8F6E\u91CD\u8BFB\u91CD\u7B97\u540E\u4ECD\u4E0E\u4ED6\u4EBA\u5199\u5165\u4EA4\u9519\uFF1B${baselineStackRelative(lane)} \u4E0E ${BASELINE_MANIFEST_RELATIVE} \u7684\u8BFB-\u6539-\u5199\u94FE\uFF09${causeNote}`, "\u7A0D\u540E\u91CD\u8DD1\u672C\u547D\u4EE4\u5373\u53EF\uFF1A\u91CD\u8DD1\u5728\u65B0\u9C9C\u76D8\u9762\u4E0A\u91CD\u653E\u540C\u4E00\u5224\u5377\u94FE\uFF08\u5E76\u53D1\u4FEE\u6539\u6309\u4E32\u884C\u91CD\u8BD5\u6536\u655B\u2014\u2014\u5BA1\u8BA1 R1 \u4FEE\u590D\u8BED\u4E49\uFF09\u3002", input);
51864
+ }
51865
+ if (attempt > 0) {
51866
+ sleepSync2(BASELINE_SET_TX_BACKOFF_MS[Math.min(attempt - 1, BASELINE_SET_TX_BACKOFF_MS.length - 1)]);
51867
+ }
51868
+ const attemptOutcome = await baselineSetAttempt(rootDir, input, lane, attempt, casFs);
51869
+ if (attemptOutcome.kind === "settled") {
51870
+ return attemptOutcome.outcome;
51871
+ }
51872
+ lastContendedViaStackAbsent = attemptOutcome.viaStackAbsent === true;
51873
+ lastContendedCasCause = attemptOutcome.viaCasCause ?? null;
51874
+ }
51194
51875
  }
51195
51876
  function renderBaselineQuizHumanLine(baseline) {
51196
51877
  if (baseline.skipped === "non_interactive") {
@@ -51235,10 +51916,12 @@ var BASELINE_MD_FACES = [
51235
51916
  `${stripStorePrefix(BASELINE_PLATFORM_DIR_RELATIVE)}/observability.md`,
51236
51917
  `${stripStorePrefix(BASELINE_PLATFORM_DIR_RELATIVE)}/delivery.md`
51237
51918
  ];
51919
+ var BASELINE_DESIGN_TOKENS_TARGET = `${stripStorePrefix(BASELINE_FRONTEND_DIR_RELATIVE)}/design-tokens.yaml`;
51238
51920
  var BASELINE_CONFIRM_TARGETS = [
51239
51921
  stripStorePrefix(baselineStackRelative("frontend")),
51240
51922
  stripStorePrefix(baselineStackRelative("backend")),
51241
- ...BASELINE_MD_FACES
51923
+ ...BASELINE_MD_FACES,
51924
+ BASELINE_DESIGN_TOKENS_TARGET
51242
51925
  ];
51243
51926
  function baselineConfirmTargetPath(rootDir, target) {
51244
51927
  return `${rootDir}/${POMASTER_DIR}/${target}`;
@@ -51435,11 +52118,6 @@ function upsertConfirmedBlock(text, record) {
51435
52118
  return stripped.endsWith("\n") ? stripped + block : `${stripped}
51436
52119
  ${block}`;
51437
52120
  }
51438
- function listUnknownEntries(text) {
51439
- const lines = text.split("\n");
51440
- const block = confirmedBlockRange(lines);
51441
- return lines.map((line, index) => insideConfirmedBlock(index, block) ? "" : UNKNOWN_ENTRY_LINE.exec(line)?.[1]?.trim() ?? "").filter((wordForm) => UNKNOWN_ENTRY_COUNT.test(`- ${wordForm}`));
51442
- }
51443
52121
  async function readGenerationSeq(rootDir) {
51444
52122
  try {
51445
52123
  const { readFile: readFile18 } = await import("node:fs/promises");
@@ -51505,7 +52183,8 @@ async function runBaselineConfirm(rootDir, input = {}) {
51505
52183
  return failBaselineConfirm(error.code, error.message, error.hint, -1);
51506
52184
  }
51507
52185
  const unknownsRemaining = countUnknownEntries(manifestFile.text);
51508
- const unsettled = new Set(listUnknownEntries(manifestFile.text));
52186
+ const ledger = parseUnknownLedger(manifestFile.text);
52187
+ const stackValuesByLane = /* @__PURE__ */ new Map();
51509
52188
  for (const lane of BASELINE_LANES) {
51510
52189
  const stackRelative = baselineStackRelative(lane);
51511
52190
  const stackFile = await readTextFile(`${rootDir}/${stackRelative}`);
@@ -51517,15 +52196,25 @@ async function runBaselineConfirm(rootDir, input = {}) {
51517
52196
  if (!parse.ok) {
51518
52197
  return failBaselineConfirm("INVALID_STATE", `${stackRelative} \u7ED3\u6784\u4E0D\u53EF\u89E3\u6790: ${parse.detail}`, "\u4FEE\u590D\u6216\u4ECE git \u6062\u590D\u8BE5\u6587\u4EF6\u540E\u91CD\u8BD5\uFF1Bconfirm \u4E0D\u731C\u6D4B\u91CD\u5199\u9879\u76EE\u57FA\u7EBF\u6587\u4EF6\u3002", unknownsRemaining);
51519
52198
  }
51520
- for (const key of STACK_KEYS[lane]) {
51521
- if (!isResolved(parse.parsed.values.get(key) ?? "")) {
51522
- unsettled.add(unknownsWordForm(lane, key));
51523
- }
51524
- }
52199
+ stackValuesByLane.set(lane, parse.parsed.values);
51525
52200
  }
51526
- if (unsettled.size > 0) {
51527
- const ordered = STACK_QUESTIONS.filter((question) => unsettled.has(unknownsWordForm(question.lane, question.key))).map((question) => unknownsWordForm(question.lane, question.key));
51528
- return failBaselineConfirm("BASELINE_UNKNOWNS_REMAINING", `unknowns \u672A\u5168\u9500\u8D26\uFF08${unsettled.size} \u952E\uFF09\uFF1A${ordered.join("\u3001")}${ordered.length < unsettled.size ? "\u3001<\u53F0\u8D26\u5916\u8BCD\u5F62>" : ""}`, "\u9010\u952E\u56DE\u586B\uFF1ATTY \u91CD\u8DD1 pomaster init \u95EE\u5377\uFF08\u5DF2\u7B54\u952E\u5E42\u7B49\u4E0D\u91CD\u590D\u95EE\uFF09\u6216 pomaster baseline set --lane <lane> --key <key> --value <value>\uFF1B\u5168\u90E8\u9500\u8D26\u540E\u518D confirm\u3002", unknownsRemaining);
52201
+ const blockingJudgement = computeBlockingSet(ledger, stackValuesByLane);
52202
+ if (!blockingJudgement.ok) {
52203
+ return failBaselineConfirm("INVALID_STATE", `${BASELINE_MANIFEST_RELATIVE} unknowns \u53F0\u8D26\u7ED3\u6784\u5316\u884C\u5F62\u72B6\u635F\u574F: ${blockingJudgement.detail}`, "\u4FEE\u590D\u6216\u4ECE git \u6062\u590D\u8BE5\u6587\u4EF6\u540E\u91CD\u8BD5\uFF1Bconfirm \u4E0D\u731C\u6D4B\u635F\u574F\u53F0\u8D26\u7684\u8BED\u4E49\uFF08\u5F62\u72B6\u95F8\u7981\u9759\u9ED8\u5FFD\u7565\u2014\u2014P-C1\uFF09\u3002", -1);
52204
+ }
52205
+ if (blockingJudgement.blocking.length > 0) {
52206
+ const blocking = new Set(blockingJudgement.blocking);
52207
+ const ordered = [];
52208
+ for (const question of STACK_QUESTIONS) {
52209
+ const wordForm = unknownsWordForm(question.lane, question.key);
52210
+ if (blocking.delete(wordForm))
52211
+ ordered.push(wordForm);
52212
+ }
52213
+ for (const entry of ledger.entries) {
52214
+ if (blocking.delete(entry.wordForm))
52215
+ ordered.push(entry.wordForm);
52216
+ }
52217
+ return failBaselineConfirm("BASELINE_UNKNOWNS_REMAINING", `\u963B\u585E\u96C6\u672A\u9500\u8D26\uFF08${blockingJudgement.blocking.length} \u952E\uFF09\uFF1A${ordered.join("\u3001")}`, "\u963B\u585E\u952E\u9010\u952E\u56DE\u586B\uFF1ATTY \u91CD\u8DD1 pomaster init \u95EE\u5377\uFF08\u5DF2\u7B54\u952E\u5E42\u7B49\u4E0D\u91CD\u590D\u95EE\uFF09\u6216 pomaster baseline set --lane <lane> --key <key> --value <value>\uFF1B\u4E0D\u963B\u585E\u5F53\u524D\u589E\u91CF\u7684\u952E\u7531 Owner \u624B\u7F16 manifest \u767B\u8BB0\u8C41\u514D\uFF08\u7ED3\u6784\u5316\u884C applicability: NOT_APPLICABLE/DEFERRED + statement/classification\uFF09\u2014\u2014\u963B\u585E\u96C6\u6E05\u96F6\u540E\u518D confirm\u3002", unknownsRemaining);
51529
52218
  }
51530
52219
  const snapshot = await computeConfirmDigests(rootDir);
51531
52220
  if (!snapshot.ok) {
@@ -51703,7 +52392,7 @@ async function baselineGateErrors(rootDir) {
51703
52392
  {
51704
52393
  code: "BASELINE_NOT_CONFIRMED",
51705
52394
  message: `baseline \u672A\u786E\u8BA4${detail}\u2014\u2014\u9879\u76EE\u67B6\u6784\u672A\u7ECF Owner \u786E\u8BA4\uFF08confirm gate\uFF1AR-L\uFF09`,
51706
- hint: "pomaster baseline confirm\uFF08\u524D\u63D0\uFF1A14 unknowns \u5168\u9500\u8D26\uFF09\u2014\u2014\u786E\u8BA4\u8BB0\u5F55\u4E0E digest \u5FEB\u7167\u5199\u5165 baseline/manifest.yaml \u540E\u91CD\u8DD1 closeout\u3002"
52395
+ hint: "pomaster baseline confirm\uFF08\u524D\u63D0\uFF1A\u963B\u585E\u96C6\u6E05\u96F6\u2014\u2014\u8C41\u514D\u767B\u8BB0\u884C\u4E0D\u963B\u585E\uFF09\u2014\u2014\u786E\u8BA4\u8BB0\u5F55\u4E0E digest \u5FEB\u7167\u5199\u5165 baseline/manifest.yaml \u540E\u91CD\u8DD1 closeout\u3002"
51707
52396
  }
51708
52397
  ];
51709
52398
  }
@@ -51728,17 +52417,45 @@ async function baselineGateErrors(rootDir) {
51728
52417
  }
51729
52418
  return [];
51730
52419
  }
52420
+ async function readBaselineBlockingPresentation(rootDir) {
52421
+ const manifestFile = await readTextFile(`${rootDir}/${BASELINE_MANIFEST_RELATIVE}`);
52422
+ if (manifestFile.kind !== "ok")
52423
+ return { remaining: null };
52424
+ const stackValues = /* @__PURE__ */ new Map();
52425
+ for (const lane of BASELINE_LANES) {
52426
+ const loaded = await loadLaneStackValues(rootDir, lane);
52427
+ if (!loaded.ok)
52428
+ return { remaining: null };
52429
+ stackValues.set(lane, loaded.values);
52430
+ }
52431
+ const judgement = computeBlockingSet(parseUnknownLedger(manifestFile.text), stackValues);
52432
+ if (!judgement.ok)
52433
+ return { remaining: null };
52434
+ return { remaining: judgement.blocking.length, applicability_summary: judgement.applicability_counts };
52435
+ }
51731
52436
  async function readBaselineConfirmationPresentation(rootDir) {
51732
52437
  const read = await readBaselineConfirmation(rootDir);
51733
52438
  if (read.kind === "manifest-absent" || read.kind === "manifest-unreadable")
51734
52439
  return null;
52440
+ const blocking = await readBaselineBlockingPresentation(rootDir);
52441
+ const blockingFields = {
52442
+ blocking_remaining: blocking.remaining,
52443
+ ...blocking.applicability_summary !== void 0 ? { applicability_summary: blocking.applicability_summary } : {}
52444
+ };
51735
52445
  if (read.kind === "record-invalid") {
51736
- return { state: "unconfirmed", unknowns_remaining: read.unknowns_remaining, at_seq: null, drifted_files: [] };
52446
+ return {
52447
+ state: "unconfirmed",
52448
+ unknowns_remaining: read.unknowns_remaining,
52449
+ ...blockingFields,
52450
+ at_seq: null,
52451
+ drifted_files: []
52452
+ };
51737
52453
  }
51738
52454
  const driftedFiles = read.mismatches.map((mismatch) => `${mismatch.target}${mismatch.note !== null ? `\uFF08${mismatch.note}\uFF09` : ""}`);
51739
52455
  return {
51740
52456
  state: read.state,
51741
52457
  unknowns_remaining: read.unknowns_remaining,
52458
+ ...blockingFields,
51742
52459
  at_seq: read.record.at_seq,
51743
52460
  drifted_files: driftedFiles,
51744
52461
  ...read.record.pending !== void 0 ? { pending_change: { change_ref: read.record.pending.change_ref, batch: read.record.pending.batch } } : {},
@@ -51746,7 +52463,7 @@ async function readBaselineConfirmationPresentation(rootDir) {
51746
52463
  };
51747
52464
  }
51748
52465
  function baselineConfirmationHumanLine(presentation) {
51749
- const unknowns = `unknowns remaining: ${presentation.unknowns_remaining}`;
52466
+ const unknowns = `unknowns remaining: ${presentation.unknowns_remaining}` + (presentation.blocking_remaining === null ? "\uFF08\u963B\u585E \u4E0D\u53EF\u5224\uFF09" : `\uFF08\u963B\u585E ${presentation.blocking_remaining}\uFF09`);
51750
52467
  if (presentation.state === "confirmed") {
51751
52468
  const ackNote = presentation.ack !== void 0 ? `\uFF1B\u4E0A\u6B21\u786E\u8BA4\u4E3A\u624B\u6539\u58F0\u660E\uFF08ack note: ${presentation.ack.note}\uFF09` : "";
51752
52469
  return ` baseline gate: \u5DF2\u786E\u8BA4\uFF08at_seq=${presentation.at_seq}${ackNote}\uFF1B${unknowns}\uFF09\u2014\u2014closeout \u6536\u53E3\u5224\u5377\u5728\u5EA7`;
@@ -51757,7 +52474,7 @@ function baselineConfirmationHumanLine(presentation) {
51757
52474
  if (presentation.state === "drifted") {
51758
52475
  return ` baseline gate: \u5DF2\u6F02\u79FB\uFF08at_seq=${presentation.at_seq}\uFF1B${presentation.drifted_files.length} \u6587\u4EF6\u4E0E\u786E\u8BA4\u5FEB\u7167\u4E0D\u7B26\uFF1A${presentation.drifted_files.join("\u3001")}\uFF09\u2014\u2014\u91CD\u786E\u8BA4: pomaster baseline confirm --change <CHANGE-id> \u6216 --ack-drifted --note "<\u7406\u7531>"\uFF08\u88F8\u91CD\u786E\u8BA4\u62D2\u7EDD\uFF1BAI \u4EE3\u8DD1 ack \u987B\u6301 Owner \u6307\u793A\uFF09`;
51759
52476
  }
51760
- return ` baseline gate: \u672A\u786E\u8BA4\uFF08${unknowns}\uFF09\u2014\u2014\u786E\u8BA4: pomaster baseline confirm\uFF0814 unknowns \u5168\u9500\u8D26\u540E\uFF09`;
52477
+ return ` baseline gate: \u672A\u786E\u8BA4\uFF08${unknowns}\uFF09\u2014\u2014\u786E\u8BA4: pomaster baseline confirm\uFF08\u963B\u585E\u96C6\u6E05\u96F6\u540E\uFF09`;
51761
52478
  }
51762
52479
  var BASELINE_CHANGE_ID_PATTERN = /^CHANGE\.[A-Za-z0-9][A-Za-z0-9_-]*$/;
51763
52480
  var BASELINE_CHANGE_ACTIVE_LIFECYCLES = ["PROPOSED", "CURRENT"];
@@ -53189,11 +53906,11 @@ async function runInit(rootDir, options = {}) {
53189
53906
  const packageObservation = await observePackageStack(rootDir);
53190
53907
  let observation = ZERO_OBSERVATION;
53191
53908
  if (packageObservation !== null) {
53192
- const applied = await applyStackObservations(rootDir, packageObservation, files);
53909
+ const registered = await registerStackObservationCandidates(rootDir, packageObservation);
53193
53910
  observation = {
53194
53911
  source: packageObservation.source,
53195
- observed: applied.observed,
53196
- skipped_resolved: applied.skipped_resolved
53912
+ observed: registered.observed,
53913
+ skipped_resolved: registered.skipped_resolved
53197
53914
  };
53198
53915
  }
53199
53916
  let baseline;
@@ -53312,7 +54029,7 @@ async function runInit(rootDir, options = {}) {
53312
54029
  }
53313
54030
  const entryLine = heavy ? " entry: \u91CD\u5165\u53E3\u9ED8\u8BA4\uFF08skills \u5E93 + hooks \u6CE8\u5165\uFF1B\u4FEE\u590D/\u91CD\u5EFA = \u91CD\u8DD1 pomaster init\uFF09" : " entry: \u6700\u5C0F\u5F62\u6001\uFF08--platforms none\uFF1A\u96F6\u5E73\u53F0\u4EA7\u7269\uFF0C\u65E0\u91CD\u5165\u53E3\u5B89\u88C5\u7269\uFF09";
53314
54031
  const baselineLine = renderBaselineQuizHumanLine(baseline);
53315
- const observationLine = observation.source === null ? " observation: package.json \u89C2\u5BDF\u9762\u7F3A\u5E2D\uFF08\u7F3A\u5E2D/\u4E0D\u53EF\u89E3\u6790\uFF09\u2014\u2014\u6280\u672F\u6808 UNKNOWN \u4FDD\u6301\uFF0C\u95EE\u5377\u5206\u6BCD\u4E0D\u53D7\u51CF" : ` observation: package.json \u2192 stack \u89C2\u5BDF\u56DE\u586B ${String(observation.observed)} \u952E\uFF08[Observed: package.json] \u6CE8\u8BB0\uFF1B${String(observation.skipped_resolved)} \u952E\u5DF2\u9500\u8D26\u8DF3\u8FC7\uFF09`;
54032
+ const observationLine = observation.source === null ? " observation: package.json \u89C2\u5BDF\u9762\u7F3A\u5E2D\uFF08\u7F3A\u5E2D/\u4E0D\u53EF\u89E3\u6790\uFF09\u2014\u2014\u6280\u672F\u6808 UNKNOWN \u4FDD\u6301\uFF0C\u95EE\u5377\u5206\u6BCD\u4E0D\u53D7\u51CF" : ` observation: package.json \u2192 \u89C2\u5BDF\u5019\u9009\u767B\u8BB0 ${String(observation.observed)} \u952E\uFF08[Observed: package.json] \u6CE8\u8BB0\u968F\u95EE\u5377\u5448\u73B0\uFF0Cadoption \u524D\u4E0D\u5165\u57FA\u7EBF\uFF1B${String(observation.skipped_resolved)} \u952E\u5DF2\u91C7\u7EB3\u5206\u8D26\u51FA\u5C40\uFF09`;
53316
54033
  const presetLine = renderBaselinePresetHumanLine(presetDraft);
53317
54034
  const human = [
53318
54035
  ...INIT_LOGO_LINES,
@@ -53456,7 +54173,7 @@ async function readCapabilityTipsEnabled(rootDir) {
53456
54173
  }
53457
54174
 
53458
54175
  // packages/cli/dist/next-action.js
53459
- import { existsSync as existsSync10, readdirSync as readdirSync16, readFileSync as readFileSync10 } from "node:fs";
54176
+ import { existsSync as existsSync11, readdirSync as readdirSync16, readFileSync as readFileSync11 } from "node:fs";
53460
54177
  import { join as join6 } from "node:path";
53461
54178
  var NEXT_ACTION_SNAPSHOT_INCOMPLETE = "NEXT_ACTION_SNAPSHOT_INCOMPLETE";
53462
54179
  var ACTIVE_LIFECYCLE_VALUES = ["PROPOSED", "CURRENT"];
@@ -53490,6 +54207,7 @@ function emptySnapshot(initialized) {
53490
54207
  task_execution_active: false,
53491
54208
  baseline_gate_codes: [],
53492
54209
  baseline_unknowns_remaining: null,
54210
+ baseline_blocking_remaining: null,
53493
54211
  baseline_pending_change_ref: null
53494
54212
  };
53495
54213
  }
@@ -53506,7 +54224,7 @@ function parseLedgerRow(row2) {
53506
54224
  };
53507
54225
  }
53508
54226
  function evidenceDirCounts(dir, pattern) {
53509
- if (!existsSync10(dir))
54227
+ if (!existsSync11(dir))
53510
54228
  return 0;
53511
54229
  let count = 0;
53512
54230
  try {
@@ -53594,7 +54312,7 @@ async function collectNextActionSnapshot(rootDir, warnings) {
53594
54312
  boundRefs = [...expiredBoundRefs, ...activeBoundRefs].sort();
53595
54313
  }
53596
54314
  const firstTask = activeTasks[0];
53597
- const taskManifestPresent = firstTask !== void 0 ? existsSync10(contextsManifestPath(rootDir, firstTask.id)) : false;
54315
+ const taskManifestPresent = firstTask !== void 0 ? existsSync11(contextsManifestPath(rootDir, firstTask.id)) : false;
53598
54316
  let taskManifestFreshness = "absent";
53599
54317
  let taskManifestRole = null;
53600
54318
  if (firstTask !== void 0 && taskManifestPresent) {
@@ -53682,6 +54400,7 @@ async function collectNextActionSnapshot(rootDir, warnings) {
53682
54400
  task_execution_active: taskExecutionActive,
53683
54401
  baseline_gate_codes: baselineGateCodeList,
53684
54402
  baseline_unknowns_remaining: baselinePresentation?.unknowns_remaining ?? null,
54403
+ baseline_blocking_remaining: baselinePresentation?.blocking_remaining ?? null,
53685
54404
  baseline_pending_change_ref: baselinePresentation?.pending_change?.change_ref ?? null
53686
54405
  };
53687
54406
  }
@@ -53694,7 +54413,7 @@ function scanTaskExecutionActive(rootDir, taskId, warnings) {
53694
54413
  if (taskId === void 0)
53695
54414
  return false;
53696
54415
  const dir = executionsDirPath(rootDir);
53697
- if (!existsSync10(dir))
54416
+ if (!existsSync11(dir))
53698
54417
  return false;
53699
54418
  let names;
53700
54419
  try {
@@ -53712,7 +54431,7 @@ function scanTaskExecutionActive(rootDir, taskId, warnings) {
53712
54431
  continue;
53713
54432
  let parsed;
53714
54433
  try {
53715
- parsed = JSON.parse(readFileSync10(join6(dir, name), "utf8"));
54434
+ parsed = JSON.parse(readFileSync11(join6(dir, name), "utf8"));
53716
54435
  } catch {
53717
54436
  warnings.push({
53718
54437
  code: NEXT_ACTION_SNAPSHOT_INCOMPLETE,
@@ -53769,12 +54488,13 @@ var NEXT_ACTION_ROUTE_TABLE = [
53769
54488
  })
53770
54489
  },
53771
54490
  {
53772
- // T2 R5:baseline 未确认(或已漂移)且 unknowns 全销账时,收口前的唯一缺口就是
53773
- // 确认仪式——此刻任何任务内推进(closeout 判卷会被 BASELINE_NOT_CONFIRMED/
53774
- // BASELINE_DRIFT 阻断)都先还这笔账。unknowns_remaining>0 时问卷分母未销账,
53775
- // 指 confirm 只会被 confirm 自身闸拒——不路由(诚实缺席)。
54491
+ // T2 R5 + P-C1 T13:baseline 未确认(或已漂移)且阻塞集清零时,收口前的唯一缺口
54492
+ // 就是确认仪式——此刻任何任务内推进(closeout 判卷会被 BASELINE_NOT_CONFIRMED/
54493
+ // BASELINE_DRIFT 阻断)都先还这笔账。判据 = blocking_remaining(§6.9):豁免登记行
54494
+ // 在册(unknowns 总口径 > 0 而阻塞 0)照常路由;阻塞键在册时指 confirm 只会被
54495
+ // confirm 自身闸拒——不路由(诚实缺席);null 不可判 fail-closed 不路由。
53776
54496
  id: "R_BASELINE_NOT_READY",
53777
- when: (s) => s.baseline_unknowns_remaining === 0 && (s.baseline_gate_codes.includes("BASELINE_NOT_CONFIRMED") || s.baseline_gate_codes.includes("BASELINE_DRIFT")) ? true : false,
54497
+ when: (s) => s.baseline_blocking_remaining === 0 && (s.baseline_gate_codes.includes("BASELINE_NOT_CONFIRMED") || s.baseline_gate_codes.includes("BASELINE_DRIFT")) ? true : false,
53778
54498
  render: (s) => {
53779
54499
  if (s.baseline_gate_codes.includes("BASELINE_DRIFT")) {
53780
54500
  return {
@@ -53793,7 +54513,7 @@ var NEXT_ACTION_ROUTE_TABLE = [
53793
54513
  return {
53794
54514
  beat: "0",
53795
54515
  command: "pomaster baseline confirm",
53796
- reason: "baseline \u672A\u786E\u8BA4\uFF08unknowns \u5DF2\u5168\u9500\u8D26\u2014\u2014\u786E\u8BA4\u662F\u552F\u4E00\u5269\u4F59\u7F3A\u53E3\uFF1Bcloseout \u5224\u5377\u4F1A\u88AB BASELINE_NOT_CONFIRMED \u963B\u65AD\uFF09"
54516
+ reason: "baseline \u672A\u786E\u8BA4\uFF08\u963B\u585E\u96C6\u5DF2\u6E05\u96F6\u2014\u2014\u786E\u8BA4\u662F\u552F\u4E00\u5269\u4F59\u7F3A\u53E3\uFF1Bcloseout \u5224\u5377\u4F1A\u88AB BASELINE_NOT_CONFIRMED \u963B\u65AD\uFF09"
53797
54517
  };
53798
54518
  }
53799
54519
  },
@@ -54875,7 +55595,7 @@ function runtimeStorePaths(store) {
54875
55595
  }
54876
55596
 
54877
55597
  // packages/cli/dist/view.js
54878
- import { existsSync as existsSync11, readFileSync as readFileSync11, readdirSync as readdirSync17 } from "node:fs";
55598
+ import { existsSync as existsSync12, readFileSync as readFileSync12, readdirSync as readdirSync17 } from "node:fs";
54879
55599
  import { join as join7 } from "node:path";
54880
55600
  init_dist();
54881
55601
 
@@ -55419,18 +56139,18 @@ async function runViewTask(rootDir, input) {
55419
56139
  var DECISION_GRAPH_SIDECAR_FILENAME = "decision-graph.json";
55420
56140
  function scanConflictReviewItems(rootDir) {
55421
56141
  const baseDir = discoveryScratchpadsDirPath(rootDir);
55422
- if (!existsSync11(baseDir))
56142
+ if (!existsSync12(baseDir))
55423
56143
  return { items: [] };
55424
56144
  const items = [];
55425
56145
  for (const dirent of readdirSync17(baseDir, { withFileTypes: true })) {
55426
56146
  if (!dirent.isDirectory())
55427
56147
  continue;
55428
56148
  const sidecarPath = join7(discoveryScratchpadDirPath(rootDir, dirent.name), DECISION_GRAPH_SIDECAR_FILENAME);
55429
- if (!existsSync11(sidecarPath))
56149
+ if (!existsSync12(sidecarPath))
55430
56150
  continue;
55431
56151
  let graph;
55432
56152
  try {
55433
- graph = JSON.parse(readFileSync11(sidecarPath, "utf8"));
56153
+ graph = JSON.parse(readFileSync12(sidecarPath, "utf8"));
55434
56154
  } catch (err) {
55435
56155
  return {
55436
56156
  error: {
@@ -55636,7 +56356,7 @@ async function runViewDecision(rootDir, input) {
55636
56356
  }, emptyResult6);
55637
56357
  }
55638
56358
  const padDir = discoveryScratchpadDirPath(rootDir, input.discoveryId);
55639
- if (!existsSync11(padDir)) {
56359
+ if (!existsSync12(padDir)) {
55640
56360
  return failView(command, {
55641
56361
  code: "SCRATCHPAD_NOT_FOUND",
55642
56362
  message: `scratchpad \u4E0D\u5B58\u5728: ${toPosix(`${DISCOVERY_SCRATCHPADS_RELATIVE}/${input.discoveryId}`)}`,
@@ -55644,7 +56364,7 @@ async function runViewDecision(rootDir, input) {
55644
56364
  }, emptyResult6);
55645
56365
  }
55646
56366
  const sidecarPath = join7(padDir, "decision-graph.json");
55647
- if (!existsSync11(sidecarPath)) {
56367
+ if (!existsSync12(sidecarPath)) {
55648
56368
  return failView(command, {
55649
56369
  code: "DECISION_GRAPH_NOT_FOUND",
55650
56370
  message: `scratchpad ${input.discoveryId} \u65E0 decision-graph sidecar\uFF08${toPosix(`${DISCOVERY_SCRATCHPADS_RELATIVE}/${input.discoveryId}/decision-graph.json`)} \u7F3A\u5E2D\uFF09`,
@@ -55653,7 +56373,7 @@ async function runViewDecision(rootDir, input) {
55653
56373
  }
55654
56374
  let graph;
55655
56375
  try {
55656
- graph = JSON.parse(readFileSync11(sidecarPath, "utf8"));
56376
+ graph = JSON.parse(readFileSync12(sidecarPath, "utf8"));
55657
56377
  } catch (err) {
55658
56378
  return failView(command, {
55659
56379
  code: "SCHEMA_INVALID",
@@ -57886,7 +58606,7 @@ ${" ".repeat(18)}note: ${row2.note}`}`)
57886
58606
 
57887
58607
  // packages/cli/dist/exec-guard.js
57888
58608
  init_dist();
57889
- import { readFileSync as readFileSync23 } from "node:fs";
58609
+ import { readFileSync as readFileSync24 } from "node:fs";
57890
58610
  import { readFile as readFile12 } from "node:fs/promises";
57891
58611
  function isFATALCode(err) {
57892
58612
  return typeof err === "object" && err !== null && (err.reason === "unknown_prefix" || err.reason === "grammar");
@@ -57963,7 +58683,7 @@ async function runExecGuard(rootDir, input) {
57963
58683
  let text;
57964
58684
  if (input.attempt === "-") {
57965
58685
  try {
57966
- text = readFileSync23(0, "utf8");
58686
+ text = readFileSync24(0, "utf8");
57967
58687
  } catch (err) {
57968
58688
  return malformed("ATTEMPT_MALFORMED", `stdin \u8BFB\u53D6\u5931\u8D25\uFF1A${err instanceof Error ? err.message : String(err)}`, "stdin \u5F62\u6001\u8981\u6C42\u7BA1\u9053\u4F20\u5165 attempt JSON\uFF08echo \u2026 | pomaster exec-guard --attempt -\uFF09\u3002");
57969
58689
  }
@@ -58135,9 +58855,1316 @@ async function runReconcile(rootDir, input) {
58135
58855
  ], [summary, ` hint: ${RECONCILE_DIRTY_HINT}`]);
58136
58856
  }
58137
58857
 
58858
+ // packages/cli/dist/recon.js
58859
+ init_dist2();
58860
+ init_dist();
58861
+ import { spawnSync as spawnSync14 } from "node:child_process";
58862
+ import { existsSync as existsSync19, mkdtempSync as mkdtempSync2, readdirSync as readdirSync19, readFileSync as readFileSync25, rmSync as rmSync12 } from "node:fs";
58863
+ import { tmpdir as tmpdir2 } from "node:os";
58864
+ import { join as join10, sep as sep2 } from "node:path";
58865
+ import { performance as performance21 } from "node:perf_hooks";
58866
+ var RECON_IMPORT_GRAPH_SENSOR_CAPABILITY = "SENSOR.BUILD.STATIC";
58867
+ var RECON_IMPORT_GRAPH_OPERATION = "scan_import_graph";
58868
+ var RECON_IMPORT_GRAPH_ADAPTER = "pomaster-cli";
58869
+ if (!SENSOR_ID_PATTERN.test(RECON_IMPORT_GRAPH_SENSOR_CAPABILITY)) {
58870
+ throw new Error(`RECON_IMPORT_GRAPH_SENSOR_CAPABILITY \u8BCD\u5F62\u6F02\u79FB\uFF08\u987B SENSOR.<DOMAIN>.<KIND>\uFF09\uFF1A${RECON_IMPORT_GRAPH_SENSOR_CAPABILITY}`);
58871
+ }
58872
+ var RECON_SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([
58873
+ ".ts",
58874
+ ".tsx",
58875
+ ".js",
58876
+ ".jsx",
58877
+ ".mjs",
58878
+ ".cjs",
58879
+ ".vue"
58880
+ ]);
58881
+ var RECON_SKIP_DIRS = /* @__PURE__ */ new Set([
58882
+ "node_modules",
58883
+ "dist",
58884
+ ".git",
58885
+ "coverage",
58886
+ ".pomaster"
58887
+ ]);
58888
+ var RECON_UNMAPPED_PRESENTATION_CAP = 20;
58889
+ function collectReconSourceFiles(rootDir, dir, out) {
58890
+ let entries;
58891
+ try {
58892
+ entries = readdirSync19(dir, { withFileTypes: true });
58893
+ } catch {
58894
+ return;
58895
+ }
58896
+ for (const entry of entries) {
58897
+ const full = join10(dir, entry.name);
58898
+ if (entry.isDirectory()) {
58899
+ if (RECON_SKIP_DIRS.has(entry.name))
58900
+ continue;
58901
+ collectReconSourceFiles(rootDir, full, out);
58902
+ continue;
58903
+ }
58904
+ if (!entry.isFile())
58905
+ continue;
58906
+ const dot = entry.name.lastIndexOf(".");
58907
+ if (dot === -1 || !RECON_SOURCE_EXTENSIONS.has(entry.name.slice(dot)))
58908
+ continue;
58909
+ const relative3 = full.slice(rootDir.length).split(sep2).join("/").replace(/^\//, "");
58910
+ out.push(relative3);
58911
+ }
58912
+ }
58913
+ function allocateObservationId(observationsDir) {
58914
+ let max = 0;
58915
+ let names;
58916
+ try {
58917
+ names = readdirSync19(observationsDir);
58918
+ } catch {
58919
+ names = [];
58920
+ }
58921
+ for (const name of names) {
58922
+ const match = /^OBS-([0-9]+)\.json$/.exec(name);
58923
+ if (match !== null) {
58924
+ const value = Number(match[1]);
58925
+ if (Number.isFinite(value) && value > max)
58926
+ max = value;
58927
+ }
58928
+ }
58929
+ return `OBS-${String(max + 1).padStart(4, "0")}`;
58930
+ }
58931
+ function emptyReconResult() {
58932
+ return {
58933
+ observation: null,
58934
+ observation_id: null,
58935
+ receipt_path: null,
58936
+ source_files: null,
58937
+ objects_resolved: null,
58938
+ external_imports: null,
58939
+ unmapped_count: null,
58940
+ confidence: null,
58941
+ captured_at_seq: null,
58942
+ report_blob: null,
58943
+ unmapped_stdout_capped: false
58944
+ };
58945
+ }
58946
+ function reconFail(error) {
58947
+ return failOutcome("recon import-graph", emptyReconResult(), [error], [`recon import-graph: FAILED \u2014 ${error.code}
58948
+ hint: ${error.hint}`]);
58949
+ }
58950
+ var RECON_EMPTY_MAPPING = {};
58951
+ function observationRecordOf(receipt) {
58952
+ return {
58953
+ record_type: "observation_receipt",
58954
+ ...receipt,
58955
+ artifact_refs: artifactRefsToSnake(receipt.artifact_refs)
58956
+ };
58957
+ }
58958
+ async function runReconImportGraph(rootDir, input) {
58959
+ const executionResolution = resolveExecutionId(input.executionId, void 0);
58960
+ if ("fail" in executionResolution || executionResolution.executionId === null) {
58961
+ return reconFail({
58962
+ code: "SCHEMA_INVALID",
58963
+ message: "fail" in executionResolution ? executionResolution.fail : `execution_id \u7F3A\u5E2D\uFF08OBS \u56DE\u6267 execution_id \u5FC5\u586B\u2014\u2014\xA76.13 \u8BC1\u660E\u4E49\u52A1\uFF09`,
58964
+ hint: "\u5148 pomaster execution begin \u767B\u8BB0\u6267\u884C\u8EAB\u4EFD\uFF08AGX-n\uFF09\uFF0C\u518D\u4EE5 --execution-id \u4F20\u5165\uFF08S1 \u7981\u81EA\u9020\u8EAB\u4EFD\uFF09\u3002"
58965
+ });
58966
+ }
58967
+ const executionId = executionResolution.executionId;
58968
+ const initialized = await requireInitialized(rootDir);
58969
+ if ("error" in initialized)
58970
+ return reconFail(initialized.error);
58971
+ if (!existsSync19(`${executionsDirPath(rootDir)}/${executionId}.json`)) {
58972
+ return reconFail({
58973
+ code: "EXECUTION_NOT_FOUND",
58974
+ message: `execution_id \u672A\u767B\u8BB0\uFF08executions/ \u6863\u6848\u7F3A\u5931\uFF09\uFF1A${executionId}`,
58975
+ hint: "\u5148 pomaster execution begin \u767B\u8BB0\u6267\u884C\u8EAB\u4EFD\uFF08.pomaster/executions/AGX-*.json \u662F\u8EAB\u4EFD\u552F\u4E00\u4E8B\u5B9E\u6E90\uFF09\uFF1B\u5DF2\u5C01\u53E3\u6267\u884C\u5141\u8BB8\u4E8B\u540E\u8865\u5F55\u3002"
58976
+ });
58977
+ }
58978
+ const paths = buildStorePaths(rootDir);
58979
+ const rawFiles = [];
58980
+ collectReconSourceFiles(rootDir, rootDir, rawFiles);
58981
+ rawFiles.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
58982
+ const files = [];
58983
+ const readFailures = [];
58984
+ for (const relative3 of rawFiles) {
58985
+ try {
58986
+ files.push({ path: relative3, content: readFileSync25(join10(rootDir, relative3), "utf8") });
58987
+ } catch (error) {
58988
+ readFailures.push(`${relative3}: unreadable (${error instanceof Error ? error.message : String(error)})`);
58989
+ }
58990
+ }
58991
+ if (files.length === 0) {
58992
+ try {
58993
+ const observationId = allocateObservationId(paths.observationsDir);
58994
+ const receipt = buildObservationReceipt({
58995
+ observationId,
58996
+ executionId,
58997
+ sensorCapability: RECON_IMPORT_GRAPH_SENSOR_CAPABILITY,
58998
+ adapter: RECON_IMPORT_GRAPH_ADAPTER,
58999
+ operation: RECON_IMPORT_GRAPH_OPERATION,
59000
+ surface: "STRUCTURAL_REALITY",
59001
+ result: "INCONCLUSIVE",
59002
+ capturedAtSeq: initialized.seq,
59003
+ artifactRefs: [],
59004
+ normalizedFacts: [
59005
+ "recon_surface: import-graph",
59006
+ "source_files: 0",
59007
+ "zero_denominator: true"
59008
+ ]
59009
+ });
59010
+ const persisted = persistObservationRecord(paths.evidenceDir, observationRecordOf(receipt));
59011
+ const receiptPath = `${POMASTER_DIR}/evidence/${persisted.relativePath}`;
59012
+ return failOutcome("recon import-graph", {
59013
+ ...emptyReconResult(),
59014
+ observation: "INCONCLUSIVE",
59015
+ observation_id: receipt.observation_id,
59016
+ receipt_path: receiptPath,
59017
+ source_files: 0,
59018
+ captured_at_seq: initialized.seq
59019
+ }, [
59020
+ {
59021
+ code: "RECON_INCONCLUSIVE",
59022
+ message: `\u96F6\u6E90\u6587\u4EF6\uFF08\u96F6\u5206\u6BCD\uFF09\u2014\u2014INCONCLUSIVE \u8D1F\u503C\u515C\u5E95\u843D\u8D26\uFF0C\u4E0D\u4F2A\u9020\u7EFF\uFF1A${receiptPath}`,
59023
+ hint: "\u679A\u4E3E\u95ED\u5305 .ts/.tsx/.js/.jsx/.mjs/.cjs/.vue\uFF08\u8DF3\u8FC7 node_modules/dist/.git/coverage/.pomaster\uFF09\u2014\u2014\u786E\u8BA4\u5BBF\u4E3B\u6E90\u7801\u6839\u975E\u7A7A\u540E\u91CD\u8DD1\uFF1B\u96F6\u5206\u6BCD\u7981\u5F53\u6EE1\u5206\u3002"
59024
+ }
59025
+ ], [
59026
+ "recon import-graph: INCONCLUSIVE \u2014 \u96F6\u6E90\u6587\u4EF6\uFF08\u96F6\u5206\u6BCD\u7981\u5F53\u6EE1\u5206\uFF0C\u4E0D\u4F2A\u9020\u7EFF\uFF09",
59027
+ `observation receipt: ${receiptPath}\uFF08result=INCONCLUSIVE\uFF1Bartifact_refs \u7A7A\u2014\u2014\u65E0\u62A5\u544A blob \u53EF\u80CC\u4E66\uFF09`,
59028
+ "\u679A\u4E3E\u95ED\u5305\uFF1A.ts/.tsx/.js/.jsx/.mjs/.cjs/.vue\uFF08\u8DF3\u8FC7 node_modules/dist/.git/coverage/.pomaster\uFF09"
59029
+ ]);
59030
+ } catch (error) {
59031
+ if (error instanceof GovernanceError)
59032
+ return reconFail(governanceErrorToCliError(error));
59033
+ throw error;
59034
+ }
59035
+ }
59036
+ try {
59037
+ const sourceSha = sha256OfCanonical(files.map((file) => ({ path: file.path, content: file.content })));
59038
+ const analysis = analyzeImportGraph({
59039
+ files,
59040
+ mapping: RECON_EMPTY_MAPPING,
59041
+ sourceSha
59042
+ });
59043
+ const reportBytes = Buffer.from(`${JSON.stringify({
59044
+ recon_surface: "import-graph",
59045
+ report: analysis.report,
59046
+ external_imports: analysis.externalImports,
59047
+ unmapped: analysis.unmapped,
59048
+ scanned_files: files.map((file) => file.path),
59049
+ source_read_failures: readFailures
59050
+ }, null, 2)}
59051
+ `, "utf8");
59052
+ const blob = persistEvidenceArtifact(paths.evidenceDir, { media: "json", bytes: reportBytes });
59053
+ const observationId = allocateObservationId(paths.observationsDir);
59054
+ const receipt = buildObservationReceipt({
59055
+ observationId,
59056
+ executionId,
59057
+ sensorCapability: RECON_IMPORT_GRAPH_SENSOR_CAPABILITY,
59058
+ adapter: RECON_IMPORT_GRAPH_ADAPTER,
59059
+ operation: RECON_IMPORT_GRAPH_OPERATION,
59060
+ surface: "STRUCTURAL_REALITY",
59061
+ result: "OBSERVED",
59062
+ capturedAtSeq: initialized.seq,
59063
+ artifactRefs: [
59064
+ {
59065
+ sha256: blob.sha256,
59066
+ media: blob.media,
59067
+ byteSize: blob.byteSize,
59068
+ storagePath: blob.storagePath
59069
+ }
59070
+ ],
59071
+ normalizedFacts: [
59072
+ "recon_surface: import-graph",
59073
+ `source_files: ${String(files.length)}`,
59074
+ `objects_resolved: ${String(analysis.report.objects_resolved)}`,
59075
+ `external_imports: ${String(analysis.externalImports)}`,
59076
+ `unmapped: ${String(analysis.unmapped.length)}`,
59077
+ `edge_proposals_not_registered: ${String(analysis.edges.length)}`,
59078
+ `confidence: ${analysis.report.confidence}`,
59079
+ ...readFailures.length > 0 ? [`source_read_failures: ${String(readFailures.length)}`] : []
59080
+ ]
59081
+ });
59082
+ const persisted = persistObservationRecord(paths.evidenceDir, observationRecordOf(receipt));
59083
+ const receiptPath = `${POMASTER_DIR}/evidence/${persisted.relativePath}`;
59084
+ const human = [
59085
+ `recon import-graph: OBSERVED \u2014 ${String(files.length)} \u4E2A\u6E90\u6587\u4EF6\uFF08confidence ${analysis.report.confidence}\uFF09`,
59086
+ `mapping \u547D\u4E2D\uFF08objects_resolved\uFF09: ${String(analysis.report.objects_resolved)} \u2014\u2014 mapping \u6052\u7A7A\uFF08\u8001\u9879\u76EE\u65E0 governed id \u5206\u6BCD\uFF1Bunmapped \u6E05\u5355\u5373\u4EA7\u51FA\uFF09`,
59087
+ `externalImports\uFF08\u88F8\u5305\u540D import \u8BA1\u6570\uFF09: ${String(analysis.externalImports)}`,
59088
+ `unmapped: ${String(analysis.unmapped.length)} \u6761\uFF08\u7981\u9759\u9ED8\u4E22\u5F03\uFF1B\u5B8C\u6574\u6E05\u5355\u89C1 report blob\uFF09`
59089
+ ];
59090
+ for (const row2 of analysis.unmapped.slice(0, RECON_UNMAPPED_PRESENTATION_CAP)) {
59091
+ human.push(` - ${row2.source} -> ${row2.specifier} (${row2.reason})`);
59092
+ }
59093
+ if (analysis.unmapped.length > RECON_UNMAPPED_PRESENTATION_CAP) {
59094
+ human.push(` \u2026\uFF08\u5176\u4F59 ${String(analysis.unmapped.length - RECON_UNMAPPED_PRESENTATION_CAP)} \u6761\u89C1 report blob ${blob.storagePath}\uFF09`);
59095
+ }
59096
+ human.push(`report blob: ${blob.storagePath}\uFF08${blob.sha256}\uFF1Bmedia=json\uFF09`);
59097
+ human.push(`observation receipt: ${receiptPath}\uFF08result=OBSERVED\uFF1Bsurface=STRUCTURAL_REALITY\uFF1Bcaptured_at_seq=${String(initialized.seq)}\uFF09`);
59098
+ human.push(`CALLS \u8FB9\u63D0\u6848 ${String(analysis.edges.length)} \u6761\u96F6\u843D\u76D8\uFF08\u767B\u8BB0\u5F52\u6D88\u8D39\u65B9 relations.registerRelation\u2014\u2014\u672C\u6279\u4E0D\u8C03\u7528\uFF09`);
59099
+ const warnings = [];
59100
+ if (readFailures.length > 0) {
59101
+ warnings.push({
59102
+ code: "RECON_SOURCE_UNREADABLE",
59103
+ message: `${String(readFailures.length)} \u4E2A\u767B\u8BB0\u5728\u518C\u7684\u6E90\u6587\u4EF6\u8BFB\u53D6\u5931\u8D25\uFF08\u5DF2\u62AB\u9732\u975E\u9759\u9ED8\u8DF3\u8FC7\uFF1B\u4E0D\u8BA1\u5165\u626B\u63CF\u5206\u6BCD\uFF09\uFF1A${readFailures.join("; ")}`,
59104
+ hint: "\u6838\u67E5\u6587\u4EF6\u6743\u9650/\u5360\u7528\u540E\u91CD\u8DD1\uFF1B\u8BFB\u5931\u8D25\u6E05\u5355\u5DF2\u968F report blob \u843D\u76D8\uFF08source_read_failures\uFF09\u3002"
59105
+ });
59106
+ }
59107
+ return okOutcome("recon import-graph", {
59108
+ observation: "OBSERVED",
59109
+ observation_id: receipt.observation_id,
59110
+ receipt_path: receiptPath,
59111
+ source_files: files.length,
59112
+ objects_resolved: analysis.report.objects_resolved,
59113
+ external_imports: analysis.externalImports,
59114
+ unmapped_count: analysis.unmapped.length,
59115
+ confidence: analysis.report.confidence,
59116
+ captured_at_seq: initialized.seq,
59117
+ report_blob: {
59118
+ sha256: blob.sha256,
59119
+ storage_path: blob.storagePath,
59120
+ byte_size: blob.byteSize
59121
+ },
59122
+ unmapped_stdout_capped: analysis.unmapped.length > RECON_UNMAPPED_PRESENTATION_CAP
59123
+ }, human, warnings);
59124
+ } catch (error) {
59125
+ if (error instanceof GovernanceError)
59126
+ return reconFail(governanceErrorToCliError(error));
59127
+ throw error;
59128
+ }
59129
+ }
59130
+ var RECON_MIGRATION_STACKS = [
59131
+ "prisma",
59132
+ "flyway",
59133
+ "liquibase",
59134
+ "alembic",
59135
+ "django_style"
59136
+ ];
59137
+ var RECON_MIGRATION_STACK_WORD_FORMS = {
59138
+ prisma: "prisma/migrations/ + migration_lock.toml + <14\u4F4D\u65F6\u95F4\u6233>_<name> \u5B50\u76EE\u5F55",
59139
+ flyway: "db/migration/ + V*__*.sql",
59140
+ liquibase: "db.changelog.{xml,yaml,json} + changelog \u76EE\u5F55",
59141
+ alembic: "alembic/versions/ + alembic.ini",
59142
+ django_style: "migrations/ \u76EE\u5F55\uFF08\u6392\u9664 prisma/migrations \u8BCD\u5F62\u2014\u2014\u540C\u4E00\u7269\u7406\u76EE\u5F55\u7981\u53CC\u6808\u53CC\u8BA1\uFF09"
59143
+ };
59144
+ var RECON_PRISMA_MIGRATION_DIR = /^[0-9]{14}_.+/;
59145
+ var RECON_FLYWAY_FILE = /^V.+__.+\.sql$/;
59146
+ var RECON_LIQUIBASE_MARKER_BASENAMES = /* @__PURE__ */ new Set([
59147
+ "db.changelog.xml",
59148
+ "db.changelog.yaml",
59149
+ "db.changelog.json"
59150
+ ]);
59151
+ var RECON_MIGRATIONS_SKIP_DIRS = /* @__PURE__ */ new Set([
59152
+ ...RECON_SKIP_DIRS,
59153
+ ".venv",
59154
+ "venv",
59155
+ "vendor",
59156
+ "target",
59157
+ "build"
59158
+ ]);
59159
+ function scanHostTree(rootDir) {
59160
+ const files = [];
59161
+ const dirs = [];
59162
+ const unreadableDirs = [];
59163
+ const walk = (dir, relative3) => {
59164
+ let entries;
59165
+ try {
59166
+ entries = readdirSync19(dir, { withFileTypes: true });
59167
+ } catch {
59168
+ unreadableDirs.push(relative3 === "" ? "." : relative3);
59169
+ return;
59170
+ }
59171
+ for (const entry of entries) {
59172
+ const full = join10(dir, entry.name);
59173
+ const rel = relative3 === "" ? entry.name : `${relative3}/${entry.name}`;
59174
+ if (entry.isDirectory()) {
59175
+ if (RECON_MIGRATIONS_SKIP_DIRS.has(entry.name))
59176
+ continue;
59177
+ dirs.push(rel);
59178
+ walk(full, rel);
59179
+ continue;
59180
+ }
59181
+ if (!entry.isFile())
59182
+ continue;
59183
+ files.push(rel);
59184
+ }
59185
+ };
59186
+ walk(rootDir, "");
59187
+ const byAsc = (a, b) => a < b ? -1 : a > b ? 1 : 0;
59188
+ return {
59189
+ files: [...files].sort(byAsc),
59190
+ dirs: [...dirs].sort(byAsc),
59191
+ unreadableDirs: [...unreadableDirs].sort(byAsc)
59192
+ };
59193
+ }
59194
+ function basenameOf(posixPath) {
59195
+ const index = posixPath.lastIndexOf("/");
59196
+ return index === -1 ? posixPath : posixPath.slice(index + 1);
59197
+ }
59198
+ function parentOf(posixPath) {
59199
+ const index = posixPath.lastIndexOf("/");
59200
+ return index === -1 ? "" : posixPath.slice(0, index);
59201
+ }
59202
+ function isSuffixWordForm(dirPath, wordForm) {
59203
+ return dirPath === wordForm || dirPath.endsWith(`/${wordForm}`);
59204
+ }
59205
+ function filesUnderDir(files, dirPrefix) {
59206
+ const prefix = `${dirPrefix}/`;
59207
+ return files.filter((file) => file.startsWith(prefix));
59208
+ }
59209
+ function sortedUnique(values) {
59210
+ return [...new Set(values)].sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
59211
+ }
59212
+ function detectMigrationStacks(scan) {
59213
+ const prismaRoots = scan.dirs.filter((dir) => isSuffixWordForm(dir, "prisma/migrations"));
59214
+ const prismaMarkers = scan.files.filter((file) => prismaRoots.includes(parentOf(file)) && basenameOf(file) === "migration_lock.toml");
59215
+ const prismaMigrationDirs = prismaRoots.flatMap((root) => scan.dirs.filter((dir) => dir.startsWith(`${root}/`) && RECON_PRISMA_MIGRATION_DIR.test(basenameOf(dir))));
59216
+ const prismaFiles = prismaMigrationDirs.flatMap((dir) => filesUnderDir(scan.files, dir));
59217
+ const flywayRoots = scan.dirs.filter((dir) => isSuffixWordForm(dir, "db/migration"));
59218
+ const flywayFiles = flywayRoots.flatMap((root) => filesUnderDir(scan.files, root).filter((file) => RECON_FLYWAY_FILE.test(basenameOf(file))));
59219
+ const liquibaseMarkers = scan.files.filter((file) => RECON_LIQUIBASE_MARKER_BASENAMES.has(basenameOf(file)));
59220
+ const liquibaseDirs = scan.dirs.filter((dir) => basenameOf(dir) === "changelog");
59221
+ const liquibaseFiles = liquibaseDirs.flatMap((dir) => filesUnderDir(scan.files, dir)).filter((file) => !liquibaseMarkers.includes(file));
59222
+ const alembicMarkers = scan.files.filter((file) => basenameOf(file) === "alembic.ini");
59223
+ const alembicVersionDirs = scan.dirs.filter((dir) => isSuffixWordForm(dir, "alembic/versions"));
59224
+ const alembicFiles = alembicVersionDirs.flatMap((dir) => filesUnderDir(scan.files, dir));
59225
+ const djangoDirs = scan.dirs.filter((dir) => basenameOf(dir) === "migrations" && !isSuffixWordForm(dir, "prisma/migrations"));
59226
+ const djangoFiles = djangoDirs.flatMap((dir) => filesUnderDir(scan.files, dir));
59227
+ const row2 = (stack, detected, migrationFiles, markerFiles) => ({
59228
+ stack,
59229
+ detected,
59230
+ migration_files: sortedUnique(migrationFiles),
59231
+ marker_files: sortedUnique(markerFiles)
59232
+ });
59233
+ return [
59234
+ row2("prisma", prismaRoots.length > 0, prismaFiles, prismaMarkers),
59235
+ row2("flyway", flywayRoots.length > 0, flywayFiles, []),
59236
+ row2("liquibase", liquibaseMarkers.length > 0 || liquibaseDirs.length > 0, liquibaseFiles, liquibaseMarkers),
59237
+ row2("alembic", alembicMarkers.length > 0 || alembicVersionDirs.length > 0, alembicFiles, alembicMarkers),
59238
+ row2("django_style", djangoDirs.length > 0, djangoFiles, [])
59239
+ ];
59240
+ }
59241
+ function allocateEnvironmentReceiptId(observationsDir) {
59242
+ let max = 0;
59243
+ let names;
59244
+ try {
59245
+ names = readdirSync19(observationsDir);
59246
+ } catch {
59247
+ names = [];
59248
+ }
59249
+ for (const name of names) {
59250
+ const match = /^ENVREC-([0-9]+)\.json$/.exec(name);
59251
+ if (match !== null) {
59252
+ const value = Number(match[1]);
59253
+ if (Number.isFinite(value) && value > max)
59254
+ max = value;
59255
+ }
59256
+ }
59257
+ return `ENVREC-${String(max + 1).padStart(4, "0")}`;
59258
+ }
59259
+ function emptyReconMigrationsResult() {
59260
+ return {
59261
+ observation: null,
59262
+ receipt_id: null,
59263
+ receipt_path: null,
59264
+ captured_at_seq: null,
59265
+ stacks: [],
59266
+ detected_stacks: null,
59267
+ scanned_files: null,
59268
+ scanned_dirs: null,
59269
+ unreadable_dirs: []
59270
+ };
59271
+ }
59272
+ function reconMigrationsFail(error) {
59273
+ return failOutcome("recon migrations", emptyReconMigrationsResult(), [error], [`recon migrations: FAILED \u2014 ${error.code}
59274
+ hint: ${error.hint}`]);
59275
+ }
59276
+ function scanDenominatorLine(scan) {
59277
+ return `\u626B\u63CF\u5206\u6BCD: ${String(scan.files.length)} \u6587\u4EF6/${String(scan.dirs.length)} \u76EE\u5F55\uFF08\u8DF3\u8FC7 node_modules/dist/.git/coverage/.pomaster + .venv/venv/vendor/target/build \u4F9D\u8D56\u4E0E\u6784\u5EFA\u4EA7\u7269\uFF09`;
59278
+ }
59279
+ function stackWordFormLines() {
59280
+ return RECON_MIGRATION_STACKS.map((stack) => ` - ${stack}: ${RECON_MIGRATION_STACK_WORD_FORMS[stack]}`);
59281
+ }
59282
+ function unreadableWarnings(scan) {
59283
+ if (scan.unreadableDirs.length === 0)
59284
+ return [];
59285
+ return [
59286
+ {
59287
+ code: "RECON_SCAN_UNREADABLE",
59288
+ message: `${String(scan.unreadableDirs.length)} \u4E2A\u76EE\u5F55\u4E0D\u53EF\u8BFB\uFF08\u5DF2\u62AB\u9732\u975E\u9759\u9ED8\u8DF3\u8FC7\uFF1B\u5176\u5185\u5BB9\u7F3A\u5E2D\u4E8E\u76D8\u70B9\u5206\u6BCD\uFF09\uFF1A${scan.unreadableDirs.join("; ")}`,
59289
+ hint: "\u6838\u67E5\u76EE\u5F55\u6743\u9650/\u5360\u7528\u540E\u91CD\u8DD1\uFF1B\u4E0D\u53EF\u8BFB\u6E05\u5355\u5DF2\u968F result.unreadable_dirs \u643A\u5E26\u3002"
59290
+ }
59291
+ ];
59292
+ }
59293
+ async function runReconMigrations(rootDir, input) {
59294
+ const executionResolution = resolveExecutionId(input.executionId, void 0);
59295
+ if ("fail" in executionResolution || executionResolution.executionId === null) {
59296
+ return reconMigrationsFail({
59297
+ code: "SCHEMA_INVALID",
59298
+ message: "fail" in executionResolution ? executionResolution.fail : `execution_id \u7F3A\u5E2D\uFF08ENVREC \u56DE\u6267 execution_id \u5FC5\u586B\u2014\u2014\xA76.7 \u901A\u8DEF\u951A\uFF09`,
59299
+ hint: "\u5148 pomaster execution begin \u767B\u8BB0\u6267\u884C\u8EAB\u4EFD\uFF08AGX-n\uFF09\uFF0C\u518D\u4EE5 --execution-id \u4F20\u5165\uFF08S1 \u7981\u81EA\u9020\u8EAB\u4EFD\uFF09\u3002"
59300
+ });
59301
+ }
59302
+ const executionId = executionResolution.executionId;
59303
+ const initialized = await requireInitialized(rootDir);
59304
+ if ("error" in initialized)
59305
+ return reconMigrationsFail(initialized.error);
59306
+ if (!existsSync19(`${executionsDirPath(rootDir)}/${executionId}.json`)) {
59307
+ return reconMigrationsFail({
59308
+ code: "EXECUTION_NOT_FOUND",
59309
+ message: `execution_id \u672A\u767B\u8BB0\uFF08executions/ \u6863\u6848\u7F3A\u5931\uFF09\uFF1A${executionId}`,
59310
+ hint: "\u5148 pomaster execution begin \u767B\u8BB0\u6267\u884C\u8EAB\u4EFD\uFF08.pomaster/executions/AGX-*.json \u662F\u8EAB\u4EFD\u552F\u4E00\u4E8B\u5B9E\u6E90\uFF09\uFF1B\u5DF2\u5C01\u53E3\u6267\u884C\u5141\u8BB8\u4E8B\u540E\u8865\u5F55\u3002"
59311
+ });
59312
+ }
59313
+ const paths = buildStorePaths(rootDir);
59314
+ const scan = scanHostTree(rootDir);
59315
+ const stacks = detectMigrationStacks(scan);
59316
+ const detectedStacks = stacks.filter((row2) => row2.detected).length;
59317
+ if (detectedStacks === 0) {
59318
+ return failOutcome("recon migrations", {
59319
+ ...emptyReconMigrationsResult(),
59320
+ observation: "NOT_RUN",
59321
+ stacks,
59322
+ detected_stacks: 0,
59323
+ scanned_files: scan.files.length,
59324
+ scanned_dirs: scan.dirs.length,
59325
+ unreadable_dirs: scan.unreadableDirs
59326
+ }, [
59327
+ {
59328
+ code: "RECON_MIGRATIONS_NOT_RUN",
59329
+ message: "\u4E94\u6808 migration \u8BCD\u5F62\u9762\u5168\u7F3A\u5E2D\uFF08prisma/flyway/liquibase/alembic/django_style\uFF09\u2014\u2014\u672C\u8DD1\u96F6\u76D8\u70B9\u4EA7\u51FA\uFF08\u4E0D\u4F2A\u9020\u7A7A\u8DD1\u7EFF\uFF09",
59330
+ hint: "\u82E5\u9879\u76EE\u786E\u6709 migration\uFF0C\u591A\u534A\u7ECF\u8BCD\u5F62\u9762\u5916\u6808\u627F\u8F7D\uFF08knex/typeorm/golang-migrate/rails db/migrate \u7B49\u2014\u2014\u672C\u6279\u6E05\u5355\u4E3A\u5C01\u95ED\u679A\u4E3E\uFF09\uFF1B\u7F3A\u5E2D = \u65E0\u76D8\u70B9\u4EA7\u51FA\uFF0C\u4E0D\u662F\u300C\u65E0 migration\u300D\u65AD\u8A00\u3002\u786E\u8BA4\u5BBF\u4E3B\u6839\u540E\u91CD\u8DD1\u3002"
59331
+ }
59332
+ ], [
59333
+ "recon migrations: NOT_RUN \u2014 \u4E94\u6808\u8BCD\u5F62\u9762\u5168\u7F3A\u5E2D\uFF08\u96F6\u76D8\u70B9\u4EA7\u51FA\uFF0C\u4E0D\u4F2A\u9020\u7A7A\u8DD1\u7EFF\uFF09",
59334
+ scanDenominatorLine(scan),
59335
+ ...stackWordFormLines(),
59336
+ "\u96F6\u843D\u76D8\uFF1A\u65E0 ENVREC \u56DE\u6267\u4EA7\u51FA\uFF08NOT_RUN \u65E0\u8DD1\u8BED\u4E49\u2014\u2014memory-harvest \u76EE\u5F55\u7F3A\u5E2D\u5148\u4F8B\u540C\u65CF\uFF09"
59337
+ ], unreadableWarnings(scan));
59338
+ }
59339
+ try {
59340
+ const receipt = buildEnvironmentReceipt({
59341
+ // observed 侧:repository_ref 是唯一诚实在场项(被盘点的 worktree 身份);
59342
+ // 其余六项实测未确认 → null 显式缺席(禁占位词冒充——Case H 诚实形态)。
59343
+ environment_ref: null,
59344
+ repository_ref: toPosix(rootDir),
59345
+ revision_ref: null,
59346
+ build_identity: null,
59347
+ runtime_instance: null,
59348
+ base_url: null,
59349
+ dataset_ref: null,
59350
+ auth_role: null,
59351
+ feature_flags: null
59352
+ }, executionId, "WRONG_OR_UNVERIFIED_INSTANCE");
59353
+ const recordId = allocateEnvironmentReceiptId(paths.observationsDir);
59354
+ const persisted = persistObservationRecord(paths.evidenceDir, { record_type: "environment_receipt", ...receipt }, { recordId });
59355
+ const receiptPath = `${POMASTER_DIR}/evidence/${persisted.relativePath}`;
59356
+ const human = [
59357
+ `recon migrations: OBSERVED \u2014 ${String(detectedStacks)}/${String(RECON_MIGRATION_STACKS.length)} \u6808\u8BCD\u5F62\u9762\u5728\u573A\uFF08ENVREC ${recordId}\uFF09`,
59358
+ scanDenominatorLine(scan)
59359
+ ];
59360
+ for (const row2 of stacks) {
59361
+ if (!row2.detected) {
59362
+ human.push(` ${row2.stack}: \u8BCD\u5F62\u7F3A\u5E2D\uFF08${RECON_MIGRATION_STACK_WORD_FORMS[row2.stack]}\uFF09`);
59363
+ continue;
59364
+ }
59365
+ const markerNote = row2.marker_files.length > 0 ? ` + ${String(row2.marker_files.length)} \u6807\u8BB0\uFF08${row2.marker_files.join(", ")}\uFF09` : "";
59366
+ human.push(` ${row2.stack}: \u547D\u4E2D \u2014 ${String(row2.migration_files.length)} migration \u5355\u5143${markerNote}`);
59367
+ for (const file of row2.migration_files)
59368
+ human.push(` - ${file}`);
59369
+ }
59370
+ human.push(`receipt: ${receiptPath}\uFF08record_type=environment_receipt\uFF1Bdoctor_verdict=WRONG_OR_UNVERIFIED_INSTANCE\u2014\u2014\u7EAF\u8BFB\u76D8\u76D8\u70B9\u4E0D\u786E\u8BA4 runtime \u5B9E\u4F8B\u8EAB\u4EFD\uFF0C\xA76.7 \u5B9E\u6D4B null \u539F\u6837\u4FDD\u7559\uFF09`);
59371
+ human.push("\u76D8\u70B9\u4E0D\u78B0 stack \u5206\u6BCD\uFF1A\u540E\u7AEF\u6808\u952E\u4ECD Owner \u95EE\u5377\u9762\uFF08\u96F6 stack.yaml \u5199\u53E3\u2014\u2014\u5B57\u8282\u5FEB\u7167\u6D4B\u8BD5\u9489\uFF09");
59372
+ human.push("\u4E94\u6808\u5206\u6BCD\u6052\u5168\u5448\u73B0\uFF1B\u8BCD\u5F62\u7F3A\u5E2D \u2260 migration \u7F3A\u5E2D\uFF08knex/typeorm/golang-migrate \u7B49\u8BCD\u5F62\u9762\u5916\u6808\u4E0D\u5728\u672C\u6279\u6E05\u5355\u2014\u2014\u76D8\u70B9\u662F\u8BCD\u5F62\u679A\u4E3E\u975E stack \u65AD\u8A00\uFF09");
59373
+ return okOutcome("recon migrations", {
59374
+ observation: "OBSERVED",
59375
+ receipt_id: recordId,
59376
+ receipt_path: receiptPath,
59377
+ captured_at_seq: initialized.seq,
59378
+ stacks,
59379
+ detected_stacks: detectedStacks,
59380
+ scanned_files: scan.files.length,
59381
+ scanned_dirs: scan.dirs.length,
59382
+ unreadable_dirs: scan.unreadableDirs
59383
+ }, human, unreadableWarnings(scan));
59384
+ } catch (error) {
59385
+ if (error instanceof GovernanceError)
59386
+ return reconMigrationsFail(governanceErrorToCliError(error));
59387
+ throw error;
59388
+ }
59389
+ }
59390
+ var RECON_SBOM_TOOL = "cdxgen";
59391
+ var RECON_SBOM_INSTALL_HINT = "npm install -g @cyclonedx/cdxgen\uFF08Apache-2.0\uFF09\u540E\u91CD\u8DD1\uFF1B\u6216\u786E\u8BA4 PATH \u542B cdxgen \u53EF\u6267\u884C\u4F53";
59392
+ var RECON_SBOM_SENSOR_CAPABILITY = "SENSOR.BUILD.STATIC";
59393
+ var RECON_SBOM_OPERATION = "scan_sbom";
59394
+ var RECON_SBOM_ADAPTER = "cdxgen";
59395
+ var RECON_SBOM_TIMEOUT_MS = 3e5;
59396
+ var CYCLONEDX_BOM_FORMAT = "CycloneDX";
59397
+ if (!SENSOR_ID_PATTERN.test(RECON_SBOM_SENSOR_CAPABILITY)) {
59398
+ throw new Error(`RECON_SBOM_SENSOR_CAPABILITY \u8BCD\u5F62\u6F02\u79FB\uFF08\u987B SENSOR.<DOMAIN>.<KIND>\uFF09\uFF1A${RECON_SBOM_SENSOR_CAPABILITY}`);
59399
+ }
59400
+ var reconSbomSpawn = (command, options) => {
59401
+ const startedAt = performance21.now();
59402
+ const res = spawnSync14(command, {
59403
+ shell: true,
59404
+ cwd: options.cwd,
59405
+ timeout: options.timeoutMs,
59406
+ encoding: "utf8",
59407
+ maxBuffer: SPAWN_MAX_BUFFER_BYTES,
59408
+ windowsHide: true,
59409
+ env: stripQuotesFromPathEnv({ ...process.env })
59410
+ });
59411
+ const externalMs = Math.max(0, Math.round(performance21.now() - startedAt));
59412
+ return {
59413
+ status: res.status,
59414
+ stdout: res.stdout ?? "",
59415
+ stderr: res.stderr ?? "",
59416
+ error: res.error?.message ?? null,
59417
+ externalMs
59418
+ };
59419
+ };
59420
+ function parseCycloneDxBom(bytes) {
59421
+ let root;
59422
+ try {
59423
+ root = JSON.parse(bytes.toString("utf8"));
59424
+ } catch {
59425
+ return null;
59426
+ }
59427
+ if (root === null || typeof root !== "object" || Array.isArray(root))
59428
+ return null;
59429
+ const record = root;
59430
+ if (record["bomFormat"] !== CYCLONEDX_BOM_FORMAT)
59431
+ return null;
59432
+ const specVersion = record["specVersion"];
59433
+ if (typeof specVersion !== "string" || /^[0-9]+\.[0-9]+/.test(specVersion) === false)
59434
+ return null;
59435
+ const components = record["components"];
59436
+ const dependencies = record["dependencies"];
59437
+ if (!Array.isArray(components) || !Array.isArray(dependencies))
59438
+ return null;
59439
+ return {
59440
+ bom_format: CYCLONEDX_BOM_FORMAT,
59441
+ spec_version: specVersion,
59442
+ components,
59443
+ dependencies
59444
+ };
59445
+ }
59446
+ function emptyReconSbomResult() {
59447
+ return {
59448
+ observation: null,
59449
+ observation_id: null,
59450
+ receipt_path: null,
59451
+ bom_format: null,
59452
+ spec_version: null,
59453
+ components: null,
59454
+ dependencies: null,
59455
+ tool_exit: null,
59456
+ tool_path: null,
59457
+ captured_at_seq: null,
59458
+ bom_blob: null
59459
+ };
59460
+ }
59461
+ function reconSbomFail(error) {
59462
+ return failOutcome("recon sbom", emptyReconSbomResult(), [error], [`recon sbom: FAILED \u2014 ${error.code}
59463
+ hint: ${error.hint}`]);
59464
+ }
59465
+ async function runReconSbom(rootDir, input) {
59466
+ const executionResolution = resolveExecutionId(input.executionId, void 0);
59467
+ if ("fail" in executionResolution || executionResolution.executionId === null) {
59468
+ return reconSbomFail({
59469
+ code: "SCHEMA_INVALID",
59470
+ message: "fail" in executionResolution ? executionResolution.fail : `execution_id \u7F3A\u5E2D\uFF08OBS \u56DE\u6267 execution_id \u5FC5\u586B\u2014\u2014\xA76.13 \u8BC1\u660E\u4E49\u52A1\uFF09`,
59471
+ hint: "\u5148 pomaster execution begin \u767B\u8BB0\u6267\u884C\u8EAB\u4EFD\uFF08AGX-n\uFF09\uFF0C\u518D\u4EE5 --execution-id \u4F20\u5165\uFF08S1 \u7981\u81EA\u9020\u8EAB\u4EFD\uFF09\u3002"
59472
+ });
59473
+ }
59474
+ const executionId = executionResolution.executionId;
59475
+ const initialized = await requireInitialized(rootDir);
59476
+ if ("error" in initialized)
59477
+ return reconSbomFail(initialized.error);
59478
+ if (!existsSync19(`${executionsDirPath(rootDir)}/${executionId}.json`)) {
59479
+ return reconSbomFail({
59480
+ code: "EXECUTION_NOT_FOUND",
59481
+ message: `execution_id \u672A\u767B\u8BB0\uFF08executions/ \u6863\u6848\u7F3A\u5931\uFF09\uFF1A${executionId}`,
59482
+ hint: "\u5148 pomaster execution begin \u767B\u8BB0\u6267\u884C\u8EAB\u4EFD\uFF08.pomaster/executions/AGX-*.json \u662F\u8EAB\u4EFD\u552F\u4E00\u4E8B\u5B9E\u6E90\uFF09\uFF1B\u5DF2\u5C01\u53E3\u6267\u884C\u5141\u8BB8\u4E8B\u540E\u8865\u5F55\u3002"
59483
+ });
59484
+ }
59485
+ const paths = buildStorePaths(rootDir);
59486
+ const probe = input.inject?.executableProbe ?? ((executable) => findExecutableOnPath(executable, platformDetectorFacts(rootDir)));
59487
+ const spawnFn = input.inject?.spawnFn ?? reconSbomSpawn;
59488
+ const toolPath = probe(RECON_SBOM_TOOL);
59489
+ if (toolPath === null) {
59490
+ return failOutcome("recon sbom", emptyReconSbomResult(), [
59491
+ {
59492
+ code: "RECON_SBOM_NOT_INSTALLED",
59493
+ message: `${RECON_SBOM_TOOL} \u4E0D\u5728 PATH\uFF08SBOM \u91C7\u96C6\u817F\u5DE5\u5177\u7F3A\u5E2D\u2014\u2014\u663E\u5F0F\u7F3A\u5E2D\u4E0D\u4F2A\u9020\u7A7A\u8DD1\uFF09`,
59494
+ hint: RECON_SBOM_INSTALL_HINT
59495
+ }
59496
+ ], [
59497
+ "recon sbom: NOT_INSTALLED \u2014 cdxgen \u4E0D\u5728 PATH\uFF08\u5DE5\u5177\u7F3A\u5E2D\u663E\u5F0F\u5448\u73B0\uFF0C\u4E0D\u4F2A\u9020\uFF09",
59498
+ `install: ${RECON_SBOM_INSTALL_HINT}`
59499
+ ]);
59500
+ }
59501
+ const tmpDir = mkdtempSync2(join10(tmpdir2(), "pomaster-recon-sbom-"));
59502
+ try {
59503
+ const outPath = join10(tmpDir, "bom.json");
59504
+ const command = `${RECON_SBOM_TOOL} -r -o "${outPath}" "${rootDir}"`;
59505
+ const run = spawnFn(command, { cwd: rootDir, timeoutMs: RECON_SBOM_TIMEOUT_MS });
59506
+ const stderrSnippet = run.stderr.trim().slice(0, 200);
59507
+ if (run.error !== null || run.status === null) {
59508
+ return failOutcome("recon sbom", { ...emptyReconSbomResult(), tool_exit: run.status, tool_path: toolPath }, [
59509
+ {
59510
+ code: "RECON_SBOM_NOT_RUN",
59511
+ message: `${RECON_SBOM_TOOL} \u5B50\u8FDB\u7A0B\u672A\u80FD\u6267\u884C\uFF08status=${String(run.status)}, error=${run.error ?? "unknown"}\uFF09\u2014\u2014\u5DE5\u5177\u6267\u884C\u5931\u8D25\u96F6\u843D\u76D8\uFF08\u4E0D\u4F2A\u9020\u7A7A\u8DD1\u7EFF\uFF09${stderrSnippet.length > 0 ? `\uFF1Bstderr \u6458\u5F55\uFF1A${stderrSnippet}` : ""}`,
59512
+ hint: "\u6838\u67E5 cdxgen \u53EF\u7528\u6027\uFF08cdxgen --version\uFF09\u540E\u91CD\u8DD1\uFF1B\u8D85\u65F6\u4E0A\u754C 300s\u2014\u2014\u5927\u578B\u4ED3\u53EF\u91CD\u8DD1\u4E00\u6B21\u6392\u9664\u5076\u53D1\u3002"
59513
+ }
59514
+ ], [
59515
+ `recon sbom: NOT_RUN \u2014 ${RECON_SBOM_TOOL} \u5B50\u8FDB\u7A0B\u672A\u80FD\u6267\u884C\uFF1B\u96F6\u843D\u76D8\u4E0D\u4F2A\u9020\u7A7A\u8DD1\u7EFF`,
59516
+ ...stderrSnippet.length > 0 ? [`stderr \u6458\u5F55: ${stderrSnippet}`] : []
59517
+ ]);
59518
+ }
59519
+ if (run.status !== 0) {
59520
+ return failOutcome("recon sbom", { ...emptyReconSbomResult(), tool_exit: run.status, tool_path: toolPath }, [
59521
+ {
59522
+ code: "RECON_SBOM_NOT_RUN",
59523
+ message: `${RECON_SBOM_TOOL} \u6267\u884C\u5931\u8D25\uFF08exit=${String(run.status)}\uFF09\u2014\u2014\u5DE5\u5177\u6267\u884C\u9519\u8BEF\u96F6\u843D\u76D8\uFF08\u4E0D\u4F2A\u9020\u7A7A\u8DD1\u7EFF\uFF09${stderrSnippet.length > 0 ? `\uFF1Bstderr \u6458\u5F55\uFF1A${stderrSnippet}` : ""}`,
59524
+ hint: "\u6838\u67E5 cdxgen \u53EF\u7528\u6027\uFF08cdxgen --version\uFF09\u4E0E\u5BBF\u4E3B\u9879\u76EE\u53EF\u8BFB\u6027\u540E\u91CD\u8DD1\uFF1B\u8D85\u65F6\u4E0A\u754C 300s\u3002"
59525
+ }
59526
+ ], [
59527
+ `recon sbom: NOT_RUN \u2014 ${RECON_SBOM_TOOL} exit ${String(run.status)}\uFF08\u5DE5\u5177\u6267\u884C\u9519\u8BEF\uFF09\uFF1B\u96F6\u843D\u76D8\u4E0D\u4F2A\u9020\u7A7A\u8DD1\u7EFF`,
59528
+ ...stderrSnippet.length > 0 ? [`stderr \u6458\u5F55: ${stderrSnippet}`] : []
59529
+ ]);
59530
+ }
59531
+ if (!existsSync19(outPath)) {
59532
+ return failOutcome("recon sbom", { ...emptyReconSbomResult(), tool_exit: run.status, tool_path: toolPath }, [
59533
+ {
59534
+ code: "RECON_SBOM_NOT_RUN",
59535
+ message: `${RECON_SBOM_TOOL} exit 0 \u4F46 BOM \u4EA7\u51FA\u6587\u4EF6\u7F3A\u5E2D\uFF08-o ${outPath} \u672A\u843D\u76D8\uFF09\u2014\u2014\u96F6\u89C2\u5BDF\u53EF\u505A\uFF0C\u96F6\u843D\u76D8\uFF08\u4E0D\u4F2A\u9020\u7A7A\u8DD1\u7EFF\uFF09`,
59536
+ hint: "\u6838\u67E5 cdxgen \u7248\u672C\u5BF9 `-r -o <file> <root>` \u8BCD\u5F62\u7684\u517C\u5BB9\u6027\u540E\u91CD\u8DD1\u3002"
59537
+ }
59538
+ ], [`recon sbom: NOT_RUN \u2014 exit 0 \u4F46 BOM \u4EA7\u51FA\u6587\u4EF6\u7F3A\u5E2D\uFF1B\u96F6\u843D\u76D8\u4E0D\u4F2A\u9020\u7A7A\u8DD1\u7EFF`]);
59539
+ }
59540
+ let bomBytes = null;
59541
+ try {
59542
+ bomBytes = readFileSync25(outPath);
59543
+ } catch {
59544
+ bomBytes = null;
59545
+ }
59546
+ const bom = bomBytes === null ? null : parseCycloneDxBom(bomBytes);
59547
+ if (bomBytes === null || bom === null) {
59548
+ const receipt2 = buildObservationReceipt({
59549
+ observationId: allocateObservationId(paths.observationsDir),
59550
+ executionId,
59551
+ sensorCapability: RECON_SBOM_SENSOR_CAPABILITY,
59552
+ adapter: RECON_SBOM_ADAPTER,
59553
+ operation: RECON_SBOM_OPERATION,
59554
+ surface: "STRUCTURAL_REALITY",
59555
+ result: "INCONCLUSIVE",
59556
+ capturedAtSeq: initialized.seq,
59557
+ artifactRefs: [],
59558
+ normalizedFacts: [
59559
+ "recon_surface: sbom",
59560
+ ...bomBytes === null ? ["bom_unreadable: true"] : ["bom_parse_failed: true", `bom_byte_size: ${String(bomBytes.length)}`],
59561
+ `tool_exit: ${String(run.status)}`,
59562
+ "stack_candidates_not_registered: true"
59563
+ ]
59564
+ });
59565
+ const persisted2 = persistObservationRecord(paths.evidenceDir, observationRecordOf(receipt2));
59566
+ const receiptPath2 = `${POMASTER_DIR}/evidence/${persisted2.relativePath}`;
59567
+ return failOutcome("recon sbom", {
59568
+ ...emptyReconSbomResult(),
59569
+ observation: "INCONCLUSIVE",
59570
+ observation_id: receipt2.observation_id,
59571
+ receipt_path: receiptPath2,
59572
+ tool_exit: run.status,
59573
+ tool_path: toolPath,
59574
+ captured_at_seq: initialized.seq
59575
+ }, [
59576
+ {
59577
+ code: "RECON_SBOM_INCONCLUSIVE",
59578
+ message: `BOM \u56DE\u8BFB\u5931\u8D25\uFF08${bomBytes === null ? "\u4EA7\u51FA\u6587\u4EF6\u4E0D\u53EF\u8BFB" : "\u89E3\u6790\u5931\u8D25/\u8BCD\u5F62\u6F02\u79FB"}\uFF09\u2014\u2014INCONCLUSIVE \u8D1F\u503C\u515C\u5E95\u843D\u8D26\uFF0C\u4E0D\u4F2A\u9020\u7EFF\uFF1A${receiptPath2}`,
59579
+ hint: "\u6838\u67E5 cdxgen \u7248\u672C\u4EA7\u51FA\u8BCD\u5F62\uFF08bomFormat=CycloneDX + specVersion + components[]/dependencies[] \u6570\u7EC4\u4F4D\uFF09\u540E\u91CD\u8DD1\uFF1B\u6B8B\u7F3A\u4EA7\u51FA\u4E0D\u6309\u9ED8\u8BA4\u503C\u8BA1\u6570\u3002"
59580
+ }
59581
+ ], [
59582
+ "recon sbom: INCONCLUSIVE \u2014 BOM \u56DE\u8BFB\u5931\u8D25\uFF08\u89E3\u6790\u5931\u8D25/\u8BCD\u5F62\u6F02\u79FB\uFF0C\u8D1F\u503C\u515C\u5E95\u843D\u8D26\u4E0D\u4F2A\u9020\u7EFF\uFF09",
59583
+ `observation receipt: ${receiptPath2}\uFF08result=INCONCLUSIVE\uFF1Bartifact_refs \u7A7A\u2014\u2014\u6B8B\u7F3A\u4EA7\u51FA\u4E0D\u662F\u8BC1\u636E\uFF0C\u65E0 blob \u53EF\u80CC\u4E66\uFF09`
59584
+ ]);
59585
+ }
59586
+ const blob = persistEvidenceArtifact(paths.evidenceDir, { media: "json", bytes: bomBytes });
59587
+ const observationId = allocateObservationId(paths.observationsDir);
59588
+ const receipt = buildObservationReceipt({
59589
+ observationId,
59590
+ executionId,
59591
+ sensorCapability: RECON_SBOM_SENSOR_CAPABILITY,
59592
+ adapter: RECON_SBOM_ADAPTER,
59593
+ operation: RECON_SBOM_OPERATION,
59594
+ surface: "STRUCTURAL_REALITY",
59595
+ result: "OBSERVED",
59596
+ capturedAtSeq: initialized.seq,
59597
+ artifactRefs: [
59598
+ {
59599
+ sha256: blob.sha256,
59600
+ media: blob.media,
59601
+ byteSize: blob.byteSize,
59602
+ storagePath: blob.storagePath
59603
+ }
59604
+ ],
59605
+ normalizedFacts: [
59606
+ "recon_surface: sbom",
59607
+ "bom_format: CycloneDX",
59608
+ `spec_version: ${bom.spec_version}`,
59609
+ `components: ${String(bom.components.length)}`,
59610
+ `dependencies: ${String(bom.dependencies.length)}`,
59611
+ `tool_exit: ${String(run.status)}`,
59612
+ "stack_candidates_not_registered: true"
59613
+ ]
59614
+ });
59615
+ const persisted = persistObservationRecord(paths.evidenceDir, observationRecordOf(receipt));
59616
+ const receiptPath = `${POMASTER_DIR}/evidence/${persisted.relativePath}`;
59617
+ const human = [
59618
+ `recon sbom: OBSERVED \u2014 CycloneDX BOM\uFF08specVersion ${bom.spec_version}\uFF1Bcomponents ${String(bom.components.length)} / dependencies ${String(bom.dependencies.length)}\uFF09`,
59619
+ `tool: ${RECON_SBOM_TOOL}\uFF08PATH \u547D\u4E2D: ${toolPath}\uFF1Bexit ${String(run.status)}\uFF09`,
59620
+ `bom blob: ${blob.storagePath}\uFF08${blob.sha256}\uFF1Bmedia=json\u2014\u2014cdxgen \u4EA7\u51FA\u539F\u6837\u5B57\u8282\u96F6\u6539\u5199\uFF09`,
59621
+ `observation receipt: ${receiptPath}\uFF08result=OBSERVED\uFF1Bsurface=STRUCTURAL_REALITY\uFF1Bcaptured_at_seq=${String(initialized.seq)}\uFF09`,
59622
+ "stack \u5019\u9009\u5316\u4E0D\u5728\u672C\u6279\uFF08Proposal \u524D\u7F6E\uFF09\uFF1A\u4EA7\u7269\u53EA\u5230 sidecar \u5448\u73B0\u2014\u2014\u96F6 StackObservationCandidate \u767B\u8BB0\u3001\u96F6 stack.yaml \u5199\u53E3\uFF08\u5B57\u8282\u5FEB\u7167\u6D4B\u8BD5\u9489\uFF09"
59623
+ ];
59624
+ return okOutcome("recon sbom", {
59625
+ observation: "OBSERVED",
59626
+ observation_id: receipt.observation_id,
59627
+ receipt_path: receiptPath,
59628
+ bom_format: bom.bom_format,
59629
+ spec_version: bom.spec_version,
59630
+ components: bom.components.length,
59631
+ dependencies: bom.dependencies.length,
59632
+ tool_exit: run.status,
59633
+ tool_path: toolPath,
59634
+ captured_at_seq: initialized.seq,
59635
+ bom_blob: {
59636
+ sha256: blob.sha256,
59637
+ storage_path: blob.storagePath,
59638
+ byte_size: blob.byteSize
59639
+ }
59640
+ }, human);
59641
+ } catch (error) {
59642
+ if (error instanceof GovernanceError)
59643
+ return reconSbomFail(governanceErrorToCliError(error));
59644
+ throw error;
59645
+ } finally {
59646
+ rmSync12(tmpDir, { recursive: true, force: true });
59647
+ }
59648
+ }
59649
+
59650
+ // packages/cli/dist/execution-audit.js
59651
+ init_dist2();
59652
+ init_dist();
59653
+ init_src();
59654
+ import { spawnSync as spawnSync15 } from "node:child_process";
59655
+ import { readdirSync as readdirSync20, readFileSync as readFileSync26, realpathSync, statSync as statSync5 } from "node:fs";
59656
+ import { join as join11, resolve as resolve2 } from "node:path";
59657
+ var EXECUTION_AUDIT_SENSOR_CAPABILITY = "SENSOR.BUILD.STATIC";
59658
+ var EXECUTION_AUDIT_OPERATION = "audit_mutation_scope";
59659
+ var EXECUTION_AUDIT_ADAPTER = "pomaster-cli";
59660
+ var EXECUTION_AUDIT_GIT_TIMEOUT_MS = 12e4;
59661
+ var EXECUTION_AUDIT_PRESENTATION_CAP = 20;
59662
+ var KEYBINDINGS_DIR_RELATIVE = `${TRUTH_OBJECTS_DIR_RELATIVE.replace(/\/objects$/, "")}/keybindings`;
59663
+ var KEYBINDING_ROW_ID_PATTERN = /^KEYBINDING\.[A-Z][A-Z0-9_]{0,31}\.[A-Z][A-Z0-9_]{0,31}(\.[A-Z][A-Z0-9_]{0,31})*$/;
59664
+ var KEYBINDING_OPERATION_ID_TOKEN_PATTERN = /^[A-Za-z][A-Za-z0-9_.-]*$/;
59665
+ if (!SENSOR_ID_PATTERN.test(EXECUTION_AUDIT_SENSOR_CAPABILITY)) {
59666
+ throw new Error(`EXECUTION_AUDIT_SENSOR_CAPABILITY \u8BCD\u5F62\u6F02\u79FB\uFF08\u987B SENSOR.<DOMAIN>.<KIND>\uFF09\uFF1A${EXECUTION_AUDIT_SENSOR_CAPABILITY}`);
59667
+ }
59668
+ function emptyExecutionAuditResult() {
59669
+ return {
59670
+ observation: null,
59671
+ observation_id: null,
59672
+ receipt_path: null,
59673
+ execution_id: null,
59674
+ diff_base: null,
59675
+ diff_base_resolved: null,
59676
+ captured_at_seq: null,
59677
+ changed_files: null,
59678
+ in_scope: null,
59679
+ out_of_scope: null,
59680
+ unmapped: null,
59681
+ excluded_skip_dirs: null,
59682
+ tracked_changed: null,
59683
+ untracked: null,
59684
+ binding_files: null,
59685
+ binding_rows: null,
59686
+ binding_rows_path_anchored: null,
59687
+ binding_rows_non_path: null,
59688
+ binding_rows_malformed: null,
59689
+ permits: null,
59690
+ permits_missing: null,
59691
+ out_of_scope_items: [],
59692
+ report_blob: null,
59693
+ out_of_scope_stdout_capped: false
59694
+ };
59695
+ }
59696
+ function executionAuditFail(error) {
59697
+ return failOutcome("execution audit", emptyExecutionAuditResult(), [error], [`execution audit: FAILED \u2014 ${error.code}
59698
+ hint: ${error.hint}`]);
59699
+ }
59700
+ function isPlainObject9(value) {
59701
+ return typeof value === "object" && value !== null && !Array.isArray(value);
59702
+ }
59703
+ function isRepoRelativePosixAnchor(value) {
59704
+ return value.length > 0 && !value.includes("\\") && !value.startsWith("/") && !/^[A-Za-z]:[\\/]/.test(value);
59705
+ }
59706
+ function loadKeybindingTable(rootDir) {
59707
+ const dir = join11(rootDir, ...KEYBINDINGS_DIR_RELATIVE.split("/"));
59708
+ let names;
59709
+ try {
59710
+ names = readdirSync20(dir).filter((name) => name.endsWith(".json")).sort();
59711
+ } catch {
59712
+ return { present: false, files: 0, rows: [], malformed: [] };
59713
+ }
59714
+ if (names.length === 0) {
59715
+ return { present: false, files: 0, rows: [], malformed: [] };
59716
+ }
59717
+ const rows = [];
59718
+ const malformed2 = [];
59719
+ for (const name of names) {
59720
+ const file = `${KEYBINDINGS_DIR_RELATIVE}/${name}`;
59721
+ let parsed;
59722
+ try {
59723
+ parsed = JSON.parse(readFileSync26(join11(dir, name), "utf8"));
59724
+ } catch (error) {
59725
+ malformed2.push({
59726
+ file,
59727
+ reason: `json_parse_failed (${error instanceof Error ? error.message : String(error)})`
59728
+ });
59729
+ continue;
59730
+ }
59731
+ if (!isPlainObject9(parsed)) {
59732
+ malformed2.push({ file, reason: "row_not_object" });
59733
+ continue;
59734
+ }
59735
+ const id = parsed["id"];
59736
+ const bindingClass = parsed["binding_class"];
59737
+ const canonicalId = parsed["canonical_id"];
59738
+ const physicalPath = parsed["physical_path"];
59739
+ const bindingStatus = parsed["binding_status"];
59740
+ if (typeof id !== "string" || !KEYBINDING_ROW_ID_PATTERN.test(id)) {
59741
+ malformed2.push({ file, reason: `id \u8BCD\u5F62\u975E\u6CD5\uFF08\u987B KEYBINDING.<DOMAIN>.<NAME> \u81F3\u5C11\u4E24\u6BB5\uFF09: ${JSON.stringify(id ?? null)}` });
59742
+ continue;
59743
+ }
59744
+ if (typeof bindingClass !== "string" || !BINDING_CLASS_VALUES.includes(bindingClass)) {
59745
+ malformed2.push({ file, reason: `binding_class \u8BCD\u8868\u5916: ${JSON.stringify(bindingClass ?? null)}` });
59746
+ continue;
59747
+ }
59748
+ if (typeof canonicalId !== "string") {
59749
+ malformed2.push({ file, reason: "canonical_id \u7F3A\u5E2D\u6216\u975E\u5B57\u7B26\u4E32" });
59750
+ continue;
59751
+ }
59752
+ try {
59753
+ parseGovernedId(canonicalId);
59754
+ } catch {
59755
+ malformed2.push({ file, reason: `canonical_id \u975E closed-world governed id: ${canonicalId}` });
59756
+ continue;
59757
+ }
59758
+ if (typeof physicalPath !== "string") {
59759
+ malformed2.push({ file, reason: "physical_path \u7F3A\u5E2D\u6216\u975E\u5B57\u7B26\u4E32" });
59760
+ continue;
59761
+ }
59762
+ if (bindingClass === "contract_operation_to_operationId") {
59763
+ if (!KEYBINDING_OPERATION_ID_TOKEN_PATTERN.test(physicalPath)) {
59764
+ malformed2.push({ file, reason: `operationId token \u8BCD\u5F62\u975E\u6CD5: ${JSON.stringify(physicalPath)}` });
59765
+ continue;
59766
+ }
59767
+ } else if (!isRepoRelativePosixAnchor(physicalPath)) {
59768
+ malformed2.push({ file, reason: `physical_path \u975E repo \u76F8\u5BF9 posix \u951A: ${JSON.stringify(physicalPath)}` });
59769
+ continue;
59770
+ }
59771
+ if (typeof bindingStatus !== "string" || !BINDING_STATUS_VALUES.includes(bindingStatus)) {
59772
+ malformed2.push({ file, reason: `binding_status \u8BCD\u8868\u5916: ${JSON.stringify(bindingStatus ?? null)}` });
59773
+ continue;
59774
+ }
59775
+ rows.push({ file, id, bindingClass, canonicalId, physicalPath, bindingStatus });
59776
+ }
59777
+ return { present: true, files: names.length, rows, malformed: malformed2 };
59778
+ }
59779
+ function bindingMatchesPath(row2, posixPath) {
59780
+ if (row2.bindingClass === "contract_operation_to_operationId")
59781
+ return false;
59782
+ if (row2.bindingClass === "capability_to_file")
59783
+ return row2.physicalPath === posixPath;
59784
+ return posixPath === row2.physicalPath || posixPath.startsWith(`${row2.physicalPath}/`);
59785
+ }
59786
+ function loadPermitScopes(rootDir, permitIds, currentSeq) {
59787
+ let raw;
59788
+ try {
59789
+ raw = readFileSync26(join11(rootDir, ...PERMITS_RELATIVE.split("/")), "utf8");
59790
+ } catch {
59791
+ return { scopes: [], missing: [...permitIds] };
59792
+ }
59793
+ let parsed;
59794
+ try {
59795
+ parsed = JSON.parse(raw);
59796
+ } catch (error) {
59797
+ return {
59798
+ error: {
59799
+ code: "SCHEMA_INVALID",
59800
+ message: `state/permits.json \u65E0\u6CD5\u89E3\u6790\uFF08\u635F\u574F\u6216\u624B\u6539\uFF09\uFF1A${error instanceof Error ? error.message : String(error)}`,
59801
+ hint: "\u8BB8\u53EF\u53F0\u8D26\u7531 kernel \u4E8B\u52A1\u7EF4\u62A4\uFF1B\u4ECE git \u6062\u590D\u540E\u91CD\u8BD5\u3002"
59802
+ }
59803
+ };
59804
+ }
59805
+ const record = isPlainObject9(parsed) ? parsed : null;
59806
+ const permits = record === null ? null : record["permits"];
59807
+ if (!Array.isArray(permits)) {
59808
+ return {
59809
+ error: {
59810
+ code: "SCHEMA_INVALID",
59811
+ message: "state/permits.json \u7ED3\u6784\u975E\u6CD5\uFF08permits \u975E\u6570\u7EC4\uFF09",
59812
+ hint: "\u8BB8\u53EF\u53F0\u8D26\u7531 kernel \u4E8B\u52A1\u7EF4\u62A4\uFF1B\u4ECE git \u6062\u590D\u540E\u91CD\u8BD5\u3002"
59813
+ }
59814
+ };
59815
+ }
59816
+ const scopes = [];
59817
+ const missing = [];
59818
+ for (const permitId of permitIds) {
59819
+ const row2 = permits.find((entry) => isPlainObject9(entry) && entry["permit_ref"] === permitId);
59820
+ if (row2 === void 0 || !isPlainObject9(row2)) {
59821
+ missing.push(permitId);
59822
+ continue;
59823
+ }
59824
+ const scope = row2["scope"];
59825
+ const subjectIdsRaw = isPlainObject9(scope) ? scope["subject_ids"] : void 0;
59826
+ const subjectIds = Array.isArray(subjectIdsRaw) ? subjectIdsRaw.filter((entry) => typeof entry === "string") : [];
59827
+ const stolenAtSeq = row2["stolen_at_seq"];
59828
+ const expiresAtSeq = row2["expires_at_seq"];
59829
+ const status = typeof stolenAtSeq === "number" ? "stolen" : typeof expiresAtSeq === "number" && currentSeq >= expiresAtSeq ? "expired" : "active";
59830
+ scopes.push({ permit_ref: permitId, subject_ids: subjectIds, status });
59831
+ }
59832
+ return { scopes, missing };
59833
+ }
59834
+ function judgeMutationScope(changedPaths, rows, scopes) {
59835
+ const pathAnchoredRows = rows.filter((row2) => row2.bindingClass !== "contract_operation_to_operationId");
59836
+ const scopeSurface = scopes.length === 0 ? "\u7A7A scope \u9762\uFF08execution \u65E0\u5728\u518C permit \u6216\u5F15\u7528\u672A\u89E3\u6790\u2014\u2014scope \u9762\u4E3A\u7A7A\uFF0C\u4EFB\u4F55\u6620\u5C04\u5747\u4E0D\u53EF\u6388\u4E88 in-scope\uFF09" : scopes.map((permit) => `${permit.permit_ref}[${permit.status}]`).join(", ");
59837
+ return changedPaths.map((path) => {
59838
+ const matched = pathAnchoredRows.filter((row2) => bindingMatchesPath(row2, path));
59839
+ if (matched.length === 0) {
59840
+ return {
59841
+ path,
59842
+ classification: "unmapped",
59843
+ mappings: [],
59844
+ basis: `unmapped\uFF1A\u65E0 KEYBINDING \u5728\u518C\u7ED1\u5B9A\u547D\u4E2D\uFF08path-anchored \u884C ${String(pathAnchoredRows.length)} \u884C\u5206\u6BCD\uFF09\u2014\u2014\u8BDA\u5B9E\u6E05\u5355\u975E\u9519\u8BEF\uFF08recon unmapped \u540C\u6B3E\u7981\u9759\u9ED8\u4E22\u5F03\uFF09`
59845
+ };
59846
+ }
59847
+ const mappings = matched.map((row2) => {
59848
+ const hit = scopes.find((permit) => permit.subject_ids.includes(row2.canonicalId));
59849
+ return {
59850
+ governed_id: row2.canonicalId,
59851
+ binding_id: row2.id,
59852
+ binding_class: row2.bindingClass,
59853
+ binding_status: row2.bindingStatus,
59854
+ in_scope: hit !== void 0,
59855
+ permit_ref: hit?.permit_ref ?? null,
59856
+ permit_status: hit?.status ?? null
59857
+ };
59858
+ });
59859
+ const inScope = mappings.some((mapping) => mapping.in_scope);
59860
+ const basis = inScope ? `in-scope\uFF1A${mappings.filter((mapping) => mapping.in_scope).map((mapping) => `${mapping.governed_id}\uFF08${mapping.binding_id}\xB7${mapping.binding_status}\uFF09\u2208 ${mapping.permit_ref}[${mapping.permit_status}] scope.subject_ids`).join("; ")}` : `out-of-scope\uFF1A${mappings.map((mapping) => `${mapping.governed_id}\uFF08${mapping.binding_id}\xB7${mapping.binding_status}\uFF09`).join("; ")} \u2209 ${scopeSurface}\u2014\u2014\u5224\u5B9A\u4F9D\u636E = kernel checkPermit scope.subject_ids \u6210\u5458\u5224\u636E`;
59861
+ return {
59862
+ path,
59863
+ classification: inScope ? "in_scope" : "out_of_scope",
59864
+ mappings,
59865
+ basis
59866
+ };
59867
+ });
59868
+ }
59869
+ function gitRun(rootDir, args) {
59870
+ const res = spawnSync15("git", [...args], {
59871
+ cwd: rootDir,
59872
+ timeout: EXECUTION_AUDIT_GIT_TIMEOUT_MS,
59873
+ maxBuffer: SPAWN_MAX_BUFFER_BYTES,
59874
+ encoding: "utf8",
59875
+ windowsHide: true
59876
+ });
59877
+ return {
59878
+ status: res.status,
59879
+ stdout: res.stdout ?? "",
59880
+ stderr: res.stderr ?? "",
59881
+ error: res.error?.message ?? null
59882
+ };
59883
+ }
59884
+ function splitNulList(stdout) {
59885
+ return stdout.split("\0").filter((entry) => entry.length > 0).map((entry) => toPosix(entry));
59886
+ }
59887
+ function pathHasSkippedSegment(posixPath) {
59888
+ return posixPath.split("/").some((segment) => RECON_SKIP_DIRS.has(segment));
59889
+ }
59890
+ function normalizedDirIdentity(path) {
59891
+ let resolved = path;
59892
+ try {
59893
+ resolved = realpathSync(path);
59894
+ } catch {
59895
+ resolved = resolve2(path);
59896
+ }
59897
+ return toPosix(resolved).toLowerCase().replace(/\/$/, "");
59898
+ }
59899
+ function sameDirectoryIdentity(a, b) {
59900
+ if (normalizedDirIdentity(a) === normalizedDirIdentity(b))
59901
+ return true;
59902
+ try {
59903
+ const sa = statSync5(a, { bigint: true });
59904
+ const sb = statSync5(b, { bigint: true });
59905
+ return sa.dev === sb.dev && sa.ino === sb.ino && sa.ino !== 0n;
59906
+ } catch {
59907
+ return false;
59908
+ }
59909
+ }
59910
+ async function runExecutionAudit(rootDir, input) {
59911
+ const executionResolution = resolveExecutionId(input.executionId, void 0);
59912
+ if ("fail" in executionResolution || executionResolution.executionId === null) {
59913
+ return executionAuditFail({
59914
+ code: "SCHEMA_INVALID",
59915
+ message: "fail" in executionResolution ? executionResolution.fail : `execution_id \u7F3A\u5E2D\uFF08OBS \u56DE\u6267 execution_id \u5FC5\u586B\u2014\u2014\xA76.13 \u8BC1\u660E\u4E49\u52A1\uFF09`,
59916
+ hint: "\u5148 pomaster execution begin \u767B\u8BB0\u6267\u884C\u8EAB\u4EFD\uFF08AGX-n\uFF09\uFF0C\u518D\u4EE5 --execution-id \u4F20\u5165\uFF08S1 \u7981\u81EA\u9020\u8EAB\u4EFD\uFF09\u3002"
59917
+ });
59918
+ }
59919
+ const executionId = executionResolution.executionId;
59920
+ const diffBase = typeof input.diffBase === "string" ? input.diffBase.trim() : "";
59921
+ if (diffBase.length === 0) {
59922
+ return executionAuditFail({
59923
+ code: "MUTATION_SCOPE_NO_ANCHOR",
59924
+ message: "--diff-base \u7F3A\u5E2D\uFF08git diff \u8D77\u59CB\u951A\u5FC5\u586B\u2014\u2014execution record \u5B9E\u8BFB\u786E\u8BA4\u65E0 ref/seq \u951A\u5B57\u6BB5\uFF0C\u951A\u7531\u8C03\u7528\u65B9\u7533\u62A5\uFF09",
59925
+ hint: "\u4EE5 execution begin \u65F6\u523B\u7684\u5DE5\u4F5C\u533A\u57FA\u7EBF ref\uFF08commit/branch/tag\uFF09\u4F20\u5165 --diff-base\uFF1B\u975E git \u5DE5\u4F5C\u533A\u5BA1\u8BA1\u4E0D\u53EF\u7528\uFF08PRD Out of Scope\uFF1A\u65E0\u7248\u672C\u951A\u663E\u5F0F\u62A5\u9519\uFF0C\u4E0D\u505A fs \u5FEB\u7167\u515C\u5E95\uFF09\u3002"
59926
+ });
59927
+ }
59928
+ const initialized = await requireInitialized(rootDir);
59929
+ if ("error" in initialized)
59930
+ return executionAuditFail(initialized.error);
59931
+ let executionRecord;
59932
+ try {
59933
+ executionRecord = readExecutionRecordById(buildStorePaths(rootDir), executionId);
59934
+ } catch (error) {
59935
+ if (error instanceof GovernanceError)
59936
+ return executionAuditFail(governanceErrorToCliError(error));
59937
+ throw error;
59938
+ }
59939
+ if (executionRecord === null) {
59940
+ return executionAuditFail({
59941
+ code: "EXECUTION_NOT_FOUND",
59942
+ message: `execution_id \u672A\u767B\u8BB0\uFF08executions/ \u6863\u6848\u7F3A\u5931\uFF09\uFF1A${executionId}`,
59943
+ hint: "\u5148 pomaster execution begin \u767B\u8BB0\u6267\u884C\u8EAB\u4EFD\uFF08.pomaster/executions/AGX-*.json \u662F\u8EAB\u4EFD\u552F\u4E00\u4E8B\u5B9E\u6E90\uFF09\uFF1B\u5DF2\u5C01\u53E3\u6267\u884C\u5141\u8BB8\u4E8B\u540E\u5BA1\u8BA1\u3002"
59944
+ });
59945
+ }
59946
+ const toplevel = gitRun(rootDir, ["rev-parse", "--show-toplevel"]);
59947
+ if (toplevel.error !== null || toplevel.status !== 0 || toplevel.stdout.trim().length === 0) {
59948
+ return executionAuditFail({
59949
+ code: "MUTATION_SCOPE_NOT_GIT_WORKTREE",
59950
+ message: `\u975E git \u5DE5\u4F5C\u533A\uFF08git rev-parse --show-toplevel \u5931\u8D25\uFF1A${toplevel.error ?? `exit ${String(toplevel.status)}`}\uFF09\u2014\u2014\u65E0\u7248\u672C\u951A\u5BA1\u8BA1\u4E0D\u53EF\u7528\uFF0C\u96F6\u843D\u76D8`,
59951
+ hint: "PRD Out of Scope\uFF1A\u975E git \u5DE5\u4F5C\u533A\u663E\u5F0F\u62A5\u9519\uFF0C\u4E0D\u505A fs \u5FEB\u7167\u515C\u5E95\uFF1B\u786E\u8BA4\u5BBF\u4E3B\u9879\u76EE\u4E3A git \u4ED3\u5E93\u540E\u91CD\u8DD1\u3002"
59952
+ });
59953
+ }
59954
+ if (!sameDirectoryIdentity(toplevel.stdout.trim(), rootDir)) {
59955
+ return executionAuditFail({
59956
+ code: "MUTATION_SCOPE_NOT_WORKTREE_ROOT",
59957
+ message: `store \u6839\u975E worktree \u6839\uFF08toplevel=${toPosix(toplevel.stdout.trim())} \u2260 root=${toPosix(resolve2(rootDir))}\uFF09\u2014\u2014diff \u8DEF\u5F84\u9762\u53EA\u5BF9 worktree \u6839\u6210\u7ACB\uFF0C\u7981\u8DEF\u5F84\u524D\u7F00\u63A8\u65AD`,
59958
+ hint: "\u5728 git worktree \u6839\uFF08.pomaster/ \u6240\u5728\u7684\u4ED3\u5E93\u6839\uFF09\u91CD\u8DD1\uFF1B\u5B50\u76EE\u5F55 store \u4E0D\u5728\u672C\u901A\u8DEF\u652F\u6301\u9762\u3002"
59959
+ });
59960
+ }
59961
+ const baseResolved = gitRun(rootDir, ["rev-parse", "--verify", "--quiet", diffBase]);
59962
+ const baseResolvedSha = baseResolved.stdout.trim();
59963
+ if (baseResolved.error !== null || baseResolved.status !== 0 || baseResolvedSha.length === 0) {
59964
+ return executionAuditFail({
59965
+ code: "MUTATION_SCOPE_BAD_BASE",
59966
+ message: `--diff-base \u65E0\u6CD5\u89E3\u6790\u4E3A\u5BF9\u8C61\uFF08git rev-parse --verify ${diffBase} \u5931\u8D25\uFF1A${baseResolved.error ?? `exit ${String(baseResolved.status)}`}\uFF09\u2014\u2014\u96F6\u843D\u76D8`,
59967
+ hint: "\u8D77\u59CB\u951A\u987B\u4E3A\u53EF\u89E3\u6790\u7684 commit/branch/tag\uFF08\u5982 execution begin \u65F6\u7684 HEAD sha\uFF09\uFF1Bgit rev-parse <ref> \u53EF\u5148\u884C\u4EBA\u5DE5\u5BF9\u8D26\u3002"
59968
+ });
59969
+ }
59970
+ const trackedRun = gitRun(rootDir, ["diff", "--name-only", "-z", baseResolvedSha]);
59971
+ if (trackedRun.error !== null || trackedRun.status !== 0) {
59972
+ return executionAuditFail({
59973
+ code: "MUTATION_SCOPE_GIT_FAILED",
59974
+ message: `git diff \u6536\u96C6\u5931\u8D25\uFF08exit=${String(trackedRun.status)}, error=${trackedRun.error ?? "unknown"}\uFF09\u2014\u2014diff \u9762\u4E0D\u53EF\u5F97\u96F6\u843D\u76D8${trackedRun.stderr.trim().length > 0 ? `\uFF1Bstderr \u6458\u5F55\uFF1A${trackedRun.stderr.trim().slice(0, 200)}` : ""}`,
59975
+ hint: "\u6838\u67E5 git \u53EF\u7528\u6027\u4E0E\u4ED3\u5E93\u5065\u5EB7\uFF08git status\uFF09\u540E\u91CD\u8DD1\uFF1B\u8D85\u65F6\u4E0A\u754C 120s\u3002"
59976
+ });
59977
+ }
59978
+ const untrackedRun = gitRun(rootDir, ["ls-files", "--others", "--exclude-standard", "-z"]);
59979
+ if (untrackedRun.error !== null || untrackedRun.status !== 0) {
59980
+ return executionAuditFail({
59981
+ code: "MUTATION_SCOPE_GIT_FAILED",
59982
+ message: `git ls-files \u6536\u96C6\u5931\u8D25\uFF08untracked \u9762\uFF1Bexit=${String(untrackedRun.status)}, error=${untrackedRun.error ?? "unknown"}\uFF09\u2014\u2014diff \u9762\u4E0D\u53EF\u5F97\u96F6\u843D\u76D8`,
59983
+ hint: "\u6838\u67E5 git \u53EF\u7528\u6027\u540E\u91CD\u8DD1\u3002"
59984
+ });
59985
+ }
59986
+ const trackedPaths = splitNulList(trackedRun.stdout);
59987
+ const untrackedPaths = splitNulList(untrackedRun.stdout);
59988
+ const merged = [.../* @__PURE__ */ new Set([...trackedPaths, ...untrackedPaths])];
59989
+ const excludedPaths = merged.filter((path) => pathHasSkippedSegment(path)).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
59990
+ const changedPaths = merged.filter((path) => !pathHasSkippedSegment(path)).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
59991
+ const table = loadKeybindingTable(rootDir);
59992
+ const permitLoad = loadPermitScopes(rootDir, executionRecord.permit_ids, initialized.seq);
59993
+ if ("error" in permitLoad)
59994
+ return executionAuditFail(permitLoad.error);
59995
+ const scopes = permitLoad.scopes;
59996
+ const missingPermits = permitLoad.missing;
59997
+ const judgments = judgeMutationScope(changedPaths, table.rows, scopes);
59998
+ const inScopeItems = judgments.filter((item) => item.classification === "in_scope");
59999
+ const outScopeItems = judgments.filter((item) => item.classification === "out_of_scope");
60000
+ const unmappedItems = judgments.filter((item) => item.classification === "unmapped");
60001
+ try {
60002
+ const storePaths = buildStorePaths(rootDir);
60003
+ const reportBytes = Buffer.from(`${JSON.stringify({
60004
+ audit_surface: "mutation-scope",
60005
+ execution_id: executionRecord.execution_id,
60006
+ execution_started_at: executionRecord.started_at,
60007
+ execution_ended_at: executionRecord.ended_at,
60008
+ diff_base: diffBase,
60009
+ diff_base_resolved: baseResolvedSha,
60010
+ counts: {
60011
+ tracked_changed: trackedPaths.length,
60012
+ untracked: untrackedPaths.length,
60013
+ changed_files: changedPaths.length,
60014
+ in_scope: inScopeItems.length,
60015
+ out_of_scope: outScopeItems.length,
60016
+ unmapped: unmappedItems.length,
60017
+ excluded_skip_dirs: excludedPaths.length,
60018
+ binding_files: table.files,
60019
+ binding_rows: table.rows.length,
60020
+ binding_rows_path_anchored: table.rows.filter((row2) => row2.bindingClass !== "contract_operation_to_operationId").length,
60021
+ binding_rows_non_path: table.rows.filter((row2) => row2.bindingClass === "contract_operation_to_operationId").length,
60022
+ binding_rows_malformed: table.malformed.length,
60023
+ permits: scopes.length,
60024
+ permits_missing: missingPermits.length
60025
+ },
60026
+ in_scope: inScopeItems,
60027
+ out_of_scope: outScopeItems,
60028
+ unmapped: unmappedItems,
60029
+ excluded_paths: excludedPaths,
60030
+ malformed_rows: table.malformed,
60031
+ binding_table_present: table.present,
60032
+ permits_view: scopes.map((permit) => ({
60033
+ permit_ref: permit.permit_ref,
60034
+ status: permit.status,
60035
+ subject_ids: permit.subject_ids
60036
+ }))
60037
+ }, null, 2)}
60038
+ `, "utf8");
60039
+ const blob = persistEvidenceArtifact(storePaths.evidenceDir, {
60040
+ media: "json",
60041
+ bytes: reportBytes
60042
+ });
60043
+ const observationId = allocateObservationId(storePaths.observationsDir);
60044
+ const receipt = buildObservationReceipt({
60045
+ observationId,
60046
+ executionId,
60047
+ sensorCapability: EXECUTION_AUDIT_SENSOR_CAPABILITY,
60048
+ adapter: EXECUTION_AUDIT_ADAPTER,
60049
+ operation: EXECUTION_AUDIT_OPERATION,
60050
+ surface: "STRUCTURAL_REALITY",
60051
+ result: "OBSERVED",
60052
+ capturedAtSeq: initialized.seq,
60053
+ artifactRefs: [
60054
+ {
60055
+ sha256: blob.sha256,
60056
+ media: blob.media,
60057
+ byteSize: blob.byteSize,
60058
+ storagePath: blob.storagePath
60059
+ }
60060
+ ],
60061
+ normalizedFacts: [
60062
+ "audit_surface: mutation-scope",
60063
+ `diff_base_resolved: ${baseResolvedSha}`,
60064
+ `tracked_changed: ${String(trackedPaths.length)}`,
60065
+ `untracked: ${String(untrackedPaths.length)}`,
60066
+ `changed_files: ${String(changedPaths.length)}`,
60067
+ `in_scope: ${String(inScopeItems.length)}`,
60068
+ `out_of_scope: ${String(outScopeItems.length)}`,
60069
+ `unmapped: ${String(unmappedItems.length)}`,
60070
+ `excluded_skip_dirs: ${String(excludedPaths.length)}`,
60071
+ `binding_rows: ${String(table.rows.length)}`,
60072
+ `binding_rows_malformed: ${String(table.malformed.length)}`,
60073
+ `permits: ${String(scopes.length)}`,
60074
+ `permits_missing: ${String(missingPermits.length)}`,
60075
+ ...changedPaths.length === 0 ? ["zero_diff: true"] : []
60076
+ ]
60077
+ });
60078
+ const persisted = persistObservationRecord(storePaths.evidenceDir, observationRecordOf(receipt));
60079
+ const receiptPath = `${POMASTER_DIR}/evidence/${persisted.relativePath}`;
60080
+ const human = [
60081
+ `execution audit: OBSERVED \u2014 \u53D8\u66F4\u6587\u4EF6 ${String(changedPaths.length)}\uFF08in ${String(inScopeItems.length)} / out ${String(outScopeItems.length)} / unmapped ${String(unmappedItems.length)}\uFF1Bexcluded ${String(excludedPaths.length)}\u2014\u2014node_modules/dist/.git/coverage/.pomaster \u6392\u9664\u95ED\u5305\uFF09`,
60082
+ `diff \u951A: ${diffBase} \u2192 ${baseResolvedSha}\uFF08execution ${executionRecord.execution_id} started_at=${executionRecord.started_at}\u2014\u2014\u951A\u7531\u8C03\u7528\u65B9\u7533\u62A5\uFF0Cexecution record \u65E0 ref/seq \u951A\u5B57\u6BB5\uFF09`
60083
+ ];
60084
+ if (outScopeItems.length > 0) {
60085
+ human.push(`\u8D8A\u754C\uFF08${String(outScopeItems.length)} \u9879\u2014\u2014\u53D8\u66F4\u8DEF\u5F84 \u2209 permit scope\uFF0C\u5904\u7F6E\u5F52 Owner\uFF09\uFF1A`);
60086
+ for (const item of outScopeItems.slice(0, EXECUTION_AUDIT_PRESENTATION_CAP)) {
60087
+ human.push(` - ${item.path} \u2014 ${item.basis}`);
60088
+ }
60089
+ if (outScopeItems.length > EXECUTION_AUDIT_PRESENTATION_CAP) {
60090
+ human.push(` \u2026\uFF08\u5176\u4F59 ${String(outScopeItems.length - EXECUTION_AUDIT_PRESENTATION_CAP)} \u6761\u89C1 report blob ${blob.storagePath}\uFF09`);
60091
+ }
60092
+ }
60093
+ if (unmappedItems.length > 0) {
60094
+ human.push(`unmapped\uFF08${String(unmappedItems.length)} \u6761\u2014\u2014\u65E0 KEYBINDING \u5728\u518C\u7ED1\u5B9A\u547D\u4E2D\uFF0C\u8BDA\u5B9E\u6E05\u5355\u975E\u9519\u8BEF${table.present ? "" : "\uFF1B\u672C\u5DE5\u4F5C\u533A\u65E0 KEYBINDING \u7ED1\u5B9A\u8868\uFF08\u5168 unmapped \u5408\u6CD5\u6001\uFF09"}\uFF09\uFF1A`);
60095
+ for (const item of unmappedItems.slice(0, EXECUTION_AUDIT_PRESENTATION_CAP)) {
60096
+ human.push(` - ${item.path}`);
60097
+ }
60098
+ if (unmappedItems.length > EXECUTION_AUDIT_PRESENTATION_CAP) {
60099
+ human.push(` \u2026\uFF08\u5176\u4F59 ${String(unmappedItems.length - EXECUTION_AUDIT_PRESENTATION_CAP)} \u6761\u89C1 report blob ${blob.storagePath}\uFF09`);
60100
+ }
60101
+ }
60102
+ human.push(`binding \u8868: ${String(table.files)} \u6587\u4EF6 / ${String(table.rows.length)} \u884C\uFF08path-anchored ${String(table.rows.length - table.rows.filter((row2) => row2.bindingClass === "contract_operation_to_operationId").length)} / non-path(operationId) ${String(table.rows.filter((row2) => row2.bindingClass === "contract_operation_to_operationId").length)} / malformed ${String(table.malformed.length)}${table.present ? "" : "\uFF1B\u76EE\u5F55\u7F3A\u5E2D=\u65E0\u8868"})`, `permit scope \u9762: ${String(scopes.length)} \u4E2A permit\uFF08${scopes.map((permit) => `${permit.permit_ref}:${permit.status}`).join(", ") || "\u65E0"}\uFF09+ missing ${String(missingPermits.length)}`, `report blob: ${blob.storagePath}\uFF08${blob.sha256}\uFF1Bmedia=json\u2014\u2014\u4E09\u5206\u7C7B\u5168\u91CF\u6E05\u5355/\u6392\u9664\u6E05\u5355/malformed \u884C\u8F7D\u4F53\uFF09`, `observation receipt: ${receiptPath}\uFF08result=OBSERVED\uFF1Bsurface=STRUCTURAL_REALITY\uFF1Bcaptured_at_seq=${String(initialized.seq)}\uFF09`, "\u96F6\u6743\u5A01\u5199\u53E3\uFF1A\u4EA7\u7269\u53EA\u843D evidence/{blobs,observations}/ sidecar\uFF08\u5B57\u8282\u5FEB\u7167\u6D4B\u8BD5\u9489\uFF09\uFF1B\u8D8A\u754C\u5448\u62A5\u4E0D\u963B\u65AD\u2014\u2014\u5904\u7F6E\u5F52 Owner\uFF08Detection \u534A\u8FB9\uFF09");
60103
+ const warnings = [];
60104
+ if (missingPermits.length > 0) {
60105
+ warnings.push({
60106
+ code: "PERMIT_REF_UNRESOLVED",
60107
+ message: `execution.permit_ids \u5F15\u7528\u7684 ${String(missingPermits.length)} \u4E2A permit \u672A\u5728\u53F0\u8D26\u89E3\u6790\uFF08scope \u9762\u6536\u7A84\u2014\u2014\u7F3A\u5931 scope \u4E0D\u6388\u4E88 in-scope\uFF09\uFF1A${missingPermits.join("; ")}`,
60108
+ hint: "\u6838\u67E5 execution begin --permit \u4E0E permit issue \u53F0\u8D26\uFF08state/permits.json\uFF09\u5BF9\u8D26\uFF1B\u5F15\u7528\u7F3A\u5931\u5C5E\u62AB\u9732\u975E\u653E\u884C\u3002"
60109
+ });
60110
+ }
60111
+ if (table.malformed.length > 0) {
60112
+ warnings.push({
60113
+ code: "KEYBINDING_ROW_MALFORMED",
60114
+ message: `${String(table.malformed.length)} \u4E2A KEYBINDING \u884C\u8BCD\u5F62\u6821\u9A8C\u5931\u8D25\uFF08\u5DF2\u62AB\u9732\u975E\u9759\u9ED8\u8DF3\u8FC7\uFF0C\u4E0D\u5165\u6620\u5C04\u5206\u6BCD\uFF09\uFF1A${table.malformed.map((row2) => row2.file).join("; ")}`,
60115
+ hint: "04-keybinding \u884C\u5BF9\u8C61\u8BCD\u5F62\u5951\u7EA6\u89C1 packages/schemas/assets/04-keybinding.schema.json\uFF1Bmalformed \u6E05\u5355\u5DF2\u968F report blob \u843D\u76D8\u3002"
60116
+ });
60117
+ }
60118
+ const result2 = {
60119
+ observation: "OBSERVED",
60120
+ observation_id: receipt.observation_id,
60121
+ receipt_path: receiptPath,
60122
+ execution_id: executionRecord.execution_id,
60123
+ diff_base: diffBase,
60124
+ diff_base_resolved: baseResolvedSha,
60125
+ captured_at_seq: initialized.seq,
60126
+ changed_files: changedPaths.length,
60127
+ in_scope: inScopeItems.length,
60128
+ out_of_scope: outScopeItems.length,
60129
+ unmapped: unmappedItems.length,
60130
+ excluded_skip_dirs: excludedPaths.length,
60131
+ tracked_changed: trackedPaths.length,
60132
+ untracked: untrackedPaths.length,
60133
+ binding_files: table.files,
60134
+ binding_rows: table.rows.length,
60135
+ binding_rows_path_anchored: table.rows.filter((row2) => row2.bindingClass !== "contract_operation_to_operationId").length,
60136
+ binding_rows_non_path: table.rows.filter((row2) => row2.bindingClass === "contract_operation_to_operationId").length,
60137
+ binding_rows_malformed: table.malformed.length,
60138
+ permits: scopes.length,
60139
+ permits_missing: missingPermits.length,
60140
+ out_of_scope_items: outScopeItems,
60141
+ report_blob: {
60142
+ sha256: blob.sha256,
60143
+ storage_path: blob.storagePath,
60144
+ byte_size: blob.byteSize
60145
+ },
60146
+ out_of_scope_stdout_capped: outScopeItems.length > EXECUTION_AUDIT_PRESENTATION_CAP
60147
+ };
60148
+ if (outScopeItems.length > 0) {
60149
+ return failOutcome("execution audit", result2, [
60150
+ {
60151
+ code: "MUTATION_SCOPE_OUT_OF_SCOPE",
60152
+ message: `\u8D8A\u754C\u53D8\u66F4 ${String(outScopeItems.length)} \u9879\uFF08execution ${executionRecord.execution_id} vs \u951A ${diffBase}\uFF09\uFF1A${outScopeItems.map((item) => item.path).join("; ")}`,
60153
+ hint: "\u8D8A\u754C\u660E\u7EC6\u89C1 stdout/result/report blob\uFF1B\u628A\u76EE\u6807\u5BF9\u8C61\u7EB3\u5165 permit \u8303\u56F4\u987B\u56DE FRAMEWORK LOCK \u91CD\u5BA1\u5347\u7EA7\uFF08D20\uFF09\uFF0C\u4E0D\u5F97\u65C1\u8DEF\u6269\u6743\u2014\u2014\u672C\u547D\u4EE4\u53EA\u89C2\u5BDF\u5448\u62A5\uFF0C\u5904\u7F6E\u5F52 Owner\u3002"
60154
+ }
60155
+ ], human, warnings);
60156
+ }
60157
+ return okOutcome("execution audit", result2, human, warnings);
60158
+ } catch (error) {
60159
+ if (error instanceof GovernanceError)
60160
+ return executionAuditFail(governanceErrorToCliError(error));
60161
+ throw error;
60162
+ }
60163
+ }
60164
+
58138
60165
  // packages/cli/dist/record.js
58139
60166
  init_dist();
58140
- import { existsSync as existsSync18, readFileSync as readFileSync24 } from "node:fs";
60167
+ import { existsSync as existsSync20, readFileSync as readFileSync27 } from "node:fs";
58141
60168
  function emptyGateRunResult() {
58142
60169
  return {
58143
60170
  grn: null,
@@ -58156,7 +60183,7 @@ function gateRunFail(error) {
58156
60183
  }
58157
60184
  function readFromBytes(path) {
58158
60185
  try {
58159
- return { bytes: readFileSync24(path, "utf8") };
60186
+ return { bytes: readFileSync27(path, "utf8") };
58160
60187
  } catch (err) {
58161
60188
  return {
58162
60189
  code: EVIDENCE_MALFORMED_CODE,
@@ -58238,7 +60265,7 @@ async function runRecordGateRun(rootDir, input) {
58238
60265
  });
58239
60266
  }
58240
60267
  const executionId = executionResolution.executionId;
58241
- if (executionId !== null && !existsSync18(`${executionsDirPath(rootDir)}/${executionId}.json`)) {
60268
+ if (executionId !== null && !existsSync20(`${executionsDirPath(rootDir)}/${executionId}.json`)) {
58242
60269
  return gateRunFail({
58243
60270
  code: "EXECUTION_NOT_FOUND",
58244
60271
  message: `execution_id \u672A\u767B\u8BB0\uFF08executions/ \u6863\u6848\u7F3A\u5931\uFF09\uFF1A${executionId}`,
@@ -58294,7 +60321,7 @@ async function runRecordGateRun(rootDir, input) {
58294
60321
  grn = input.grn;
58295
60322
  let targetBytes = null;
58296
60323
  try {
58297
- targetBytes = readFileSync24(`${runsDir}/${grn}.json`, "utf8");
60324
+ targetBytes = readFileSync27(`${runsDir}/${grn}.json`, "utf8");
58298
60325
  } catch {
58299
60326
  targetBytes = null;
58300
60327
  }
@@ -58489,7 +60516,7 @@ async function runRecordClaim(rootDir, input) {
58489
60516
  });
58490
60517
  }
58491
60518
  const executionId = executionResolution.executionId;
58492
- if (executionId !== null && !existsSync18(`${executionsDirPath(rootDir)}/${executionId}.json`)) {
60519
+ if (executionId !== null && !existsSync20(`${executionsDirPath(rootDir)}/${executionId}.json`)) {
58493
60520
  return claimFail({
58494
60521
  code: "EXECUTION_NOT_FOUND",
58495
60522
  message: `execution_id \u672A\u767B\u8BB0\uFF08executions/ \u6863\u6848\u7F3A\u5931\uFF09\uFF1A${executionId}`,
@@ -58516,7 +60543,7 @@ async function runRecordClaim(rootDir, input) {
58516
60543
  clm = input.clm;
58517
60544
  let targetBytes = null;
58518
60545
  try {
58519
- targetBytes = readFileSync24(`${claimsDir}/${clm}.json`, "utf8");
60546
+ targetBytes = readFileSync27(`${claimsDir}/${clm}.json`, "utf8");
58520
60547
  } catch {
58521
60548
  targetBytes = null;
58522
60549
  }
@@ -58630,7 +60657,7 @@ async function runRecordVerification(rootDir, input) {
58630
60657
  const claimPath = `${claimsDirPath(rootDir)}/${input.clm}.json`;
58631
60658
  let bytes = null;
58632
60659
  try {
58633
- bytes = readFileSync24(claimPath, "utf8");
60660
+ bytes = readFileSync27(claimPath, "utf8");
58634
60661
  } catch {
58635
60662
  bytes = null;
58636
60663
  }
@@ -58679,7 +60706,7 @@ async function runRecordVerification(rootDir, input) {
58679
60706
  });
58680
60707
  }
58681
60708
  const executionId = executionResolution.executionId;
58682
- if (executionId !== null && !existsSync18(`${executionsDirPath(rootDir)}/${executionId}.json`)) {
60709
+ if (executionId !== null && !existsSync20(`${executionsDirPath(rootDir)}/${executionId}.json`)) {
58683
60710
  return verificationFail({
58684
60711
  code: "EXECUTION_NOT_FOUND",
58685
60712
  message: `execution_id \u672A\u767B\u8BB0\uFF08executions/ \u6863\u6848\u7F3A\u5931\uFF09\uFF1A${executionId}`,
@@ -58737,9 +60764,9 @@ async function runRecordVerification(rootDir, input) {
58737
60764
  // packages/cli/dist/closeout.js
58738
60765
  init_dist();
58739
60766
  init_src();
58740
- import { readdirSync as readdirSync19 } from "node:fs";
60767
+ import { readdirSync as readdirSync21 } from "node:fs";
58741
60768
  import { readFile as readFile13 } from "node:fs/promises";
58742
- import { join as join10 } from "node:path";
60769
+ import { join as join12 } from "node:path";
58743
60770
  function emptyResult4(task) {
58744
60771
  return {
58745
60772
  task,
@@ -58804,7 +60831,7 @@ function grnOrdinal(grn) {
58804
60831
  var GRN_SIDECAR_PATTERN = /^GRN-[0-9]+(?:\..+)?$/;
58805
60832
  function listGrnSidecarFiles(runsDir) {
58806
60833
  try {
58807
- return readdirSync19(runsDir).filter((name) => GRN_SIDECAR_PATTERN.test(name) && !name.endsWith(".json")).sort();
60834
+ return readdirSync21(runsDir).filter((name) => GRN_SIDECAR_PATTERN.test(name) && !name.endsWith(".json")).sort();
58808
60835
  } catch {
58809
60836
  return [];
58810
60837
  }
@@ -58812,7 +60839,7 @@ function listGrnSidecarFiles(runsDir) {
58812
60839
  async function readRunRecord(runsDir, fileName) {
58813
60840
  let parsed;
58814
60841
  try {
58815
- parsed = JSON.parse(await readFile13(join10(runsDir, fileName), "utf8"));
60842
+ parsed = JSON.parse(await readFile13(join12(runsDir, fileName), "utf8"));
58816
60843
  } catch (err) {
58817
60844
  return { damage: `evidence/runs/${fileName}: JSON \u65E0\u6CD5\u89E3\u6790 \u2014 ${err instanceof Error ? err.message : String(err)}` };
58818
60845
  }
@@ -58833,7 +60860,7 @@ async function readRunRecord(runsDir, fileName) {
58833
60860
  async function readClaimRecord(claimsDir, fileName) {
58834
60861
  let bytes;
58835
60862
  try {
58836
- bytes = await readFile13(join10(claimsDir, fileName), "utf8");
60863
+ bytes = await readFile13(join12(claimsDir, fileName), "utf8");
58837
60864
  } catch {
58838
60865
  return { missing: true };
58839
60866
  }
@@ -58896,7 +60923,7 @@ async function runCloseout(rootDir, input) {
58896
60923
  hint: "change \u7684\u5B8C\u6210\u5224\u5377\u7ECF\u7531\u5176 affected TASKs \u9010\u4EFB\u52A1 closeout\uFF1Bkind \u8BCD\u5F62\u89C1 02b kind-payloads\u3002"
58897
60924
  }, withKind);
58898
60925
  }
58899
- const bodyPath = join10(rootDir, POMASTER_DIR, ...row2.bodyRef.split("/"));
60926
+ const bodyPath = join12(rootDir, POMASTER_DIR, ...row2.bodyRef.split("/"));
58900
60927
  let bodyRaw;
58901
60928
  try {
58902
60929
  bodyRaw = await readFile13(bodyPath, "utf8");
@@ -59033,7 +61060,7 @@ async function runCloseout(rootDir, input) {
59033
61060
  const claimsDirForSpec = claimsDirPath(rootDir);
59034
61061
  const specRows = index.objects.filter((row3) => row3.id.startsWith("SPEC."));
59035
61062
  for (const specRow of specRows) {
59036
- const specBodyPath = join10(rootDir, POMASTER_DIR, ...specRow.bodyRef.split("/"));
61063
+ const specBodyPath = join12(rootDir, POMASTER_DIR, ...specRow.bodyRef.split("/"));
59037
61064
  let specRaw;
59038
61065
  try {
59039
61066
  specRaw = await readFile13(specBodyPath, "utf8");
@@ -59418,8 +61445,8 @@ function kernelErrorOf2(err) {
59418
61445
 
59419
61446
  // packages/cli/dist/catalog.js
59420
61447
  init_dist();
59421
- import { writeFileSync as writeFileSync4 } from "node:fs";
59422
- import { join as join11 } from "node:path";
61448
+ import { writeFileSync as writeFileSync5 } from "node:fs";
61449
+ import { join as join13 } from "node:path";
59423
61450
  function emptyMaterial() {
59424
61451
  return {
59425
61452
  title_zh: null,
@@ -59637,7 +61664,7 @@ async function runCatalogRelock(deps) {
59637
61664
  try {
59638
61665
  catalogRoot = catalogRootOf(deps);
59639
61666
  report = relockCatalog(catalogRoot);
59640
- writeFileSync4(join11(catalogRoot, LOCK_FILE_NAME), `${JSON.stringify(report.next, null, 2)}
61667
+ writeFileSync5(join13(catalogRoot, LOCK_FILE_NAME), `${JSON.stringify(report.next, null, 2)}
59641
61668
  `, "utf8");
59642
61669
  verification = verifyCatalogLock(catalogRoot);
59643
61670
  } catch (error) {
@@ -59986,7 +62013,7 @@ async function runGraph(input) {
59986
62013
  }
59987
62014
 
59988
62015
  // packages/cli/dist/eval.js
59989
- import { existsSync as existsSync19, readFileSync as readFileSync25 } from "node:fs";
62016
+ import { existsSync as existsSync21, readFileSync as readFileSync28 } from "node:fs";
59990
62017
  import { fileURLToPath as fileURLToPath4 } from "node:url";
59991
62018
  init_dist();
59992
62019
  var EVAL_SUITES = ["behavioral"];
@@ -60007,7 +62034,7 @@ function loadSeeds(seedsPath = BEHAVIORAL_SEEDS_PATH) {
60007
62034
  if (lower.endsWith(".yaml") || lower.endsWith(".yml")) {
60008
62035
  throw new Error(`eval \u547D\u4EE4\u6D88\u8D39\u9762\u4E3A seeds.json\uFF0C\u4E0D\u63A5\u53D7 yaml \u8F7D\u7269\uFF08${seedsPath}\uFF09\u3002PRD \xA794.2 yaml \u8F7D\u7269\uFF08tests/behavioral/eval-cases.yaml\uFF09\u662F\u767B\u8BB0\u5F62\u6001\uFF1Aschema \u6821\u9A8C\u4E0E json \u540C\u6784\u951A\u5B9A\u5728 tests/behavioral/eval-carrier.spec.ts\uFF08js-yaml devDependency + ajv\uFF0Ctests \u9762\uFF09\uFF1B\u5224\u5377\u8BF7\u6CE8\u5165 seeds.json \u6216\u7701\u7565 seedsPath \u7528\u4ED3\u5E93\u7F3A\u7701\u8D26\u672C\u3002`);
60009
62036
  }
60010
- const raw = JSON.parse(readFileSync25(seedsPath, "utf8"));
62037
+ const raw = JSON.parse(readFileSync28(seedsPath, "utf8"));
60011
62038
  const file = raw;
60012
62039
  if (!Array.isArray(file.seeds)) {
60013
62040
  throw new Error(`seeds.json \u5F62\u6001\u975E\u6CD5\uFF1A\u7F3A seeds \u6570\u7EC4\uFF08${seedsPath}\uFF09`);
@@ -60267,7 +62294,7 @@ async function runEval(input) {
60267
62294
  ], [`eval: FAILED \u2014 EVAL_SUITE_UNKNOWN\uFF08${input.suite}\uFF09`]);
60268
62295
  }
60269
62296
  const seedsPath = input.seedsPath ?? BEHAVIORAL_SEEDS_PATH;
60270
- if (!existsSync19(seedsPath)) {
62297
+ if (!existsSync21(seedsPath)) {
60271
62298
  return failOutcome(command, { suite: input.suite, seeds_path: seedsPath, report: zeroReport() }, [
60272
62299
  {
60273
62300
  code: "SEEDS_NOT_AVAILABLE",
@@ -60578,7 +62605,7 @@ async function runAuditTask(rootDir, input) {
60578
62605
  init_dist();
60579
62606
  init_src();
60580
62607
  import { readFile as readFile15 } from "node:fs/promises";
60581
- import { join as join12 } from "node:path";
62608
+ import { join as join14 } from "node:path";
60582
62609
  async function runLedgerRecord(rootDir, input, deps) {
60583
62610
  const emptyResult6 = {
60584
62611
  ledger_ref: "",
@@ -60667,7 +62694,7 @@ async function runLedgerRecord(rootDir, input, deps) {
60667
62694
  }
60668
62695
  async function runLedgerList(rootDir, input) {
60669
62696
  const classificationFilter = input.classification?.trim() ? input.classification.trim() : null;
60670
- const path = join12(rootDir, POMASTER_DIR, "state", "exception-ledger.json");
62697
+ const path = join14(rootDir, POMASTER_DIR, "state", "exception-ledger.json");
60671
62698
  let raw;
60672
62699
  try {
60673
62700
  raw = await readFile15(path, "utf8");
@@ -60756,31 +62783,31 @@ async function runLedgerList(rootDir, input) {
60756
62783
 
60757
62784
  // packages/cli/dist/knowledge.js
60758
62785
  init_dist();
60759
- import { existsSync as existsSync22 } from "node:fs";
60760
- import { join as join15 } from "node:path";
62786
+ import { existsSync as existsSync24 } from "node:fs";
62787
+ import { join as join17 } from "node:path";
60761
62788
 
60762
62789
  // packages/cli/dist/research.js
60763
62790
  init_src();
60764
62791
  init_dist();
60765
- import { existsSync as existsSync21 } from "node:fs";
62792
+ import { existsSync as existsSync23 } from "node:fs";
60766
62793
  import { mkdir as mkdir2, readFile as readFile17, readdir as readdir2, writeFile as writeFile5 } from "node:fs/promises";
60767
- import { join as join14 } from "node:path";
62794
+ import { join as join16 } from "node:path";
60768
62795
 
60769
62796
  // packages/cli/dist/brainstorm.js
60770
62797
  init_src();
60771
62798
  init_dist();
60772
- import { existsSync as existsSync20 } from "node:fs";
62799
+ import { existsSync as existsSync22 } from "node:fs";
60773
62800
  import { mkdir, readdir, readFile as readFile16, writeFile as writeFile4 } from "node:fs/promises";
60774
- import { isAbsolute, join as join13, relative as relative2, resolve as resolve2 } from "node:path";
62801
+ import { isAbsolute, join as join15, relative as relative2, resolve as resolve3 } from "node:path";
60775
62802
  var PROMOTE_TARGETS = ["CHANGE", "TASK"];
60776
62803
  function scratchpadRefOf(id) {
60777
62804
  return `.pomaster/discovery/scratchpads/${id}/`;
60778
62805
  }
60779
62806
  function stateFilePath(rootDir, id) {
60780
- return join13(discoveryScratchpadDirPath(rootDir, id), "state.json");
62807
+ return join15(discoveryScratchpadDirPath(rootDir, id), "state.json");
60781
62808
  }
60782
62809
  function metaFilePath(rootDir, id) {
60783
- return join13(discoveryScratchpadDirPath(rootDir, id), "meta.json");
62810
+ return join15(discoveryScratchpadDirPath(rootDir, id), "meta.json");
60784
62811
  }
60785
62812
  function cliError(err) {
60786
62813
  if (err instanceof GovernedIdParseError) {
@@ -60797,7 +62824,7 @@ function cliError(err) {
60797
62824
  };
60798
62825
  }
60799
62826
  async function readJsonFile(path) {
60800
- if (!existsSync20(path))
62827
+ if (!existsSync22(path))
60801
62828
  return null;
60802
62829
  try {
60803
62830
  return JSON.parse(await readFile16(path, "utf8"));
@@ -60872,7 +62899,7 @@ async function runBrainstormStart(rootDir, input) {
60872
62899
  ], [`brainstorm start: FAILED \u2014 id \u8BCD\u5F62\u975E\u6CD5\uFF08${id}\uFF09`]);
60873
62900
  }
60874
62901
  if (id === void 0) {
60875
- const existing = existsSync20(padsDir) ? await readdir(padsDir) : [];
62902
+ const existing = existsSync22(padsDir) ? await readdir(padsDir) : [];
60876
62903
  let seq2 = 1;
60877
62904
  while (existing.includes(`idea-${String(seq2).padStart(3, "0")}`))
60878
62905
  seq2 += 1;
@@ -60880,7 +62907,7 @@ async function runBrainstormStart(rootDir, input) {
60880
62907
  }
60881
62908
  const padDir = discoveryScratchpadDirPath(rootDir, id);
60882
62909
  const statePath = stateFilePath(rootDir, id);
60883
- if (existsSync20(padDir)) {
62910
+ if (existsSync22(padDir)) {
60884
62911
  const existingState = await readJsonFile(statePath);
60885
62912
  if (existingState !== null && typeof existingState === "object") {
60886
62913
  const file = existingState;
@@ -60969,7 +62996,7 @@ async function runBrainstormStart(rootDir, input) {
60969
62996
  }
60970
62997
  async function runBrainstormStatus(rootDir) {
60971
62998
  const padsDir = discoveryScratchpadsDirPath(rootDir);
60972
- if (!existsSync20(padsDir)) {
62999
+ if (!existsSync22(padsDir)) {
60973
63000
  return okOutcome("brainstorm status", { scratchpads: [] }, [
60974
63001
  "brainstorm status\uFF1A\u65E0\u6D3B\u8DC3 discovery\uFF08scratchpads \u76EE\u5F55\u4E0D\u5B58\u5728\u2014\u2014\u663E\u5F0F\u7A7A\uFF0C\u975E\u9759\u9ED8\uFF09",
60975
63002
  " \u5F00\u59CB\u4E00\u6B21\u8BA8\u8BBA\uFF1Apomaster brainstorm start [--ephemeral]"
@@ -61404,7 +63431,7 @@ async function runBrainstormPromote(rootDir, input) {
61404
63431
  let txPath = null;
61405
63432
  let txOutError = null;
61406
63433
  if (input.txOut !== void 0) {
61407
- const resolvedTx = resolve2(rootDir, input.txOut);
63434
+ const resolvedTx = resolve3(rootDir, input.txOut);
61408
63435
  const relPosix = relative2(rootDir, resolvedTx).split("\\").join("/");
61409
63436
  const escapes = relPosix.length === 0 || relPosix === ".." || relPosix.startsWith("../") || isAbsolute(relPosix);
61410
63437
  if (escapes) {
@@ -61434,7 +63461,7 @@ async function runBrainstormPromote(rootDir, input) {
61434
63461
  return fail6(txOutError, [`brainstorm promote: FAILED \u2014 SCHEMA_INVALID (--tx-out)`]);
61435
63462
  }
61436
63463
  if (txPath === null) {
61437
- txPath = join13(discoveryScratchpadDirPath(rootDir, input.discoveryId), "promote-tx.json");
63464
+ txPath = join15(discoveryScratchpadDirPath(rootDir, input.discoveryId), "promote-tx.json");
61438
63465
  }
61439
63466
  try {
61440
63467
  await mkdir(discoveryScratchpadDirPath(rootDir, input.discoveryId), { recursive: true });
@@ -61561,11 +63588,11 @@ var UNKNOWN_TRIAGE_KEYS = [
61561
63588
  ];
61562
63589
  var DECISION_GRAPH_FILENAME = "decision-graph.json";
61563
63590
  function decisionGraphPath(rootDir, id) {
61564
- return join13(discoveryScratchpadDirPath(rootDir, id), DECISION_GRAPH_FILENAME);
63591
+ return join15(discoveryScratchpadDirPath(rootDir, id), DECISION_GRAPH_FILENAME);
61565
63592
  }
61566
63593
  var DECISION_INPUTS_FILENAME = "decision-inputs.json";
61567
63594
  function decisionInputsPath(rootDir, id) {
61568
- return join13(discoveryScratchpadDirPath(rootDir, id), DECISION_INPUTS_FILENAME);
63595
+ return join15(discoveryScratchpadDirPath(rootDir, id), DECISION_INPUTS_FILENAME);
61569
63596
  }
61570
63597
  async function loadDecisionGraph(rootDir, id) {
61571
63598
  const graphPath = decisionGraphPath(rootDir, id);
@@ -62310,7 +64337,7 @@ async function resolveResearchHost(rootDir, hostOption) {
62310
64337
  }
62311
64338
  };
62312
64339
  }
62313
- if (!existsSync21(join14(rootDir, ...host.split("/")))) {
64340
+ if (!existsSync23(join16(rootDir, ...host.split("/")))) {
62314
64341
  return {
62315
64342
  error: {
62316
64343
  code: "RESEARCH_HOST_NOT_FOUND",
@@ -62322,7 +64349,7 @@ async function resolveResearchHost(rootDir, hostOption) {
62322
64349
  return { host };
62323
64350
  }
62324
64351
  const padsDir = discoveryScratchpadsDirPath(rootDir);
62325
- if (!existsSync21(padsDir)) {
64352
+ if (!existsSync23(padsDir)) {
62326
64353
  return {
62327
64354
  error: {
62328
64355
  code: "RESEARCH_HOST_NOT_FOUND",
@@ -62335,7 +64362,7 @@ async function resolveResearchHost(rootDir, hostOption) {
62335
64362
  const active = [];
62336
64363
  for (const id of entries) {
62337
64364
  try {
62338
- const raw = JSON.parse(await readFile17(join14(padsDir, id, "state.json"), "utf8"));
64365
+ const raw = JSON.parse(await readFile17(join16(padsDir, id, "state.json"), "utf8"));
62339
64366
  if (typeof raw.state === "string" && (raw.state === "DISCOVERY" || raw.state === "READY_TO_PROMOTE")) {
62340
64367
  active.push(id);
62341
64368
  }
@@ -62363,7 +64390,7 @@ async function resolveResearchHost(rootDir, hostOption) {
62363
64390
  return { host: `.pomaster/discovery/scratchpads/${active[0]}/` };
62364
64391
  }
62365
64392
  async function readIndexYaml(indexPath) {
62366
- if (!existsSync21(indexPath))
64393
+ if (!existsSync23(indexPath))
62367
64394
  return null;
62368
64395
  try {
62369
64396
  return JSON.parse(await readFile17(indexPath, "utf8"));
@@ -62450,11 +64477,11 @@ async function runResearchStart(rootDir, input) {
62450
64477
  const created = [];
62451
64478
  const skipped = [];
62452
64479
  try {
62453
- const researchDir = join14(rootDir, ...artifactRoot.split("/"));
64480
+ const researchDir = join16(rootDir, ...artifactRoot.split("/"));
62454
64481
  await mkdir2(researchDir, { recursive: true });
62455
64482
  for (const fileName of RESEARCH_ARTIFACT_FILES) {
62456
- const filePath = join14(researchDir, fileName);
62457
- if (existsSync21(filePath)) {
64483
+ const filePath = join16(researchDir, fileName);
64484
+ if (existsSync23(filePath)) {
62458
64485
  skipped.push(`${artifactRoot}${fileName}`);
62459
64486
  continue;
62460
64487
  }
@@ -62525,8 +64552,8 @@ async function runResearchList(rootDir, hostArg) {
62525
64552
  ], [`research list: FAILED \u2014 SCHEMA_INVALID`]);
62526
64553
  }
62527
64554
  const hostRef = normalizeDir(hostArg);
62528
- const hostDir = join14(rootDir, ...hostRef.split("/"));
62529
- if (!existsSync21(hostDir)) {
64555
+ const hostDir = join16(rootDir, ...hostRef.split("/"));
64556
+ if (!existsSync23(hostDir)) {
62530
64557
  return failOutcome("research list", { host_ref: hostRef, artifacts: [] }, [
62531
64558
  {
62532
64559
  code: "RESEARCH_HOST_NOT_FOUND",
@@ -62535,7 +64562,7 @@ async function runResearchList(rootDir, hostArg) {
62535
64562
  }
62536
64563
  ], [`research list: FAILED \u2014 RESEARCH_HOST_NOT_FOUND (${hostRef})`]);
62537
64564
  }
62538
- const indexPath = join14(hostDir, "research", "index.yaml");
64565
+ const indexPath = join16(hostDir, "research", "index.yaml");
62539
64566
  const index = await readIndexYaml(indexPath);
62540
64567
  const artifacts = [];
62541
64568
  if (index !== null) {
@@ -62592,8 +64619,8 @@ async function runResearchInspect(rootDir, researchId) {
62592
64619
  }
62593
64620
  ], [`research inspect: FAILED \u2014 SCHEMA_INVALID`]);
62594
64621
  }
62595
- const hostDir = join14(rootDir, ...hostRef.split("/"));
62596
- if (!existsSync21(hostDir)) {
64622
+ const hostDir = join16(rootDir, ...hostRef.split("/"));
64623
+ if (!existsSync23(hostDir)) {
62597
64624
  return failOutcome("research inspect", {
62598
64625
  research_id: researchId,
62599
64626
  artifact_root: artifactRoot,
@@ -62610,9 +64637,9 @@ async function runResearchInspect(rootDir, researchId) {
62610
64637
  }
62611
64638
  ], [`research inspect: FAILED \u2014 RESEARCH_HOST_NOT_FOUND (${hostRef})`]);
62612
64639
  }
62613
- const researchDir = join14(hostDir, "research");
62614
- const indexPath = join14(researchDir, "index.yaml");
62615
- if (!existsSync21(indexPath)) {
64640
+ const researchDir = join16(hostDir, "research");
64641
+ const indexPath = join16(researchDir, "index.yaml");
64642
+ if (!existsSync23(indexPath)) {
62616
64643
  return failOutcome("research inspect", {
62617
64644
  research_id: researchId,
62618
64645
  artifact_root: artifactRoot,
@@ -62666,7 +64693,7 @@ async function runResearchInspect(rootDir, researchId) {
62666
64693
  }
62667
64694
  const files = RESEARCH_ARTIFACT_FILES.map((f) => ({
62668
64695
  file: f,
62669
- present: existsSync21(join14(researchDir, f))
64696
+ present: existsSync23(join16(researchDir, f))
62670
64697
  }));
62671
64698
  const missing = files.filter((f) => !f.present).map((f) => f.file);
62672
64699
  const rawFindings = Array.isArray(index.findings) ? index.findings : [];
@@ -62775,8 +64802,8 @@ async function runResearchInspect(rootDir, researchId) {
62775
64802
  }, human, warnings);
62776
64803
  }
62777
64804
  async function scratchpadDiscoveryState(rootDir, id) {
62778
- const statePath = join14(discoveryScratchpadDirPath(rootDir, id), "state.json");
62779
- if (!existsSync21(statePath)) {
64805
+ const statePath = join16(discoveryScratchpadDirPath(rootDir, id), "state.json");
64806
+ if (!existsSync23(statePath)) {
62780
64807
  return {
62781
64808
  error: {
62782
64809
  code: "SCRATCHPAD_NOT_FOUND",
@@ -62824,7 +64851,7 @@ function requestsOfIndex(index) {
62824
64851
  async function mutateIndexRequests(indexPath, artifactRoot, hostRef, mutate) {
62825
64852
  let index;
62826
64853
  let created = false;
62827
- if (existsSync21(indexPath)) {
64854
+ if (existsSync23(indexPath)) {
62828
64855
  let parsed;
62829
64856
  try {
62830
64857
  parsed = JSON.parse(await readFile17(indexPath, "utf8"));
@@ -62851,7 +64878,7 @@ async function mutateIndexRequests(indexPath, artifactRoot, hostRef, mutate) {
62851
64878
  const changed = mutate(index);
62852
64879
  if (!changed && !created)
62853
64880
  return { created, changed: false };
62854
- await mkdir2(join14(indexPath, ".."), { recursive: true });
64881
+ await mkdir2(join16(indexPath, ".."), { recursive: true });
62855
64882
  await writeFile5(indexPath, `${JSON.stringify(index, null, 2)}
62856
64883
  `, "utf8");
62857
64884
  return { created, changed: true };
@@ -62920,9 +64947,9 @@ async function runResearchRequest(rootDir, input) {
62920
64947
  hint: `\u8DEF\u7531\u952E\u8BCD\u5F62\uFF1A${Object.keys(RESEARCH_MODE_ROUTE_HINTS).join(" | ")}\u3002`
62921
64948
  }, [`research request: FAILED \u2014 SCHEMA_INVALID (--gap)`]);
62922
64949
  }
62923
- const indexPath = join14(discoveryScratchpadDirPath(rootDir, input.discoveryId), "research", "index.yaml");
64950
+ const indexPath = join16(discoveryScratchpadDirPath(rootDir, input.discoveryId), "research", "index.yaml");
62924
64951
  let existingIndex = null;
62925
- if (existsSync21(indexPath)) {
64952
+ if (existsSync23(indexPath)) {
62926
64953
  try {
62927
64954
  existingIndex = JSON.parse(await readFile17(indexPath, "utf8"));
62928
64955
  } catch {
@@ -63165,7 +65192,7 @@ async function runResearchHandoff(rootDir, input) {
63165
65192
  }
63166
65193
  }
63167
65194
  }
63168
- const indexPath = join14(discoveryScratchpadDirPath(rootDir, input.discoveryId), "research", "index.yaml");
65195
+ const indexPath = join16(discoveryScratchpadDirPath(rootDir, input.discoveryId), "research", "index.yaml");
63169
65196
  const statusMap = /* @__PURE__ */ new Map();
63170
65197
  for (const id of handoff.answered_requests)
63171
65198
  statusMap.set(id, "answered");
@@ -63466,8 +65493,8 @@ async function loadResearchFinding(rootDir, researchId, findingNumber) {
63466
65493
  }
63467
65494
  };
63468
65495
  }
63469
- const indexPath = join15(rootDir, ...artifactRoot.split("/"), "index.yaml");
63470
- if (!existsSync22(indexPath)) {
65496
+ const indexPath = join17(rootDir, ...artifactRoot.split("/"), "index.yaml");
65497
+ if (!existsSync24(indexPath)) {
63471
65498
  return {
63472
65499
  error: {
63473
65500
  code: "RESEARCH_ARTIFACT_NOT_FOUND",
@@ -63682,7 +65709,7 @@ async function runKnowledgeDemote(rootDir, input, deps) {
63682
65709
 
63683
65710
  // packages/cli/dist/memory.js
63684
65711
  init_dist();
63685
- import { readFileSync as readFileSync26 } from "node:fs";
65712
+ import { readFileSync as readFileSync29 } from "node:fs";
63686
65713
  import { homedir as homedir3 } from "node:os";
63687
65714
  var [MEMORY_ENTRY_NOT_FOUND, MEMORY_ALREADY_REVIEWED, MEMORY_REVIEW_REQUIRED, MEMORY_ALREADY_PROMOTED, MEMORY_PROMOTE_OWNER_REQUIRED, MEMORY_CAPTURE_DUPLICATE, MEMORY_HARVEST_NOT_RUN] = MEMORY_CLI_ERROR_VALUES;
63688
65715
  function toCliError2(err, docSection) {
@@ -63751,7 +65778,7 @@ function readStdinText() {
63751
65778
  };
63752
65779
  }
63753
65780
  try {
63754
- return { text: readFileSync26(0, "utf8") };
65781
+ return { text: readFileSync29(0, "utf8") };
63755
65782
  } catch (err) {
63756
65783
  return {
63757
65784
  error: {
@@ -64329,7 +66356,7 @@ async function runMemoryAudit(rootDir, input) {
64329
66356
 
64330
66357
  // packages/cli/dist/production.js
64331
66358
  init_dist();
64332
- import { readFileSync as readFileSync27 } from "node:fs";
66359
+ import { readFileSync as readFileSync30 } from "node:fs";
64333
66360
  var [BAND_SCHEMA_INVALID, BAND_NOT_FOUND, OBSERVATION_NOT_EVALUABLE, CHALLENGE_REJECTED, EVIDENCE_NOT_FOUND] = PRODUCTION_CLI_ERROR_VALUES;
64334
66361
  var NO_AUTO_APPLY_NOTE = "\u5448\u62A5\u6001\u2014\u2014\u4E0D\u5F97\u81EA\u52A8\u5E94\u7528\uFF08PRD \xA790.4 L5695 \u9010\u5B57\uFF09\uFF1APOMASTER_SELF_IMPROVEMENT_CANDIDATE \u65E0\u4EFB\u4F55\u81EA\u52A8\u5E94\u7528\u901A\u8DEF\uFF0C\u300C\u5E94\u7528\u300D\u6C38\u8FDC\u662F\u4EBA/Owner \u7ECF\u6CBB\u7406\u9762\u7684\u663E\u5F0F\u52A8\u4F5C";
64335
66362
  function fail5(result2, command, error) {
@@ -64591,7 +66618,7 @@ async function runProductionEvaluate(rootDir, input) {
64591
66618
  const filePath = input.observationsFile.trim();
64592
66619
  let text;
64593
66620
  try {
64594
- text = readFileSync27(filePath, "utf8");
66621
+ text = readFileSync30(filePath, "utf8");
64595
66622
  } catch (err) {
64596
66623
  return fail5(empty, command, {
64597
66624
  code: OBSERVATION_NOT_EVALUABLE,
@@ -65175,7 +67202,7 @@ async function runTraceList(rootDir) {
65175
67202
 
65176
67203
  // packages/cli/dist/agents.js
65177
67204
  init_dist();
65178
- import { existsSync as existsSync23, readFileSync as readFileSync28, writeFileSync as writeFileSync5 } from "node:fs";
67205
+ import { existsSync as existsSync25, readFileSync as readFileSync31, writeFileSync as writeFileSync6 } from "node:fs";
65179
67206
  var GATEKEEPER_DRIFT_OBSERVED = "GATEKEEPER_DRIFT_OBSERVED";
65180
67207
  var SUPERVISOR_TRIGGER_OBSERVED = "SUPERVISOR_TRIGGER_OBSERVED";
65181
67208
  async function runAgentsStatus(rootDir, input = {}) {
@@ -65335,10 +67362,10 @@ var DISPATCH_PACK_WRITE_FAILED = "IO_WRITE_FAILED";
65335
67362
  async function referenceSection(rootDir, taskId, warnings) {
65336
67363
  const lines = [];
65337
67364
  const manifestPath = `${contextsDirPath(rootDir)}/${taskId}.context.json`;
65338
- if (existsSync23(manifestPath)) {
67365
+ if (existsSync25(manifestPath)) {
65339
67366
  let generatedAtSeq = null;
65340
67367
  try {
65341
- const parsed = JSON.parse(readFileSync28(manifestPath, "utf8"));
67368
+ const parsed = JSON.parse(readFileSync31(manifestPath, "utf8"));
65342
67369
  const seq2 = isRecord6(parsed) ? parsed.generated_at_seq : void 0;
65343
67370
  if (typeof seq2 === "number")
65344
67371
  generatedAtSeq = seq2;
@@ -65499,7 +67526,7 @@ async function runAgentsDispatchPack(rootDir, input) {
65499
67526
  let outFile = null;
65500
67527
  if (input.out !== void 0) {
65501
67528
  try {
65502
- writeFileSync5(input.out, `${packLines.join("\n")}
67529
+ writeFileSync6(input.out, `${packLines.join("\n")}
65503
67530
  `, "utf8");
65504
67531
  outFile = toPosix(input.out);
65505
67532
  } catch (err) {
@@ -65670,6 +67697,10 @@ async function runMigrateTrellisSpec(rootDir, input) {
65670
67697
  }
65671
67698
  }
65672
67699
 
67700
+ // packages/cli/dist/baseline-tokens.js
67701
+ init_js_yaml();
67702
+ init_src();
67703
+
65673
67704
  // packages/cli/dist/index.js
65674
67705
  var defaultIo = {
65675
67706
  stdout: (line) => process.stdout.write(`${line}
@@ -65718,7 +67749,7 @@ function createProgram(runs, io = defaultIo) {
65718
67749
  });
65719
67750
  record({ command: "init", outcome, asJson });
65720
67751
  });
65721
- const baseline = program2.command("baseline").description("Project Engineering Baseline \u9500\u8D26\u4E0E\u786E\u8BA4 gate \u901A\u8DEF\uFF08R-M/R-L\uFF09\uFF1Aset = \u5355\u952E\u663E\u5F0F\u5199\u5165 .pomaster/baseline/<lane>/stack.yaml \u5E76\u540C\u6B65\u9500\u8D26 manifest unknowns \u53F0\u8D26\uFF08TTY init \u6280\u672F\u6808\u95EE\u5377\u7684\u975E\u4EA4\u4E92\u5B6A\u751F\u2014\u2014CI/\u811A\u672C\u573A\u666F\uFF1B\u952E\u8BCD\u5F62 fail-closed\uFF1B\u5DF2\u7B54\u952E\u6539\u578B\u62D2\u7EDD\uFF09\uFF1Bconfirm = \u57FA\u7EBF\u786E\u8BA4\u65BD\u65AD\uFF0814 unknowns \u5168\u9500\u8D26\u540E manifest \u8BB0 confirmed digest \u5FEB\u7167\u2014\u201424 \u6587\u4EF6\u5355\u4E00\u8D44\u4EA7\u6E05\u5355\uFF1B\u91CD\u786E\u8BA4\u4E09\u901A\u9053 --change / --ack-drifted --note / \u88F8\u91CD\u786E\u8BA4\u62D2\u7EDD\uFF1Bcloseout/doctor/status \u6D88\u8D39\u786E\u8BA4\u6001\uFF09");
67752
+ const baseline = program2.command("baseline").description("Project Engineering Baseline \u9500\u8D26\u4E0E\u786E\u8BA4 gate \u901A\u8DEF\uFF08R-M/R-L\uFF09\uFF1Aset = \u5355\u952E\u663E\u5F0F\u5199\u5165 .pomaster/baseline/<lane>/stack.yaml \u5E76\u540C\u6B65\u9500\u8D26 manifest unknowns \u53F0\u8D26\uFF08TTY init \u6280\u672F\u6808\u95EE\u5377\u7684\u975E\u4EA4\u4E92\u5B6A\u751F\u2014\u2014CI/\u811A\u672C\u573A\u666F\uFF1B\u952E\u8BCD\u5F62 fail-closed\uFF1B\u5DF2\u7B54\u952E\u6539\u578B\u62D2\u7EDD\uFF09\uFF1Bconfirm = \u57FA\u7EBF\u786E\u8BA4\u65BD\u65AD\uFF08\u963B\u585E\u96C6\u6E05\u96F6\u540E manifest \u8BB0 confirmed digest \u5FEB\u7167\u2014\u201425 \u6587\u4EF6\u5355\u4E00\u8D44\u4EA7\u6E05\u5355\uFF1B\u91CD\u786E\u8BA4\u4E09\u901A\u9053 --change / --ack-drifted --note / \u88F8\u91CD\u786E\u8BA4\u62D2\u7EDD\uFF1Bcloseout/doctor/status \u6D88\u8D39\u786E\u8BA4\u6001\uFF09");
65722
67753
  baseline.command("set").description("\u5355\u952E\u540E\u8865\u9500\u8D26/\u6CBB\u7406\u901A\u8DEF\u4FEE\u6539\uFF1A--lane <frontend|backend> --key <lane \u952E\u96C6\u95ED\u5305> --value <\u9009\u578B\u503C>\uFF08UNKNOWN \u8D77\u6B65\u8BCD\u5F62\u4E0D\u53EF\u4F5C\u503C\uFF1B\u540C\u503C\u91CD\u653E\u5E42\u7B49 NO_CHANGE \u5E76\u81EA\u6108\u53F0\u8D26\u6F0F\u9500\uFF1B\u5F02\u503C\u6539\u578B BASELINE_KEY_ALREADY_SET \u663E\u5F0F\u62D2\u7EDD\uFF1B\u786E\u8BA4\u6001\u5728\u5EA7\u65E0 --change \u2192 BASELINE_ALREADY_CONFIRMED\uFF0C\u6301 --change <CHANGE-id> \u4E14\u5BF9\u8C61\u5728\u518C\u3001lifecycle \u5408\u6CD5 \u2192 \u5199\u5165\u5E76\u8F6C pending-change\u2014\u2014\u540C\u4E00 CHANGE \u8FDE\u6539\u591A\u952E\u5168\u7A0B\u5141\u8BB8\uFF0C\u643A\u540C ref confirm \u7EC8\u7ED3\uFF09").requiredOption("--lane <lane>", "\u6280\u672F\u6808 lane\uFF08frontend | backend\uFF09").requiredOption("--key <key>", "stack.yaml \u952E\uFF08lane \u952E\u96C6\u95ED\u5305\uFF1Afrontend framework|language|build|router|state|grid|ui|css|testing\uFF1Bbackend language|framework|persistence|database|cache\uFF09").requiredOption("--value <value>", "\u9009\u578B\u503C\uFF08\u4FDD\u5B88\u8BCD\u5F62\uFF1A[A-Za-z0-9] \u8D77\u59CB\u3001[A-Za-z0-9 _./+#()-]\u3001\u2264120 \u5B57\u7B26\uFF1BUNKNOWN \u4E0D\u53EF\u4F5C\u503C\uFF09").option("--change <change-id>", "\u6CBB\u7406\u901A\u8DEF\u6388\u6743\uFF08\u4EC5\u786E\u8BA4\u6001\u5728\u5EA7\u65F6\u88AB\u6D88\u8D39\uFF09\uFF1ACHANGE.* \u5BF9\u8C61\u5728\u518C\u4E14 lifecycle \u2208 PROPOSED|CURRENT\uFF08kernel \u6821\u9A8C\uFF09\uFF1B\u5F02\u503C\u5199\u5165\u8F6C pending-change\uFF08\u8BB0\u5F55\u4FDD\u7559\uFF09\uFF0C\u643A\u540C ref confirm \u7EC8\u7ED3").option("--json", "machine-readable JSON output (\xA745)").action(async (opts, command) => {
65723
67754
  const outcome = await runBaselineSet(resolveDir(command), {
65724
67755
  lane: opts.lane,
@@ -65732,7 +67763,7 @@ function createProgram(runs, io = defaultIo) {
65732
67763
  asJson: command.opts().json === true
65733
67764
  });
65734
67765
  });
65735
- baseline.command("confirm").description('\u57FA\u7EBF\u786E\u8BA4\u65BD\u65AD\uFF08R-L gate\uFF1Bverdict + exit code\uFF09\uFF1A\u524D\u63D0 = 14 unknowns \u5168\u9500\u8D26\uFF08BASELINE_UNKNOWNS_REMAINING fail-closed \u9010\u6761\u5217\u51FA\u7F3A\u952E\uFF09\uFF1B\u52A8\u4F5C = manifest.yaml \u5199 confirmed \u786E\u8BA4\u8BB0\u5F55\uFF08at_seq \u65F6\u70B9\u951A + 24 \u6587\u4EF6\u786E\u8BA4\u8D44\u4EA7\u6E05\u5355 sha256 \u5FEB\u7167 = 2 stack.yaml + 22 md\u2014\u2014N1 \u5355\u4E00\u5206\u6BCD\uFF0Cmanifest \u4E0D\u81EA\u5F15\u7528\uFF09\uFF1B\u521D\u6B21\u786E\u8BA4\u4E0D\u9700\u8981\u4EFB\u4F55\u901A\u9053\uFF1B\u5DF2\u786E\u8BA4\u4E14 digest \u65E0\u6F02\u79FB \u2192 NO_CHANGE \u96F6\u5199\u5165\uFF1B\u91CD\u786E\u8BA4\u4E09\u901A\u9053\uFF08N2/Owner 09-06 \u8865\u88C1\u5B9A\uFF09\uFF1A--change <CHANGE-id>\uFF08\u6CBB\u7406\u901A\u8DEF\uFF1Adrifted \u8986\u76D6 / pending \u540C ref \u7EC8\u7ED3\uFF09\u6216 --ack-drifted --note "<\u7406\u7531>"\uFF08Owner \u624B\u6539\u58F0\u660E\uFF1Ajournal BASELINE_ACK \u7559\u75D5 + \u8BB0\u5F55 ack \u6807\u8BB0\uFF1BAI \u4EE3\u8DD1\u987B\u6301 Owner \u6307\u793A\uFF09\uFF1B\u88F8\u91CD\u786E\u8BA4 = BASELINE_RECONFIRM_REQUIRES_CHANGE \u663E\u5F0F\u62D2\u7EDD\uFF1Bcloseout \u6D88\u8D39\uFF1ABASELINE_NOT_CONFIRMED / BASELINE_DRIFT \u4E24\u963B\u585E\u7801').option("--change <change-id>", "\u91CD\u786E\u8BA4\u901A\u9053 1\uFF08\u6CBB\u7406\u901A\u8DEF\uFF09\uFF1ACHANGE.* \u5BF9\u8C61\u5728\u518C\u4E14 lifecycle \u2208 PROPOSED|CURRENT\uFF1Bdrifted \u91CD\u786E\u8BA4\u7684\u6388\u6743\u8986\u76D6 / pending-change \u53D8\u66F4\u6279\u7684\u540C ref \u7EC8\u7ED3").option("--ack-drifted", "\u91CD\u786E\u8BA4\u901A\u9053 2\uFF08Owner \u624B\u6539\u58F0\u660E\uFF09\uFF1A\u663E\u5F0F\u58F0\u660E\u5F53\u524D\u6F02\u79FB\u4E3A\u6388\u6743\u624B\u6539\uFF0822 \u4EFD md \u65E0\u6CBB\u7406\u5199\u547D\u4EE4\u7684\u624B\u6539/\u8865\u6587\u6863\u901A\u8DEF\uFF09\uFF1B\u987B\u4E0E --note \u540C\u7528\uFF1Bjournal \u843D BASELINE_ACK \u7559\u75D5\uFF1BAI \u4EE3\u8DD1\u987B\u6301 Owner \u6307\u793A").option("--note <note>", "\u624B\u6539\u58F0\u660E\u7406\u7531\uFF08--ack-drifted \u5FC5\u586B\uFF1B\u5355\u884C \u2264200 \u5B57\u7B26\uFF1B\u5165 manifest ack \u6BB5\u4E0E journal\uFF09").option("--json", "machine-readable JSON output (\xA745)").action(async (_opts, command) => {
67766
+ baseline.command("confirm").description('\u57FA\u7EBF\u786E\u8BA4\u65BD\u65AD\uFF08R-L gate\uFF1Bverdict + exit code\uFF09\uFF1A\u524D\u63D0 = \u963B\u585E\u96C6\u6E05\u96F6\uFF08P-C1\uFF1Aunknowns \u53F0\u8D26\u53CC\u8BCD\u5F62\u2014\u2014\u8C41\u514D\u767B\u8BB0\u884C\u4E0D\u963B\u585E\uFF0C\u963B\u585E\u952E BASELINE_UNKNOWNS_REMAINING fail-closed \u9010\u6761\u5217\u51FA\uFF0C\u7ED3\u6784\u5316\u884C\u5F62\u72B6\u635F\u574F INVALID_STATE\uFF09\uFF1B\u52A8\u4F5C = manifest.yaml \u5199 confirmed \u786E\u8BA4\u8BB0\u5F55\uFF08at_seq \u65F6\u70B9\u951A + 25 \u6587\u4EF6\u786E\u8BA4\u8D44\u4EA7\u6E05\u5355 sha256 \u5FEB\u7167 = 2 stack.yaml + 22 md + 1 design-tokens.yaml\u2014\u2014N1 \u5355\u4E00\u5206\u6BCD\uFF0CADR-20 \u6269 25\uFF0Cmanifest \u4E0D\u81EA\u5F15\u7528\uFF09\uFF1B\u521D\u6B21\u786E\u8BA4\u4E0D\u9700\u8981\u4EFB\u4F55\u901A\u9053\uFF1B\u5DF2\u786E\u8BA4\u4E14 digest \u65E0\u6F02\u79FB \u2192 NO_CHANGE \u96F6\u5199\u5165\uFF1B\u91CD\u786E\u8BA4\u4E09\u901A\u9053\uFF08N2/Owner 09-06 \u8865\u88C1\u5B9A\uFF09\uFF1A--change <CHANGE-id>\uFF08\u6CBB\u7406\u901A\u8DEF\uFF1Adrifted \u8986\u76D6 / pending \u540C ref \u7EC8\u7ED3\uFF09\u6216 --ack-drifted --note "<\u7406\u7531>"\uFF08Owner \u624B\u6539\u58F0\u660E\uFF1Ajournal BASELINE_ACK \u7559\u75D5 + \u8BB0\u5F55 ack \u6807\u8BB0\uFF1BAI \u4EE3\u8DD1\u987B\u6301 Owner \u6307\u793A\uFF09\uFF1B\u88F8\u91CD\u786E\u8BA4 = BASELINE_RECONFIRM_REQUIRES_CHANGE \u663E\u5F0F\u62D2\u7EDD\uFF1Bcloseout \u6D88\u8D39\uFF1ABASELINE_NOT_CONFIRMED / BASELINE_DRIFT \u4E24\u963B\u585E\u7801').option("--change <change-id>", "\u91CD\u786E\u8BA4\u901A\u9053 1\uFF08\u6CBB\u7406\u901A\u8DEF\uFF09\uFF1ACHANGE.* \u5BF9\u8C61\u5728\u518C\u4E14 lifecycle \u2208 PROPOSED|CURRENT\uFF1Bdrifted \u91CD\u786E\u8BA4\u7684\u6388\u6743\u8986\u76D6 / pending-change \u53D8\u66F4\u6279\u7684\u540C ref \u7EC8\u7ED3").option("--ack-drifted", "\u91CD\u786E\u8BA4\u901A\u9053 2\uFF08Owner \u624B\u6539\u58F0\u660E\uFF09\uFF1A\u663E\u5F0F\u58F0\u660E\u5F53\u524D\u6F02\u79FB\u4E3A\u6388\u6743\u624B\u6539\uFF0822 \u4EFD md \u65E0\u6CBB\u7406\u5199\u547D\u4EE4\u7684\u624B\u6539/\u8865\u6587\u6863\u901A\u8DEF\uFF09\uFF1B\u987B\u4E0E --note \u540C\u7528\uFF1Bjournal \u843D BASELINE_ACK \u7559\u75D5\uFF1BAI \u4EE3\u8DD1\u987B\u6301 Owner \u6307\u793A").option("--note <note>", "\u624B\u6539\u58F0\u660E\u7406\u7531\uFF08--ack-drifted \u5FC5\u586B\uFF1B\u5355\u884C \u2264200 \u5B57\u7B26\uFF1B\u5165 manifest ack \u6BB5\u4E0E journal\uFF09").option("--json", "machine-readable JSON output (\xA745)").action(async (_opts, command) => {
65736
67767
  const opts = command.opts();
65737
67768
  const outcome = await runBaselineConfirm(resolveDir(command), {
65738
67769
  ...opts.change !== void 0 ? { change: opts.change } : {},
@@ -66751,6 +68782,17 @@ function createProgram(runs, io = defaultIo) {
66751
68782
  asJson: command.opts().json === true
66752
68783
  });
66753
68784
  });
68785
+ execution.command("audit").description("\u53D8\u66F4\u8D8A\u754C\u5BA1\u8BA1\uFF08Detection \u534A\u8FB9\uFF09\uFF1Agit diff \u8D77\u59CB\u951A\u6536\u96C6\u6267\u884C\u671F\u5B9E\u9645\u53D8\u66F4\u6587\u4EF6\u96C6\uFF08--diff-base \u8C03\u7528\u65B9\u7533\u62A5\u2014\u2014execution record \u65E0 ref/seq \u951A\u5B57\u6BB5\uFF1Buntracked \u540C\u6536\uFF1B\u8DEF\u5F84\u6E05\u6D17\u6CBF recon \u679A\u4E3E\u6392\u9664\u95ED\u5305 node_modules/dist/.git/coverage/.pomaster\uFF09\u2192 KEYBINDING \u5728\u518C\u7ED1\u5B9A\u89E3\u6790 governed id\uFF08\u672A\u547D\u4E2D unmapped \u8BDA\u5B9E\u6E05\u5355\u7981\u9759\u9ED8\u4E22\u5F03\uFF1B\u65E0\u7ED1\u5B9A\u8868\u5DE5\u4F5C\u533A\u5168 unmapped \u8BDA\u5B9E\u5448\u73B0\u975E\u9519\u8BEF\uFF09\u2192 \u5BF9\u7167 execution.permit_ids \u7684 permit scope.subject_ids \u5224 in/out-of-scope\uFF08\u5224\u5377\u951A kernel checkPermit \u6210\u5458\u5224\u5B9A\u5355\u4E00\u5B9E\u73B0\uFF09\u2192 \u5BA1\u8BA1\u62A5\u544A blob + OBS \u56DE\u6267\u843D 17 sidecar\uFF08result=OBSERVED \u5E26 blob ref\uFF09+ stdout \u8D8A\u754C\u9010\u6761\u660E\u7EC6\uFF08path + \u5224\u5B9A\u4F9D\u636E\uFF09\uFF1B\u8D8A\u754C\u5B58\u5728 exit 1 \u4E0D\u4F2A\u9020\u7EFF\uFF1B\u975E git \u5DE5\u4F5C\u533A/\u951A\u7F3A\u5E2D/\u951A\u65E0\u6548 fail-closed \u96F6\u843D\u76D8\uFF08\u4E0D\u505A fs \u5FEB\u7167\u515C\u5E95\uFF09").requiredOption("--execution-id <AGX-n>", "\u6267\u884C\u8EAB\u4EFD\u951A\uFF08AGX-<\u5E74\u4EFD>-<\u5E8F\u53F7>\uFF1BOBS \u56DE\u6267 execution_id \u5FC5\u586B\u2014\u2014S1 \u7981\u81EA\u9020\u8EAB\u4EFD\uFF0C\u987B\u4E3A executions/ \u5DF2\u767B\u8BB0\u6863\u6848\uFF0C\u5DF2\u5C01\u53E3\u6267\u884C\u5141\u8BB8\u4E8B\u540E\u5BA1\u8BA1\uFF09").requiredOption("--diff-base <git-ref>", "diff \u8D77\u59CB\u951A\uFF08commit/branch/tag\u2014\u2014execution begin \u65F6\u523B\u7684\u5DE5\u4F5C\u533A\u57FA\u7EBF ref\uFF1Bexecution record \u5B9E\u8BFB\u65E0 ref/seq \u951A\u5B57\u6BB5\uFF0C\u951A\u7531\u8C03\u7528\u65B9\u7533\u62A5\uFF1A\u7F3A\u5E2D/\u65E0\u6548 = \u663E\u5F0F\u62A5\u9519\u96F6\u843D\u76D8\uFF09").option("--json", "machine-readable JSON output (\xA745)").action(async (opts, command) => {
68786
+ const outcome = await runExecutionAudit(resolveDir(command), {
68787
+ executionId: opts.executionId,
68788
+ diffBase: opts.diffBase
68789
+ });
68790
+ record({
68791
+ command: "execution audit",
68792
+ outcome,
68793
+ asJson: command.opts().json === true
68794
+ });
68795
+ });
66754
68796
  const trace = program2.command("trace").description("Execution Trace \u547D\u4EE4\u9762\uFF08\xA78/\xA714 P0.5-3\uFF09\uFF1Ashow = \u6D3E\u751F\u6295\u5F71\u7EAF\u8BFB\uFF08\u5C01\u5B58\u5728\u5EA7=\u5C01\u5B58\u5FEB\u7167+stale \u5BF9\u8D26\u663E\u5F0F\uFF1B--seal --retention <\u56DB\u6863> = \u663E\u5F0F\u7269\u5316\u5BA1\u8BA1\u5FEB\u7167\uFF09/ list = \u5C01\u5B58\u6E05\u5355\uFF1BTrace \u662F Identity \u7684\u6D3E\u751F\u6295\u5F71\u4FA7\u8F66\uFF08A19 Identity Is Not Trace\uFF09\uFF0CCLI \u96F6\u5224\u5377\u96F6 GC");
66755
68797
  trace.command("show").description("\u6309 AGX \u5448\u73B0 Execution Trace Manifest\uFF08\xA78.2 \u95ED\u5F62\u6001 12 \u952E\uFF09\uFF1A\u7F3A\u7701 = \u7EAF\u6295\u5F71 on-demand\uFF08journal TX_APPLIED \u5199\u8DB3\u8FF9 + evidence GRN/CLM \u6536\u636E\u2014\u2014\u96F6\u65B0\u91C7\u96C6\u5668\uFF0C\u540C state \u91CD\u653E\u5B57\u8282\u7A33\u5B9A\uFF09\uFF1B\u5C01\u5B58\u5728\u5EA7 = \u5C01\u5B58\u5FEB\u7167 + canonical \u91CD\u653E\u5BF9\u8D26\uFF08stale \u663E\u5F0F\u5448\u73B0\u975E\u9519\u8BEF\u2014\u2014\u5FEB\u7167\u4E0D\u5192\u5145\u65B0\u9C9C\uFF09\uFF1B--seal --retention <\u6863> = \u663E\u5F0F\u7269\u5316\uFF08retention \u5FC5\u586B\u6210\u5BF9\uFF1AEPHEMERAL\u2192runtime/traces \u53EF\u4E22\u5F03\uFF0CTASK/INCIDENT/AUDIT_RETENTION\u2192traces/ durable \u8FDB Git\uFF1B\u4EC5\u8BB0\u5F55\u4E0D GC\u2014\u2014\u88C1\u51B3 8 \u2461\uFF09\uFF1B\u8BCD\u5F62\u975E\u6CD5/\u672A\u767B\u8BB0\u6863\u6848/\u8BCD\u8868\u5916/\u91CD\u590D\u5C01\u5B58\u539F\u7801\u900F\u4F20\uFF08SCHEMA_INVALID/EXECUTION_NOT_FOUND/VOCAB_INVALID_VALUE/TRACE_ALREADY_SEALED\uFF09").argument("<execution-id>", "\u6267\u884C\u8EAB\u4EFD\uFF08AGX-<4\u4F4D\u5E74\u4EFD>-<\u5E8F\u53F7>\uFF1B\u7981\u81EA\u9020\u7B2C\u4E8C\u79CD EXEC-* \u8EAB\u4EFD\u2014\u2014\xA716 Case A\uFF09").option("--seal", "\u663E\u5F0F\u5C01\u5B58\uFF1A\u7269\u5316\u5F53\u524D\u6295\u5F71\u4E3A\u5BA1\u8BA1\u5FEB\u7167\uFF08\u4E0E --retention \u6210\u5BF9\u5FC5\u586B\uFF1B\u91CD\u590D\u5C01\u5B58 TRACE_ALREADY_SEALED \u663E\u5F0F\u62D2\u7EDD\uFF09").option("--retention <retention>", "\u7559\u5B58\u6863\uFF08PRD \xA78.3 \u56DB\u6863\u9010\u5B57\uFF1AEPHEMERAL | TASK_RETENTION | INCIDENT_RETENTION | AUDIT_RETENTION\uFF1B\u8BCD\u8868\u5916 VOCAB_INVALID_VALUE fail-closed\u2014\u2014\u4EC5\u8BB0\u5F55\u4E0D GC\uFF09").option("--json", "machine-readable JSON output (\xA745)").action(async (executionId, opts, command) => {
66756
68798
  const outcome = await runTraceShow(resolveDir(command), executionId, {
@@ -66810,6 +68852,37 @@ function createProgram(runs, io = defaultIo) {
66810
68852
  asJson: command.opts().json === true
66811
68853
  });
66812
68854
  });
68855
+ const recon = program2.command("recon").description("\u5BBF\u4E3B\u4EE3\u7801\u4E8B\u5B9E recon \u7F16\u6392\u58F3\uFF08F-M5 \u9996\u6279\u4E09\u4E59 B8/B4/B1\uFF1BB10 \u4E59\uFF09\uFF1A\u679A\u4E3E \u2192 \u5206\u6790/\u91C7\u96C6 \u2192 blob+17 \u89C2\u5BDF\u56DE\u6267 sidecar \u2192 \u5448\u73B0\u2014\u2014\u4EA7\u7269\u53EA\u843D evidence/{blobs,observations}/ sidecar \u5E73\u9762\uFF0C\u96F6\u6743\u5A01\u6587\u4EF6\u5199\u53E3\u96F6 store \u4E8B\u52A1\uFF08persistObservationRecord \u9996\u4E2A\u751F\u4EA7\u6D88\u8D39\u65B9\uFF09");
68856
+ recon.command("import-graph").description("\u5BBF\u4E3B\u6E90\u6587\u4EF6 import \u56FE\u9759\u6001\u626B\u63CF\uFF08B8 \u4E59\uFF09\uFF1AcollectSourceFiles \u5F62\u6001\u679A\u4E3E\uFF08\u8DF3\u8FC7 node_modules/dist/.git/coverage/.pomaster\uFF1B.ts/.tsx/.js/.jsx/.mjs/.cjs/.vue\uFF09\u2192 kernel analyzeImportGraph \u7EAF\u51FD\u6570\u76F4\u8C03\uFF08\u96F6\u7B2C\u4E8C\u5B9E\u73B0\uFF1Bmapping \u6052\u7A7A\u2014\u2014\u8001\u9879\u76EE\u65E0 governed id\uFF0Cunmapped \u6E05\u5355\u5373\u4EA7\u51FA\u7981\u9759\u9ED8\u4E22\u5F03\uFF09\u2192 \xA7148 \u62A5\u544A\u843D blob\uFF08persistEvidenceArtifact \u5185\u5BB9\u5BFB\u5740\uFF09\u2192 OBS \u56DE\u6267\u843D 17 sidecar\uFF08persistObservationRecord\uFF1Bresult=OBSERVED \u5E26 blob ref\u3001surface=STRUCTURAL_REALITY\u3001sensor=SENSOR.BUILD.STATIC\uFF09\u2192 \u5448\u73B0\uFF08mapping \u547D\u4E2D/externalImports/unmapped \u6E05\u5355/confidence\uFF09\uFF1B\u96F6\u6E90\u6587\u4EF6 \u2192 INCONCLUSIVE \u8D1F\u503C\u515C\u5E95\u843D\u8D26\u4E0D\u4F2A\u9020\u7EFF").requiredOption("--execution-id <AGX-n>", "\u6267\u884C\u8EAB\u4EFD\u951A\uFF08AGX-<\u5E74\u4EFD>-<\u5E8F\u53F7>\uFF1BOBS \u56DE\u6267 execution_id \u5FC5\u586B\u2014\u2014S1 \u7981\u81EA\u9020\u8EAB\u4EFD\uFF0C\u987B\u4E3A executions/ \u5DF2\u767B\u8BB0\u6863\u6848\uFF0C\u5DF2\u5C01\u53E3\u6267\u884C\u5141\u8BB8\u4E8B\u540E\u8865\u5F55\uFF09").option("--json", "machine-readable JSON output (\xA745)").action(async (opts, command) => {
68857
+ const outcome = await runReconImportGraph(resolveDir(command), {
68858
+ executionId: opts.executionId
68859
+ });
68860
+ record({
68861
+ command: "recon import-graph",
68862
+ outcome,
68863
+ asJson: command.opts().json === true
68864
+ });
68865
+ });
68866
+ recon.command("migrations").description("migration \u76EE\u5F55\u76D8\u70B9\uFF08B4 \u4E59\uFF09\uFF1A\u4E94\u6808\u8BCD\u5F62\u9762\u7EAF\u8BFB\u76D8\u679A\u4E3E\uFF08prisma/flyway/liquibase/alembic/django_style\u2014\u2014\u96F6\u5916\u90E8\u4F9D\u8D56\u96F6\u5DE5\u5177\u6267\u884C\uFF0Cliquibase/flyway \u5DE5\u5177\u672C\u4F53 license \u7EA2\u706F\u4E0D\u6267\u884C\uFF1B\u8DF3\u8FC7 node_modules/dist/.git/coverage/.pomaster/.venv/venv/vendor/target/build\uFF09\u2192 ENVREC \u56DE\u6267\u843D 17 sidecar\uFF08persistObservationRecord \u663E\u5F0F recordId\uFF1Bdoctor_verdict=WRONG_OR_UNVERIFIED_INSTANCE\u2014\u2014\u7EAF\u8BFB\u76D8\u76D8\u70B9\u4E0D\u786E\u8BA4\u5B9E\u4F8B\u8EAB\u4EFD\uFF09\u2192 \u5448\u73B0\uFF08\u5404\u6808\u547D\u4E2D\u8BA1\u6570 + \u6587\u4EF6\u6E05\u5355\u5168\u91CF\u96F6\u622A\u65AD\uFF09\uFF1B\u4E94\u6808\u8BCD\u5F62\u9762\u5168\u7F3A\u5E2D \u2192 NOT_RUN \u4E0D\u4F2A\u9020\u7A7A\u8DD1\u7EFF\uFF1B\u76D8\u70B9\u4E0D\u78B0 stack \u5206\u6BCD\uFF08\u96F6 stack.yaml \u5199\u53E3\uFF0C\u8BCD\u5F62\u76D8\u70B9\u975E stack \u65AD\u8A00\uFF09").requiredOption("--execution-id <AGX-n>", "\u6267\u884C\u8EAB\u4EFD\u951A\uFF08AGX-<\u5E74\u4EFD>-<\u5E8F\u53F7>\uFF1BENVREC \u56DE\u6267 execution_id \u5FC5\u586B\u2014\u2014S1 \u7981\u81EA\u9020\u8EAB\u4EFD\uFF0C\u987B\u4E3A executions/ \u5DF2\u767B\u8BB0\u6863\u6848\uFF0C\u5DF2\u5C01\u53E3\u6267\u884C\u5141\u8BB8\u4E8B\u540E\u8865\u5F55\uFF09").option("--json", "machine-readable JSON output (\xA745)").action(async (opts, command) => {
68867
+ const outcome = await runReconMigrations(resolveDir(command), {
68868
+ executionId: opts.executionId
68869
+ });
68870
+ record({
68871
+ command: "recon migrations",
68872
+ outcome,
68873
+ asJson: command.opts().json === true
68874
+ });
68875
+ });
68876
+ recon.command("sbom").description("SBOM \u4F9D\u8D56\u6E05\u5355\u91C7\u96C6\u817F\uFF08B1 \u4E59(a)\uFF0Ccdxgen Apache-2.0\uFF09\uFF1Adetect \u63A2 cdxgen \u5728 PATH\uFF08findExecutableOnPath \u5355\u4E00\u63A2\u6D4B\u9762\u2014\u2014\u7F3A\u5E2D \u2192 NOT_INSTALLED \u663E\u5F0F\u7F3A\u5E2D\u5E26 reason+installHint \u4E0D\u4F2A\u9020\uFF09\u2192 spawn `cdxgen -r -o <tmp>/bom.json <root>`\uFF08\u771F\u5B9E spawnSync\uFF1B64MB maxBuffer\uFF1BPATH \u5F15\u53F7\u6D88\u6BD2\uFF1Btmp \u7528 os.tmpdir \u6D3E\u751F\u8FD0\u884C\u540E\u6E05\u7406\uFF09\u2192 CycloneDX \u8BCD\u5F62\u6821\u9A8C\u56DE\u8BFB\uFF08bomFormat=CycloneDX + specVersion + components[]/dependencies[]\u2014\u2014\u89E3\u6790\u5931\u8D25/\u8BCD\u5F62\u6F02\u79FB \u2192 INCONCLUSIVE \u8D1F\u503C\u515C\u5E95\u843D\u8D26\u7981\u9ED8\u8BA4\u503C\uFF09\u2192 BOM \u539F\u6837\u5B57\u8282\u843D blob\uFF08persistEvidenceArtifact\uFF09\u2192 OBS \u56DE\u6267\u843D 17 sidecar\uFF08result=OBSERVED \u5E26 blob ref\uFF1Bsurface=STRUCTURAL_REALITY\u2014\u2014PRD \xA76.4 dependency graph \u2208 \u7ED3\u6784\u4E8B\u5B9E\u9762\uFF09\u2192 \u5448\u73B0\uFF08components/dependencies \u8BA1\u6570\uFF09\uFF1Bstack \u5019\u9009\u5316\u4E0D\u5728\u672C\u6279\uFF08Proposal \u524D\u7F6E\uFF09\u2014\u2014\u96F6 StackObservationCandidate \u89E6\u78B0\u96F6 stack.yaml \u5199\u53E3").requiredOption("--execution-id <AGX-n>", "\u6267\u884C\u8EAB\u4EFD\u951A\uFF08AGX-<\u5E74\u4EFD>-<\u5E8F\u53F7>\uFF1BOBS \u56DE\u6267 execution_id \u5FC5\u586B\u2014\u2014S1 \u7981\u81EA\u9020\u8EAB\u4EFD\uFF0C\u987B\u4E3A executions/ \u5DF2\u767B\u8BB0\u6863\u6848\uFF0C\u5DF2\u5C01\u53E3\u6267\u884C\u5141\u8BB8\u4E8B\u540E\u8865\u5F55\uFF09").option("--json", "machine-readable JSON output (\xA745)").action(async (opts, command) => {
68877
+ const outcome = await runReconSbom(resolveDir(command), {
68878
+ executionId: opts.executionId
68879
+ });
68880
+ record({
68881
+ command: "recon sbom",
68882
+ outcome,
68883
+ asJson: command.opts().json === true
68884
+ });
68885
+ });
66813
68886
  return program2;
66814
68887
  }
66815
68888
  function collectValues(value, previous) {
@@ -66817,12 +68890,12 @@ function collectValues(value, previous) {
66817
68890
  }
66818
68891
  function readLineFromStdin() {
66819
68892
  const rl = createInterface({ input: process.stdin });
66820
- return new Promise((resolve3) => {
68893
+ return new Promise((resolve4) => {
66821
68894
  rl.once("line", (line) => {
66822
- resolve3(line);
68895
+ resolve4(line);
66823
68896
  rl.close();
66824
68897
  });
66825
- rl.once("close", () => resolve3(null));
68898
+ rl.once("close", () => resolve4(null));
66826
68899
  });
66827
68900
  }
66828
68901
  function takeKeyToken(buffer) {
@@ -66840,7 +68913,7 @@ function takeKeyToken(buffer) {
66840
68913
  return head === void 0 ? null : { token: head, rest: buffer.slice(1) };
66841
68914
  }
66842
68915
  function pumpStdinKeys(handler) {
66843
- return new Promise((resolve3) => {
68916
+ return new Promise((resolve4) => {
66844
68917
  let buffer = "";
66845
68918
  const cleanup = () => {
66846
68919
  process.stdin.removeListener("data", onData);
@@ -66849,7 +68922,7 @@ function pumpStdinKeys(handler) {
66849
68922
  };
66850
68923
  const onDone = () => {
66851
68924
  cleanup();
66852
- resolve3();
68925
+ resolve4();
66853
68926
  };
66854
68927
  const onData = (chunk) => {
66855
68928
  buffer += typeof chunk === "string" ? chunk : chunk.toString("utf8");
@@ -66860,7 +68933,7 @@ function pumpStdinKeys(handler) {
66860
68933
  buffer = token.rest;
66861
68934
  if (!handler(token.token)) {
66862
68935
  cleanup();
66863
- resolve3();
68936
+ resolve4();
66864
68937
  return;
66865
68938
  }
66866
68939
  }