@sailfish-ai/sf-veritas 0.4.0 → 0.5.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 (36) hide show
  1. package/README.md +19 -0
  2. package/dist/contextManager-B4JXc4ak.cjs +1 -0
  3. package/dist/{contextManager-C2ONL8XY.js → contextManager-BSAjnoti.js} +149 -143
  4. package/dist/plugins/funcspanEsbuildPlugin.cjs +1 -1
  5. package/dist/plugins/funcspanEsbuildPlugin.mjs +1 -1
  6. package/dist/plugins/funcspanRollupPlugin.cjs +1 -1
  7. package/dist/plugins/funcspanRollupPlugin.mjs +1 -1
  8. package/dist/plugins/funcspanTscPlugin.cjs +1 -1
  9. package/dist/plugins/funcspanTscPlugin.mjs +1 -1
  10. package/dist/plugins/funcspanVitePlugin.cjs +1 -1
  11. package/dist/plugins/funcspanVitePlugin.mjs +1 -1
  12. package/dist/plugins/funcspanWebpackPlugin.cjs +1 -1
  13. package/dist/plugins/funcspanWebpackPlugin.mjs +1 -1
  14. package/dist/{runtimeConfig-xahsyRmN.cjs → runtimeConfig-D18ZMMnT.cjs} +4 -4
  15. package/dist/{runtimeConfig-BUJ13zxm.js → runtimeConfig-Dmaavj6j.js} +279 -277
  16. package/dist/sf-veritas.cjs +27 -19
  17. package/dist/sf-veritas.mjs +1479 -1128
  18. package/dist/telemetryWorker.cjs +1 -1
  19. package/dist/types/baseTransmitter.d.ts +8 -10
  20. package/dist/types/contextManager.d.ts +0 -1
  21. package/dist/types/funcSpanCapture.d.ts +2 -0
  22. package/dist/types/funcSpanConfig.d.ts +60 -5
  23. package/dist/types/functionSpanCaptureRules.d.ts +133 -0
  24. package/dist/types/functionSpanCaptureSession.d.ts +77 -0
  25. package/dist/types/functionSpanTransmitter.d.ts +22 -3
  26. package/dist/types/setupConfig.d.ts +4 -0
  27. package/dist/types/uplinkClient.d.ts +20 -0
  28. package/dist/types/uuidPool.d.ts +31 -0
  29. package/dist/worker-pool-capture.cjs +1 -1
  30. package/dist/worker-pool-capture.mjs +1 -1
  31. package/dist/workerPoolSpanCapture-DDrqOj7z.cjs +83 -0
  32. package/dist/workerPoolSpanCapture-SpiqdLu-.js +709 -0
  33. package/package.json +4 -2
  34. package/dist/contextManager-CL0Qs7uI.cjs +0 -1
  35. package/dist/workerPoolSpanCapture-C3T98kWy.cjs +0 -83
  36. package/dist/workerPoolSpanCapture-DL8wfDIr.js +0 -575
package/README.md CHANGED
@@ -278,6 +278,25 @@ addOrUpdateMetadata("user-123", { birthday: "2000-01-01" }, true);
278
278
 
279
279
  By following these steps, you can seamlessly integrate `sf-veritas` into your Node.js project and start capturing LEaPS (Logs, Exceptions, and Print Statements) effectively!
280
280
 
281
+ ## Debug Mode
282
+
283
+ Sailfish supports a server-triggered debug mode that turns on full
284
+ function-span capture (arguments, return values, timings) for a
285
+ time-bounded, budget-bounded window — for live backend services
286
+ (Kafka consumers, message-queue workers, cron jobs).
287
+
288
+ The collector holds a Node WebSocket connection to the Sailfish backend
289
+ via the `ws` package. When the UI enables debug for a service identifier,
290
+ the rule list is broadcast to every pod of that service simultaneously
291
+ via Redis pub/sub on the backend, applied through a process-wide override
292
+ on the funcSpan resolver. Rules support per-function targeting,
293
+ argument-value conditions (`==`, `!=`, `<=`, `starts_with`, etc.), child-call
294
+ propagation, and per-rule sample rates.
295
+
296
+ Disable via `SF_DEBUG_MODE_DISABLED=true`. See
297
+ [`docs/docs-enterprise/debug-mode.md`](../../docs/docs-enterprise/debug-mode.md)
298
+ for the full user-facing description, rule schema, and limitations.
299
+
281
300
  ## Release Notes
282
301
 
283
302
  ### 0.3.2-alpha1
@@ -0,0 +1 @@
1
+ "use strict";const A=require("async_hooks"),V=require("child_process"),N=require("fs"),F=require("fs/promises"),w=require("os");function x(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const B=x(F),m=x(w),i=[];for(let n=0;n<256;++n)i.push((n+256).toString(16).slice(1));let f;const W=new Uint8Array(16),L={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function v(n,e,t){if(L.randomUUID&&!n)return L.randomUUID();const r=(n=n||{}).random??n.rng?.()??(function(){if(!f){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");f=crypto.getRandomValues.bind(crypto)}return f(W)})();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=15&r[6]|64,r[8]=63&r[8]|128,(function(s,o=0){return(i[s[o+0]]+i[s[o+1]]+i[s[o+2]]+i[s[o+3]]+"-"+i[s[o+4]]+i[s[o+5]]+"-"+i[s[o+6]]+i[s[o+7]]+"-"+i[s[o+8]]+i[s[o+9]]+"-"+i[s[o+10]]+i[s[o+11]]+i[s[o+12]]+i[s[o+13]]+i[s[o+14]]+i[s[o+15]]).toLowerCase()})(r)}class K{apiKey;apiGraphqlEndpoint;sfDebug;serviceIdentifier;serviceVersion;serviceUUID;serviceAdditionalMetadata;profilingModeEnabled;profilingMaxDepth;profilingMaxVariableSizeKb;domainsToNotPropagateHeadersTo;domainsToPropagateHeadersTo;nodeModulesToCollectLocalVariablesOn;printConfigurationStatuses;logLevel;stackDepthLocals;stackDepthCodeTraceDepth;packageLibraryType;version;gitSha;gitOrg;gitRepo;gitProvider;serviceDisplayName;infrastructureType;infrastructureDetails;framework;additionalFrameworks;serviceRole;setupInterceptorsFile;setupInterceptorsLine;logIgnoreRegex;captureRequestHeaders;captureResponseHeaders;captureRequestBody;captureResponseBody;requestBodyLimitBytes;responseBodyLimitBytes;bullmqBulkAggregateMode;retryOnClientError;dataSensitivityLevel;exceptionCaptureLocals;uplinkEnable;uplinkUrl;_serviceIdentificationReceived=!1;constructor(e){this.apiKey=e.apiKey,this.apiGraphqlEndpoint=e?.apiGraphqlEndpoint||process.env.SAILFISH_GRAPHQL_ENDPOINT||"https://api-service.sailfishqa.com/graphql/",this.sfDebug=e?.debug===!0||process.env.SF_DEBUG==="true",this.serviceIdentifier=e?.serviceIdentifier||process.env.SERVICE_IDENTIFIER,this.serviceUUID=v(),this.serviceVersion=e?.serviceVersion||process.env.SERVICE_VERSION,this.gitSha=e?.gitSha||process.env.GIT_SHA||process.env.GITHUB_SHA||process.env.CI_COMMIT_SHA||process.env.BITBUCKET_COMMIT||process.env.VERCEL_GIT_COMMIT_SHA||process.env.CIRCLE_SHA1||process.env.HEROKU_SLUG_COMMIT||process.env.RENDER_GIT_COMMIT||process.env.RAILWAY_GIT_COMMIT_SHA||process.env.CODEBUILD_RESOLVED_SOURCE_VERSION;const t=process.env.GITHUB_REPOSITORY?.split("/");this.gitOrg=e?.gitOrg||process.env.GIT_ORG||(t&&t.length>=2?t[0]:void 0)||process.env.CI_PROJECT_NAMESPACE||process.env.BITBUCKET_REPO_OWNER||process.env.VERCEL_GIT_REPO_OWNER||process.env.CIRCLE_PROJECT_USERNAME,this.gitRepo=e?.gitRepo||process.env.GIT_REPO||(t&&t.length>=2?t.slice(1).join("/"):void 0)||process.env.CI_PROJECT_NAME||process.env.BITBUCKET_REPO_SLUG||process.env.VERCEL_GIT_REPO_SLUG||process.env.CIRCLE_PROJECT_REPONAME,this.gitProvider=e?.gitProvider||process.env.GIT_PROVIDER||(process.env.GITHUB_ACTIONS?"github":void 0)||(process.env.GITLAB_CI?"gitlab":void 0)||(process.env.BITBUCKET_PIPELINE_UUID?"bitbucket":void 0)||(process.env.CIRCLECI?"circleci":void 0),this.serviceDisplayName=e?.serviceDisplayName||process.env.SERVICE_DISPLAY_NAME,this.serviceAdditionalMetadata=e?.serviceAdditionalMetadata||{},this.profilingModeEnabled=e?.profilingModeEnabled??!1,this.profilingMaxDepth=e?.profilingMaxDepth??5,this.profilingMaxVariableSizeKb=e?.profilingMaxVariableSizeKb??25,this.domainsToNotPropagateHeadersTo=e?.domainsToNotPropagateHeadersTo||[],this.domainsToPropagateHeadersTo=e?.domainsToPropagateHeadersTo!==void 0?e.domainsToPropagateHeadersTo:["*"],this.nodeModulesToCollectLocalVariablesOn=e?.nodeModulesToCollectLocalVariablesOn||["_all_"],this.printConfigurationStatuses=process.env.PRINT_CONFIGURATION_STATUSES||"true",this.logLevel=process.env.LOG_LEVEL||"INFO",this.stackDepthLocals=process.env.SAILFISH_EXCEPTION_STACK_DEPTH_LOCALS!==void 0?parseInt(process.env.SAILFISH_EXCEPTION_STACK_DEPTH_LOCALS,10):5,isNaN(this.stackDepthLocals)&&(this.stackDepthLocals=-1),this.stackDepthCodeTraceDepth=process.env.SAILFISH_EXCEPTION_STACK_DEPTH_CODE_TRACE_DEPTH!==void 0?parseInt(process.env.SAILFISH_EXCEPTION_STACK_DEPTH_CODE_TRACE_DEPTH,10):-1,isNaN(this.stackDepthCodeTraceDepth)&&(this.stackDepthCodeTraceDepth=-1),this.packageLibraryType="JS/TS BACKEND",this.version=this.getPackageVersion();const r=(function(){return process.env.KUBERNETES_SERVICE_HOST||N.existsSync("/var/run/secrets/kubernetes.io/serviceaccount/token")?{type:"Kubernetes",details:{namespace:process.env.POD_NAMESPACE||"",podName:process.env.HOSTNAME||"",nodeName:process.env.NODE_NAME||""}}:process.env.AWS_LAMBDA_FUNCTION_NAME?{type:"AWS Lambda",details:{functionName:process.env.AWS_LAMBDA_FUNCTION_NAME||"",region:process.env.AWS_REGION||"",runtime:process.env.AWS_EXECUTION_ENV||""}}:process.env.AWS_EXECUTION_ENV?{type:"AWS",details:{executionEnv:process.env.AWS_EXECUTION_ENV||"",region:process.env.AWS_REGION||""}}:process.env.GOOGLE_CLOUD_PROJECT?{type:"Google Cloud",details:{project:process.env.GOOGLE_CLOUD_PROJECT||""}}:process.env.AZURE_FUNCTIONS_ENVIRONMENT?{type:"Azure Functions",details:{environment:process.env.AZURE_FUNCTIONS_ENVIRONMENT||""}}:process.env.VERCEL?{type:"Vercel",details:{env:process.env.VERCEL_ENV||"",region:process.env.VERCEL_REGION||""}}:process.env.NETLIFY?{type:"Netlify",details:{}}:process.env.FLY_APP_NAME?{type:"Fly.io",details:{appName:process.env.FLY_APP_NAME||"",region:process.env.FLY_REGION||""}}:process.env.RENDER_SERVICE_ID?{type:"Render",details:{serviceId:process.env.RENDER_SERVICE_ID||""}}:process.env.RAILWAY_ENVIRONMENT?{type:"Railway",details:{environment:process.env.RAILWAY_ENVIRONMENT||""}}:N.existsSync("/.dockerenv")?{type:"Docker",details:{}}:{type:"Unknown",details:{os:m.platform(),arch:m.arch(),nodeVersion:process.version}}})();this.infrastructureType=r.type,this.infrastructureDetails=r.details;const s=(function(){const H=[{pkg:"@nestjs/core",name:"nestjs"},{pkg:"@apollo/server",name:"apollo-server"},{pkg:"apollo-server",name:"apollo-server"},{pkg:"mercurius",name:"mercurius"},{pkg:"next",name:"nextjs"},{pkg:"nuxt",name:"nuxtjs"},{pkg:"express",name:"express"},{pkg:"fastify",name:"fastify"},{pkg:"koa",name:"koa"},{pkg:"@hapi/hapi",name:"hapi"},{pkg:"hono",name:"hono"}],d=[],g=new Set;for(const{pkg:h,name:C}of H)if(!g.has(C))try{require.resolve(h),d.push(C),g.add(C)}catch{}if(typeof process<"u"){if(!g.has("nuxtjs")&&globalThis._importMeta_!==void 0){let h=!1;try{(globalThis._importMeta_?.url||"").includes(".output/server")&&(h=!0)}catch{}h&&(d.unshift("nuxtjs"),g.add("nuxtjs"))}!g.has("meteorjs")&&process.env.METEOR_SHELL_DIR&&(d.unshift("meteorjs"),g.add("meteorjs"))}return{framework:d.length>0?d[0]:null,additionalFrameworks:d.slice(1),serviceRole:d.includes("nextjs")||d.includes("nuxtjs")?"fullstack":"backend"}})();this.framework=s.framework??void 0,this.additionalFrameworks=s.additionalFrameworks,this.serviceRole=s.serviceRole;const o=process.env.SF_LOG_IGNORE_REGEX;if(o)try{this.logIgnoreRegex=new RegExp(o)}catch{}this.captureRequestHeaders=process.env.SF_NETWORKHOP_CAPTURE_REQUEST_HEADERS==="true",this.captureResponseHeaders=process.env.SF_NETWORKHOP_CAPTURE_RESPONSE_HEADERS==="true",this.captureRequestBody=process.env.SF_NETWORKHOP_CAPTURE_REQUEST_BODY==="true",this.captureResponseBody=process.env.SF_NETWORKHOP_CAPTURE_RESPONSE_BODY==="true",this.bullmqBulkAggregateMode=process.env.SF_BULLMQ_BULK_AGGREGATE==="true";const c=parseInt(process.env.SF_NETWORKHOP_REQUEST_LIMIT_MB||"1",10);this.requestBodyLimitBytes=1024*(isNaN(c)?1:c)*1024;const p=parseInt(process.env.SF_NETWORKHOP_RESPONSE_LIMIT_MB||"1",10);this.responseBodyLimitBytes=1024*(isNaN(p)?1:p)*1024;const u=(process.env.SF_RETRY_ON_CLIENT_ERROR||"").toLowerCase(),k=u==="all"||u==="idempotent"||u==="none"?u:void 0;this.retryOnClientError=k??e.retryOnClientError??"all",this.dataSensitivityLevel=process.env.SAILFISH_DATA_SENSITIVITY_LEVEL||"standard",this.exceptionCaptureLocals=process.env.SAILFISH_EXCEPTION_CAPTURE_LOCALS!=="false",this.uplinkEnable=process.env.SF_UPLINK_ENABLE!=="false",this.uplinkUrl=process.env.SF_UPLINK_URL||""}getPackageVersion(){return"0.2.14"}get serviceIdentificationReceived(){return this._serviceIdentificationReceived}setServiceIdentificationReceived(e){this._serviceIdentificationReceived=e}}const M=Symbol.for("sailfish.sf_config");function O(){return globalThis[M]}function S(){const n=O();if(!n)throw new Error("Configuration has not been initialized. Call getOrCreateConfig(options) first.");return n}const y=Symbol.for("sf.ctx.storeAls"),a=globalThis,T=a[y]??(a[y]=new A.AsyncLocalStorage),b="nonsession-applogs",G=["identitytoolkit.googleapis.com","t.co","*.twitter.com","*.gravatar.com","*.googleapis.com","*.amazonaws.com","*.smooch.io","*.zendesk.com"],D=Symbol.for("sf.ctx.als"),E=a[D]??(a[D]=new A.AsyncLocalStorage),P=Symbol.for("sf.ctx.fnSpanAls"),R=a[P]??(a[P]=new A.AsyncLocalStorage),U=Symbol.for("sf.ctx.sessionRegistry"),_=a[U]??(a[U]=new Map),I={handledExceptions:new Set,reentrancyGuardLoggingActive:!1,reentrancyGuardLoggingPreActive:!1,reentrancyGuardPrintActive:!1,reentrancyGuardPrintPreActive:!1,reentrancyGuardExceptionActive:!1,reentrancyGuardExceptionPreActive:!1,excludedDomains:new Set(G),supportedDomains:new Set};class l{static GLOBAL_MANAGER_SYMBOL=Symbol.for("sf.ctx.manager");constructor(){}current(){return T.getStore()}ensureStore(){const e=this.current();if(e)return e;const t=new Map;return T.enterWith(t),t}runWith(e,t){const r=this.current()??new Map,s=new Map(r);for(const[o,c]of Object.entries(e))s.set(o,c);return T.run(s,t)}static getInstance(){return a[l.GLOBAL_MANAGER_SYMBOL]||(a[l.GLOBAL_MANAGER_SYMBOL]=new l),a[l.GLOBAL_MANAGER_SYMBOL]}getCurrentContext(){return E.getStore()||I}setCurrentContext(e){const t=E.getStore()||I;E.enterWith({...t,...e})}ensureSession(e){let t=_.get(e);return t||(t={...I},_.set(e,t)),t}getContextFor(e){return _.get(e)??I}updateContextFor(e,t){const r=this.ensureSession(e);_.set(e,{...r,...t})}runWithSession(e,t){const r={...this.ensureSession(e)};return E.run(r,t)}deleteSession(e){_.delete(e)}runScoped(e,t){const r=E.getStore()??I,s={...r,handledExceptions:new Set(r.handledExceptions),excludedDomains:new Set(r.excludedDomains),supportedDomains:new Set(r.supportedDomains),...e};return E.run(s,t)}getTraceId(){return this.getCurrentContext().traceId}getPageVisitUUID(){return this.getCurrentContext().pageVisitUUID}setTraceId(e){this.setCurrentContext({traceId:e})}setPageVisitUUID(e){this.setCurrentContext({pageVisitUUID:e})}getCurrentFunctionSpanId(){return R.getStore()}setCurrentFunctionSpanId(e){R.enterWith(e)}clearCurrentFunctionSpanId(){R.enterWith(void 0)}getOrSetSfTraceId(e,t=!1){let r=this.getTraceId();return r||(r=e||(t?v():`${b}-v3/${S().apiKey}/${v()}`),this.setTraceId(r),S().sfDebug&&console.log(" Created new trace ID:",r),r)}getOrSetPageVisitUUID(){let e=this.getPageVisitUUID();return e||(e=v(),this.setPageVisitUUID(e),S().sfDebug&&console.log(" Created new page visit UUID:",e),e)}getHandledExceptions(){return this.getCurrentContext().handledExceptions}markExceptionHandled(e){const t=this.getHandledExceptions();t.add(e),this.setCurrentContext({handledExceptions:t})}hasHandledException(e){return this.getHandledExceptions().has(e)}resetHandledExceptions(){this.setCurrentContext({handledExceptions:new Set})}getExcludedDomains(){return this.getCurrentContext().excludedDomains}getSupportedDomains(){return this.getCurrentContext().supportedDomains}addSupportedDomains(e){this.getCurrentContext().supportedDomains.add(e.toLowerCase().trim())}setTraceIdFor(e,t){this.updateContextFor(e,{traceId:t})}setPageVisitUUIDFor(e,t){this.updateContextFor(e,{pageVisitUUID:t})}}exports.ContextManager=l,exports.DEFAULT_DOMAINS_TO_EXCLUDE=G,exports.NONSESSION_APPLOGS=b,exports.backfillGitInfoAsync=async function(n){if(!(n.gitOrg&&n.gitRepo&&n.gitProvider))try{const e=await(async function(){let t="";try{t=await new Promise((r,s)=>{V.execFile("git",["remote","get-url","origin"],{timeout:3e3},(o,c)=>{o?s(o):r((c||"").trim())})})}catch{try{const r=(await B.readFile(".git/config","utf-8")).match(/\[remote "origin"\][^[]*url\s*=\s*(.+)/m);r&&(t=r[1].trim())}catch{}}return t?(function(r){let s,o,c;if(r.includes("github.com")?s="github":r.includes("gitlab.com")?s="gitlab":r.includes("bitbucket.org")&&(s="bitbucket"),r.startsWith("https://")||r.startsWith("http://")){const p=r.split("/");p.length>=5&&(o=p[3],c=p[4].replace(/\.git$/,""))}else{const p=r.indexOf(":");if(p>0){const u=r.substring(p+1).replace(/\.git$/,"").split("/");u.length>=2&&(o=u[0],c=u[1])}}return{org:o,repo:c,provider:s}})(t):{}})();n.gitOrg||(n.gitOrg=e.org),n.gitRepo||(n.gitRepo=e.repo),n.gitProvider||(n.gitProvider=e.provider)}catch{}},exports.getConfig=S,exports.getCurrentFunctionSpanId=function(){return l.getInstance().getCurrentFunctionSpanId()},exports.getGlobalConfigUnsafe=O,exports.getOrCreateConfig=function(n){const e=O();if(e)return{config:e};const t=new K(n);(function(s){globalThis[M]=s})(t);const r=globalThis;return r.__sf_configEpoch=(r.__sf_configEpoch??0)+1,t.sfDebug&&console.log("[[getOrCreateConfig]] Created global config:",t),{config:t}},exports.runWithContext=function(n){const e={...l.getInstance().getCurrentContext()};E.run(e,()=>{n()})},exports.v4=v;
@@ -1,82 +1,86 @@
1
- var G = Object.defineProperty;
2
- var H = (n, e, t) => e in n ? G(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var r = (n, e, t) => H(n, typeof e != "symbol" ? e + "" : e, t);
4
- import { AsyncLocalStorage as P } from "async_hooks";
5
- import { execFile as V } from "child_process";
6
- import { existsSync as m } from "fs";
7
- import * as k from "fs/promises";
8
- import * as N from "os";
1
+ var H = Object.defineProperty;
2
+ var V = (o, e, t) => e in o ? H(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var s = (o, e, t) => V(o, typeof e != "symbol" ? e + "" : e, t);
4
+ import { AsyncLocalStorage as N } from "async_hooks";
5
+ import { execFile as F } from "child_process";
6
+ import { existsSync as A } from "fs";
7
+ import * as B from "fs/promises";
8
+ import * as L from "os";
9
9
  const a = [];
10
- for (let n = 0; n < 256; ++n) a.push((n + 256).toString(16).slice(1));
10
+ for (let o = 0; o < 256; ++o) a.push((o + 256).toString(16).slice(1));
11
11
  let T;
12
- const F = new Uint8Array(16), A = { randomUUID: typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto) };
13
- function C(n, e, t) {
14
- if (A.randomUUID && !n) return A.randomUUID();
15
- const s = (n = n || {}).random ?? n.rng?.() ?? (function() {
12
+ const w = new Uint8Array(16), D = { randomUUID: typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto) };
13
+ function S(o, e, t) {
14
+ if (D.randomUUID && !o) return D.randomUUID();
15
+ const r = (o = o || {}).random ?? o.rng?.() ?? (function() {
16
16
  if (!T) {
17
17
  if (typeof crypto > "u" || !crypto.getRandomValues) throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
18
18
  T = crypto.getRandomValues.bind(crypto);
19
19
  }
20
- return T(F);
20
+ return T(w);
21
21
  })();
22
- if (s.length < 16) throw new Error("Random bytes length must be >= 16");
23
- return s[6] = 15 & s[6] | 64, s[8] = 63 & s[8] | 128, (function(o, i = 0) {
24
- return (a[o[i + 0]] + a[o[i + 1]] + a[o[i + 2]] + a[o[i + 3]] + "-" + a[o[i + 4]] + a[o[i + 5]] + "-" + a[o[i + 6]] + a[o[i + 7]] + "-" + a[o[i + 8]] + a[o[i + 9]] + "-" + a[o[i + 10]] + a[o[i + 11]] + a[o[i + 12]] + a[o[i + 13]] + a[o[i + 14]] + a[o[i + 15]]).toLowerCase();
25
- })(s);
22
+ if (r.length < 16) throw new Error("Random bytes length must be >= 16");
23
+ return r[6] = 15 & r[6] | 64, r[8] = 63 & r[8] | 128, (function(n, i = 0) {
24
+ return (a[n[i + 0]] + a[n[i + 1]] + a[n[i + 2]] + a[n[i + 3]] + "-" + a[n[i + 4]] + a[n[i + 5]] + "-" + a[n[i + 6]] + a[n[i + 7]] + "-" + a[n[i + 8]] + a[n[i + 9]] + "-" + a[n[i + 10]] + a[n[i + 11]] + a[n[i + 12]] + a[n[i + 13]] + a[n[i + 14]] + a[n[i + 15]]).toLowerCase();
25
+ })(r);
26
26
  }
27
- class B {
27
+ class K {
28
28
  constructor(e) {
29
- r(this, "apiKey");
30
- r(this, "apiGraphqlEndpoint");
31
- r(this, "sfDebug");
32
- r(this, "serviceIdentifier");
33
- r(this, "serviceVersion");
34
- r(this, "serviceUUID");
35
- r(this, "serviceAdditionalMetadata");
36
- r(this, "profilingModeEnabled");
37
- r(this, "profilingMaxDepth");
38
- r(this, "profilingMaxVariableSizeKb");
39
- r(this, "domainsToNotPropagateHeadersTo");
40
- r(this, "domainsToPropagateHeadersTo");
41
- r(this, "nodeModulesToCollectLocalVariablesOn");
42
- r(this, "printConfigurationStatuses");
43
- r(this, "logLevel");
44
- r(this, "stackDepthLocals");
45
- r(this, "stackDepthCodeTraceDepth");
46
- r(this, "packageLibraryType");
47
- r(this, "version");
48
- r(this, "gitSha");
49
- r(this, "gitOrg");
50
- r(this, "gitRepo");
51
- r(this, "gitProvider");
52
- r(this, "serviceDisplayName");
53
- r(this, "infrastructureType");
54
- r(this, "infrastructureDetails");
55
- r(this, "framework");
56
- r(this, "additionalFrameworks");
57
- r(this, "serviceRole");
58
- r(this, "setupInterceptorsFile");
59
- r(this, "setupInterceptorsLine");
60
- r(this, "logIgnoreRegex");
61
- r(this, "captureRequestHeaders");
62
- r(this, "captureResponseHeaders");
63
- r(this, "captureRequestBody");
64
- r(this, "captureResponseBody");
65
- r(this, "requestBodyLimitBytes");
66
- r(this, "responseBodyLimitBytes");
67
- r(this, "bullmqBulkAggregateMode");
68
- r(this, "retryOnClientError");
69
- r(this, "_serviceIdentificationReceived", !1);
70
- this.apiKey = e.apiKey, this.apiGraphqlEndpoint = e?.apiGraphqlEndpoint || process.env.SAILFISH_GRAPHQL_ENDPOINT || "https://api-service.sailfishqa.com/graphql/", this.sfDebug = e?.debug === !0 || process.env.SF_DEBUG === "true", this.serviceIdentifier = e?.serviceIdentifier || process.env.SERVICE_IDENTIFIER, this.serviceUUID = C(), this.serviceVersion = e?.serviceVersion || process.env.SERVICE_VERSION, this.gitSha = e?.gitSha || process.env.GIT_SHA || process.env.GITHUB_SHA || process.env.CI_COMMIT_SHA || process.env.BITBUCKET_COMMIT || process.env.VERCEL_GIT_COMMIT_SHA || process.env.CIRCLE_SHA1 || process.env.HEROKU_SLUG_COMMIT || process.env.RENDER_GIT_COMMIT || process.env.RAILWAY_GIT_COMMIT_SHA || process.env.CODEBUILD_RESOLVED_SOURCE_VERSION;
29
+ s(this, "apiKey");
30
+ s(this, "apiGraphqlEndpoint");
31
+ s(this, "sfDebug");
32
+ s(this, "serviceIdentifier");
33
+ s(this, "serviceVersion");
34
+ s(this, "serviceUUID");
35
+ s(this, "serviceAdditionalMetadata");
36
+ s(this, "profilingModeEnabled");
37
+ s(this, "profilingMaxDepth");
38
+ s(this, "profilingMaxVariableSizeKb");
39
+ s(this, "domainsToNotPropagateHeadersTo");
40
+ s(this, "domainsToPropagateHeadersTo");
41
+ s(this, "nodeModulesToCollectLocalVariablesOn");
42
+ s(this, "printConfigurationStatuses");
43
+ s(this, "logLevel");
44
+ s(this, "stackDepthLocals");
45
+ s(this, "stackDepthCodeTraceDepth");
46
+ s(this, "packageLibraryType");
47
+ s(this, "version");
48
+ s(this, "gitSha");
49
+ s(this, "gitOrg");
50
+ s(this, "gitRepo");
51
+ s(this, "gitProvider");
52
+ s(this, "serviceDisplayName");
53
+ s(this, "infrastructureType");
54
+ s(this, "infrastructureDetails");
55
+ s(this, "framework");
56
+ s(this, "additionalFrameworks");
57
+ s(this, "serviceRole");
58
+ s(this, "setupInterceptorsFile");
59
+ s(this, "setupInterceptorsLine");
60
+ s(this, "logIgnoreRegex");
61
+ s(this, "captureRequestHeaders");
62
+ s(this, "captureResponseHeaders");
63
+ s(this, "captureRequestBody");
64
+ s(this, "captureResponseBody");
65
+ s(this, "requestBodyLimitBytes");
66
+ s(this, "responseBodyLimitBytes");
67
+ s(this, "bullmqBulkAggregateMode");
68
+ s(this, "retryOnClientError");
69
+ s(this, "dataSensitivityLevel");
70
+ s(this, "exceptionCaptureLocals");
71
+ s(this, "uplinkEnable");
72
+ s(this, "uplinkUrl");
73
+ s(this, "_serviceIdentificationReceived", !1);
74
+ this.apiKey = e.apiKey, this.apiGraphqlEndpoint = e?.apiGraphqlEndpoint || process.env.SAILFISH_GRAPHQL_ENDPOINT || "https://api-service.sailfishqa.com/graphql/", this.sfDebug = e?.debug === !0 || process.env.SF_DEBUG === "true", this.serviceIdentifier = e?.serviceIdentifier || process.env.SERVICE_IDENTIFIER, this.serviceUUID = S(), this.serviceVersion = e?.serviceVersion || process.env.SERVICE_VERSION, this.gitSha = e?.gitSha || process.env.GIT_SHA || process.env.GITHUB_SHA || process.env.CI_COMMIT_SHA || process.env.BITBUCKET_COMMIT || process.env.VERCEL_GIT_COMMIT_SHA || process.env.CIRCLE_SHA1 || process.env.HEROKU_SLUG_COMMIT || process.env.RENDER_GIT_COMMIT || process.env.RAILWAY_GIT_COMMIT_SHA || process.env.CODEBUILD_RESOLVED_SOURCE_VERSION;
71
75
  const t = process.env.GITHUB_REPOSITORY?.split("/");
72
76
  this.gitOrg = e?.gitOrg || process.env.GIT_ORG || (t && t.length >= 2 ? t[0] : void 0) || process.env.CI_PROJECT_NAMESPACE || process.env.BITBUCKET_REPO_OWNER || process.env.VERCEL_GIT_REPO_OWNER || process.env.CIRCLE_PROJECT_USERNAME, this.gitRepo = e?.gitRepo || process.env.GIT_REPO || (t && t.length >= 2 ? t.slice(1).join("/") : void 0) || process.env.CI_PROJECT_NAME || process.env.BITBUCKET_REPO_SLUG || process.env.VERCEL_GIT_REPO_SLUG || process.env.CIRCLE_PROJECT_REPONAME, this.gitProvider = e?.gitProvider || process.env.GIT_PROVIDER || (process.env.GITHUB_ACTIONS ? "github" : void 0) || (process.env.GITLAB_CI ? "gitlab" : void 0) || (process.env.BITBUCKET_PIPELINE_UUID ? "bitbucket" : void 0) || (process.env.CIRCLECI ? "circleci" : void 0), this.serviceDisplayName = e?.serviceDisplayName || process.env.SERVICE_DISPLAY_NAME, this.serviceAdditionalMetadata = e?.serviceAdditionalMetadata || {}, this.profilingModeEnabled = e?.profilingModeEnabled ?? !1, this.profilingMaxDepth = e?.profilingMaxDepth ?? 5, this.profilingMaxVariableSizeKb = e?.profilingMaxVariableSizeKb ?? 25, this.domainsToNotPropagateHeadersTo = e?.domainsToNotPropagateHeadersTo || [], this.domainsToPropagateHeadersTo = e?.domainsToPropagateHeadersTo !== void 0 ? e.domainsToPropagateHeadersTo : ["*"], this.nodeModulesToCollectLocalVariablesOn = e?.nodeModulesToCollectLocalVariablesOn || ["_all_"], this.printConfigurationStatuses = process.env.PRINT_CONFIGURATION_STATUSES || "true", this.logLevel = process.env.LOG_LEVEL || "INFO", this.stackDepthLocals = process.env.SAILFISH_EXCEPTION_STACK_DEPTH_LOCALS !== void 0 ? parseInt(process.env.SAILFISH_EXCEPTION_STACK_DEPTH_LOCALS, 10) : 5, isNaN(this.stackDepthLocals) && (this.stackDepthLocals = -1), this.stackDepthCodeTraceDepth = process.env.SAILFISH_EXCEPTION_STACK_DEPTH_CODE_TRACE_DEPTH !== void 0 ? parseInt(process.env.SAILFISH_EXCEPTION_STACK_DEPTH_CODE_TRACE_DEPTH, 10) : -1, isNaN(this.stackDepthCodeTraceDepth) && (this.stackDepthCodeTraceDepth = -1), this.packageLibraryType = "JS/TS BACKEND", this.version = this.getPackageVersion();
73
- const s = (function() {
74
- return process.env.KUBERNETES_SERVICE_HOST || m("/var/run/secrets/kubernetes.io/serviceaccount/token") ? { type: "Kubernetes", details: { namespace: process.env.POD_NAMESPACE || "", podName: process.env.HOSTNAME || "", nodeName: process.env.NODE_NAME || "" } } : process.env.AWS_LAMBDA_FUNCTION_NAME ? { type: "AWS Lambda", details: { functionName: process.env.AWS_LAMBDA_FUNCTION_NAME || "", region: process.env.AWS_REGION || "", runtime: process.env.AWS_EXECUTION_ENV || "" } } : process.env.AWS_EXECUTION_ENV ? { type: "AWS", details: { executionEnv: process.env.AWS_EXECUTION_ENV || "", region: process.env.AWS_REGION || "" } } : process.env.GOOGLE_CLOUD_PROJECT ? { type: "Google Cloud", details: { project: process.env.GOOGLE_CLOUD_PROJECT || "" } } : process.env.AZURE_FUNCTIONS_ENVIRONMENT ? { type: "Azure Functions", details: { environment: process.env.AZURE_FUNCTIONS_ENVIRONMENT || "" } } : process.env.VERCEL ? { type: "Vercel", details: { env: process.env.VERCEL_ENV || "", region: process.env.VERCEL_REGION || "" } } : process.env.NETLIFY ? { type: "Netlify", details: {} } : process.env.FLY_APP_NAME ? { type: "Fly.io", details: { appName: process.env.FLY_APP_NAME || "", region: process.env.FLY_REGION || "" } } : process.env.RENDER_SERVICE_ID ? { type: "Render", details: { serviceId: process.env.RENDER_SERVICE_ID || "" } } : process.env.RAILWAY_ENVIRONMENT ? { type: "Railway", details: { environment: process.env.RAILWAY_ENVIRONMENT || "" } } : m("/.dockerenv") ? { type: "Docker", details: {} } : { type: "Unknown", details: { os: N.platform(), arch: N.arch(), nodeVersion: process.version } };
77
+ const r = (function() {
78
+ return process.env.KUBERNETES_SERVICE_HOST || A("/var/run/secrets/kubernetes.io/serviceaccount/token") ? { type: "Kubernetes", details: { namespace: process.env.POD_NAMESPACE || "", podName: process.env.HOSTNAME || "", nodeName: process.env.NODE_NAME || "" } } : process.env.AWS_LAMBDA_FUNCTION_NAME ? { type: "AWS Lambda", details: { functionName: process.env.AWS_LAMBDA_FUNCTION_NAME || "", region: process.env.AWS_REGION || "", runtime: process.env.AWS_EXECUTION_ENV || "" } } : process.env.AWS_EXECUTION_ENV ? { type: "AWS", details: { executionEnv: process.env.AWS_EXECUTION_ENV || "", region: process.env.AWS_REGION || "" } } : process.env.GOOGLE_CLOUD_PROJECT ? { type: "Google Cloud", details: { project: process.env.GOOGLE_CLOUD_PROJECT || "" } } : process.env.AZURE_FUNCTIONS_ENVIRONMENT ? { type: "Azure Functions", details: { environment: process.env.AZURE_FUNCTIONS_ENVIRONMENT || "" } } : process.env.VERCEL ? { type: "Vercel", details: { env: process.env.VERCEL_ENV || "", region: process.env.VERCEL_REGION || "" } } : process.env.NETLIFY ? { type: "Netlify", details: {} } : process.env.FLY_APP_NAME ? { type: "Fly.io", details: { appName: process.env.FLY_APP_NAME || "", region: process.env.FLY_REGION || "" } } : process.env.RENDER_SERVICE_ID ? { type: "Render", details: { serviceId: process.env.RENDER_SERVICE_ID || "" } } : process.env.RAILWAY_ENVIRONMENT ? { type: "Railway", details: { environment: process.env.RAILWAY_ENVIRONMENT || "" } } : A("/.dockerenv") ? { type: "Docker", details: {} } : { type: "Unknown", details: { os: L.platform(), arch: L.arch(), nodeVersion: process.version } };
75
79
  })();
76
- this.infrastructureType = s.type, this.infrastructureDetails = s.details;
77
- const o = (function() {
78
- const b = [{ pkg: "@nestjs/core", name: "nestjs" }, { pkg: "@apollo/server", name: "apollo-server" }, { pkg: "apollo-server", name: "apollo-server" }, { pkg: "mercurius", name: "mercurius" }, { pkg: "next", name: "nextjs" }, { pkg: "nuxt", name: "nuxtjs" }, { pkg: "express", name: "express" }, { pkg: "fastify", name: "fastify" }, { pkg: "koa", name: "koa" }, { pkg: "@hapi/hapi", name: "hapi" }, { pkg: "hono", name: "hono" }], l = [], _ = /* @__PURE__ */ new Set();
79
- for (const { pkg: I, name: R } of b) if (!_.has(R)) try {
80
+ this.infrastructureType = r.type, this.infrastructureDetails = r.details;
81
+ const n = (function() {
82
+ const G = [{ pkg: "@nestjs/core", name: "nestjs" }, { pkg: "@apollo/server", name: "apollo-server" }, { pkg: "apollo-server", name: "apollo-server" }, { pkg: "mercurius", name: "mercurius" }, { pkg: "next", name: "nextjs" }, { pkg: "nuxt", name: "nuxtjs" }, { pkg: "express", name: "express" }, { pkg: "fastify", name: "fastify" }, { pkg: "koa", name: "koa" }, { pkg: "@hapi/hapi", name: "hapi" }, { pkg: "hono", name: "hono" }], l = [], _ = /* @__PURE__ */ new Set();
83
+ for (const { pkg: I, name: R } of G) if (!_.has(R)) try {
80
84
  require.resolve(I), l.push(R), _.add(R);
81
85
  } catch {
82
86
  }
@@ -93,19 +97,19 @@ class B {
93
97
  }
94
98
  return { framework: l.length > 0 ? l[0] : null, additionalFrameworks: l.slice(1), serviceRole: l.includes("nextjs") || l.includes("nuxtjs") ? "fullstack" : "backend" };
95
99
  })();
96
- this.framework = o.framework ?? void 0, this.additionalFrameworks = o.additionalFrameworks, this.serviceRole = o.serviceRole;
100
+ this.framework = n.framework ?? void 0, this.additionalFrameworks = n.additionalFrameworks, this.serviceRole = n.serviceRole;
97
101
  const i = process.env.SF_LOG_IGNORE_REGEX;
98
102
  if (i) try {
99
103
  this.logIgnoreRegex = new RegExp(i);
100
104
  } catch {
101
105
  }
102
106
  this.captureRequestHeaders = process.env.SF_NETWORKHOP_CAPTURE_REQUEST_HEADERS === "true", this.captureResponseHeaders = process.env.SF_NETWORKHOP_CAPTURE_RESPONSE_HEADERS === "true", this.captureRequestBody = process.env.SF_NETWORKHOP_CAPTURE_REQUEST_BODY === "true", this.captureResponseBody = process.env.SF_NETWORKHOP_CAPTURE_RESPONSE_BODY === "true", this.bullmqBulkAggregateMode = process.env.SF_BULLMQ_BULK_AGGREGATE === "true";
103
- const c = parseInt(process.env.SF_NETWORKHOP_REQUEST_LIMIT_MB || "1", 10);
104
- this.requestBodyLimitBytes = 1024 * (isNaN(c) ? 1 : c) * 1024;
105
- const p = parseInt(process.env.SF_NETWORKHOP_RESPONSE_LIMIT_MB || "1", 10);
106
- this.responseBodyLimitBytes = 1024 * (isNaN(p) ? 1 : p) * 1024;
107
- const u = (process.env.SF_RETRY_ON_CLIENT_ERROR || "").toLowerCase(), M = u === "all" || u === "idempotent" || u === "none" ? u : void 0;
108
- this.retryOnClientError = M ?? e.retryOnClientError ?? "all";
107
+ const p = parseInt(process.env.SF_NETWORKHOP_REQUEST_LIMIT_MB || "1", 10);
108
+ this.requestBodyLimitBytes = 1024 * (isNaN(p) ? 1 : p) * 1024;
109
+ const d = parseInt(process.env.SF_NETWORKHOP_RESPONSE_LIMIT_MB || "1", 10);
110
+ this.responseBodyLimitBytes = 1024 * (isNaN(d) ? 1 : d) * 1024;
111
+ const u = (process.env.SF_RETRY_ON_CLIENT_ERROR || "").toLowerCase(), k = u === "all" || u === "idempotent" || u === "none" ? u : void 0;
112
+ this.retryOnClientError = k ?? e.retryOnClientError ?? "all", this.dataSensitivityLevel = process.env.SAILFISH_DATA_SENSITIVITY_LEVEL || "standard", this.exceptionCaptureLocals = process.env.SAILFISH_EXCEPTION_CAPTURE_LOCALS !== "false", this.uplinkEnable = process.env.SF_UPLINK_ENABLE !== "false", this.uplinkUrl = process.env.SF_UPLINK_URL || "";
109
113
  }
110
114
  getPackageVersion() {
111
115
  return "0.2.14";
@@ -117,60 +121,62 @@ class B {
117
121
  this._serviceIdentificationReceived = e;
118
122
  }
119
123
  }
120
- async function X(n) {
121
- if (!(n.gitOrg && n.gitRepo && n.gitProvider)) try {
124
+ async function J(o) {
125
+ if (!(o.gitOrg && o.gitRepo && o.gitProvider)) try {
122
126
  const e = await (async function() {
123
127
  let t = "";
124
128
  try {
125
- t = await new Promise((s, o) => {
126
- V("git", ["remote", "get-url", "origin"], { timeout: 3e3 }, (i, c) => {
127
- i ? o(i) : s((c || "").trim());
129
+ t = await new Promise((r, n) => {
130
+ F("git", ["remote", "get-url", "origin"], { timeout: 3e3 }, (i, p) => {
131
+ i ? n(i) : r((p || "").trim());
128
132
  });
129
133
  });
130
134
  } catch {
131
135
  try {
132
- const s = (await k.readFile(".git/config", "utf-8")).match(/\[remote "origin"\][^[]*url\s*=\s*(.+)/m);
133
- s && (t = s[1].trim());
136
+ const r = (await B.readFile(".git/config", "utf-8")).match(/\[remote "origin"\][^[]*url\s*=\s*(.+)/m);
137
+ r && (t = r[1].trim());
134
138
  } catch {
135
139
  }
136
140
  }
137
- return t ? (function(s) {
138
- let o, i, c;
139
- if (s.includes("github.com") ? o = "github" : s.includes("gitlab.com") ? o = "gitlab" : s.includes("bitbucket.org") && (o = "bitbucket"), s.startsWith("https://") || s.startsWith("http://")) {
140
- const p = s.split("/");
141
- p.length >= 5 && (i = p[3], c = p[4].replace(/\.git$/, ""));
141
+ return t ? (function(r) {
142
+ let n, i, p;
143
+ if (r.includes("github.com") ? n = "github" : r.includes("gitlab.com") ? n = "gitlab" : r.includes("bitbucket.org") && (n = "bitbucket"), r.startsWith("https://") || r.startsWith("http://")) {
144
+ const d = r.split("/");
145
+ d.length >= 5 && (i = d[3], p = d[4].replace(/\.git$/, ""));
142
146
  } else {
143
- const p = s.indexOf(":");
144
- if (p > 0) {
145
- const u = s.substring(p + 1).replace(/\.git$/, "").split("/");
146
- u.length >= 2 && (i = u[0], c = u[1]);
147
+ const d = r.indexOf(":");
148
+ if (d > 0) {
149
+ const u = r.substring(d + 1).replace(/\.git$/, "").split("/");
150
+ u.length >= 2 && (i = u[0], p = u[1]);
147
151
  }
148
152
  }
149
- return { org: i, repo: c, provider: o };
153
+ return { org: i, repo: p, provider: n };
150
154
  })(t) : {};
151
155
  })();
152
- n.gitOrg || (n.gitOrg = e.org), n.gitRepo || (n.gitRepo = e.repo), n.gitProvider || (n.gitProvider = e.provider);
156
+ o.gitOrg || (o.gitOrg = e.org), o.gitRepo || (o.gitRepo = e.repo), o.gitProvider || (o.gitProvider = e.provider);
153
157
  } catch {
154
158
  }
155
159
  }
156
- const U = Symbol.for("sailfish.sf_config");
157
- function x() {
158
- return globalThis[U];
160
+ const M = Symbol.for("sailfish.sf_config");
161
+ function b() {
162
+ return globalThis[M];
159
163
  }
160
- function z(n) {
161
- const e = x();
164
+ function Q(o) {
165
+ const e = b();
162
166
  if (e) return { config: e };
163
- const t = new B(n);
164
- return (function(s) {
165
- globalThis[U] = s;
166
- })(t), t.sfDebug && console.log("[[getOrCreateConfig]] Created global config:", t), { config: t };
167
+ const t = new K(o);
168
+ (function(n) {
169
+ globalThis[M] = n;
170
+ })(t);
171
+ const r = globalThis;
172
+ return r.__sf_configEpoch = (r.__sf_configEpoch ?? 0) + 1, t.sfDebug && console.log("[[getOrCreateConfig]] Created global config:", t), { config: t };
167
173
  }
168
174
  function f() {
169
- const n = x();
170
- if (!n) throw new Error("Configuration has not been initialized. Call getOrCreateConfig(options) first.");
171
- return n;
175
+ const o = b();
176
+ if (!o) throw new Error("Configuration has not been initialized. Call getOrCreateConfig(options) first.");
177
+ return o;
172
178
  }
173
- const D = Symbol.for("sf.ctx.storeAls"), d = globalThis, O = d[D] ?? (d[D] = new P()), w = "nonsession-applogs", K = ["identitytoolkit.googleapis.com", "t.co", "*.twitter.com", "*.gravatar.com", "*.googleapis.com", "*.amazonaws.com", "*.smooch.io", "*.zendesk.com"], L = Symbol.for("sf.ctx.als"), E = d[L] ?? (d[L] = new P()), y = Symbol.for("sf.ctx.sessionRegistry"), h = d[y] ?? (d[y] = /* @__PURE__ */ new Map()), v = { handledExceptions: /* @__PURE__ */ new Set(), reentrancyGuardLoggingActive: !1, reentrancyGuardLoggingPreActive: !1, reentrancyGuardPrintActive: !1, reentrancyGuardPrintPreActive: !1, reentrancyGuardExceptionActive: !1, reentrancyGuardExceptionPreActive: !1, excludedDomains: new Set(K), supportedDomains: /* @__PURE__ */ new Set() }, g = class g {
179
+ const y = Symbol.for("sf.ctx.storeAls"), c = globalThis, O = c[y] ?? (c[y] = new N()), W = "nonsession-applogs", Y = ["identitytoolkit.googleapis.com", "t.co", "*.twitter.com", "*.gravatar.com", "*.googleapis.com", "*.amazonaws.com", "*.smooch.io", "*.zendesk.com"], U = Symbol.for("sf.ctx.als"), E = c[U] ?? (c[U] = new N()), P = Symbol.for("sf.ctx.fnSpanAls"), m = c[P] ?? (c[P] = new N()), x = Symbol.for("sf.ctx.sessionRegistry"), v = c[x] ?? (c[x] = /* @__PURE__ */ new Map()), h = { handledExceptions: /* @__PURE__ */ new Set(), reentrancyGuardLoggingActive: !1, reentrancyGuardLoggingPreActive: !1, reentrancyGuardPrintActive: !1, reentrancyGuardPrintPreActive: !1, reentrancyGuardExceptionActive: !1, reentrancyGuardExceptionPreActive: !1, excludedDomains: new Set(Y), supportedDomains: /* @__PURE__ */ new Set() }, g = class g {
174
180
  constructor() {
175
181
  }
176
182
  current() {
@@ -183,41 +189,41 @@ const D = Symbol.for("sf.ctx.storeAls"), d = globalThis, O = d[D] ?? (d[D] = new
183
189
  return O.enterWith(t), t;
184
190
  }
185
191
  runWith(e, t) {
186
- const s = this.current() ?? /* @__PURE__ */ new Map(), o = new Map(s);
187
- for (const [i, c] of Object.entries(e)) o.set(i, c);
188
- return O.run(o, t);
192
+ const r = this.current() ?? /* @__PURE__ */ new Map(), n = new Map(r);
193
+ for (const [i, p] of Object.entries(e)) n.set(i, p);
194
+ return O.run(n, t);
189
195
  }
190
196
  static getInstance() {
191
- return d[g.GLOBAL_MANAGER_SYMBOL] || (d[g.GLOBAL_MANAGER_SYMBOL] = new g()), d[g.GLOBAL_MANAGER_SYMBOL];
197
+ return c[g.GLOBAL_MANAGER_SYMBOL] || (c[g.GLOBAL_MANAGER_SYMBOL] = new g()), c[g.GLOBAL_MANAGER_SYMBOL];
192
198
  }
193
199
  getCurrentContext() {
194
- return E.getStore() || v;
200
+ return E.getStore() || h;
195
201
  }
196
202
  setCurrentContext(e) {
197
- const t = E.getStore() || v;
203
+ const t = E.getStore() || h;
198
204
  E.enterWith({ ...t, ...e });
199
205
  }
200
206
  ensureSession(e) {
201
- let t = h.get(e);
202
- return t || (t = { ...v }, h.set(e, t)), t;
207
+ let t = v.get(e);
208
+ return t || (t = { ...h }, v.set(e, t)), t;
203
209
  }
204
210
  getContextFor(e) {
205
- return h.get(e) ?? v;
211
+ return v.get(e) ?? h;
206
212
  }
207
213
  updateContextFor(e, t) {
208
- const s = this.ensureSession(e);
209
- h.set(e, { ...s, ...t });
214
+ const r = this.ensureSession(e);
215
+ v.set(e, { ...r, ...t });
210
216
  }
211
217
  runWithSession(e, t) {
212
- const s = { ...this.ensureSession(e) };
213
- return E.run(s, t);
218
+ const r = { ...this.ensureSession(e) };
219
+ return E.run(r, t);
214
220
  }
215
221
  deleteSession(e) {
216
- h.delete(e);
222
+ v.delete(e);
217
223
  }
218
224
  runScoped(e, t) {
219
- const s = E.getStore() ?? v, o = { ...s, handledExceptions: new Set(s.handledExceptions), excludedDomains: new Set(s.excludedDomains), supportedDomains: new Set(s.supportedDomains), ...e };
220
- return E.run(o, t);
225
+ const r = E.getStore() ?? h, n = { ...r, handledExceptions: new Set(r.handledExceptions), excludedDomains: new Set(r.excludedDomains), supportedDomains: new Set(r.supportedDomains), ...e };
226
+ return E.run(n, t);
221
227
  }
222
228
  getTraceId() {
223
229
  return this.getCurrentContext().traceId;
@@ -232,21 +238,21 @@ const D = Symbol.for("sf.ctx.storeAls"), d = globalThis, O = d[D] ?? (d[D] = new
232
238
  this.setCurrentContext({ pageVisitUUID: e });
233
239
  }
234
240
  getCurrentFunctionSpanId() {
235
- return this.getCurrentContext().currentFunctionSpanId;
241
+ return m.getStore();
236
242
  }
237
243
  setCurrentFunctionSpanId(e) {
238
- this.setCurrentContext({ currentFunctionSpanId: e });
244
+ m.enterWith(e);
239
245
  }
240
246
  clearCurrentFunctionSpanId() {
241
- this.setCurrentContext({ currentFunctionSpanId: void 0 });
247
+ m.enterWith(void 0);
242
248
  }
243
249
  getOrSetSfTraceId(e, t = !1) {
244
- let s = this.getTraceId();
245
- return s || (s = e || (t ? C() : `${w}-v3/${f().apiKey}/${C()}`), this.setTraceId(s), f().sfDebug && console.log(" Created new trace ID:", s), s);
250
+ let r = this.getTraceId();
251
+ return r || (r = e || (t ? S() : `${W}-v3/${f().apiKey}/${S()}`), this.setTraceId(r), f().sfDebug && console.log(" Created new trace ID:", r), r);
246
252
  }
247
253
  getOrSetPageVisitUUID() {
248
254
  let e = this.getPageVisitUUID();
249
- return e || (e = C(), this.setPageVisitUUID(e), f().sfDebug && console.log(" Created new page visit UUID:", e), e);
255
+ return e || (e = S(), this.setPageVisitUUID(e), f().sfDebug && console.log(" Created new page visit UUID:", e), e);
250
256
  }
251
257
  getHandledExceptions() {
252
258
  return this.getCurrentContext().handledExceptions;
@@ -277,26 +283,26 @@ const D = Symbol.for("sf.ctx.storeAls"), d = globalThis, O = d[D] ?? (d[D] = new
277
283
  this.updateContextFor(e, { pageVisitUUID: t });
278
284
  }
279
285
  };
280
- r(g, "GLOBAL_MANAGER_SYMBOL", Symbol.for("sf.ctx.manager"));
281
- let S = g;
282
- function J(n) {
283
- const e = { ...S.getInstance().getCurrentContext() };
286
+ s(g, "GLOBAL_MANAGER_SYMBOL", Symbol.for("sf.ctx.manager"));
287
+ let C = g;
288
+ function $(o) {
289
+ const e = { ...C.getInstance().getCurrentContext() };
284
290
  E.run(e, () => {
285
- n();
291
+ o();
286
292
  });
287
293
  }
288
- function Q() {
289
- return S.getInstance().getCurrentFunctionSpanId();
294
+ function Z() {
295
+ return C.getInstance().getCurrentFunctionSpanId();
290
296
  }
291
297
  export {
292
- S as C,
293
- K as D,
294
- w as N,
295
- x as a,
296
- Q as b,
297
- z as c,
298
- X as d,
298
+ C,
299
+ Y as D,
300
+ W as N,
301
+ b as a,
302
+ Z as b,
303
+ Q as c,
304
+ J as d,
299
305
  f as g,
300
- J as r,
301
- C as v
306
+ $ as r,
307
+ S as v
302
308
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("fs"),p=require("../funcSpanTransformer-D0W2t41q.cjs"),f=require("../consoleLocationTransformer-BSSB5msZ.cjs"),h=require("../runtimeConfig-xahsyRmN.cjs");function d(a={}){try{if(h.shouldEnableRuntimeHooks())return console.warn("[FuncSpan Esbuild Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation"),{name:"sailfish-funcspan-esbuild-disabled",setup(){}}}catch{}const{enabled:r=!0,includeNodeModules:i=[],debug:s=!1}=a;return{name:"sailfish-funcspan-esbuild",setup(u){r&&(u.onLoad({filter:/\.(js|ts|jsx|tsx)$/},async e=>{if(e.path.includes("node_modules")&&!i.some(n=>e.path.includes(`node_modules/${n}`))||e.path.includes("@sailfish-ai/sf-veritas")||e.path.includes("jsts-backend/dist"))return null;try{let n=c.readFileSync(e.path,"utf-8"),o=!1;const t=await p.transformFunctionSpans(n,e.path,{projectRoot:process.cwd(),includeNodeModules:i,debug:s});t.modified&&(n=t.code,o=!0);const l=await f.transformConsoleLocations(n,e.path,{projectRoot:process.cwd(),includeNodeModules:i,debug:s});if(l.modified&&(n=l.code,o=!0),o)return{contents:n,loader:e.path.endsWith(".ts")||e.path.endsWith(".tsx")?"ts":"js"}}catch(n){s&&console.error(`[FuncSpan Esbuild] Error transforming ${e.path}:`,n)}return null}),s&&console.log("[FuncSpan Esbuild] Plugin initialized"))}}}exports.default=d,exports.funcspanEsbuildPlugin=d;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("fs"),p=require("../funcSpanTransformer-D0W2t41q.cjs"),f=require("../consoleLocationTransformer-BSSB5msZ.cjs"),h=require("../runtimeConfig-D18ZMMnT.cjs");function d(a={}){try{if(h.shouldEnableRuntimeHooks())return console.warn("[FuncSpan Esbuild Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation"),{name:"sailfish-funcspan-esbuild-disabled",setup(){}}}catch{}const{enabled:r=!0,includeNodeModules:i=[],debug:s=!1}=a;return{name:"sailfish-funcspan-esbuild",setup(u){r&&(u.onLoad({filter:/\.(js|ts|jsx|tsx)$/},async e=>{if(e.path.includes("node_modules")&&!i.some(n=>e.path.includes(`node_modules/${n}`))||e.path.includes("@sailfish-ai/sf-veritas")||e.path.includes("jsts-backend/dist"))return null;try{let n=c.readFileSync(e.path,"utf-8"),o=!1;const t=await p.transformFunctionSpans(n,e.path,{projectRoot:process.cwd(),includeNodeModules:i,debug:s});t.modified&&(n=t.code,o=!0);const l=await f.transformConsoleLocations(n,e.path,{projectRoot:process.cwd(),includeNodeModules:i,debug:s});if(l.modified&&(n=l.code,o=!0),o)return{contents:n,loader:e.path.endsWith(".ts")||e.path.endsWith(".tsx")?"ts":"js"}}catch(n){s&&console.error(`[FuncSpan Esbuild] Error transforming ${e.path}:`,n)}return null}),s&&console.log("[FuncSpan Esbuild] Plugin initialized"))}}}exports.default=d,exports.funcspanEsbuildPlugin=d;
@@ -1,7 +1,7 @@
1
1
  import { readFileSync as r } from "fs";
2
2
  import { t as c } from "../funcSpanTransformer-S_WeAt_m.js";
3
3
  import { t as p } from "../consoleLocationTransformer-DZu_9MDA.js";
4
- import { s as f } from "../runtimeConfig-BUJ13zxm.js";
4
+ import { s as f } from "../runtimeConfig-Dmaavj6j.js";
5
5
  function j(a = {}) {
6
6
  try {
7
7
  if (f()) return console.warn("[FuncSpan Esbuild Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation"), { name: "sailfish-funcspan-esbuild-disabled", setup() {
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("../funcSpanTransformer-D0W2t41q.cjs"),p=require("../consoleLocationTransformer-BSSB5msZ.cjs"),m=require("../runtimeConfig-xahsyRmN.cjs");function d(a={}){try{if(m.shouldEnableRuntimeHooks())return console.warn("[FuncSpan Rollup Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation"),{name:"sailfish-funcspan-rollup-disabled"}}catch{}const{enabled:c=!0,includeNodeModules:o=[],debug:u=!1}=a;return{name:"sailfish-funcspan-rollup",async transform(s,n){if(!c||!n.match(/\.(js|ts|jsx|tsx)$/)||n.includes("node_modules")&&!o.some(e=>n.includes(`node_modules/${e}`))||n.includes("@sailfish-ai/sf-veritas")||n.includes("jsts-backend/dist"))return null;try{let e=s,l=null,r=!1;const t=await f.transformFunctionSpans(e,n,{projectRoot:process.cwd(),includeNodeModules:o,debug:u});t.modified&&(e=t.code,l=t.map,r=!0);const i=await p.transformConsoleLocations(e,n,{projectRoot:process.cwd(),includeNodeModules:o,debug:u});if(i.modified&&(e=i.code,l=i.map,r=!0),r)return{code:e,map:l||null}}catch(e){u&&console.error(`[FuncSpan Rollup] Error transforming ${n}:`,e)}return null}}}exports.default=d,exports.funcspanRollupPlugin=d;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("../funcSpanTransformer-D0W2t41q.cjs"),p=require("../consoleLocationTransformer-BSSB5msZ.cjs"),m=require("../runtimeConfig-D18ZMMnT.cjs");function d(a={}){try{if(m.shouldEnableRuntimeHooks())return console.warn("[FuncSpan Rollup Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation"),{name:"sailfish-funcspan-rollup-disabled"}}catch{}const{enabled:c=!0,includeNodeModules:o=[],debug:u=!1}=a;return{name:"sailfish-funcspan-rollup",async transform(s,n){if(!c||!n.match(/\.(js|ts|jsx|tsx)$/)||n.includes("node_modules")&&!o.some(e=>n.includes(`node_modules/${e}`))||n.includes("@sailfish-ai/sf-veritas")||n.includes("jsts-backend/dist"))return null;try{let e=s,l=null,r=!1;const t=await f.transformFunctionSpans(e,n,{projectRoot:process.cwd(),includeNodeModules:o,debug:u});t.modified&&(e=t.code,l=t.map,r=!0);const i=await p.transformConsoleLocations(e,n,{projectRoot:process.cwd(),includeNodeModules:o,debug:u});if(i.modified&&(e=i.code,l=i.map,r=!0),r)return{code:e,map:l||null}}catch(e){u&&console.error(`[FuncSpan Rollup] Error transforming ${n}:`,e)}return null}}}exports.default=d,exports.funcspanRollupPlugin=d;
@@ -1,6 +1,6 @@
1
1
  import { t as c } from "../funcSpanTransformer-S_WeAt_m.js";
2
2
  import { t as p } from "../consoleLocationTransformer-DZu_9MDA.js";
3
- import { s as f } from "../runtimeConfig-BUJ13zxm.js";
3
+ import { s as f } from "../runtimeConfig-Dmaavj6j.js";
4
4
  function h(r = {}) {
5
5
  try {
6
6
  if (f()) return console.warn("[FuncSpan Rollup Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation"), { name: "sailfish-funcspan-rollup-disabled" };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("fs"),T=require("glob"),y=require("path"),D=require("../funcSpanTransformer-D0W2t41q.cjs"),b=require("../consoleLocationTransformer-BSSB5msZ.cjs"),v=require("../runtimeConfig-xahsyRmN.cjs");async function C(n={}){try{if(v.shouldEnableRuntimeHooks())return void console.warn("[FuncSpan TSC Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation")}catch{}const{outDir:N="dist",include:_=["**/*.js"],exclude:m=["**/*.test.js","**/*.spec.js","**/__tests__/**"],projectRoot:c=process.cwd(),includeNodeModules:d=[],debug:s=!1}=n,p=y.resolve(c,N);console.log("[FuncSpan TSC] Starting post-build function instrumentation..."),console.log(`[FuncSpan TSC] Output directory: ${p}`),console.log(`[FuncSpan TSC] Project root: ${c}`);const i=[];for(const o of _){const e=T.sync(o,{cwd:p,absolute:!0,ignore:m});i.push(...e)}console.log(`[FuncSpan TSC] Found ${i.length} JavaScript files to process`);let S=0,f=0;for(const o of i)try{let e=a.readFileSync(o,"utf-8"),r=null,u=!1;const t=await D.transformFunctionSpans(e,o,{projectRoot:c,includeNodeModules:d,debug:s});t.modified&&(e=t.code,r=t.map,u=!0);const l=await b.transformConsoleLocations(e,o,{projectRoot:c,includeNodeModules:d,debug:s});if(l.modified&&(e=l.code,r=l.map,u=!0),u){if(a.writeFileSync(o,e,"utf-8"),r){const F=`${o}.map`;a.writeFileSync(F,JSON.stringify(r),"utf-8"),s&&console.log(`[FuncSpan TSC] Generated source map: ${F}`)}S++,f+=t.functionsWrapped,s&&console.log(`[FuncSpan TSC] Modified: ${o} (${t.functionsWrapped} functions)`)}}catch(e){console.error(`[FuncSpan TSC] Error processing ${o}:`,e)}console.log(`[FuncSpan TSC] ✅ Completed: Modified ${S} files, wrapped ${f} functions`)}async function g(){const n={outDir:process.env.SF_FUNCSPAN_OUT_DIR||"dist",debug:process.env.SF_FUNCSPAN_DEBUG==="true",includeNodeModules:process.env.SF_FUNCSPAN_INCLUDE_NODE_MODULES?process.env.SF_FUNCSPAN_INCLUDE_NODE_MODULES.split(","):[]};await C(n)}require.main===module&&g().catch(n=>{console.error("[FuncSpan TSC] Fatal error:",n),process.exit(1)}),exports.cli=g,exports.processTscFiles=C;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("fs"),T=require("glob"),y=require("path"),D=require("../funcSpanTransformer-D0W2t41q.cjs"),b=require("../consoleLocationTransformer-BSSB5msZ.cjs"),v=require("../runtimeConfig-D18ZMMnT.cjs");async function C(n={}){try{if(v.shouldEnableRuntimeHooks())return void console.warn("[FuncSpan TSC Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation")}catch{}const{outDir:N="dist",include:_=["**/*.js"],exclude:m=["**/*.test.js","**/*.spec.js","**/__tests__/**"],projectRoot:c=process.cwd(),includeNodeModules:d=[],debug:s=!1}=n,p=y.resolve(c,N);console.log("[FuncSpan TSC] Starting post-build function instrumentation..."),console.log(`[FuncSpan TSC] Output directory: ${p}`),console.log(`[FuncSpan TSC] Project root: ${c}`);const i=[];for(const o of _){const e=T.sync(o,{cwd:p,absolute:!0,ignore:m});i.push(...e)}console.log(`[FuncSpan TSC] Found ${i.length} JavaScript files to process`);let S=0,f=0;for(const o of i)try{let e=a.readFileSync(o,"utf-8"),r=null,u=!1;const t=await D.transformFunctionSpans(e,o,{projectRoot:c,includeNodeModules:d,debug:s});t.modified&&(e=t.code,r=t.map,u=!0);const l=await b.transformConsoleLocations(e,o,{projectRoot:c,includeNodeModules:d,debug:s});if(l.modified&&(e=l.code,r=l.map,u=!0),u){if(a.writeFileSync(o,e,"utf-8"),r){const F=`${o}.map`;a.writeFileSync(F,JSON.stringify(r),"utf-8"),s&&console.log(`[FuncSpan TSC] Generated source map: ${F}`)}S++,f+=t.functionsWrapped,s&&console.log(`[FuncSpan TSC] Modified: ${o} (${t.functionsWrapped} functions)`)}}catch(e){console.error(`[FuncSpan TSC] Error processing ${o}:`,e)}console.log(`[FuncSpan TSC] ✅ Completed: Modified ${S} files, wrapped ${f} functions`)}async function g(){const n={outDir:process.env.SF_FUNCSPAN_OUT_DIR||"dist",debug:process.env.SF_FUNCSPAN_DEBUG==="true",includeNodeModules:process.env.SF_FUNCSPAN_INCLUDE_NODE_MODULES?process.env.SF_FUNCSPAN_INCLUDE_NODE_MODULES.split(","):[]};await C(n)}require.main===module&&g().catch(n=>{console.error("[FuncSpan TSC] Fatal error:",n),process.exit(1)}),exports.cli=g,exports.processTscFiles=C;
@@ -3,7 +3,7 @@ import { sync as _ } from "glob";
3
3
  import { resolve as D } from "path";
4
4
  import { t as T } from "../funcSpanTransformer-S_WeAt_m.js";
5
5
  import { t as U } from "../consoleLocationTransformer-DZu_9MDA.js";
6
- import { s as $ } from "../runtimeConfig-BUJ13zxm.js";
6
+ import { s as $ } from "../runtimeConfig-Dmaavj6j.js";
7
7
  async function v(n = {}) {
8
8
  try {
9
9
  if ($()) return void console.warn("[FuncSpan TSC Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation");
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("../funcSpanTransformer-D0W2t41q.cjs"),a=require("../consoleLocationTransformer-BSSB5msZ.cjs"),f=require("../runtimeConfig-xahsyRmN.cjs");exports.funcspanVitePlugin=function(l={}){try{if(f.shouldEnableRuntimeHooks())return console.warn("[FuncSpan Vite Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation"),{name:"sailfish-funcspan-vite-disabled"}}catch{}const{enabled:c=!0,includeNodeModules:t=[],debug:o=!1}=l;return{name:"sailfish-funcspan-vite",enforce:"pre",async transform(s,e){if(!c||!e.match(/\.(js|ts|jsx|tsx)$/)||e.startsWith("\0")||e.includes("node_modules")&&!t.some(n=>e.includes(`node_modules/${n}`))||e.includes("@sailfish-ai/sf-veritas")||e.includes("jsts-backend/dist"))return null;try{let n=s,i=!1;const u=await d.transformFunctionSpans(n,e,{projectRoot:process.cwd(),includeNodeModules:t,debug:o});u.modified&&(n=u.code,i=!0);const r=await a.transformConsoleLocations(n,e,{projectRoot:process.cwd(),includeNodeModules:t,debug:o});if(r.modified&&(n=r.code,i=!0),i)return{code:n,map:null}}catch(n){o&&console.error(`[FuncSpan Vite] Error transforming ${e}:`,n)}return null}}};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("../funcSpanTransformer-D0W2t41q.cjs"),a=require("../consoleLocationTransformer-BSSB5msZ.cjs"),f=require("../runtimeConfig-D18ZMMnT.cjs");exports.funcspanVitePlugin=function(l={}){try{if(f.shouldEnableRuntimeHooks())return console.warn("[FuncSpan Vite Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation"),{name:"sailfish-funcspan-vite-disabled"}}catch{}const{enabled:c=!0,includeNodeModules:t=[],debug:o=!1}=l;return{name:"sailfish-funcspan-vite",enforce:"pre",async transform(s,e){if(!c||!e.match(/\.(js|ts|jsx|tsx)$/)||e.startsWith("\0")||e.includes("node_modules")&&!t.some(n=>e.includes(`node_modules/${n}`))||e.includes("@sailfish-ai/sf-veritas")||e.includes("jsts-backend/dist"))return null;try{let n=s,i=!1;const u=await d.transformFunctionSpans(n,e,{projectRoot:process.cwd(),includeNodeModules:t,debug:o});u.modified&&(n=u.code,i=!0);const r=await a.transformConsoleLocations(n,e,{projectRoot:process.cwd(),includeNodeModules:t,debug:o});if(r.modified&&(n=r.code,i=!0),i)return{code:n,map:null}}catch(n){o&&console.error(`[FuncSpan Vite] Error transforming ${e}:`,n)}return null}}};
@@ -1,6 +1,6 @@
1
1
  import { t as d } from "../funcSpanTransformer-S_WeAt_m.js";
2
2
  import { t as a } from "../consoleLocationTransformer-DZu_9MDA.js";
3
- import { s as f } from "../runtimeConfig-BUJ13zxm.js";
3
+ import { s as f } from "../runtimeConfig-Dmaavj6j.js";
4
4
  function g(l = {}) {
5
5
  try {
6
6
  if (f()) return console.warn("[FuncSpan Vite Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation"), { name: "sailfish-funcspan-vite-disabled" };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("../runtimeConfig-xahsyRmN.cjs"),a=require("path"),P=require("url");function m(r){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const n in r)if(n!=="default"){const t=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(o,n,t.get?t:{enumerable:!0,get:()=>r[n]})}}return o.default=r,Object.freeze(o)}const f=m(a);class u{options;constructor(o={}){this.options={enabled:!0,includeNodeModules:[],debug:!1,enableWorkerPoolTracking:!1,workerPoolTrackDns:!1,workerPoolTrackFs:!1,workerPoolTrackCrypto:!1,workerPoolTrackZlib:!1,...o}}apply(o){try{if(b.shouldEnableRuntimeHooks())return void console.warn("[FuncSpan Webpack Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation")}catch{}const{enabled:n,includeNodeModules:t,debug:c}=this.options;if(!n)return;const l="FuncspanWebpackPlugin";o.hooks.compilation.tap(l,s=>{s.hooks.buildModule.tap(l,i=>{i.resource&&i.resource.match(/\.(js|ts|jsx|tsx)$/)&&(!i.resource.includes("node_modules")||t?.some(e=>i.resource.includes(`node_modules/${e}`)))}),o.webpack.NormalModule.getCompilationHooks(s).loader.tap(l,(i,e)=>{if(!e.resource||!e.resource.match(/\.(js|ts|jsx|tsx)$/)||e.resource.includes("node_modules")&&!t?.some(p=>e.resource.includes(`node_modules/${p}`)))return;const d=typeof __dirname<"u"?__dirname:a.dirname(P.fileURLToPath(require("node:url").pathToFileURL(__filename).href)),k=f.join(d,"funcspanWebpackLoader.cjs");e.loaders.push({loader:k,options:{projectRoot:o.context,includeNodeModules:t,debug:c,enableWorkerPoolTracking:this.options.enableWorkerPoolTracking,workerPoolTrackDns:this.options.workerPoolTrackDns,workerPoolTrackFs:this.options.workerPoolTrackFs,workerPoolTrackCrypto:this.options.workerPoolTrackCrypto,workerPoolTrackZlib:this.options.workerPoolTrackZlib}})})}),c&&console.log("[FuncSpan Webpack] Plugin initialized")}}exports.FuncspanWebpackPlugin=u,exports.default=u;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("../runtimeConfig-D18ZMMnT.cjs"),a=require("path"),P=require("url");function m(r){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const n in r)if(n!=="default"){const t=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(o,n,t.get?t:{enumerable:!0,get:()=>r[n]})}}return o.default=r,Object.freeze(o)}const f=m(a);class u{options;constructor(o={}){this.options={enabled:!0,includeNodeModules:[],debug:!1,enableWorkerPoolTracking:!1,workerPoolTrackDns:!1,workerPoolTrackFs:!1,workerPoolTrackCrypto:!1,workerPoolTrackZlib:!1,...o}}apply(o){try{if(b.shouldEnableRuntimeHooks())return void console.warn("[FuncSpan Webpack Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation")}catch{}const{enabled:n,includeNodeModules:t,debug:c}=this.options;if(!n)return;const l="FuncspanWebpackPlugin";o.hooks.compilation.tap(l,s=>{s.hooks.buildModule.tap(l,i=>{i.resource&&i.resource.match(/\.(js|ts|jsx|tsx)$/)&&(!i.resource.includes("node_modules")||t?.some(e=>i.resource.includes(`node_modules/${e}`)))}),o.webpack.NormalModule.getCompilationHooks(s).loader.tap(l,(i,e)=>{if(!e.resource||!e.resource.match(/\.(js|ts|jsx|tsx)$/)||e.resource.includes("node_modules")&&!t?.some(p=>e.resource.includes(`node_modules/${p}`)))return;const d=typeof __dirname<"u"?__dirname:a.dirname(P.fileURLToPath(require("node:url").pathToFileURL(__filename).href)),k=f.join(d,"funcspanWebpackLoader.cjs");e.loaders.push({loader:k,options:{projectRoot:o.context,includeNodeModules:t,debug:c,enableWorkerPoolTracking:this.options.enableWorkerPoolTracking,workerPoolTrackDns:this.options.workerPoolTrackDns,workerPoolTrackFs:this.options.workerPoolTrackFs,workerPoolTrackCrypto:this.options.workerPoolTrackCrypto,workerPoolTrackZlib:this.options.workerPoolTrackZlib}})})}),c&&console.log("[FuncSpan Webpack] Plugin initialized")}}exports.FuncspanWebpackPlugin=u,exports.default=u;
@@ -1,7 +1,7 @@
1
1
  var k = Object.defineProperty;
2
2
  var m = (r, o, s) => o in r ? k(r, o, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[o] = s;
3
3
  var c = (r, o, s) => m(r, typeof o != "symbol" ? o + "" : o, s);
4
- import { s as b } from "../runtimeConfig-BUJ13zxm.js";
4
+ import { s as b } from "../runtimeConfig-Dmaavj6j.js";
5
5
  import * as P from "path";
6
6
  import { dirname as T } from "path";
7
7
  import { fileURLToPath as f } from "url";