@astrasyncai/verification-gateway 5.15.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 (96) hide show
  1. package/README.md +9 -1
  2. package/dist/adapters/express.d.mts +1 -1
  3. package/dist/adapters/express.d.ts +1 -1
  4. package/dist/adapters/express.js +17 -2
  5. package/dist/adapters/express.js.map +1 -1
  6. package/dist/adapters/express.mjs +17 -2
  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 +4 -1
  11. package/dist/adapters/mcp.js.map +1 -1
  12. package/dist/adapters/mcp.mjs +4 -1
  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 +17 -2
  17. package/dist/adapters/nextjs.js.map +1 -1
  18. package/dist/adapters/nextjs.mjs +17 -2
  19. package/dist/adapters/nextjs.mjs.map +1 -1
  20. package/dist/adapters/sdk.d.mts +1 -1
  21. package/dist/adapters/sdk.d.ts +1 -1
  22. package/dist/adapters/sdk.js +4 -1
  23. package/dist/adapters/sdk.js.map +1 -1
  24. package/dist/adapters/sdk.mjs +4 -1
  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 +4 -1
  33. package/dist/bin/astrasync-codex-hook.js +4 -1
  34. package/dist/bin/astrasync-guard.js +123 -1
  35. package/dist/bin/astrasync.js +146 -6
  36. package/dist/browser/background.js +4 -1
  37. package/dist/browser/background.js.map +1 -1
  38. package/dist/browser/background.mjs +4 -1
  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 +4 -1
  45. package/dist/codex/index.js.map +1 -1
  46. package/dist/codex/index.mjs +4 -1
  47. package/dist/codex/index.mjs.map +1 -1
  48. package/dist/cursor/extension.js +4 -1
  49. package/dist/cursor/extension.js.map +1 -1
  50. package/dist/cursor/extension.mjs +4 -1
  51. package/dist/cursor/extension.mjs.map +1 -1
  52. package/dist/edge-config.d.mts +1 -1
  53. package/dist/edge-config.d.ts +1 -1
  54. package/dist/edge-config.js +1 -1
  55. package/dist/edge-config.js.map +1 -1
  56. package/dist/edge-config.mjs +1 -1
  57. package/dist/edge-config.mjs.map +1 -1
  58. package/dist/edge-core/index.d.mts +1 -1
  59. package/dist/edge-core/index.d.ts +1 -1
  60. package/dist/edge-core/index.js +5 -2
  61. package/dist/edge-core/index.js.map +1 -1
  62. package/dist/edge-core/index.mjs +5 -2
  63. package/dist/edge-core/index.mjs.map +1 -1
  64. package/dist/gateway/gateway.js +4 -1
  65. package/dist/gateway/gateway.js.map +1 -1
  66. package/dist/gateway/gateway.mjs +4 -1
  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 +96 -57
  71. package/dist/index.d.ts +96 -57
  72. package/dist/index.js +43 -15
  73. package/dist/index.js.map +1 -1
  74. package/dist/index.mjs +42 -15
  75. package/dist/index.mjs.map +1 -1
  76. package/dist/registration/index.js +1 -1
  77. package/dist/registration/index.js.map +1 -1
  78. package/dist/registration/index.mjs +1 -1
  79. package/dist/registration/index.mjs.map +1 -1
  80. package/dist/transport/index.js +1 -1
  81. package/dist/transport/index.js.map +1 -1
  82. package/dist/transport/index.mjs +1 -1
  83. package/dist/transport/index.mjs.map +1 -1
  84. package/dist/{types-Dxf9DBpr.d.mts → types-Blz520bR.d.mts} +10 -0
  85. package/dist/{types-Dxf9DBpr.d.ts → types-Blz520bR.d.ts} +10 -0
  86. package/dist/{types-DtJjlW4O.d.ts → types-Bm1QvGqI.d.ts} +10 -0
  87. package/dist/{types-Eg6VoBNH.d.mts → types-DBe4hgfT.d.mts} +10 -0
  88. package/dist/ui/index.d.mts +1 -1
  89. package/dist/ui/index.d.ts +1 -1
  90. package/dist/verify.d.mts +1 -1
  91. package/dist/verify.d.ts +1 -1
  92. package/dist/verify.js +4 -1
  93. package/dist/verify.js.map +1 -1
  94. package/dist/verify.mjs +4 -1
  95. package/dist/verify.mjs.map +1 -1
  96. package/package.json +1 -1
@@ -3752,7 +3752,7 @@ function getTrustLevel(score) {
3752
3752
  }
3753
3753
 
3754
3754
  // src/version.ts
3755
- var SDK_VERSION = "5.15.0";
3755
+ var SDK_VERSION = "5.16.0";
3756
3756
 
3757
3757
  // src/http.ts
3758
3758
  var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
@@ -3889,6 +3889,8 @@ function getCacheKey(request, counterpartyId) {
3889
3889
  request.durationRequired ?? "",
3890
3890
  request.invocationProtocol || "",
3891
3891
  request.enableRuntimeChallenge ? "1" : "0",
3892
+ // 5.16.0: route policy changes the verdict (owners / challenge).
3893
+ request.routePolicy ? JSON.stringify(request.routePolicy) : "",
3892
3894
  // callerMetadata fields contribute to risk model; include the ones
3893
3895
  // backend reads. sourceIp/userAgent/forwardedFor change per-request
3894
3896
  // so their inclusion effectively forces a re-check for any varying
@@ -4061,6 +4063,7 @@ async function callVerifyAccessAPI(config, request) {
4061
4063
  if (requestData.subAgentDepth !== void 0) body.subAgentDepth = requestData.subAgentDepth;
4062
4064
  if (requestData.enableRuntimeChallenge)
4063
4065
  body.enableRuntimeChallenge = requestData.enableRuntimeChallenge;
4066
+ if (requestData.routePolicy) body.routePolicy = requestData.routePolicy;
4064
4067
  if (requestData.createSession) body.createSession = requestData.createSession;
4065
4068
  if (requestData.durationRequired) body.durationRequired = requestData.durationRequired;
4066
4069
  if (requestData.counterpartyType) body.counterpartyType = requestData.counterpartyType;
@@ -3751,7 +3751,7 @@ function getTrustLevel(score) {
3751
3751
  }
3752
3752
 
3753
3753
  // src/version.ts
3754
- var SDK_VERSION = "5.15.0";
3754
+ var SDK_VERSION = "5.16.0";
3755
3755
 
3756
3756
  // src/http.ts
3757
3757
  var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
@@ -3888,6 +3888,8 @@ function getCacheKey(request, counterpartyId) {
3888
3888
  request.durationRequired ?? "",
3889
3889
  request.invocationProtocol || "",
3890
3890
  request.enableRuntimeChallenge ? "1" : "0",
3891
+ // 5.16.0: route policy changes the verdict (owners / challenge).
3892
+ request.routePolicy ? JSON.stringify(request.routePolicy) : "",
3891
3893
  // callerMetadata fields contribute to risk model; include the ones
3892
3894
  // backend reads. sourceIp/userAgent/forwardedFor change per-request
3893
3895
  // so their inclusion effectively forces a re-check for any varying
@@ -4060,6 +4062,7 @@ async function callVerifyAccessAPI(config, request) {
4060
4062
  if (requestData.subAgentDepth !== void 0) body.subAgentDepth = requestData.subAgentDepth;
4061
4063
  if (requestData.enableRuntimeChallenge)
4062
4064
  body.enableRuntimeChallenge = requestData.enableRuntimeChallenge;
4065
+ if (requestData.routePolicy) body.routePolicy = requestData.routePolicy;
4063
4066
  if (requestData.createSession) body.createSession = requestData.createSession;
4064
4067
  if (requestData.durationRequired) body.durationRequired = requestData.durationRequired;
4065
4068
  if (requestData.counterpartyType) body.counterpartyType = requestData.counterpartyType;
@@ -3713,7 +3713,7 @@ Policy saved to ${outputPath}`);
3713
3713
  };
3714
3714
 
3715
3715
  // src/version.ts
3716
- var SDK_VERSION = "5.15.0";
3716
+ var SDK_VERSION = "5.16.0";
3717
3717
 
3718
3718
  // src/http.ts
3719
3719
  var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
@@ -4754,6 +4754,8 @@ function getCacheKey(request2, counterpartyId) {
4754
4754
  request2.durationRequired ?? "",
4755
4755
  request2.invocationProtocol || "",
4756
4756
  request2.enableRuntimeChallenge ? "1" : "0",
4757
+ // 5.16.0: route policy changes the verdict (owners / challenge).
4758
+ request2.routePolicy ? JSON.stringify(request2.routePolicy) : "",
4757
4759
  // callerMetadata fields contribute to risk model; include the ones
4758
4760
  // backend reads. sourceIp/userAgent/forwardedFor change per-request
4759
4761
  // so their inclusion effectively forces a re-check for any varying
@@ -4926,6 +4928,7 @@ async function callVerifyAccessAPI(config, request2) {
4926
4928
  if (requestData.subAgentDepth !== void 0) body.subAgentDepth = requestData.subAgentDepth;
4927
4929
  if (requestData.enableRuntimeChallenge)
4928
4930
  body.enableRuntimeChallenge = requestData.enableRuntimeChallenge;
4931
+ if (requestData.routePolicy) body.routePolicy = requestData.routePolicy;
4929
4932
  if (requestData.createSession) body.createSession = requestData.createSession;
4930
4933
  if (requestData.durationRequired) body.durationRequired = requestData.durationRequired;
4931
4934
  if (requestData.counterpartyType) body.counterpartyType = requestData.counterpartyType;
@@ -6981,6 +6984,88 @@ function writeManagedSettings(files, outDir) {
6981
6984
  });
6982
6985
  }
6983
6986
 
6987
+ // src/fleet/git-route.ts
6988
+ var import_child_process2 = require("child_process");
6989
+ var realGit = (args) => (0, import_child_process2.execFileSync)("git", args, { encoding: "utf-8" });
6990
+ function gitRouteConfig(opts) {
6991
+ const base2 = opts.checkpoint.replace(/\/+$/, "");
6992
+ if (!/^https:\/\//.test(base2) && !/^http:\/\/(localhost|127\.0\.0\.1)(:\d+)?$/.test(base2)) {
6993
+ throw new Error("--checkpoint must be an https:// URL");
6994
+ }
6995
+ if (!/^ASTRA-[A-Za-z0-9_-]{8,64}$/.test(opts.agent))
6996
+ throw new Error("--agent must be an ASTRA-id");
6997
+ if (!/^[A-Za-z0-9_-]{4,120}$/.test(opts.slug))
6998
+ throw new Error("--slug must be the connector slug");
6999
+ const upstream = opts.upstream ?? "github";
7000
+ return [
7001
+ [`url.${base2}/a/${opts.slug}/git/${upstream}/.insteadOf`, opts.host ?? "https://github.com/"],
7002
+ [`credential.${base2}.helper`, "!astrasync guard git-credential"],
7003
+ ["astrasync.agent", opts.agent],
7004
+ ["astrasync.checkpoint", base2]
7005
+ ];
7006
+ }
7007
+ function applyGitRoute(opts, git = realGit) {
7008
+ const entries = gitRouteConfig(opts);
7009
+ for (const [key, value] of entries) git(["config", "--global", key, value]);
7010
+ return entries.map(([k, v]) => `${k} = ${v}`);
7011
+ }
7012
+ function removeGitRoute(git = realGit) {
7013
+ let base2 = "";
7014
+ try {
7015
+ base2 = git(["config", "--global", "--get", "astrasync.checkpoint"]).trim();
7016
+ } catch {
7017
+ return [];
7018
+ }
7019
+ const removed = [];
7020
+ const unset = (args) => {
7021
+ try {
7022
+ git(["config", "--global", ...args]);
7023
+ removed.push(args[args.length - 1]);
7024
+ } catch {
7025
+ }
7026
+ };
7027
+ let urls = "";
7028
+ try {
7029
+ urls = git(["config", "--global", "--get-regexp", "^url\\..*\\.insteadof$"]);
7030
+ } catch {
7031
+ }
7032
+ for (const line of urls.split("\n")) {
7033
+ const key = line.split(" ")[0];
7034
+ if (key && key.toLowerCase().startsWith(`url.${base2}/`.toLowerCase())) unset(["--unset", key]);
7035
+ }
7036
+ unset(["--unset", `credential.${base2}.helper`]);
7037
+ unset(["--unset", "astrasync.agent"]);
7038
+ unset(["--unset", "astrasync.checkpoint"]);
7039
+ return removed;
7040
+ }
7041
+ function gitCredentialAnswer(action, input, deps) {
7042
+ if (action !== "get" || !deps.agent || !deps.checkpoint || !deps.deviceCredential) return "";
7043
+ const fields = Object.fromEntries(
7044
+ input.split("\n").map((l) => l.split("=")).filter((p) => p.length >= 2).map(([k, ...v]) => [k, v.join("=")])
7045
+ );
7046
+ const host = new URL(deps.checkpoint).host;
7047
+ if (fields.host && fields.host !== host) return "";
7048
+ return `username=${deps.agent}
7049
+ password=${deps.deviceCredential}
7050
+ `;
7051
+ }
7052
+ function runGitCredential(action, input, git = realGit) {
7053
+ const read = (key) => {
7054
+ try {
7055
+ return git(["config", "--global", "--get", key]).trim();
7056
+ } catch {
7057
+ return void 0;
7058
+ }
7059
+ };
7060
+ const loaded = loadEnrolment(fleetPaths());
7061
+ const deviceCredential = loaded && "enrolment" in loaded ? loaded.enrolment.credential : void 0;
7062
+ return gitCredentialAnswer(action, input, {
7063
+ agent: read("astrasync.agent"),
7064
+ checkpoint: read("astrasync.checkpoint"),
7065
+ deviceCredential
7066
+ });
7067
+ }
7068
+
6984
7069
  // src/cli/guard.ts
6985
7070
  var DEFAULT_POLICY_PATH = "./local-policy.yaml";
6986
7071
  var DEFAULT_CONFIG_DIR = ".astrasync";
@@ -7516,6 +7601,32 @@ async function cmdFleetStatus() {
7516
7601
  const status = await getFleetStatus(fleetPaths());
7517
7602
  for (const line of formatFleetStatus(status)) console.log(line);
7518
7603
  }
7604
+ async function cmdGitRoute() {
7605
+ try {
7606
+ if (process.argv.includes("--undo")) {
7607
+ const removed = removeGitRoute();
7608
+ console.log(removed.length ? `Removed: ${removed.join(", ")}` : "No git route was set.");
7609
+ return;
7610
+ }
7611
+ const lines = applyGitRoute({
7612
+ checkpoint: flagValue("--checkpoint") ?? "",
7613
+ slug: flagValue("--slug") ?? "",
7614
+ agent: flagValue("--agent") ?? "",
7615
+ upstream: flagValue("--upstream")
7616
+ });
7617
+ console.log("git now fetches and pushes github.com through your Workforce Guard checkpoint:");
7618
+ for (const l of lines) console.log(` ${l}`);
7619
+ console.log("Commits still run your local hooks. Undo with: astrasync guard git-route --undo");
7620
+ } catch (err) {
7621
+ console.error(`git-route failed: ${err instanceof Error ? err.message : String(err)}`);
7622
+ process.exit(1);
7623
+ }
7624
+ }
7625
+ async function cmdGitCredential() {
7626
+ const action = process.argv[process.argv.indexOf("git-credential") + 1] ?? "";
7627
+ const input = fs.readFileSync(0, "utf-8");
7628
+ process.stdout.write(runGitCredential(action, input));
7629
+ }
7519
7630
  async function cmdManagedSettings() {
7520
7631
  const targets = [];
7521
7632
  if (process.argv.includes("--claude")) targets.push("claude");
@@ -7584,6 +7695,12 @@ async function main() {
7584
7695
  case "managed-settings":
7585
7696
  await cmdManagedSettings();
7586
7697
  break;
7698
+ case "git-route":
7699
+ await cmdGitRoute();
7700
+ break;
7701
+ case "git-credential":
7702
+ await cmdGitCredential();
7703
+ break;
7587
7704
  default:
7588
7705
  console.log("AstraSync Local Guard\n");
7589
7706
  console.log("Usage: astrasync guard <command>\n");
@@ -7608,6 +7725,11 @@ async function main() {
7608
7725
  console.log(" (--api-base-url <url>, --system for machine scope)");
7609
7726
  console.log(" fleet-status Show fleet enrolment, signed policy and heartbeat");
7610
7727
  console.log(" managed-settings Print MDM templates (--claude, --codex, --out <dir>)");
7728
+ console.log(" git-route Route git through your Workforce Guard checkpoint");
7729
+ console.log(
7730
+ " (--checkpoint <url> --slug <connector> --agent <ASTRA-id>;"
7731
+ );
7732
+ console.log(" --undo to remove)");
7611
7733
  console.log("");
7612
7734
  process.exit(command ? 1 : 0);
7613
7735
  }
@@ -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.15.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;
@@ -6092,6 +6102,7 @@ var init_express = __esm({
6092
6102
  "src/adapters/express.ts"() {
6093
6103
  "use strict";
6094
6104
  init_commerce_detect();
6105
+ init_types2();
6095
6106
  init_stepup_poll();
6096
6107
  init_verify();
6097
6108
  init_http2();
@@ -6114,6 +6125,7 @@ var init_nextjs = __esm({
6114
6125
  "src/adapters/nextjs.ts"() {
6115
6126
  "use strict";
6116
6127
  init_commerce_detect();
6128
+ init_types2();
6117
6129
  init_stepup_poll();
6118
6130
  init_verify();
6119
6131
  init_http2();
@@ -6362,7 +6374,7 @@ var init_extractor_registry = __esm({
6362
6374
  });
6363
6375
 
6364
6376
  // src/transport/registry/types.ts
6365
- var init_types2 = __esm({
6377
+ var init_types3 = __esm({
6366
6378
  "src/transport/registry/types.ts"() {
6367
6379
  "use strict";
6368
6380
  }
@@ -6420,7 +6432,7 @@ var init_transport = __esm({
6420
6432
  init_vi_verify();
6421
6433
  init_commerce_pipeline();
6422
6434
  init_extractor_registry();
6423
- init_types2();
6435
+ init_types3();
6424
6436
  init_visa();
6425
6437
  init_mastercard();
6426
6438
  init_web_bot_auth();
@@ -6740,6 +6752,7 @@ var init_http_signatures = __esm({
6740
6752
  var init_src = __esm({
6741
6753
  "src/index.ts"() {
6742
6754
  "use strict";
6755
+ init_types2();
6743
6756
  init_trust_levels();
6744
6757
  init_verify();
6745
6758
  init_failure_posture();
@@ -7871,7 +7884,7 @@ var init_enrolment_store = __esm({
7871
7884
 
7872
7885
  // src/fleet/types.ts
7873
7886
  var FLEET_POLICY_TYP, FLEET_POLICY_AUD, FLEET_POLICY_ISS, FLEET_KEYS_TYP, FLEET_KEYS_AUD, DEFAULT_HEARTBEAT_INTERVAL_SEC;
7874
- var init_types3 = __esm({
7887
+ var init_types4 = __esm({
7875
7888
  "src/fleet/types.ts"() {
7876
7889
  "use strict";
7877
7890
  FLEET_POLICY_TYP = "fleet-policy+jwt";
@@ -8002,7 +8015,7 @@ var init_policy_verify = __esm({
8002
8015
  import_crypto = require("crypto");
8003
8016
  import_jose5 = require("jose");
8004
8017
  init_pdlss_parser();
8005
- init_types3();
8018
+ init_types4();
8006
8019
  FleetPolicyError = class extends Error {
8007
8020
  constructor(message) {
8008
8021
  super(message);
@@ -8223,7 +8236,7 @@ var init_cli = __esm({
8223
8236
  init_client2();
8224
8237
  init_enrolment_store();
8225
8238
  init_policy_verify();
8226
- init_types3();
8239
+ init_types4();
8227
8240
  DEFAULT_FLEET_API_BASE_URL = "https://astrasync.ai/api";
8228
8241
  MANAGED_SETTINGS_LOCATIONS = {
8229
8242
  // code.claude.com/docs/en/managed-settings
@@ -8242,6 +8255,95 @@ var init_cli = __esm({
8242
8255
  }
8243
8256
  });
8244
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
+
8245
8347
  // src/cli/guard.ts
8246
8348
  var guard_exports = {};
8247
8349
  function createPrompt() {
@@ -8776,6 +8878,32 @@ async function cmdFleetStatus() {
8776
8878
  const status = await getFleetStatus(fleetPaths());
8777
8879
  for (const line of formatFleetStatus(status)) console.log(line);
8778
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
+ }
8779
8907
  async function cmdManagedSettings() {
8780
8908
  const targets = [];
8781
8909
  if (process.argv.includes("--claude")) targets.push("claude");
@@ -8844,6 +8972,12 @@ async function main() {
8844
8972
  case "managed-settings":
8845
8973
  await cmdManagedSettings();
8846
8974
  break;
8975
+ case "git-route":
8976
+ await cmdGitRoute();
8977
+ break;
8978
+ case "git-credential":
8979
+ await cmdGitCredential();
8980
+ break;
8847
8981
  default:
8848
8982
  console.log("AstraSync Local Guard\n");
8849
8983
  console.log("Usage: astrasync guard <command>\n");
@@ -8868,6 +9002,11 @@ async function main() {
8868
9002
  console.log(" (--api-base-url <url>, --system for machine scope)");
8869
9003
  console.log(" fleet-status Show fleet enrolment, signed policy and heartbeat");
8870
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)");
8871
9010
  console.log("");
8872
9011
  process.exit(command ? 1 : 0);
8873
9012
  }
@@ -8890,6 +9029,7 @@ var init_guard = __esm({
8890
9029
  init_settings_installer2();
8891
9030
  init_cli();
8892
9031
  init_enrolment_store();
9032
+ init_git_route();
8893
9033
  DEFAULT_POLICY_PATH = "./local-policy.yaml";
8894
9034
  DEFAULT_CONFIG_DIR = ".astrasync";
8895
9035
  main().catch((err) => {
@@ -3988,7 +3988,7 @@ function getTrustLevel(score) {
3988
3988
  }
3989
3989
 
3990
3990
  // src/version.ts
3991
- var SDK_VERSION = "5.15.0";
3991
+ var SDK_VERSION = "5.16.0";
3992
3992
 
3993
3993
  // src/http.ts
3994
3994
  var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
@@ -4125,6 +4125,8 @@ function getCacheKey(request, counterpartyId) {
4125
4125
  request.durationRequired ?? "",
4126
4126
  request.invocationProtocol || "",
4127
4127
  request.enableRuntimeChallenge ? "1" : "0",
4128
+ // 5.16.0: route policy changes the verdict (owners / challenge).
4129
+ request.routePolicy ? JSON.stringify(request.routePolicy) : "",
4128
4130
  // callerMetadata fields contribute to risk model; include the ones
4129
4131
  // backend reads. sourceIp/userAgent/forwardedFor change per-request
4130
4132
  // so their inclusion effectively forces a re-check for any varying
@@ -4297,6 +4299,7 @@ async function callVerifyAccessAPI(config, request) {
4297
4299
  if (requestData.subAgentDepth !== void 0) body.subAgentDepth = requestData.subAgentDepth;
4298
4300
  if (requestData.enableRuntimeChallenge)
4299
4301
  body.enableRuntimeChallenge = requestData.enableRuntimeChallenge;
4302
+ if (requestData.routePolicy) body.routePolicy = requestData.routePolicy;
4300
4303
  if (requestData.createSession) body.createSession = requestData.createSession;
4301
4304
  if (requestData.durationRequired) body.durationRequired = requestData.durationRequired;
4302
4305
  if (requestData.counterpartyType) body.counterpartyType = requestData.counterpartyType;