@astrasyncai/verification-gateway 3.11.0 → 3.12.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.
- package/dist/adapter-interface/interface.d.mts +2 -2
- package/dist/adapter-interface/interface.d.ts +2 -2
- package/dist/adapters/express.d.mts +2 -2
- package/dist/adapters/express.d.ts +2 -2
- package/dist/adapters/express.js +22 -3
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +22 -3
- package/dist/adapters/express.mjs.map +1 -1
- package/dist/adapters/mcp.d.mts +1 -1
- package/dist/adapters/mcp.d.ts +1 -1
- package/dist/adapters/mcp.js +22 -3
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +22 -3
- package/dist/adapters/mcp.mjs.map +1 -1
- package/dist/adapters/nextjs.d.mts +2 -2
- package/dist/adapters/nextjs.d.ts +2 -2
- package/dist/adapters/nextjs.js +22 -3
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +22 -3
- package/dist/adapters/nextjs.mjs.map +1 -1
- package/dist/adapters/sdk.d.mts +2 -2
- package/dist/adapters/sdk.d.ts +2 -2
- package/dist/adapters/sdk.js +22 -3
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +22 -3
- package/dist/adapters/sdk.mjs.map +1 -1
- package/dist/agent/index.d.mts +2 -2
- package/dist/agent/index.d.ts +2 -2
- package/dist/bin/astrasync-claude-hook.js +84 -21
- package/dist/bin/astrasync-codex-hook.js +84 -21
- package/dist/bin/astrasync-guard.js +84 -21
- package/dist/bin/astrasync.js +85 -21
- package/dist/browser/background.js +84 -21
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +84 -21
- package/dist/browser/background.mjs.map +1 -1
- package/dist/browser/browser-adapter.d.mts +2 -2
- package/dist/browser/browser-adapter.d.ts +2 -2
- package/dist/claude-code/claude-code-adapter.d.mts +2 -2
- package/dist/claude-code/claude-code-adapter.d.ts +2 -2
- package/dist/cli/index.d.mts +2 -2
- package/dist/cli/index.d.ts +2 -2
- package/dist/codex/index.d.mts +2 -2
- package/dist/codex/index.d.ts +2 -2
- package/dist/codex/index.js +84 -21
- package/dist/codex/index.js.map +1 -1
- package/dist/codex/index.mjs +84 -21
- package/dist/codex/index.mjs.map +1 -1
- package/dist/cursor/cursor-adapter.d.mts +2 -2
- package/dist/cursor/cursor-adapter.d.ts +2 -2
- package/dist/cursor/extension.d.mts +2 -2
- package/dist/cursor/extension.d.ts +2 -2
- package/dist/cursor/extension.js +84 -21
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +84 -21
- package/dist/cursor/extension.mjs.map +1 -1
- package/dist/edge-config.d.mts +1 -1
- package/dist/edge-config.d.ts +1 -1
- package/dist/{express-DCXa1oqj.d.mts → express-B39o89gf.d.mts} +1 -1
- package/dist/{express-ClNtDhhc.d.ts → express-BuxKNO_q.d.ts} +1 -1
- package/dist/gateway/gateway.d.mts +2 -2
- package/dist/gateway/gateway.d.ts +2 -2
- package/dist/gateway/gateway.js +84 -21
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +84 -21
- package/dist/gateway/gateway.mjs.map +1 -1
- package/dist/git-trigger/git-hooks.d.mts +2 -2
- package/dist/git-trigger/git-hooks.d.ts +2 -2
- package/dist/{index-CfHurO1P.d.ts → index-BG62SXso.d.ts} +1 -1
- package/dist/{index-D2ztkumS.d.ts → index-CLHdqs2M.d.ts} +1 -1
- package/dist/{index-Dr_XiN65.d.mts → index-CqydB4ks.d.mts} +1 -1
- package/dist/{index-BrNKDmiR.d.mts → index-DME3w3lf.d.mts} +1 -1
- package/dist/index.d.mts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +42 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +41 -3
- package/dist/index.mjs.map +1 -1
- package/dist/local-evaluator/evaluator.d.mts +11 -2
- package/dist/local-evaluator/evaluator.d.ts +11 -2
- package/dist/local-evaluator/evaluator.js +20 -9
- package/dist/local-evaluator/evaluator.js.map +1 -1
- package/dist/local-evaluator/evaluator.mjs +20 -9
- package/dist/local-evaluator/evaluator.mjs.map +1 -1
- package/dist/{nextjs-DcQIk6Zj.d.mts → nextjs-D74W7wt-.d.mts} +1 -1
- package/dist/{nextjs-CEBVBsdi.d.ts → nextjs-Ddlw_J1J.d.ts} +1 -1
- package/dist/{sdk-CZkbSOeO.d.mts → sdk-Bn6bj7kt.d.mts} +1 -1
- package/dist/{sdk-H0JCLW2y.d.ts → sdk-CT7gdkfR.d.ts} +1 -1
- package/dist/transport/index.d.mts +2 -2
- package/dist/transport/index.d.ts +2 -2
- package/dist/{types-sy3tq8lp.d.mts → types-BntuzEEn.d.mts} +103 -1
- package/dist/{types-BV6abBnF.d.mts → types-DHu7m9HI.d.ts} +7 -2
- package/dist/{types-C23_uaY8.d.ts → types-Djw4GLtz.d.mts} +7 -2
- package/dist/{types-9tns4wyl.d.ts → types-SDu4Llbe.d.ts} +103 -1
- package/dist/ui/index.d.mts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/verify.d.mts +13 -2
- package/dist/verify.d.ts +13 -2
- package/dist/verify.js +42 -3
- package/dist/verify.js.map +1 -1
- package/dist/verify.mjs +41 -3
- package/dist/verify.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
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-
|
|
2
|
+
import { P as PDLSSContext, V as VerificationDecision, A as AgentAction, I as InterceptResult } from '../types-Djw4GLtz.mjs';
|
|
3
3
|
import '../gateway/gateway.mjs';
|
|
4
|
-
import '../types-
|
|
4
|
+
import '../types-BntuzEEn.mjs';
|
|
5
5
|
import '../metadata-capture.mjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
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-
|
|
2
|
+
import { P as PDLSSContext, V as VerificationDecision, A as AgentAction, I as InterceptResult } from '../types-DHu7m9HI.js';
|
|
3
3
|
import '../gateway/gateway.js';
|
|
4
|
-
import '../types-
|
|
4
|
+
import '../types-SDu4Llbe.js';
|
|
5
5
|
import '../metadata-capture.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PlatformAdapter, AdapterConfig } from '../adapter-interface/interface.mjs';
|
|
2
|
-
import { A as AgentAction, I as InterceptResult, P as PDLSSContext, V as VerificationDecision } from '../types-
|
|
2
|
+
import { A as AgentAction, I as InterceptResult, P as PDLSSContext, V as VerificationDecision } from '../types-Djw4GLtz.mjs';
|
|
3
3
|
import '../gateway/gateway.mjs';
|
|
4
|
-
import '../types-
|
|
4
|
+
import '../types-BntuzEEn.mjs';
|
|
5
5
|
import '../metadata-capture.mjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PlatformAdapter, AdapterConfig } from '../adapter-interface/interface.js';
|
|
2
|
-
import { A as AgentAction, I as InterceptResult, P as PDLSSContext, V as VerificationDecision } from '../types-
|
|
2
|
+
import { A as AgentAction, I as InterceptResult, P as PDLSSContext, V as VerificationDecision } from '../types-DHu7m9HI.js';
|
|
3
3
|
import '../gateway/gateway.js';
|
|
4
|
-
import '../types-
|
|
4
|
+
import '../types-SDu4Llbe.js';
|
|
5
5
|
import '../metadata-capture.js';
|
|
6
6
|
|
|
7
7
|
/**
|
package/dist/cli/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { b as LocalPurposeRule, d as LocalScope, c as LocalRiskThresholds, L as LocalPolicy, P as PDLSSContext, V as VerificationDecision, A as AgentAction, I as InterceptResult } from '../types-
|
|
1
|
+
import { b as LocalPurposeRule, d as LocalScope, c as LocalRiskThresholds, L as LocalPolicy, P as PDLSSContext, V as VerificationDecision, A as AgentAction, I as InterceptResult } from '../types-Djw4GLtz.mjs';
|
|
2
2
|
import { PlatformAdapter, AdapterConfig } from '../adapter-interface/interface.mjs';
|
|
3
|
-
import '../types-
|
|
3
|
+
import '../types-BntuzEEn.mjs';
|
|
4
4
|
import '../metadata-capture.mjs';
|
|
5
5
|
import '../gateway/gateway.mjs';
|
|
6
6
|
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { b as LocalPurposeRule, d as LocalScope, c as LocalRiskThresholds, L as LocalPolicy, P as PDLSSContext, V as VerificationDecision, A as AgentAction, I as InterceptResult } from '../types-
|
|
1
|
+
import { b as LocalPurposeRule, d as LocalScope, c as LocalRiskThresholds, L as LocalPolicy, P as PDLSSContext, V as VerificationDecision, A as AgentAction, I as InterceptResult } from '../types-DHu7m9HI.js';
|
|
2
2
|
import { PlatformAdapter, AdapterConfig } from '../adapter-interface/interface.js';
|
|
3
|
-
import '../types-
|
|
3
|
+
import '../types-SDu4Llbe.js';
|
|
4
4
|
import '../metadata-capture.js';
|
|
5
5
|
import '../gateway/gateway.js';
|
|
6
6
|
|
package/dist/codex/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PlatformAdapter, AdapterConfig } from '../adapter-interface/interface.mjs';
|
|
2
|
-
import { A as AgentAction, I as InterceptResult, P as PDLSSContext, V as VerificationDecision } from '../types-
|
|
2
|
+
import { A as AgentAction, I as InterceptResult, P as PDLSSContext, V as VerificationDecision } from '../types-Djw4GLtz.mjs';
|
|
3
3
|
import { AstraSyncGateway } from '../gateway/gateway.mjs';
|
|
4
|
-
import '../types-
|
|
4
|
+
import '../types-BntuzEEn.mjs';
|
|
5
5
|
import '../metadata-capture.mjs';
|
|
6
6
|
|
|
7
7
|
/**
|
package/dist/codex/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PlatformAdapter, AdapterConfig } from '../adapter-interface/interface.js';
|
|
2
|
-
import { A as AgentAction, I as InterceptResult, P as PDLSSContext, V as VerificationDecision } from '../types-
|
|
2
|
+
import { A as AgentAction, I as InterceptResult, P as PDLSSContext, V as VerificationDecision } from '../types-DHu7m9HI.js';
|
|
3
3
|
import { AstraSyncGateway } from '../gateway/gateway.js';
|
|
4
|
-
import '../types-
|
|
4
|
+
import '../types-SDu4Llbe.js';
|
|
5
5
|
import '../metadata-capture.js';
|
|
6
6
|
|
|
7
7
|
/**
|
package/dist/codex/index.js
CHANGED
|
@@ -434,8 +434,9 @@ function extractBacktickSubstitutions(text, collect) {
|
|
|
434
434
|
return kept.join(" ");
|
|
435
435
|
}
|
|
436
436
|
function basename(token) {
|
|
437
|
-
const slash = token.lastIndexOf("/");
|
|
438
|
-
|
|
437
|
+
const slash = Math.max(token.lastIndexOf("/"), token.lastIndexOf("\\"));
|
|
438
|
+
const name = slash === -1 ? token : token.slice(slash + 1);
|
|
439
|
+
return name.replace(/\.(exe|cmd|bat|ps1)$/i, "");
|
|
439
440
|
}
|
|
440
441
|
function matchSegment(segment, list) {
|
|
441
442
|
const tokens = segment.split(/\s+/).filter((t) => /[a-z0-9]/.test(t));
|
|
@@ -568,7 +569,9 @@ var LocalEvaluator = class {
|
|
|
568
569
|
}
|
|
569
570
|
return {
|
|
570
571
|
recommendation: "ALLOW",
|
|
571
|
-
|
|
572
|
+
// "evaluated": dimensions absent from the policy are skipped, not
|
|
573
|
+
// failed — evaluatedDimensions below records which ones ran.
|
|
574
|
+
reason: "All evaluated PDLSS checks passed",
|
|
572
575
|
evaluatedDimensions: {
|
|
573
576
|
purpose: true,
|
|
574
577
|
scope: !!this.policy.scope,
|
|
@@ -667,7 +670,7 @@ var LocalEvaluator = class {
|
|
|
667
670
|
}
|
|
668
671
|
}
|
|
669
672
|
if ((context.purpose === "file.read" || context.purpose === "file.write" || context.purpose === "file.delete") && context.target) {
|
|
670
|
-
const targetLower = context.target.toLowerCase();
|
|
673
|
+
const targetLower = context.target.toLowerCase().replace(/\\/g, "/");
|
|
671
674
|
for (const sensitivePath of SENSITIVE_PATHS) {
|
|
672
675
|
if (targetLower.includes(sensitivePath.toLowerCase())) {
|
|
673
676
|
score = Math.max(score, 50);
|
|
@@ -696,12 +699,20 @@ var LocalEvaluator = class {
|
|
|
696
699
|
matchesAnyPattern(value, patterns) {
|
|
697
700
|
return patterns.some((pattern) => this.matchGlob(value, pattern));
|
|
698
701
|
}
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
702
|
+
homePrefix() {
|
|
703
|
+
if (this.cachedHomePrefix !== void 0) return this.cachedHomePrefix;
|
|
704
|
+
const env = typeof process !== "undefined" ? process.env : void 0;
|
|
705
|
+
const home = env?.HOME || env?.USERPROFILE;
|
|
706
|
+
this.cachedHomePrefix = home ? home.replace(/\\/g, "/") : null;
|
|
707
|
+
return this.cachedHomePrefix;
|
|
708
|
+
}
|
|
704
709
|
matchGlob(value, pattern) {
|
|
710
|
+
value = value.replace(/\\/g, "/");
|
|
711
|
+
pattern = pattern.replace(/\\/g, "/");
|
|
712
|
+
if (pattern === "~" || pattern.startsWith("~/")) {
|
|
713
|
+
const home = this.homePrefix();
|
|
714
|
+
if (home) pattern = home + pattern.slice(1);
|
|
715
|
+
}
|
|
705
716
|
if (pattern === value) return true;
|
|
706
717
|
const starCount = (pattern.match(/\*/g) ?? []).length;
|
|
707
718
|
if (starCount > 8) {
|
|
@@ -3974,7 +3985,7 @@ function getTrustLevel(score) {
|
|
|
3974
3985
|
}
|
|
3975
3986
|
|
|
3976
3987
|
// src/version.ts
|
|
3977
|
-
var SDK_VERSION = "3.
|
|
3988
|
+
var SDK_VERSION = "3.12.0";
|
|
3978
3989
|
|
|
3979
3990
|
// src/well-known.ts
|
|
3980
3991
|
var CACHE_TTL_MS = 60 * 60 * 1e3;
|
|
@@ -4141,6 +4152,7 @@ function createGuidanceResponse(_config, reason, options = {}) {
|
|
|
4141
4152
|
}
|
|
4142
4153
|
] : void 0,
|
|
4143
4154
|
correlationId: options.correlationId,
|
|
4155
|
+
attemptId: options.attemptId,
|
|
4144
4156
|
verifiedAt: /* @__PURE__ */ new Date()
|
|
4145
4157
|
};
|
|
4146
4158
|
}
|
|
@@ -4170,6 +4182,8 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
4170
4182
|
body.runtimeChallengeOptions = requestData.runtimeChallengeOptions;
|
|
4171
4183
|
if (requestData.invocationProtocol) body.invocationProtocol = requestData.invocationProtocol;
|
|
4172
4184
|
if (requestData.commerceArtifacts) body.commerceArtifacts = requestData.commerceArtifacts;
|
|
4185
|
+
if (requestData.attemptId) body.attemptId = requestData.attemptId;
|
|
4186
|
+
if (requestData.considerationSet) body.considerationSet = requestData.considerationSet;
|
|
4173
4187
|
body.sdkVersion = SDK_VERSION;
|
|
4174
4188
|
if (requestData.callerMetadata || requestData.clientIp || requestData.userAgent) {
|
|
4175
4189
|
const meta = {
|
|
@@ -4197,6 +4211,9 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
4197
4211
|
if (response.status === 410) {
|
|
4198
4212
|
return {
|
|
4199
4213
|
success: true,
|
|
4214
|
+
// 3.12.0 (Trust Record): keep the server-echoed attempt handle even on
|
|
4215
|
+
// the synthesised 410 deny shape (echoed on every branch).
|
|
4216
|
+
attemptId: typeof data?.attemptId === "string" ? data.attemptId : void 0,
|
|
4200
4217
|
access: {
|
|
4201
4218
|
allowed: false,
|
|
4202
4219
|
accessLevel: "none",
|
|
@@ -4215,7 +4232,8 @@ async function callVerifyAccessAPI(config, request) {
|
|
|
4215
4232
|
return {
|
|
4216
4233
|
success: false,
|
|
4217
4234
|
error: data.message || data.error || `API returned ${response.status}`,
|
|
4218
|
-
correlationId: typeof data?.correlationId === "string" ? data.correlationId : void 0
|
|
4235
|
+
correlationId: typeof data?.correlationId === "string" ? data.correlationId : void 0,
|
|
4236
|
+
attemptId: typeof data?.attemptId === "string" ? data.attemptId : void 0
|
|
4219
4237
|
};
|
|
4220
4238
|
}
|
|
4221
4239
|
return data;
|
|
@@ -4249,7 +4267,13 @@ async function verify(config, request, options) {
|
|
|
4249
4267
|
if (mergedConfig.debug) {
|
|
4250
4268
|
console.log("[VerificationGateway] Returning cached result");
|
|
4251
4269
|
}
|
|
4252
|
-
|
|
4270
|
+
const hit = { ...cached };
|
|
4271
|
+
if (request.attemptId) {
|
|
4272
|
+
hit.attemptId = request.attemptId;
|
|
4273
|
+
} else {
|
|
4274
|
+
delete hit.attemptId;
|
|
4275
|
+
}
|
|
4276
|
+
return hit;
|
|
4253
4277
|
}
|
|
4254
4278
|
}
|
|
4255
4279
|
const enrichedRequest = { ...request };
|
|
@@ -4269,6 +4293,7 @@ async function verify(config, request, options) {
|
|
|
4269
4293
|
return createGuidanceResponse(mergedConfig, apiResponse.error, {
|
|
4270
4294
|
source: "api_error",
|
|
4271
4295
|
correlationId: apiResponse.correlationId,
|
|
4296
|
+
attemptId: apiResponse.attemptId,
|
|
4272
4297
|
urls
|
|
4273
4298
|
});
|
|
4274
4299
|
}
|
|
@@ -4304,6 +4329,9 @@ async function verify(config, request, options) {
|
|
|
4304
4329
|
// Anonymous traffic has no session → correlationId is the per-attempt
|
|
4305
4330
|
// linking key (the sessionId-equivalent for anonymous callers).
|
|
4306
4331
|
correlationId: apiResponse.correlationId,
|
|
4332
|
+
// 3.12.0 (Trust Record): server echoes the attempt-chain handle on
|
|
4333
|
+
// every branch — denials included (the funnel outlives one deny).
|
|
4334
|
+
attemptId: apiResponse.attemptId,
|
|
4307
4335
|
recommendation: apiResponse.recommendation,
|
|
4308
4336
|
recommendationReasons: apiResponse.recommendationReasons,
|
|
4309
4337
|
stepUpApproval: apiResponse.stepUpApproval,
|
|
@@ -4355,6 +4383,8 @@ async function verify(config, request, options) {
|
|
|
4355
4383
|
// v2.3.10 (defect #34, round-4): anonymous responses surface correlationId
|
|
4356
4384
|
// (no session row exists for unverified callers).
|
|
4357
4385
|
correlationId: apiResponse.correlationId,
|
|
4386
|
+
// 3.12.0 (Trust Record): server-echoed attempt-chain handle.
|
|
4387
|
+
attemptId: apiResponse.attemptId,
|
|
4358
4388
|
runtimeChallenge: apiResponse.runtimeChallenge,
|
|
4359
4389
|
tokenGuidance: apiResponse.tokenGuidance,
|
|
4360
4390
|
recommendation: apiResponse.recommendation,
|
|
@@ -4738,13 +4768,29 @@ var TraceLogger = class {
|
|
|
4738
4768
|
*/
|
|
4739
4769
|
logEvaluation(context, decision) {
|
|
4740
4770
|
if (!this.enabled) return;
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4771
|
+
let event;
|
|
4772
|
+
try {
|
|
4773
|
+
event = {
|
|
4774
|
+
id: this.generateId(),
|
|
4775
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
4776
|
+
type: "evaluation",
|
|
4777
|
+
context: redactDeep(context),
|
|
4778
|
+
decision: redactDeep(decision)
|
|
4779
|
+
};
|
|
4780
|
+
} catch (err) {
|
|
4781
|
+
event = {
|
|
4782
|
+
id: this.generateId(),
|
|
4783
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
4784
|
+
type: "error",
|
|
4785
|
+
metadata: {
|
|
4786
|
+
error: `trace redaction failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
4787
|
+
recommendation: decision.recommendation,
|
|
4788
|
+
purpose: context.purpose,
|
|
4789
|
+
action: context.action
|
|
4790
|
+
}
|
|
4791
|
+
};
|
|
4792
|
+
}
|
|
4793
|
+
this.write(event);
|
|
4748
4794
|
}
|
|
4749
4795
|
/**
|
|
4750
4796
|
* Log a tool call the guard saw but did not govern. One line per skip
|
|
@@ -4786,17 +4832,34 @@ var TraceLogger = class {
|
|
|
4786
4832
|
});
|
|
4787
4833
|
}
|
|
4788
4834
|
write(event) {
|
|
4835
|
+
let line;
|
|
4836
|
+
try {
|
|
4837
|
+
line = JSON.stringify(event) + "\n";
|
|
4838
|
+
} catch {
|
|
4839
|
+
return;
|
|
4840
|
+
}
|
|
4789
4841
|
try {
|
|
4790
4842
|
const filePath = this.getCurrentFilePath();
|
|
4791
|
-
const line = JSON.stringify(event) + "\n";
|
|
4792
4843
|
if ((0, import_fs3.existsSync)(filePath)) {
|
|
4793
4844
|
const stats = (0, import_fs3.statSync)(filePath);
|
|
4794
4845
|
if (stats.size > MAX_FILE_SIZE) {
|
|
4795
4846
|
this.rotate();
|
|
4796
4847
|
}
|
|
4797
4848
|
}
|
|
4798
|
-
(0
|
|
4849
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
4850
|
+
try {
|
|
4851
|
+
(0, import_fs3.appendFileSync)(filePath, line);
|
|
4852
|
+
return;
|
|
4853
|
+
} catch {
|
|
4854
|
+
}
|
|
4855
|
+
}
|
|
4856
|
+
const fallbackPath = filePath.replace(/\.jsonl$/, `-r${process.pid}.jsonl`);
|
|
4857
|
+
(0, import_fs3.appendFileSync)(fallbackPath, line);
|
|
4799
4858
|
} catch {
|
|
4859
|
+
try {
|
|
4860
|
+
console.error(`[AstraSync TraceLogger] failed to persist trace line: ${line.trim()}`);
|
|
4861
|
+
} catch {
|
|
4862
|
+
}
|
|
4800
4863
|
}
|
|
4801
4864
|
}
|
|
4802
4865
|
getCurrentFilePath() {
|