@astrasyncai/verification-gateway 5.14.0 → 5.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/README.md +36 -18
  2. package/dist/adapters/express.d.mts +1 -1
  3. package/dist/adapters/express.d.ts +1 -1
  4. package/dist/adapters/express.js +492 -240
  5. package/dist/adapters/express.js.map +1 -1
  6. package/dist/adapters/express.mjs +492 -240
  7. package/dist/adapters/express.mjs.map +1 -1
  8. package/dist/adapters/mcp.d.mts +1 -1
  9. package/dist/adapters/mcp.d.ts +1 -1
  10. package/dist/adapters/mcp.js +23 -6
  11. package/dist/adapters/mcp.js.map +1 -1
  12. package/dist/adapters/mcp.mjs +23 -6
  13. package/dist/adapters/mcp.mjs.map +1 -1
  14. package/dist/adapters/nextjs.d.mts +1 -1
  15. package/dist/adapters/nextjs.d.ts +1 -1
  16. package/dist/adapters/nextjs.js +475 -239
  17. package/dist/adapters/nextjs.js.map +1 -1
  18. package/dist/adapters/nextjs.mjs +475 -239
  19. package/dist/adapters/nextjs.mjs.map +1 -1
  20. package/dist/adapters/sdk.d.mts +18 -10
  21. package/dist/adapters/sdk.d.ts +18 -10
  22. package/dist/adapters/sdk.js +83 -23
  23. package/dist/adapters/sdk.js.map +1 -1
  24. package/dist/adapters/sdk.mjs +83 -23
  25. package/dist/adapters/sdk.mjs.map +1 -1
  26. package/dist/agent/index.d.mts +69 -54
  27. package/dist/agent/index.d.ts +69 -54
  28. package/dist/agent/index.js +24 -14
  29. package/dist/agent/index.js.map +1 -1
  30. package/dist/agent/index.mjs +24 -14
  31. package/dist/agent/index.mjs.map +1 -1
  32. package/dist/bin/astrasync-claude-hook.js +58 -11
  33. package/dist/bin/astrasync-codex-hook.js +58 -11
  34. package/dist/bin/astrasync-guard.js +177 -11
  35. package/dist/bin/astrasync.js +433 -38
  36. package/dist/browser/background.js +53 -6
  37. package/dist/browser/background.js.map +1 -1
  38. package/dist/browser/background.mjs +63 -6
  39. package/dist/browser/background.mjs.map +1 -1
  40. package/dist/cli/index.js +1 -1
  41. package/dist/cli/index.js.map +1 -1
  42. package/dist/cli/index.mjs +1 -1
  43. package/dist/cli/index.mjs.map +1 -1
  44. package/dist/codex/index.js +58 -11
  45. package/dist/codex/index.js.map +1 -1
  46. package/dist/codex/index.mjs +68 -11
  47. package/dist/codex/index.mjs.map +1 -1
  48. package/dist/cursor/extension.js +58 -11
  49. package/dist/cursor/extension.js.map +1 -1
  50. package/dist/cursor/extension.mjs +68 -11
  51. package/dist/cursor/extension.mjs.map +1 -1
  52. package/dist/edge-config.d.mts +31 -2
  53. package/dist/edge-config.d.ts +31 -2
  54. package/dist/edge-config.js +35 -5
  55. package/dist/edge-config.js.map +1 -1
  56. package/dist/edge-config.mjs +32 -4
  57. package/dist/edge-config.mjs.map +1 -1
  58. package/dist/edge-core/index.d.mts +11 -2
  59. package/dist/edge-core/index.d.ts +11 -2
  60. package/dist/edge-core/index.js +97 -11
  61. package/dist/edge-core/index.js.map +1 -1
  62. package/dist/edge-core/index.mjs +95 -11
  63. package/dist/edge-core/index.mjs.map +1 -1
  64. package/dist/gateway/gateway.js +53 -6
  65. package/dist/gateway/gateway.js.map +1 -1
  66. package/dist/gateway/gateway.mjs +63 -6
  67. package/dist/gateway/gateway.mjs.map +1 -1
  68. package/dist/git-trigger/git-hooks.d.mts +1 -1
  69. package/dist/git-trigger/git-hooks.d.ts +1 -1
  70. package/dist/index.d.mts +1407 -88
  71. package/dist/index.d.ts +1407 -88
  72. package/dist/index.js +5148 -2616
  73. package/dist/index.js.map +1 -1
  74. package/dist/index.mjs +5094 -2618
  75. package/dist/index.mjs.map +1 -1
  76. package/dist/registration/index.d.mts +28 -2
  77. package/dist/registration/index.d.ts +28 -2
  78. package/dist/registration/index.js +18 -3
  79. package/dist/registration/index.js.map +1 -1
  80. package/dist/registration/index.mjs +15 -2
  81. package/dist/registration/index.mjs.map +1 -1
  82. package/dist/transport/index.d.mts +7 -5
  83. package/dist/transport/index.d.ts +7 -5
  84. package/dist/transport/index.js +61 -5
  85. package/dist/transport/index.js.map +1 -1
  86. package/dist/transport/index.mjs +67 -11
  87. package/dist/transport/index.mjs.map +1 -1
  88. package/dist/{types-BCkwBA84.d.mts → types-Blz520bR.d.mts} +116 -12
  89. package/dist/{types-BCkwBA84.d.ts → types-Blz520bR.d.ts} +116 -12
  90. package/dist/{types-C_b4QTyO.d.ts → types-Bm1QvGqI.d.ts} +114 -10
  91. package/dist/{types-DlshIIR-.d.mts → types-DBe4hgfT.d.mts} +114 -10
  92. package/dist/ui/index.d.mts +1 -1
  93. package/dist/ui/index.d.ts +1 -1
  94. package/dist/verify.d.mts +1 -1
  95. package/dist/verify.d.ts +1 -1
  96. package/dist/verify.js +23 -6
  97. package/dist/verify.js.map +1 -1
  98. package/dist/verify.mjs +23 -6
  99. package/dist/verify.mjs.map +1 -1
  100. package/package.json +1 -1
@@ -36,7 +36,7 @@ var SDK_VERSION;
36
36
  var init_version = __esm({
37
37
  "src/version.ts"() {
38
38
  "use strict";
39
- SDK_VERSION = "5.14.0";
39
+ SDK_VERSION = "5.16.0";
40
40
  }
41
41
  });
42
42
 
@@ -5030,6 +5030,13 @@ var init_local = __esm({
5030
5030
  }
5031
5031
  });
5032
5032
 
5033
+ // src/types.ts
5034
+ var init_types2 = __esm({
5035
+ "src/types.ts"() {
5036
+ "use strict";
5037
+ }
5038
+ });
5039
+
5033
5040
  // src/trust-levels.ts
5034
5041
  function getTrustLevel(score) {
5035
5042
  if (score >= 80) return "PLATINUM";
@@ -5161,6 +5168,8 @@ function getCacheKey(request2, counterpartyId) {
5161
5168
  request2.durationRequired ?? "",
5162
5169
  request2.invocationProtocol || "",
5163
5170
  request2.enableRuntimeChallenge ? "1" : "0",
5171
+ // 5.16.0: route policy changes the verdict (owners / challenge).
5172
+ request2.routePolicy ? JSON.stringify(request2.routePolicy) : "",
5164
5173
  // callerMetadata fields contribute to risk model; include the ones
5165
5174
  // backend reads. sourceIp/userAgent/forwardedFor change per-request
5166
5175
  // so their inclusion effectively forces a re-check for any varying
@@ -5331,6 +5340,7 @@ async function callVerifyAccessAPI(config, request2) {
5331
5340
  if (requestData.subAgentDepth !== void 0) body.subAgentDepth = requestData.subAgentDepth;
5332
5341
  if (requestData.enableRuntimeChallenge)
5333
5342
  body.enableRuntimeChallenge = requestData.enableRuntimeChallenge;
5343
+ if (requestData.routePolicy) body.routePolicy = requestData.routePolicy;
5334
5344
  if (requestData.createSession) body.createSession = requestData.createSession;
5335
5345
  if (requestData.durationRequired) body.durationRequired = requestData.durationRequired;
5336
5346
  if (requestData.counterpartyType) body.counterpartyType = requestData.counterpartyType;
@@ -5341,6 +5351,7 @@ async function callVerifyAccessAPI(config, request2) {
5341
5351
  if (requestData.invocationProtocol) body.invocationProtocol = requestData.invocationProtocol;
5342
5352
  if (requestData.commercePhase) body.commercePhase = requestData.commercePhase;
5343
5353
  if (requestData.checkoutSessionId) body.checkoutSessionId = requestData.checkoutSessionId;
5354
+ if (requestData.checkoutJwt) body.checkoutJwt = requestData.checkoutJwt;
5344
5355
  if (requestData.checkoutItems) body.checkoutItems = requestData.checkoutItems;
5345
5356
  if (requestData.buyerEmail) body.buyerEmail = requestData.buyerEmail;
5346
5357
  if (requestData.commerceArtifacts) body.commerceArtifacts = requestData.commerceArtifacts;
@@ -5491,7 +5502,8 @@ async function verify(config, request2, options) {
5491
5502
  "[VerificationGateway] minTrustScore / minTrustScoreForFull are deprecated in v2.3.0 and have no effect. Server is now the single source of truth for access decisions (verified ID + runtime challenge + PDLSS + trust score). To gate access to an endpoint, configure the endpoint's trust_score_requirement server-side."
5492
5503
  );
5493
5504
  }
5494
- if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache) {
5505
+ const uncacheable = Boolean(request2.commerceArtifacts);
5506
+ if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache && !uncacheable) {
5495
5507
  const cached = getCachedResult(request2, mergedConfig.counterpartyId);
5496
5508
  if (cached) {
5497
5509
  if (mergedConfig.debug) {
@@ -5572,7 +5584,10 @@ async function verify(config, request2, options) {
5572
5584
  // MERCHANT caller only (bridge callers strip it before the agent plane).
5573
5585
  settlementToken: apiResponse.settlementToken,
5574
5586
  // 5.6.0: fulfilment contact — merchant-only lane, same strip rule.
5575
- fulfilment: apiResponse.fulfilment
5587
+ fulfilment: apiResponse.fulfilment,
5588
+ mandates: apiResponse.mandates,
5589
+ kyaToken: apiResponse.kyaToken,
5590
+ aep: apiResponse.aep
5576
5591
  };
5577
5592
  return result2;
5578
5593
  }
@@ -5582,7 +5597,10 @@ async function verify(config, request2, options) {
5582
5597
  trustScore: apiResponse.agent.trustScore,
5583
5598
  trustLevel: getTrustLevel(apiResponse.agent.trustScore),
5584
5599
  blockchainAnchored: apiResponse.agent.blockchainStatus === "anchored",
5585
- status: apiResponse.agent.agentStatus
5600
+ status: apiResponse.agent.agentStatus,
5601
+ ...apiResponse.agent.protocolIdentities && {
5602
+ protocolIdentities: apiResponse.agent.protocolIdentities
5603
+ }
5586
5604
  } : void 0;
5587
5605
  const developer = apiResponse.developer ? {
5588
5606
  astradId: apiResponse.developer.kyaOwnerId,
@@ -5633,7 +5651,11 @@ async function verify(config, request2, options) {
5633
5651
  settlementOutcome: apiResponse.settlementOutcome,
5634
5652
  settlementToken: apiResponse.settlementToken,
5635
5653
  // 5.6.0: fulfilment contact — merchant-only lane, same strip rule.
5636
- fulfilment: apiResponse.fulfilment
5654
+ fulfilment: apiResponse.fulfilment,
5655
+ // 5.15.0: merchant-lane AP2 mandates + KYAPay identity token.
5656
+ mandates: apiResponse.mandates,
5657
+ kyaToken: apiResponse.kyaToken,
5658
+ aep: apiResponse.aep
5637
5659
  };
5638
5660
  if (result.recommendation === "deny") {
5639
5661
  result.policyAllowed = false;
@@ -5653,7 +5675,9 @@ async function verify(config, request2, options) {
5653
5675
  }
5654
5676
  const escalates = result.requiresStepUp === true || result.requiresApproval === true || result.recommendation === "step_up_required";
5655
5677
  if (mergedConfig.cacheTtl !== 0 && result.recommendation !== "deny" && !escalates) {
5656
- cacheResult(request2, result, mergedConfig.cacheTtl, mergedConfig.counterpartyId);
5678
+ if (!uncacheable) {
5679
+ cacheResult(request2, result, mergedConfig.cacheTtl, mergedConfig.counterpartyId);
5680
+ }
5657
5681
  }
5658
5682
  return result;
5659
5683
  }
@@ -5709,6 +5733,41 @@ var init_settlement = __esm({
5709
5733
  }
5710
5734
  });
5711
5735
 
5736
+ // src/metadata-capture.ts
5737
+ var MAX_TOTAL_BYTES;
5738
+ var init_metadata_capture = __esm({
5739
+ "src/metadata-capture.ts"() {
5740
+ "use strict";
5741
+ MAX_TOTAL_BYTES = 16 * 1024;
5742
+ }
5743
+ });
5744
+
5745
+ // src/edge-core/request.ts
5746
+ var init_request = __esm({
5747
+ "src/edge-core/request.ts"() {
5748
+ "use strict";
5749
+ init_metadata_capture();
5750
+ }
5751
+ });
5752
+
5753
+ // src/edge-core/detect.ts
5754
+ var init_detect = __esm({
5755
+ "src/edge-core/detect.ts"() {
5756
+ "use strict";
5757
+ init_request();
5758
+ }
5759
+ });
5760
+
5761
+ // src/adapters/commerce-detect.ts
5762
+ var MAX_BODY_BYTES;
5763
+ var init_commerce_detect = __esm({
5764
+ "src/adapters/commerce-detect.ts"() {
5765
+ "use strict";
5766
+ init_detect();
5767
+ MAX_BODY_BYTES = 64 * 1024;
5768
+ }
5769
+ });
5770
+
5712
5771
  // src/transport/http.ts
5713
5772
  var init_http2 = __esm({
5714
5773
  "src/transport/http.ts"() {
@@ -5737,12 +5796,10 @@ var init_pdlss_pre_check = __esm({
5737
5796
  }
5738
5797
  });
5739
5798
 
5740
- // src/metadata-capture.ts
5741
- var MAX_TOTAL_BYTES;
5742
- var init_metadata_capture = __esm({
5743
- "src/metadata-capture.ts"() {
5799
+ // src/route-pattern.ts
5800
+ var init_route_pattern = __esm({
5801
+ "src/route-pattern.ts"() {
5744
5802
  "use strict";
5745
- MAX_TOTAL_BYTES = 16 * 1024;
5746
5803
  }
5747
5804
  });
5748
5805
 
@@ -5752,6 +5809,8 @@ var init_edge_config = __esm({
5752
5809
  "src/edge-config.ts"() {
5753
5810
  "use strict";
5754
5811
  init_http();
5812
+ init_route_pattern();
5813
+ init_route_pattern();
5755
5814
  DEFAULT_EDGE_CONFIG = Object.freeze({
5756
5815
  version: 1,
5757
5816
  mode: "observe",
@@ -5772,22 +5831,6 @@ var init_platform_signatures = __esm({
5772
5831
  }
5773
5832
  });
5774
5833
 
5775
- // src/edge-core/request.ts
5776
- var init_request = __esm({
5777
- "src/edge-core/request.ts"() {
5778
- "use strict";
5779
- init_metadata_capture();
5780
- }
5781
- });
5782
-
5783
- // src/edge-core/detect.ts
5784
- var init_detect = __esm({
5785
- "src/edge-core/detect.ts"() {
5786
- "use strict";
5787
- init_request();
5788
- }
5789
- });
5790
-
5791
5834
  // src/edge-core/classify.ts
5792
5835
  var init_classify = __esm({
5793
5836
  "src/edge-core/classify.ts"() {
@@ -6058,6 +6101,8 @@ var DEFAULT_ROUTES_REFRESH_MS;
6058
6101
  var init_express = __esm({
6059
6102
  "src/adapters/express.ts"() {
6060
6103
  "use strict";
6104
+ init_commerce_detect();
6105
+ init_types2();
6061
6106
  init_stepup_poll();
6062
6107
  init_verify();
6063
6108
  init_http2();
@@ -6069,6 +6114,7 @@ var init_express = __esm({
6069
6114
  init_metadata_capture();
6070
6115
  init_anonymous_beacon();
6071
6116
  init_failure_posture();
6117
+ init_route_pattern();
6072
6118
  DEFAULT_ROUTES_REFRESH_MS = 5 * 60 * 1e3;
6073
6119
  }
6074
6120
  });
@@ -6078,6 +6124,8 @@ var DEFAULT_ROUTES_REFRESH_MS2;
6078
6124
  var init_nextjs = __esm({
6079
6125
  "src/adapters/nextjs.ts"() {
6080
6126
  "use strict";
6127
+ init_commerce_detect();
6128
+ init_types2();
6081
6129
  init_stepup_poll();
6082
6130
  init_verify();
6083
6131
  init_http2();
@@ -6088,6 +6136,7 @@ var init_nextjs = __esm({
6088
6136
  init_http_pdlss();
6089
6137
  init_approval_gate();
6090
6138
  init_verified_hop();
6139
+ init_route_pattern();
6091
6140
  DEFAULT_ROUTES_REFRESH_MS2 = 5 * 60 * 1e3;
6092
6141
  }
6093
6142
  });
@@ -6099,6 +6148,7 @@ var init_sdk = __esm({
6099
6148
  init_verify();
6100
6149
  init_trust_levels();
6101
6150
  init_http();
6151
+ init_errors();
6102
6152
  }
6103
6153
  });
6104
6154
 
@@ -6324,7 +6374,7 @@ var init_extractor_registry = __esm({
6324
6374
  });
6325
6375
 
6326
6376
  // src/transport/registry/types.ts
6327
- var init_types2 = __esm({
6377
+ var init_types3 = __esm({
6328
6378
  "src/transport/registry/types.ts"() {
6329
6379
  "use strict";
6330
6380
  }
@@ -6382,7 +6432,7 @@ var init_transport = __esm({
6382
6432
  init_vi_verify();
6383
6433
  init_commerce_pipeline();
6384
6434
  init_extractor_registry();
6385
- init_types2();
6435
+ init_types3();
6386
6436
  init_visa();
6387
6437
  init_mastercard();
6388
6438
  init_web_bot_auth();
@@ -6489,10 +6539,220 @@ var init_runtime_signatures = __esm({
6489
6539
  }
6490
6540
  });
6491
6541
 
6542
+ // src/ucp/agent-header.ts
6543
+ var init_agent_header = __esm({
6544
+ "src/ucp/agent-header.ts"() {
6545
+ "use strict";
6546
+ }
6547
+ });
6548
+
6549
+ // src/ucp/profile.ts
6550
+ var UCP_VERSION, SPEC, SCHEMAS;
6551
+ var init_profile = __esm({
6552
+ "src/ucp/profile.ts"() {
6553
+ "use strict";
6554
+ UCP_VERSION = "2026-08-25";
6555
+ SPEC = `https://ucp.dev/${UCP_VERSION}/specification`;
6556
+ SCHEMAS = `https://ucp.dev/${UCP_VERSION}/schemas`;
6557
+ }
6558
+ });
6559
+
6560
+ // src/ucp/negotiate.ts
6561
+ var init_negotiate = __esm({
6562
+ "src/ucp/negotiate.ts"() {
6563
+ "use strict";
6564
+ }
6565
+ });
6566
+
6567
+ // src/ucp/messages.ts
6568
+ var init_messages = __esm({
6569
+ "src/ucp/messages.ts"() {
6570
+ "use strict";
6571
+ }
6572
+ });
6573
+
6574
+ // src/http-signatures/sign.ts
6575
+ var import_http_message_signatures2;
6576
+ var init_sign = __esm({
6577
+ "src/http-signatures/sign.ts"() {
6578
+ "use strict";
6579
+ import_http_message_signatures2 = require("http-message-signatures");
6580
+ }
6581
+ });
6582
+
6583
+ // src/ucp/signatures.ts
6584
+ var import_http_message_signatures3;
6585
+ var init_signatures = __esm({
6586
+ "src/ucp/signatures.ts"() {
6587
+ "use strict";
6588
+ import_http_message_signatures3 = require("http-message-signatures");
6589
+ init_sign();
6590
+ init_rfc9421_verify();
6591
+ }
6592
+ });
6593
+
6594
+ // src/mandates/sd-jwt.ts
6595
+ var import_jose2;
6596
+ var init_sd_jwt = __esm({
6597
+ "src/mandates/sd-jwt.ts"() {
6598
+ "use strict";
6599
+ import_jose2 = require("jose");
6600
+ }
6601
+ });
6602
+
6603
+ // src/mandates/ap2.ts
6604
+ var init_ap22 = __esm({
6605
+ "src/mandates/ap2.ts"() {
6606
+ "use strict";
6607
+ init_sd_jwt();
6608
+ }
6609
+ });
6610
+
6611
+ // src/mandates/index.ts
6612
+ var init_mandates = __esm({
6613
+ "src/mandates/index.ts"() {
6614
+ "use strict";
6615
+ init_sd_jwt();
6616
+ init_ap22();
6617
+ }
6618
+ });
6619
+
6620
+ // src/idempotency/index.ts
6621
+ var DEFAULT_IDEMPOTENCY_TTL_MS;
6622
+ var init_idempotency = __esm({
6623
+ "src/idempotency/index.ts"() {
6624
+ "use strict";
6625
+ DEFAULT_IDEMPOTENCY_TTL_MS = 24 * 60 * 60 * 1e3;
6626
+ }
6627
+ });
6628
+
6629
+ // src/ucp/jcs.ts
6630
+ var init_jcs = __esm({
6631
+ "src/ucp/jcs.ts"() {
6632
+ "use strict";
6633
+ }
6634
+ });
6635
+
6636
+ // src/ucp/report-amount.ts
6637
+ var init_report_amount = __esm({
6638
+ "src/ucp/report-amount.ts"() {
6639
+ "use strict";
6640
+ }
6641
+ });
6642
+
6643
+ // src/ucp/checkout-kit.ts
6644
+ var import_jose3;
6645
+ var init_checkout_kit = __esm({
6646
+ "src/ucp/checkout-kit.ts"() {
6647
+ "use strict";
6648
+ import_jose3 = require("jose");
6649
+ init_mandates();
6650
+ init_idempotency();
6651
+ init_jcs();
6652
+ init_agent_header();
6653
+ init_negotiate();
6654
+ init_messages();
6655
+ init_profile();
6656
+ init_signatures();
6657
+ init_report_amount();
6658
+ }
6659
+ });
6660
+
6661
+ // src/ucp/index.ts
6662
+ var init_ucp2 = __esm({
6663
+ "src/ucp/index.ts"() {
6664
+ "use strict";
6665
+ init_agent_header();
6666
+ init_profile();
6667
+ init_negotiate();
6668
+ init_messages();
6669
+ init_signatures();
6670
+ init_checkout_kit();
6671
+ init_jcs();
6672
+ }
6673
+ });
6674
+
6675
+ // src/payments/x402.ts
6676
+ var init_x4022 = __esm({
6677
+ "src/payments/x402.ts"() {
6678
+ "use strict";
6679
+ }
6680
+ });
6681
+
6682
+ // src/payments/mpp.ts
6683
+ var init_mpp2 = __esm({
6684
+ "src/payments/mpp.ts"() {
6685
+ "use strict";
6686
+ }
6687
+ });
6688
+
6689
+ // src/payments/kyapay.ts
6690
+ var import_jose4;
6691
+ var init_kyapay = __esm({
6692
+ "src/payments/kyapay.ts"() {
6693
+ "use strict";
6694
+ import_jose4 = require("jose");
6695
+ }
6696
+ });
6697
+
6698
+ // src/payments/index.ts
6699
+ var init_payments = __esm({
6700
+ "src/payments/index.ts"() {
6701
+ "use strict";
6702
+ init_x4022();
6703
+ init_mpp2();
6704
+ init_kyapay();
6705
+ }
6706
+ });
6707
+
6708
+ // src/aep/core.ts
6709
+ var ED25519_PKCS8_PREFIX, ED25519_SPKI_PREFIX;
6710
+ var init_core = __esm({
6711
+ "src/aep/core.ts"() {
6712
+ "use strict";
6713
+ ED25519_PKCS8_PREFIX = Buffer.from("302e020100300506032b657004220420", "hex");
6714
+ ED25519_SPKI_PREFIX = Buffer.from("302a300506032b6570032100", "hex");
6715
+ }
6716
+ });
6717
+
6718
+ // src/aep/index.ts
6719
+ var init_aep = __esm({
6720
+ "src/aep/index.ts"() {
6721
+ "use strict";
6722
+ init_core();
6723
+ }
6724
+ });
6725
+
6726
+ // src/acp/checkout-kit.ts
6727
+ var init_checkout_kit2 = __esm({
6728
+ "src/acp/checkout-kit.ts"() {
6729
+ "use strict";
6730
+ init_idempotency();
6731
+ init_report_amount();
6732
+ }
6733
+ });
6734
+
6735
+ // src/acp/index.ts
6736
+ var init_acp2 = __esm({
6737
+ "src/acp/index.ts"() {
6738
+ "use strict";
6739
+ init_checkout_kit2();
6740
+ }
6741
+ });
6742
+
6743
+ // src/http-signatures/index.ts
6744
+ var init_http_signatures = __esm({
6745
+ "src/http-signatures/index.ts"() {
6746
+ "use strict";
6747
+ init_sign();
6748
+ }
6749
+ });
6750
+
6492
6751
  // src/index.ts
6493
6752
  var init_src = __esm({
6494
6753
  "src/index.ts"() {
6495
6754
  "use strict";
6755
+ init_types2();
6496
6756
  init_trust_levels();
6497
6757
  init_verify();
6498
6758
  init_failure_posture();
@@ -6521,6 +6781,14 @@ var init_src = __esm({
6521
6781
  init_pdlss_parser();
6522
6782
  init_schema();
6523
6783
  init_version();
6784
+ init_route_pattern();
6785
+ init_ucp2();
6786
+ init_payments();
6787
+ init_aep();
6788
+ init_acp2();
6789
+ init_mandates();
6790
+ init_http_signatures();
6791
+ init_idempotency();
6524
6792
  }
6525
6793
  });
6526
6794
 
@@ -7616,7 +7884,7 @@ var init_enrolment_store = __esm({
7616
7884
 
7617
7885
  // src/fleet/types.ts
7618
7886
  var FLEET_POLICY_TYP, FLEET_POLICY_AUD, FLEET_POLICY_ISS, FLEET_KEYS_TYP, FLEET_KEYS_AUD, DEFAULT_HEARTBEAT_INTERVAL_SEC;
7619
- var init_types3 = __esm({
7887
+ var init_types4 = __esm({
7620
7888
  "src/fleet/types.ts"() {
7621
7889
  "use strict";
7622
7890
  FLEET_POLICY_TYP = "fleet-policy+jwt";
@@ -7661,8 +7929,8 @@ async function verifyFleetPolicy(jws, jwks, options) {
7661
7929
  let payloadBytes;
7662
7930
  let header;
7663
7931
  try {
7664
- const keySet = (0, import_jose2.createLocalJWKSet)(jwks);
7665
- const result = await (0, import_jose2.compactVerify)(jws, keySet, { algorithms: ["ES256"] });
7932
+ const keySet = (0, import_jose5.createLocalJWKSet)(jwks);
7933
+ const result = await (0, import_jose5.compactVerify)(jws, keySet, { algorithms: ["ES256"] });
7666
7934
  payloadBytes = result.payload;
7667
7935
  header = result.protectedHeader;
7668
7936
  } catch (err) {
@@ -7708,9 +7976,9 @@ async function resolveFleetJwks(pinned, chain, ownerId) {
7708
7976
  let lastSeq = 0;
7709
7977
  for (const link of chain) {
7710
7978
  try {
7711
- const { payload, protectedHeader } = await (0, import_jose2.compactVerify)(
7979
+ const { payload, protectedHeader } = await (0, import_jose5.compactVerify)(
7712
7980
  link,
7713
- (0, import_jose2.createLocalJWKSet)(trusted),
7981
+ (0, import_jose5.createLocalJWKSet)(trusted),
7714
7982
  { algorithms: ["ES256"] }
7715
7983
  );
7716
7984
  if (protectedHeader.typ !== FLEET_KEYS_TYP) continue;
@@ -7740,14 +8008,14 @@ async function pickNewestValid(candidates, jwks, options) {
7740
8008
  if (!best) throw lastError;
7741
8009
  return best;
7742
8010
  }
7743
- var import_crypto, import_jose2, FleetPolicyError;
8011
+ var import_crypto, import_jose5, FleetPolicyError;
7744
8012
  var init_policy_verify = __esm({
7745
8013
  "src/fleet/policy-verify.ts"() {
7746
8014
  "use strict";
7747
8015
  import_crypto = require("crypto");
7748
- import_jose2 = require("jose");
8016
+ import_jose5 = require("jose");
7749
8017
  init_pdlss_parser();
7750
- init_types3();
8018
+ init_types4();
7751
8019
  FleetPolicyError = class extends Error {
7752
8020
  constructor(message) {
7753
8021
  super(message);
@@ -7968,7 +8236,7 @@ var init_cli = __esm({
7968
8236
  init_client2();
7969
8237
  init_enrolment_store();
7970
8238
  init_policy_verify();
7971
- init_types3();
8239
+ init_types4();
7972
8240
  DEFAULT_FLEET_API_BASE_URL = "https://astrasync.ai/api";
7973
8241
  MANAGED_SETTINGS_LOCATIONS = {
7974
8242
  // code.claude.com/docs/en/managed-settings
@@ -7987,6 +8255,95 @@ var init_cli = __esm({
7987
8255
  }
7988
8256
  });
7989
8257
 
8258
+ // src/fleet/git-route.ts
8259
+ function gitRouteConfig(opts) {
8260
+ const base2 = opts.checkpoint.replace(/\/+$/, "");
8261
+ if (!/^https:\/\//.test(base2) && !/^http:\/\/(localhost|127\.0\.0\.1)(:\d+)?$/.test(base2)) {
8262
+ throw new Error("--checkpoint must be an https:// URL");
8263
+ }
8264
+ if (!/^ASTRA-[A-Za-z0-9_-]{8,64}$/.test(opts.agent))
8265
+ throw new Error("--agent must be an ASTRA-id");
8266
+ if (!/^[A-Za-z0-9_-]{4,120}$/.test(opts.slug))
8267
+ throw new Error("--slug must be the connector slug");
8268
+ const upstream = opts.upstream ?? "github";
8269
+ return [
8270
+ [`url.${base2}/a/${opts.slug}/git/${upstream}/.insteadOf`, opts.host ?? "https://github.com/"],
8271
+ [`credential.${base2}.helper`, "!astrasync guard git-credential"],
8272
+ ["astrasync.agent", opts.agent],
8273
+ ["astrasync.checkpoint", base2]
8274
+ ];
8275
+ }
8276
+ function applyGitRoute(opts, git = realGit) {
8277
+ const entries = gitRouteConfig(opts);
8278
+ for (const [key, value] of entries) git(["config", "--global", key, value]);
8279
+ return entries.map(([k, v]) => `${k} = ${v}`);
8280
+ }
8281
+ function removeGitRoute(git = realGit) {
8282
+ let base2 = "";
8283
+ try {
8284
+ base2 = git(["config", "--global", "--get", "astrasync.checkpoint"]).trim();
8285
+ } catch {
8286
+ return [];
8287
+ }
8288
+ const removed = [];
8289
+ const unset = (args) => {
8290
+ try {
8291
+ git(["config", "--global", ...args]);
8292
+ removed.push(args[args.length - 1]);
8293
+ } catch {
8294
+ }
8295
+ };
8296
+ let urls = "";
8297
+ try {
8298
+ urls = git(["config", "--global", "--get-regexp", "^url\\..*\\.insteadof$"]);
8299
+ } catch {
8300
+ }
8301
+ for (const line of urls.split("\n")) {
8302
+ const key = line.split(" ")[0];
8303
+ if (key && key.toLowerCase().startsWith(`url.${base2}/`.toLowerCase())) unset(["--unset", key]);
8304
+ }
8305
+ unset(["--unset", `credential.${base2}.helper`]);
8306
+ unset(["--unset", "astrasync.agent"]);
8307
+ unset(["--unset", "astrasync.checkpoint"]);
8308
+ return removed;
8309
+ }
8310
+ function gitCredentialAnswer(action, input, deps) {
8311
+ if (action !== "get" || !deps.agent || !deps.checkpoint || !deps.deviceCredential) return "";
8312
+ const fields = Object.fromEntries(
8313
+ input.split("\n").map((l) => l.split("=")).filter((p) => p.length >= 2).map(([k, ...v]) => [k, v.join("=")])
8314
+ );
8315
+ const host = new URL(deps.checkpoint).host;
8316
+ if (fields.host && fields.host !== host) return "";
8317
+ return `username=${deps.agent}
8318
+ password=${deps.deviceCredential}
8319
+ `;
8320
+ }
8321
+ function runGitCredential(action, input, git = realGit) {
8322
+ const read = (key) => {
8323
+ try {
8324
+ return git(["config", "--global", "--get", key]).trim();
8325
+ } catch {
8326
+ return void 0;
8327
+ }
8328
+ };
8329
+ const loaded = loadEnrolment(fleetPaths());
8330
+ const deviceCredential = loaded && "enrolment" in loaded ? loaded.enrolment.credential : void 0;
8331
+ return gitCredentialAnswer(action, input, {
8332
+ agent: read("astrasync.agent"),
8333
+ checkpoint: read("astrasync.checkpoint"),
8334
+ deviceCredential
8335
+ });
8336
+ }
8337
+ var import_child_process2, realGit;
8338
+ var init_git_route = __esm({
8339
+ "src/fleet/git-route.ts"() {
8340
+ "use strict";
8341
+ import_child_process2 = require("child_process");
8342
+ init_enrolment_store();
8343
+ realGit = (args) => (0, import_child_process2.execFileSync)("git", args, { encoding: "utf-8" });
8344
+ }
8345
+ });
8346
+
7990
8347
  // src/cli/guard.ts
7991
8348
  var guard_exports = {};
7992
8349
  function createPrompt() {
@@ -8521,6 +8878,32 @@ async function cmdFleetStatus() {
8521
8878
  const status = await getFleetStatus(fleetPaths());
8522
8879
  for (const line of formatFleetStatus(status)) console.log(line);
8523
8880
  }
8881
+ async function cmdGitRoute() {
8882
+ try {
8883
+ if (process.argv.includes("--undo")) {
8884
+ const removed = removeGitRoute();
8885
+ console.log(removed.length ? `Removed: ${removed.join(", ")}` : "No git route was set.");
8886
+ return;
8887
+ }
8888
+ const lines = applyGitRoute({
8889
+ checkpoint: flagValue("--checkpoint") ?? "",
8890
+ slug: flagValue("--slug") ?? "",
8891
+ agent: flagValue("--agent") ?? "",
8892
+ upstream: flagValue("--upstream")
8893
+ });
8894
+ console.log("git now fetches and pushes github.com through your Workforce Guard checkpoint:");
8895
+ for (const l of lines) console.log(` ${l}`);
8896
+ console.log("Commits still run your local hooks. Undo with: astrasync guard git-route --undo");
8897
+ } catch (err) {
8898
+ console.error(`git-route failed: ${err instanceof Error ? err.message : String(err)}`);
8899
+ process.exit(1);
8900
+ }
8901
+ }
8902
+ async function cmdGitCredential() {
8903
+ const action = process.argv[process.argv.indexOf("git-credential") + 1] ?? "";
8904
+ const input = fs.readFileSync(0, "utf-8");
8905
+ process.stdout.write(runGitCredential(action, input));
8906
+ }
8524
8907
  async function cmdManagedSettings() {
8525
8908
  const targets = [];
8526
8909
  if (process.argv.includes("--claude")) targets.push("claude");
@@ -8589,6 +8972,12 @@ async function main() {
8589
8972
  case "managed-settings":
8590
8973
  await cmdManagedSettings();
8591
8974
  break;
8975
+ case "git-route":
8976
+ await cmdGitRoute();
8977
+ break;
8978
+ case "git-credential":
8979
+ await cmdGitCredential();
8980
+ break;
8592
8981
  default:
8593
8982
  console.log("AstraSync Local Guard\n");
8594
8983
  console.log("Usage: astrasync guard <command>\n");
@@ -8613,6 +9002,11 @@ async function main() {
8613
9002
  console.log(" (--api-base-url <url>, --system for machine scope)");
8614
9003
  console.log(" fleet-status Show fleet enrolment, signed policy and heartbeat");
8615
9004
  console.log(" managed-settings Print MDM templates (--claude, --codex, --out <dir>)");
9005
+ console.log(" git-route Route git through your Workforce Guard checkpoint");
9006
+ console.log(
9007
+ " (--checkpoint <url> --slug <connector> --agent <ASTRA-id>;"
9008
+ );
9009
+ console.log(" --undo to remove)");
8616
9010
  console.log("");
8617
9011
  process.exit(command ? 1 : 0);
8618
9012
  }
@@ -8635,6 +9029,7 @@ var init_guard = __esm({
8635
9029
  init_settings_installer2();
8636
9030
  init_cli();
8637
9031
  init_enrolment_store();
9032
+ init_git_route();
8638
9033
  DEFAULT_POLICY_PATH = "./local-policy.yaml";
8639
9034
  DEFAULT_CONFIG_DIR = ".astrasync";
8640
9035
  main().catch((err) => {