@astrasyncai/verification-gateway 5.4.0 → 5.4.2

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 (133) hide show
  1. package/dist/adapter-interface/interface.d.mts +2 -3
  2. package/dist/adapter-interface/interface.d.ts +2 -3
  3. package/dist/adapters/express.d.mts +63 -4
  4. package/dist/adapters/express.d.ts +63 -4
  5. package/dist/adapters/express.js +9 -2
  6. package/dist/adapters/express.js.map +1 -1
  7. package/dist/adapters/express.mjs +9 -2
  8. package/dist/adapters/express.mjs.map +1 -1
  9. package/dist/adapters/mcp.d.mts +396 -4
  10. package/dist/adapters/mcp.d.ts +396 -4
  11. package/dist/adapters/mcp.js +9 -2
  12. package/dist/adapters/mcp.js.map +1 -1
  13. package/dist/adapters/mcp.mjs +9 -2
  14. package/dist/adapters/mcp.mjs.map +1 -1
  15. package/dist/adapters/nextjs.d.mts +22 -4
  16. package/dist/adapters/nextjs.d.ts +22 -4
  17. package/dist/adapters/nextjs.js +9 -2
  18. package/dist/adapters/nextjs.js.map +1 -1
  19. package/dist/adapters/nextjs.mjs +9 -2
  20. package/dist/adapters/nextjs.mjs.map +1 -1
  21. package/dist/adapters/sdk.d.mts +157 -3
  22. package/dist/adapters/sdk.d.ts +157 -3
  23. package/dist/adapters/sdk.js +35 -15
  24. package/dist/adapters/sdk.js.map +1 -1
  25. package/dist/adapters/sdk.mjs +35 -15
  26. package/dist/adapters/sdk.mjs.map +1 -1
  27. package/dist/agent/index.d.mts +224 -3
  28. package/dist/agent/index.d.ts +224 -3
  29. package/dist/agent/index.js +1 -1
  30. package/dist/agent/index.js.map +1 -1
  31. package/dist/agent/index.mjs +1 -1
  32. package/dist/agent/index.mjs.map +1 -1
  33. package/dist/bin/astrasync-claude-hook.js +9 -2
  34. package/dist/bin/astrasync-codex-hook.js +9 -2
  35. package/dist/bin/astrasync-guard.js +9 -2
  36. package/dist/bin/astrasync.js +9 -2
  37. package/dist/browser/background.js +9 -2
  38. package/dist/browser/background.js.map +1 -1
  39. package/dist/browser/background.mjs +9 -2
  40. package/dist/browser/background.mjs.map +1 -1
  41. package/dist/browser/browser-adapter.d.mts +1 -5
  42. package/dist/browser/browser-adapter.d.ts +1 -5
  43. package/dist/claude-code/claude-code-adapter.d.mts +1 -5
  44. package/dist/claude-code/claude-code-adapter.d.ts +1 -5
  45. package/dist/cli/index.d.mts +1 -5
  46. package/dist/cli/index.d.ts +1 -5
  47. package/dist/cli/index.js +1 -1
  48. package/dist/cli/index.js.map +1 -1
  49. package/dist/cli/index.mjs +1 -1
  50. package/dist/cli/index.mjs.map +1 -1
  51. package/dist/codex/index.d.mts +1 -5
  52. package/dist/codex/index.d.ts +1 -5
  53. package/dist/codex/index.js +9 -2
  54. package/dist/codex/index.js.map +1 -1
  55. package/dist/codex/index.mjs +9 -2
  56. package/dist/codex/index.mjs.map +1 -1
  57. package/dist/cursor/cursor-adapter.d.mts +1 -5
  58. package/dist/cursor/cursor-adapter.d.ts +1 -5
  59. package/dist/cursor/extension.d.mts +1 -5
  60. package/dist/cursor/extension.d.ts +1 -5
  61. package/dist/cursor/extension.js +9 -2
  62. package/dist/cursor/extension.js.map +1 -1
  63. package/dist/cursor/extension.mjs +9 -2
  64. package/dist/cursor/extension.mjs.map +1 -1
  65. package/dist/edge-config.d.mts +1 -1
  66. package/dist/edge-config.d.ts +1 -1
  67. package/dist/edge-config.js +1 -1
  68. package/dist/edge-config.js.map +1 -1
  69. package/dist/edge-config.mjs +1 -1
  70. package/dist/edge-config.mjs.map +1 -1
  71. package/dist/edge-core/index.d.mts +1 -1
  72. package/dist/edge-core/index.d.ts +1 -1
  73. package/dist/edge-core/index.js +9 -2
  74. package/dist/edge-core/index.js.map +1 -1
  75. package/dist/edge-core/index.mjs +9 -2
  76. package/dist/edge-core/index.mjs.map +1 -1
  77. package/dist/gateway/gateway.d.mts +2 -3
  78. package/dist/gateway/gateway.d.ts +2 -3
  79. package/dist/gateway/gateway.js +9 -2
  80. package/dist/gateway/gateway.js.map +1 -1
  81. package/dist/gateway/gateway.mjs +9 -2
  82. package/dist/gateway/gateway.mjs.map +1 -1
  83. package/dist/git-trigger/git-hooks.d.mts +253 -3
  84. package/dist/git-trigger/git-hooks.d.ts +253 -3
  85. package/dist/index.d.mts +4506 -42
  86. package/dist/index.d.ts +4506 -42
  87. package/dist/index.js +35 -15
  88. package/dist/index.js.map +1 -1
  89. package/dist/index.mjs +35 -15
  90. package/dist/index.mjs.map +1 -1
  91. package/dist/interface-q1WrMsB1.d.mts +365 -0
  92. package/dist/interface-q1WrMsB1.d.ts +365 -0
  93. package/dist/local-evaluator/evaluator.d.mts +2 -3
  94. package/dist/local-evaluator/evaluator.d.ts +2 -3
  95. package/dist/registration/index.js +1 -1
  96. package/dist/registration/index.js.map +1 -1
  97. package/dist/registration/index.mjs +1 -1
  98. package/dist/registration/index.mjs.map +1 -1
  99. package/dist/transport/index.d.mts +1324 -4
  100. package/dist/transport/index.d.ts +1324 -4
  101. package/dist/transport/index.js +1 -1
  102. package/dist/transport/index.js.map +1 -1
  103. package/dist/transport/index.mjs +1 -1
  104. package/dist/transport/index.mjs.map +1 -1
  105. package/dist/{types-DGh2akuh.d.ts → types-BRz2U0Pn.d.ts} +2 -2
  106. package/dist/{types-76TB0fxW.d.ts → types-BU04qAAR.d.mts} +59 -213
  107. package/dist/{types-CD1F9fmp.d.mts → types-BU04qAAR.d.ts} +59 -213
  108. package/dist/types-Bd2O3eX1.d.mts +769 -0
  109. package/dist/types-BfILnheI.d.mts +189 -0
  110. package/dist/types-BfILnheI.d.ts +189 -0
  111. package/dist/{types-z_RNjHWm.d.mts → types-CfBpm3w5.d.mts} +2 -2
  112. package/dist/types-DMChboN_.d.ts +769 -0
  113. package/dist/ui/index.d.mts +1 -2
  114. package/dist/ui/index.d.ts +1 -2
  115. package/dist/verify.d.mts +1 -1
  116. package/dist/verify.d.ts +1 -1
  117. package/dist/verify.js +9 -2
  118. package/dist/verify.js.map +1 -1
  119. package/dist/verify.mjs +9 -2
  120. package/dist/verify.mjs.map +1 -1
  121. package/package.json +1 -1
  122. package/dist/express-BIAT2pe0.d.mts +0 -69
  123. package/dist/express-D3Tf-b23.d.ts +0 -69
  124. package/dist/index-BVJkTyIF.d.mts +0 -248
  125. package/dist/index-By021oSN.d.mts +0 -1469
  126. package/dist/index-DaMXZabg.d.ts +0 -248
  127. package/dist/index-iJ9_DdLk.d.ts +0 -1469
  128. package/dist/mcp-BqfTDZLh.d.mts +0 -397
  129. package/dist/mcp-OrVOrH-s.d.ts +0 -397
  130. package/dist/nextjs-DGJXzWst.d.mts +0 -28
  131. package/dist/nextjs-xM-jdNrX.d.ts +0 -28
  132. package/dist/sdk-C1IOA5LE.d.ts +0 -173
  133. package/dist/sdk-C6_-6D-9.d.mts +0 -173
@@ -1,8 +1,258 @@
1
- import { AstraSyncGateway } from '../gateway/gateway.mjs';
2
- import { V as VerificationDecision, P as PDLSSContext } from '../types-z_RNjHWm.mjs';
3
- import '../types-CD1F9fmp.mjs';
1
+ import { T as TokenGuidance, b as CounterpartyType } from '../types-Bd2O3eX1.mjs';
4
2
  import '../metadata-capture.mjs';
5
3
 
4
+ /**
5
+ * AstraSync Gateway - Types for gateway modes, local evaluation, and adapter interface.
6
+ */
7
+ type GatewayMode = 'online' | 'local' | 'hybrid';
8
+ /**
9
+ * Posture controls whether the gateway actively blocks or just monitors.
10
+ * - active: Evaluate and enforce decisions (block/allow/review)
11
+ * - passive: Evaluate and log but never block (telemetry-only mode)
12
+ */
13
+ type GatewayPosture = 'active' | 'passive';
14
+ interface AstraSyncGatewayConfig {
15
+ mode: GatewayMode;
16
+ /** Enforcement posture: 'active' blocks actions, 'passive' logs only (default: 'active') */
17
+ posture?: GatewayPosture;
18
+ /** AstraSync API base URL (required for online/hybrid modes) */
19
+ apiBaseUrl?: string;
20
+ /** API key for authenticating with AstraSync (required for online/hybrid modes) */
21
+ apiKey?: string;
22
+ /**
23
+ * ASTRA- agent id this gateway acts as. Attached to hybrid sync entries and
24
+ * used as the default identity for online verification when the caller
25
+ * passes no per-call astraId.
26
+ */
27
+ agentId?: string;
28
+ /** Path to local PDLSS policy YAML file (required for local/hybrid modes) */
29
+ policyFile?: string;
30
+ /** Inline policy object (alternative to policyFile) */
31
+ policy?: LocalPolicy;
32
+ /** Sync interval in seconds for hybrid mode (default: 3600) */
33
+ syncInterval?: number;
34
+ /** Cache verification results TTL in seconds (default: 300) */
35
+ cacheTtl?: number;
36
+ /** Enable debug logging */
37
+ debug?: boolean;
38
+ /** Enable trace logging to .astrasync/traces/ (default: false) */
39
+ traceEnabled?: boolean;
40
+ /** Trace log directory (default: .astrasync/traces/) */
41
+ tracePath?: string;
42
+ /** Minimum trust score for standard access (online/hybrid) */
43
+ minTrustScore?: number;
44
+ /** Minimum trust score for full access (online/hybrid) */
45
+ minTrustScoreForFull?: number;
46
+ /** Custom headers to send with API requests */
47
+ customHeaders?: Record<string, string>;
48
+ /** Counterparty URL for analytics */
49
+ counterpartyUrl?: string;
50
+ /** Counterparty type for analytics */
51
+ counterpartyType?: CounterpartyType;
52
+ }
53
+ interface PDLSSContext {
54
+ /** Purpose category (e.g. email.send, shell.exec, file.read) */
55
+ purpose: string;
56
+ /** Specific action within purpose */
57
+ action: string;
58
+ /** Target resource, recipient, or counterparty */
59
+ target: string;
60
+ /** Types of data access (read, write, delete) */
61
+ dataAccess?: string[];
62
+ /** Network domains/IPs being accessed */
63
+ networkAccess?: string[];
64
+ /** Resource type (customer, order, file, directory, process) */
65
+ resourceType?: string;
66
+ /** Risk factors for this action */
67
+ riskFactors?: RiskFactor[];
68
+ /** Transaction value (if financial) */
69
+ transactionValue?: number;
70
+ /** Currency for transaction */
71
+ currency?: string;
72
+ /** Additional metadata */
73
+ metadata?: Record<string, unknown>;
74
+ }
75
+ interface RiskFactor {
76
+ type: 'financial' | 'data_sensitivity' | 'privilege_escalation' | 'network_scope' | 'destructive';
77
+ severity: 'low' | 'medium' | 'high' | 'critical';
78
+ detail: string;
79
+ }
80
+ interface VerificationDecision {
81
+ recommendation: 'ALLOW' | 'DENY' | 'MANUAL_REVIEW';
82
+ reason: string;
83
+ trustScore?: number;
84
+ tokenGuidance?: TokenGuidance;
85
+ sessionId?: string;
86
+ /**
87
+ * PDLSS dimensions that were evaluated. `true` = the dimension was
88
+ * configured in the policy and therefore ran; `false` = the dimension is
89
+ * absent from the policy and was skipped — NOT "failed" (a failed
90
+ * dimension never produces an ALLOW; this field is only set on ALLOW).
91
+ */
92
+ evaluatedDimensions?: {
93
+ purpose: boolean;
94
+ scope: boolean;
95
+ limits: boolean;
96
+ riskThresholds: boolean;
97
+ };
98
+ }
99
+ interface LocalPolicy {
100
+ version: string;
101
+ name: string;
102
+ description?: string;
103
+ purposes: LocalPurposeRule[];
104
+ scope?: LocalScope;
105
+ limits?: LocalLimits;
106
+ riskThresholds?: LocalRiskThresholds;
107
+ selfInstantiation?: LocalSelfInstantiation;
108
+ }
109
+ interface LocalPurposeRule {
110
+ id: string;
111
+ allowed: boolean;
112
+ targets?: string[];
113
+ blockedPatterns?: string[];
114
+ requiresApproval?: boolean;
115
+ }
116
+ interface LocalScope {
117
+ allowedDomains?: string[];
118
+ blockedDomains?: string[];
119
+ blockedResources?: string[];
120
+ }
121
+ interface LocalLimits {
122
+ /**
123
+ * Autonomous Limit — a transaction value at or below this is granted without
124
+ * escalation. A value in the band `[autonomousThreshold, maxTransactionAmount)`
125
+ * requires human approval (step-up → MANUAL_REVIEW), mirroring the backend
126
+ * `checkWithinLimits` ladder. When omitted there is no autonomous band: every
127
+ * positive value below the Hard Limit is granted (legacy flat-cap behaviour).
128
+ */
129
+ autonomousThreshold?: number;
130
+ /**
131
+ * Hard Limit — a transaction value at or above this is denied outright. (Named
132
+ * `maxTransactionAmount` for backward compatibility with existing local policy
133
+ * files; it is the SDK equivalent of the backend `approvalThreshold`.)
134
+ */
135
+ maxTransactionAmount?: number;
136
+ maxRequestsPerHour?: number;
137
+ currency?: string;
138
+ }
139
+ interface LocalRiskThresholds {
140
+ autoAllow: {
141
+ min: number;
142
+ max: number;
143
+ };
144
+ requireApproval: {
145
+ min: number;
146
+ max: number;
147
+ };
148
+ autoBlock: {
149
+ min: number;
150
+ max: number;
151
+ };
152
+ }
153
+ interface LocalSelfInstantiation {
154
+ /** Whether sub-agent spawning is allowed */
155
+ allowed: boolean;
156
+ /** Maximum depth of sub-agent chain */
157
+ maxDepth?: number;
158
+ }
159
+
160
+ /**
161
+ * Hybrid Mode — Local evaluation for speed, async API sync for trust scoring.
162
+ *
163
+ * Immediate: local PDLSS evaluation (< 1ms)
164
+ * Async: queued API verification for audit trail and trust score updates
165
+ *
166
+ * Queue entries are persisted to disk so they survive process restarts.
167
+ */
168
+
169
+ interface FlushOptions {
170
+ /** Max entries to attempt this flush (default: all pending). */
171
+ limit?: number;
172
+ /**
173
+ * Per-entry time budget in ms. A timed-out entry stays pending (no retry
174
+ * penalty — slow network is not a failure) and ends the flush early.
175
+ * Stateless callers (the Claude Code hook) use this to keep sync off the
176
+ * tool-call critical path.
177
+ */
178
+ perEntryTimeoutMs?: number;
179
+ }
180
+
181
+ /**
182
+ * AstraSyncGateway — Primary API surface for agent verification.
183
+ *
184
+ * Supports three operational modes:
185
+ * - online: Full API-based verification with trust scoring and audit trail
186
+ * - local: Offline PDLSS evaluation using a local policy file (no account required)
187
+ * - hybrid: Local eval for speed + async API sync for trust scoring
188
+ *
189
+ * @example
190
+ * ```typescript
191
+ * // Local mode (free, no account)
192
+ * const gateway = new AstraSyncGateway({ mode: 'local', policyFile: './policy.yaml' });
193
+ * const decision = await gateway.evaluate(context);
194
+ *
195
+ * // Online mode (paid, full features)
196
+ * const gateway = new AstraSyncGateway({ mode: 'online', apiKey: 'key' });
197
+ * const decision = await gateway.evaluate(context);
198
+ * ```
199
+ */
200
+
201
+ declare class AstraSyncGateway {
202
+ private config;
203
+ private evaluator;
204
+ private syncQueue;
205
+ private traceLogger;
206
+ private initialized;
207
+ constructor(config: AstraSyncGatewayConfig);
208
+ private validateConfig;
209
+ /**
210
+ * Initialize the gateway (loads policy files, starts sync queues).
211
+ * Called automatically on first evaluate() if not called manually.
212
+ */
213
+ initialize(): Promise<void>;
214
+ /**
215
+ * Graceful shutdown. Flushes sync queue and cleans up resources.
216
+ * Stateless callers (hooks) pass bounded flush options so sync never
217
+ * sits on a tool call's critical path.
218
+ */
219
+ shutdown(options?: {
220
+ syncFlush?: FlushOptions;
221
+ }): Promise<void>;
222
+ /**
223
+ * Evaluate an action against the verification policy.
224
+ * Routes to the appropriate mode handler.
225
+ *
226
+ * In passive posture, evaluation runs but always returns ALLOW
227
+ * (the real decision is logged for telemetry).
228
+ */
229
+ evaluate(context: PDLSSContext, astraId?: string): Promise<VerificationDecision>;
230
+ /**
231
+ * Get the current mode.
232
+ */
233
+ get mode(): AstraSyncGatewayConfig['mode'];
234
+ /**
235
+ * Get the current posture (active or passive).
236
+ */
237
+ get posture(): 'active' | 'passive';
238
+ /**
239
+ * Switch modes at runtime (e.g. after upgrade from free to paid).
240
+ */
241
+ switchMode(newMode: AstraSyncGatewayConfig['mode'], additionalConfig?: Partial<AstraSyncGatewayConfig>): Promise<void>;
242
+ /**
243
+ * Get sync queue status (hybrid mode only).
244
+ */
245
+ getSyncStatus(): {
246
+ pending: number;
247
+ total: number;
248
+ } | null;
249
+ /**
250
+ * Record a tool call the calling adapter saw but did not govern
251
+ * (unmapped tool, skipTools, MCP with governMcp off). Trace-only.
252
+ */
253
+ logSkippedTool(toolName: string, reason: string): void;
254
+ }
255
+
6
256
  /**
7
257
  * Git Trigger — Enterprise git push / PR verification
8
258
  *
@@ -1,8 +1,258 @@
1
- import { AstraSyncGateway } from '../gateway/gateway.js';
2
- import { V as VerificationDecision, P as PDLSSContext } from '../types-DGh2akuh.js';
3
- import '../types-76TB0fxW.js';
1
+ import { T as TokenGuidance, b as CounterpartyType } from '../types-DMChboN_.js';
4
2
  import '../metadata-capture.js';
5
3
 
4
+ /**
5
+ * AstraSync Gateway - Types for gateway modes, local evaluation, and adapter interface.
6
+ */
7
+ type GatewayMode = 'online' | 'local' | 'hybrid';
8
+ /**
9
+ * Posture controls whether the gateway actively blocks or just monitors.
10
+ * - active: Evaluate and enforce decisions (block/allow/review)
11
+ * - passive: Evaluate and log but never block (telemetry-only mode)
12
+ */
13
+ type GatewayPosture = 'active' | 'passive';
14
+ interface AstraSyncGatewayConfig {
15
+ mode: GatewayMode;
16
+ /** Enforcement posture: 'active' blocks actions, 'passive' logs only (default: 'active') */
17
+ posture?: GatewayPosture;
18
+ /** AstraSync API base URL (required for online/hybrid modes) */
19
+ apiBaseUrl?: string;
20
+ /** API key for authenticating with AstraSync (required for online/hybrid modes) */
21
+ apiKey?: string;
22
+ /**
23
+ * ASTRA- agent id this gateway acts as. Attached to hybrid sync entries and
24
+ * used as the default identity for online verification when the caller
25
+ * passes no per-call astraId.
26
+ */
27
+ agentId?: string;
28
+ /** Path to local PDLSS policy YAML file (required for local/hybrid modes) */
29
+ policyFile?: string;
30
+ /** Inline policy object (alternative to policyFile) */
31
+ policy?: LocalPolicy;
32
+ /** Sync interval in seconds for hybrid mode (default: 3600) */
33
+ syncInterval?: number;
34
+ /** Cache verification results TTL in seconds (default: 300) */
35
+ cacheTtl?: number;
36
+ /** Enable debug logging */
37
+ debug?: boolean;
38
+ /** Enable trace logging to .astrasync/traces/ (default: false) */
39
+ traceEnabled?: boolean;
40
+ /** Trace log directory (default: .astrasync/traces/) */
41
+ tracePath?: string;
42
+ /** Minimum trust score for standard access (online/hybrid) */
43
+ minTrustScore?: number;
44
+ /** Minimum trust score for full access (online/hybrid) */
45
+ minTrustScoreForFull?: number;
46
+ /** Custom headers to send with API requests */
47
+ customHeaders?: Record<string, string>;
48
+ /** Counterparty URL for analytics */
49
+ counterpartyUrl?: string;
50
+ /** Counterparty type for analytics */
51
+ counterpartyType?: CounterpartyType;
52
+ }
53
+ interface PDLSSContext {
54
+ /** Purpose category (e.g. email.send, shell.exec, file.read) */
55
+ purpose: string;
56
+ /** Specific action within purpose */
57
+ action: string;
58
+ /** Target resource, recipient, or counterparty */
59
+ target: string;
60
+ /** Types of data access (read, write, delete) */
61
+ dataAccess?: string[];
62
+ /** Network domains/IPs being accessed */
63
+ networkAccess?: string[];
64
+ /** Resource type (customer, order, file, directory, process) */
65
+ resourceType?: string;
66
+ /** Risk factors for this action */
67
+ riskFactors?: RiskFactor[];
68
+ /** Transaction value (if financial) */
69
+ transactionValue?: number;
70
+ /** Currency for transaction */
71
+ currency?: string;
72
+ /** Additional metadata */
73
+ metadata?: Record<string, unknown>;
74
+ }
75
+ interface RiskFactor {
76
+ type: 'financial' | 'data_sensitivity' | 'privilege_escalation' | 'network_scope' | 'destructive';
77
+ severity: 'low' | 'medium' | 'high' | 'critical';
78
+ detail: string;
79
+ }
80
+ interface VerificationDecision {
81
+ recommendation: 'ALLOW' | 'DENY' | 'MANUAL_REVIEW';
82
+ reason: string;
83
+ trustScore?: number;
84
+ tokenGuidance?: TokenGuidance;
85
+ sessionId?: string;
86
+ /**
87
+ * PDLSS dimensions that were evaluated. `true` = the dimension was
88
+ * configured in the policy and therefore ran; `false` = the dimension is
89
+ * absent from the policy and was skipped — NOT "failed" (a failed
90
+ * dimension never produces an ALLOW; this field is only set on ALLOW).
91
+ */
92
+ evaluatedDimensions?: {
93
+ purpose: boolean;
94
+ scope: boolean;
95
+ limits: boolean;
96
+ riskThresholds: boolean;
97
+ };
98
+ }
99
+ interface LocalPolicy {
100
+ version: string;
101
+ name: string;
102
+ description?: string;
103
+ purposes: LocalPurposeRule[];
104
+ scope?: LocalScope;
105
+ limits?: LocalLimits;
106
+ riskThresholds?: LocalRiskThresholds;
107
+ selfInstantiation?: LocalSelfInstantiation;
108
+ }
109
+ interface LocalPurposeRule {
110
+ id: string;
111
+ allowed: boolean;
112
+ targets?: string[];
113
+ blockedPatterns?: string[];
114
+ requiresApproval?: boolean;
115
+ }
116
+ interface LocalScope {
117
+ allowedDomains?: string[];
118
+ blockedDomains?: string[];
119
+ blockedResources?: string[];
120
+ }
121
+ interface LocalLimits {
122
+ /**
123
+ * Autonomous Limit — a transaction value at or below this is granted without
124
+ * escalation. A value in the band `[autonomousThreshold, maxTransactionAmount)`
125
+ * requires human approval (step-up → MANUAL_REVIEW), mirroring the backend
126
+ * `checkWithinLimits` ladder. When omitted there is no autonomous band: every
127
+ * positive value below the Hard Limit is granted (legacy flat-cap behaviour).
128
+ */
129
+ autonomousThreshold?: number;
130
+ /**
131
+ * Hard Limit — a transaction value at or above this is denied outright. (Named
132
+ * `maxTransactionAmount` for backward compatibility with existing local policy
133
+ * files; it is the SDK equivalent of the backend `approvalThreshold`.)
134
+ */
135
+ maxTransactionAmount?: number;
136
+ maxRequestsPerHour?: number;
137
+ currency?: string;
138
+ }
139
+ interface LocalRiskThresholds {
140
+ autoAllow: {
141
+ min: number;
142
+ max: number;
143
+ };
144
+ requireApproval: {
145
+ min: number;
146
+ max: number;
147
+ };
148
+ autoBlock: {
149
+ min: number;
150
+ max: number;
151
+ };
152
+ }
153
+ interface LocalSelfInstantiation {
154
+ /** Whether sub-agent spawning is allowed */
155
+ allowed: boolean;
156
+ /** Maximum depth of sub-agent chain */
157
+ maxDepth?: number;
158
+ }
159
+
160
+ /**
161
+ * Hybrid Mode — Local evaluation for speed, async API sync for trust scoring.
162
+ *
163
+ * Immediate: local PDLSS evaluation (< 1ms)
164
+ * Async: queued API verification for audit trail and trust score updates
165
+ *
166
+ * Queue entries are persisted to disk so they survive process restarts.
167
+ */
168
+
169
+ interface FlushOptions {
170
+ /** Max entries to attempt this flush (default: all pending). */
171
+ limit?: number;
172
+ /**
173
+ * Per-entry time budget in ms. A timed-out entry stays pending (no retry
174
+ * penalty — slow network is not a failure) and ends the flush early.
175
+ * Stateless callers (the Claude Code hook) use this to keep sync off the
176
+ * tool-call critical path.
177
+ */
178
+ perEntryTimeoutMs?: number;
179
+ }
180
+
181
+ /**
182
+ * AstraSyncGateway — Primary API surface for agent verification.
183
+ *
184
+ * Supports three operational modes:
185
+ * - online: Full API-based verification with trust scoring and audit trail
186
+ * - local: Offline PDLSS evaluation using a local policy file (no account required)
187
+ * - hybrid: Local eval for speed + async API sync for trust scoring
188
+ *
189
+ * @example
190
+ * ```typescript
191
+ * // Local mode (free, no account)
192
+ * const gateway = new AstraSyncGateway({ mode: 'local', policyFile: './policy.yaml' });
193
+ * const decision = await gateway.evaluate(context);
194
+ *
195
+ * // Online mode (paid, full features)
196
+ * const gateway = new AstraSyncGateway({ mode: 'online', apiKey: 'key' });
197
+ * const decision = await gateway.evaluate(context);
198
+ * ```
199
+ */
200
+
201
+ declare class AstraSyncGateway {
202
+ private config;
203
+ private evaluator;
204
+ private syncQueue;
205
+ private traceLogger;
206
+ private initialized;
207
+ constructor(config: AstraSyncGatewayConfig);
208
+ private validateConfig;
209
+ /**
210
+ * Initialize the gateway (loads policy files, starts sync queues).
211
+ * Called automatically on first evaluate() if not called manually.
212
+ */
213
+ initialize(): Promise<void>;
214
+ /**
215
+ * Graceful shutdown. Flushes sync queue and cleans up resources.
216
+ * Stateless callers (hooks) pass bounded flush options so sync never
217
+ * sits on a tool call's critical path.
218
+ */
219
+ shutdown(options?: {
220
+ syncFlush?: FlushOptions;
221
+ }): Promise<void>;
222
+ /**
223
+ * Evaluate an action against the verification policy.
224
+ * Routes to the appropriate mode handler.
225
+ *
226
+ * In passive posture, evaluation runs but always returns ALLOW
227
+ * (the real decision is logged for telemetry).
228
+ */
229
+ evaluate(context: PDLSSContext, astraId?: string): Promise<VerificationDecision>;
230
+ /**
231
+ * Get the current mode.
232
+ */
233
+ get mode(): AstraSyncGatewayConfig['mode'];
234
+ /**
235
+ * Get the current posture (active or passive).
236
+ */
237
+ get posture(): 'active' | 'passive';
238
+ /**
239
+ * Switch modes at runtime (e.g. after upgrade from free to paid).
240
+ */
241
+ switchMode(newMode: AstraSyncGatewayConfig['mode'], additionalConfig?: Partial<AstraSyncGatewayConfig>): Promise<void>;
242
+ /**
243
+ * Get sync queue status (hybrid mode only).
244
+ */
245
+ getSyncStatus(): {
246
+ pending: number;
247
+ total: number;
248
+ } | null;
249
+ /**
250
+ * Record a tool call the calling adapter saw but did not govern
251
+ * (unmapped tool, skipTools, MCP with governMcp off). Trace-only.
252
+ */
253
+ logSkippedTool(toolName: string, reason: string): void;
254
+ }
255
+
6
256
  /**
7
257
  * Git Trigger — Enterprise git push / PR verification
8
258
  *