@astrasyncai/verification-gateway 3.10.1 → 3.11.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.
Files changed (77) hide show
  1. package/dist/adapter-interface/interface.d.mts +1 -1
  2. package/dist/adapter-interface/interface.d.ts +1 -1
  3. package/dist/adapters/express.js +1 -1
  4. package/dist/adapters/express.js.map +1 -1
  5. package/dist/adapters/express.mjs +1 -1
  6. package/dist/adapters/express.mjs.map +1 -1
  7. package/dist/adapters/mcp.js +1 -1
  8. package/dist/adapters/mcp.js.map +1 -1
  9. package/dist/adapters/mcp.mjs +1 -1
  10. package/dist/adapters/mcp.mjs.map +1 -1
  11. package/dist/adapters/nextjs.js +1 -1
  12. package/dist/adapters/nextjs.js.map +1 -1
  13. package/dist/adapters/nextjs.mjs +1 -1
  14. package/dist/adapters/nextjs.mjs.map +1 -1
  15. package/dist/adapters/sdk.js +1 -1
  16. package/dist/adapters/sdk.js.map +1 -1
  17. package/dist/adapters/sdk.mjs +1 -1
  18. package/dist/adapters/sdk.mjs.map +1 -1
  19. package/dist/bin/astrasync-claude-hook.js +105 -27
  20. package/dist/bin/astrasync-codex-hook.js +5151 -0
  21. package/dist/bin/astrasync-guard.js +234 -32
  22. package/dist/bin/astrasync.js +242 -32
  23. package/dist/browser/background.js +84 -17
  24. package/dist/browser/background.js.map +1 -1
  25. package/dist/browser/background.mjs +84 -17
  26. package/dist/browser/background.mjs.map +1 -1
  27. package/dist/browser/browser-adapter.d.mts +1 -1
  28. package/dist/browser/browser-adapter.d.ts +1 -1
  29. package/dist/claude-code/claude-code-adapter.d.mts +1 -1
  30. package/dist/claude-code/claude-code-adapter.d.ts +1 -1
  31. package/dist/claude-code/claude-code-adapter.js +9 -1
  32. package/dist/claude-code/claude-code-adapter.js.map +1 -1
  33. package/dist/claude-code/claude-code-adapter.mjs +9 -1
  34. package/dist/claude-code/claude-code-adapter.mjs.map +1 -1
  35. package/dist/cli/index.d.mts +1 -1
  36. package/dist/cli/index.d.ts +1 -1
  37. package/dist/codex/index.d.mts +230 -0
  38. package/dist/codex/index.d.ts +230 -0
  39. package/dist/codex/index.js +5269 -0
  40. package/dist/codex/index.js.map +1 -0
  41. package/dist/codex/index.mjs +5241 -0
  42. package/dist/codex/index.mjs.map +1 -0
  43. package/dist/cursor/cursor-adapter.d.mts +1 -1
  44. package/dist/cursor/cursor-adapter.d.ts +1 -1
  45. package/dist/cursor/extension.d.mts +1 -1
  46. package/dist/cursor/extension.d.ts +1 -1
  47. package/dist/cursor/extension.js +84 -17
  48. package/dist/cursor/extension.js.map +1 -1
  49. package/dist/cursor/extension.mjs +84 -17
  50. package/dist/cursor/extension.mjs.map +1 -1
  51. package/dist/gateway/gateway.d.mts +6 -1
  52. package/dist/gateway/gateway.d.ts +6 -1
  53. package/dist/gateway/gateway.js +84 -17
  54. package/dist/gateway/gateway.js.map +1 -1
  55. package/dist/gateway/gateway.mjs +84 -17
  56. package/dist/gateway/gateway.mjs.map +1 -1
  57. package/dist/git-trigger/git-hooks.d.mts +1 -1
  58. package/dist/git-trigger/git-hooks.d.ts +1 -1
  59. package/dist/index.d.mts +1 -1
  60. package/dist/index.d.ts +1 -1
  61. package/dist/index.js +1 -1
  62. package/dist/index.js.map +1 -1
  63. package/dist/index.mjs +1 -1
  64. package/dist/index.mjs.map +1 -1
  65. package/dist/local-evaluator/evaluator.d.mts +10 -1
  66. package/dist/local-evaluator/evaluator.d.ts +10 -1
  67. package/dist/local-evaluator/evaluator.js +20 -9
  68. package/dist/local-evaluator/evaluator.js.map +1 -1
  69. package/dist/local-evaluator/evaluator.mjs +20 -9
  70. package/dist/local-evaluator/evaluator.mjs.map +1 -1
  71. package/dist/{types-C23_uaY8.d.ts → types-DhFPiZ3t.d.ts} +6 -1
  72. package/dist/{types-BV6abBnF.d.mts → types-cQVCMeNV.d.mts} +6 -1
  73. package/dist/verify.js +1 -1
  74. package/dist/verify.js.map +1 -1
  75. package/dist/verify.mjs +1 -1
  76. package/dist/verify.mjs.map +1 -1
  77. package/package.json +8 -2
@@ -1,5 +1,5 @@
1
1
  import { PlatformAdapter, AdapterConfig } from '../adapter-interface/interface.mjs';
2
- import { P as PDLSSContext, V as VerificationDecision, A as AgentAction, I as InterceptResult } from '../types-BV6abBnF.mjs';
2
+ import { P as PDLSSContext, V as VerificationDecision, A as AgentAction, I as InterceptResult } from '../types-cQVCMeNV.mjs';
3
3
  import '../gateway/gateway.mjs';
4
4
  import '../types-sy3tq8lp.mjs';
5
5
  import '../metadata-capture.mjs';
@@ -1,5 +1,5 @@
1
1
  import { PlatformAdapter, AdapterConfig } from '../adapter-interface/interface.js';
2
- import { P as PDLSSContext, V as VerificationDecision, A as AgentAction, I as InterceptResult } from '../types-C23_uaY8.js';
2
+ import { P as PDLSSContext, V as VerificationDecision, A as AgentAction, I as InterceptResult } from '../types-DhFPiZ3t.js';
3
3
  import '../gateway/gateway.js';
4
4
  import '../types-9tns4wyl.js';
5
5
  import '../metadata-capture.js';
@@ -1,7 +1,7 @@
1
1
  import { VSCodeAPI } from './cursor-adapter.mjs';
2
2
  import '../adapter-interface/interface.mjs';
3
3
  import '../gateway/gateway.mjs';
4
- import '../types-BV6abBnF.mjs';
4
+ import '../types-cQVCMeNV.mjs';
5
5
  import '../types-sy3tq8lp.mjs';
6
6
  import '../metadata-capture.mjs';
7
7
 
@@ -1,7 +1,7 @@
1
1
  import { VSCodeAPI } from './cursor-adapter.js';
2
2
  import '../adapter-interface/interface.js';
3
3
  import '../gateway/gateway.js';
4
- import '../types-C23_uaY8.js';
4
+ import '../types-DhFPiZ3t.js';
5
5
  import '../types-9tns4wyl.js';
6
6
  import '../metadata-capture.js';
7
7
 
@@ -391,8 +391,9 @@ function extractBacktickSubstitutions(text, collect) {
391
391
  return kept.join(" ");
392
392
  }
393
393
  function basename(token) {
394
- const slash = token.lastIndexOf("/");
395
- return slash === -1 ? token : token.slice(slash + 1);
394
+ const slash = Math.max(token.lastIndexOf("/"), token.lastIndexOf("\\"));
395
+ const name = slash === -1 ? token : token.slice(slash + 1);
396
+ return name.replace(/\.(exe|cmd|bat|ps1)$/i, "");
396
397
  }
397
398
  function matchSegment(segment, list) {
398
399
  const tokens = segment.split(/\s+/).filter((t) => /[a-z0-9]/.test(t));
@@ -525,7 +526,9 @@ var LocalEvaluator = class {
525
526
  }
526
527
  return {
527
528
  recommendation: "ALLOW",
528
- reason: "All PDLSS checks passed",
529
+ // "evaluated": dimensions absent from the policy are skipped, not
530
+ // failed — evaluatedDimensions below records which ones ran.
531
+ reason: "All evaluated PDLSS checks passed",
529
532
  evaluatedDimensions: {
530
533
  purpose: true,
531
534
  scope: !!this.policy.scope,
@@ -624,7 +627,7 @@ var LocalEvaluator = class {
624
627
  }
625
628
  }
626
629
  if ((context.purpose === "file.read" || context.purpose === "file.write" || context.purpose === "file.delete") && context.target) {
627
- const targetLower = context.target.toLowerCase();
630
+ const targetLower = context.target.toLowerCase().replace(/\\/g, "/");
628
631
  for (const sensitivePath of SENSITIVE_PATHS) {
629
632
  if (targetLower.includes(sensitivePath.toLowerCase())) {
630
633
  score = Math.max(score, 50);
@@ -653,12 +656,20 @@ var LocalEvaluator = class {
653
656
  matchesAnyPattern(value, patterns) {
654
657
  return patterns.some((pattern) => this.matchGlob(value, pattern));
655
658
  }
656
- /**
657
- * Simple glob pattern matching.
658
- * Supports * (matches any characters including / and spaces) and ? (single char).
659
- * Uses the same approach as the backend's matchGlobPattern.
660
- */
659
+ homePrefix() {
660
+ if (this.cachedHomePrefix !== void 0) return this.cachedHomePrefix;
661
+ const env = typeof process !== "undefined" ? process.env : void 0;
662
+ const home = env?.HOME || env?.USERPROFILE;
663
+ this.cachedHomePrefix = home ? home.replace(/\\/g, "/") : null;
664
+ return this.cachedHomePrefix;
665
+ }
661
666
  matchGlob(value, pattern) {
667
+ value = value.replace(/\\/g, "/");
668
+ pattern = pattern.replace(/\\/g, "/");
669
+ if (pattern === "~" || pattern.startsWith("~/")) {
670
+ const home = this.homePrefix();
671
+ if (home) pattern = home + pattern.slice(1);
672
+ }
662
673
  if (pattern === value) return true;
663
674
  const starCount = (pattern.match(/\*/g) ?? []).length;
664
675
  if (starCount > 8) {
@@ -3931,7 +3942,7 @@ function getTrustLevel(score) {
3931
3942
  }
3932
3943
 
3933
3944
  // src/version.ts
3934
- var SDK_VERSION = "3.10.1";
3945
+ var SDK_VERSION = "3.11.1";
3935
3946
 
3936
3947
  // src/well-known.ts
3937
3948
  var CACHE_TTL_MS = 60 * 60 * 1e3;
@@ -4446,10 +4457,12 @@ function toGatewayConfig(config) {
4446
4457
  };
4447
4458
  }
4448
4459
  function toVerificationRequest(context, astraId) {
4460
+ const dotIndex = context.purpose.indexOf(".");
4461
+ const dotted = dotIndex > 0;
4449
4462
  return {
4450
4463
  credentials: { astraId },
4451
- purpose: context.purpose,
4452
- action: context.action,
4464
+ purpose: dotted ? context.purpose.slice(0, dotIndex) : context.purpose,
4465
+ action: dotted ? context.purpose : context.action,
4453
4466
  resourceType: context.resourceType,
4454
4467
  resource: context.target,
4455
4468
  transactionValue: context.transactionValue,
@@ -4692,13 +4705,43 @@ var TraceLogger = class {
4692
4705
  * Log an evaluation event.
4693
4706
  */
4694
4707
  logEvaluation(context, decision) {
4708
+ if (!this.enabled) return;
4709
+ let event;
4710
+ try {
4711
+ event = {
4712
+ id: this.generateId(),
4713
+ timestamp: /* @__PURE__ */ new Date(),
4714
+ type: "evaluation",
4715
+ context: redactDeep(context),
4716
+ decision: redactDeep(decision)
4717
+ };
4718
+ } catch (err) {
4719
+ event = {
4720
+ id: this.generateId(),
4721
+ timestamp: /* @__PURE__ */ new Date(),
4722
+ type: "error",
4723
+ metadata: {
4724
+ error: `trace redaction failed: ${err instanceof Error ? err.message : String(err)}`,
4725
+ recommendation: decision.recommendation,
4726
+ purpose: context.purpose,
4727
+ action: context.action
4728
+ }
4729
+ };
4730
+ }
4731
+ this.write(event);
4732
+ }
4733
+ /**
4734
+ * Log a tool call the guard saw but did not govern. One line per skip
4735
+ * keeps coverage holes (unmapped platform tools) visible in the traces
4736
+ * instead of silently indistinguishable from ALLOW.
4737
+ */
4738
+ logSkipped(toolName, reason) {
4695
4739
  if (!this.enabled) return;
4696
4740
  this.write({
4697
4741
  id: this.generateId(),
4698
4742
  timestamp: /* @__PURE__ */ new Date(),
4699
- type: "evaluation",
4700
- context: redactDeep(context),
4701
- decision: redactDeep(decision)
4743
+ type: "skipped",
4744
+ metadata: { toolName, reason }
4702
4745
  });
4703
4746
  }
4704
4747
  /**
@@ -4727,17 +4770,34 @@ var TraceLogger = class {
4727
4770
  });
4728
4771
  }
4729
4772
  write(event) {
4773
+ let line;
4774
+ try {
4775
+ line = JSON.stringify(event) + "\n";
4776
+ } catch {
4777
+ return;
4778
+ }
4730
4779
  try {
4731
4780
  const filePath = this.getCurrentFilePath();
4732
- const line = JSON.stringify(event) + "\n";
4733
4781
  if ((0, import_fs3.existsSync)(filePath)) {
4734
4782
  const stats = (0, import_fs3.statSync)(filePath);
4735
4783
  if (stats.size > MAX_FILE_SIZE) {
4736
4784
  this.rotate();
4737
4785
  }
4738
4786
  }
4739
- (0, import_fs3.appendFileSync)(filePath, line);
4787
+ for (let attempt = 0; attempt < 3; attempt++) {
4788
+ try {
4789
+ (0, import_fs3.appendFileSync)(filePath, line);
4790
+ return;
4791
+ } catch {
4792
+ }
4793
+ }
4794
+ const fallbackPath = filePath.replace(/\.jsonl$/, `-r${process.pid}.jsonl`);
4795
+ (0, import_fs3.appendFileSync)(fallbackPath, line);
4740
4796
  } catch {
4797
+ try {
4798
+ console.error(`[AstraSync TraceLogger] failed to persist trace line: ${line.trim()}`);
4799
+ } catch {
4800
+ }
4741
4801
  }
4742
4802
  }
4743
4803
  getCurrentFilePath() {
@@ -4898,6 +4958,13 @@ var AstraSyncGateway = class {
4898
4958
  getSyncStatus() {
4899
4959
  return this.syncQueue?.getStatus() || null;
4900
4960
  }
4961
+ /**
4962
+ * Record a tool call the calling adapter saw but did not govern
4963
+ * (unmapped tool, skipTools, MCP with governMcp off). Trace-only.
4964
+ */
4965
+ logSkippedTool(toolName, reason) {
4966
+ this.traceLogger?.logSkipped(toolName, reason);
4967
+ }
4901
4968
  };
4902
4969
 
4903
4970
  // src/cursor/extension.ts