@haystackeditor/cli 0.15.27 → 0.15.28

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 (52) hide show
  1. package/README.md +13 -20
  2. package/dist/assets/hooks/agent-context/detect.ts +7 -7
  3. package/dist/assets/hooks/agent-context/parsers/claude.ts +1 -1
  4. package/dist/assets/hooks/scripts/commit-msg.sh +1 -3
  5. package/dist/assets/hooks/scripts/post-commit.sh +1 -3
  6. package/dist/assets/hooks/scripts/pre-push.sh +1 -4
  7. package/dist/assets/hooks/scripts/prepare-commit-msg.sh +1 -2
  8. package/dist/assets/telemetry/browser-runtime.js +651 -43
  9. package/dist/assets/telemetry/runtime.cjs +62 -68
  10. package/dist/commands/design-verify.d.ts +11 -3
  11. package/dist/commands/design-verify.js +147 -4
  12. package/dist/commands/hooks.d.ts +1 -5
  13. package/dist/commands/hooks.js +10 -112
  14. package/dist/commands/install-session-hooks.d.ts +2 -2
  15. package/dist/commands/install-session-hooks.js +71 -21
  16. package/dist/commands/mcp.js +1 -34
  17. package/dist/commands/pr.js +2 -7
  18. package/dist/commands/setup.d.ts +1 -2
  19. package/dist/commands/setup.js +18 -272
  20. package/dist/commands/submit.js +1 -2
  21. package/dist/commands/verify-hosted.d.ts +13 -0
  22. package/dist/commands/verify-hosted.js +49 -1
  23. package/dist/commands/verify-precompute.d.ts +19 -0
  24. package/dist/commands/verify-precompute.js +328 -0
  25. package/dist/index.js +37 -38
  26. package/dist/schema.d.ts +1 -2
  27. package/dist/schema.js +1 -2
  28. package/dist/triage/prompts.d.ts +0 -7
  29. package/dist/triage/prompts.js +0 -145
  30. package/dist/triage/runner.js +3 -22
  31. package/dist/triage/types.d.ts +1 -8
  32. package/dist/types.d.ts +8 -8
  33. package/dist/types.js +1 -1
  34. package/dist/utils/design-verifier-api.d.ts +71 -0
  35. package/dist/utils/design-verifier-api.js +96 -0
  36. package/dist/utils/design-verifier-result.d.ts +7 -2
  37. package/dist/utils/design-verifier-result.js +67 -21
  38. package/dist/utils/git.d.ts +5 -1
  39. package/dist/utils/git.js +19 -9
  40. package/dist/utils/github-api.js +11 -14
  41. package/dist/utils/hooks.d.ts +1 -15
  42. package/dist/utils/hooks.js +1 -127
  43. package/dist/utils/telemetry.d.ts +2 -0
  44. package/dist/utils/telemetry.js +81 -8
  45. package/package.json +2 -1
  46. package/schemas/cloud-verifier.v1.json +69 -3
  47. package/schemas/{pr.v2.json → pr.v3.json} +3 -12
  48. package/dist/commands/traces.d.ts +0 -48
  49. package/dist/commands/traces.js +0 -92
  50. package/dist/triage/traces.d.ts +0 -20
  51. package/dist/triage/traces.js +0 -311
  52. package/schemas/traces.v1.json +0 -53
@@ -18,6 +18,10 @@ var __haystackWebAtlasModuleApi = (function installHaystackWebAtlas(host) {
18
18
  } catch (_) { return null; }
19
19
 
20
20
  var MAX_EVENTS = 128;
21
+ var MAX_RUNTIME_SITE_MAPPINGS = 256;
22
+ var MAX_ACTION_SEGMENTS_PER_PAGE = 256;
23
+ var MAX_ACTION_SEGMENT_BYTES_PER_PAGE = 1024 * 1024;
24
+ var MAX_FALLBACK_DELIVERIES_IN_FLIGHT = 2;
21
25
  var TRACE_HEADER = 'x-haystack-trace-id';
22
26
  var ACTION_HEADER = 'x-haystack-action-id';
23
27
  var COHORT_HEADER = 'x-haystack-cohort';
@@ -25,7 +29,13 @@ var __haystackWebAtlasModuleApi = (function installHaystackWebAtlas(host) {
25
29
  var REQUEST_SITE_HEADER = 'x-haystack-request-site-id';
26
30
  var nativeFunctionToString = Function.prototype.toString;
27
31
  var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
32
+ var nativeGetOwnPropertyDescriptors = Object.getOwnPropertyDescriptors;
28
33
  var nativeGetPrototypeOf = Object.getPrototypeOf;
34
+ var nativeObjectCreate = Object.create;
35
+ var nativeDefineProperties = Object.defineProperties;
36
+ var nativeDefineProperty = Object.defineProperty;
37
+ var nativeObjectPrototype = Object.prototype;
38
+ var nativeObjectKeys = Object.keys;
29
39
  var nativeHasOwnProperty = Object.prototype.hasOwnProperty;
30
40
  var nativeReflectApply = Reflect.apply.bind(Reflect);
31
41
  var nativeReflectConstruct = Reflect.construct.bind(Reflect);
@@ -78,7 +88,13 @@ var __haystackWebAtlasModuleApi = (function installHaystackWebAtlas(host) {
78
88
  var pagehideInstalled = false;
79
89
  var nativeArrayIsArray = Array.isArray;
80
90
  var active = null;
91
+ var directProbeContext = null;
92
+ var overlapQuarantine = false;
81
93
  var recorderDisabled = false;
94
+ var actionSegmentsAttempted = 0;
95
+ var actionSegmentBytesAttempted = 0;
96
+ var fallbackDeliveriesInFlight = 0;
97
+ var fallbackDeliveryUnavailable = false;
82
98
  var runtimeActions = Object.create(null);
83
99
  var runtimeSites = Object.create(null);
84
100
  var assignedCohort = null;
@@ -101,6 +117,34 @@ var __haystackWebAtlasModuleApi = (function installHaystackWebAtlas(host) {
101
117
  // in successful records; recorder failures must never affect the app.
102
118
  }
103
119
 
120
+ function omit(context) {
121
+ if (!context || context.saturated) return;
122
+ context.omittedEvents++;
123
+ // Omission accounting is telemetry work too. Once its bounded budget is
124
+ // exhausted, all later probes in this action become lossy pass-throughs.
125
+ if (context.omittedEvents >= MAX_EVENTS) context.saturated = true;
126
+ }
127
+
128
+ function saturate(context) {
129
+ if (!context || context.saturated) return;
130
+ omit(context);
131
+ context.saturated = true;
132
+ }
133
+
134
+ function admitProbe(context) {
135
+ if (!context || context.saturated) return false;
136
+ if (!overlapQuarantine || directProbeContext === context) return true;
137
+ // JavaScript does not expose a portable async-context owner. After one
138
+ // genuine overlap, a token-only late probe could belong to either root.
139
+ // Keep exact action boundaries and captured continuations, but disclose at
140
+ // most one omitted ambiguous probe per later action instead of guessing.
141
+ if (!context.quarantineProbeOmitted) {
142
+ context.quarantineProbeOmitted = true;
143
+ omit(context);
144
+ }
145
+ return false;
146
+ }
147
+
104
148
  function ownDataValue(name) {
105
149
  return safeHostData(name);
106
150
  }
@@ -176,6 +220,21 @@ var __haystackWebAtlasModuleApi = (function installHaystackWebAtlas(host) {
176
220
  return null;
177
221
  }
178
222
 
223
+ function safeContractPrototypeMethod(receiver, name) {
224
+ try {
225
+ var cursor = nativeGetPrototypeOf(receiver);
226
+ for (var depth = 0; cursor && depth < 12; depth++) {
227
+ var descriptor = nativeGetOwnPropertyDescriptor(cursor, name);
228
+ if (descriptor) {
229
+ return nativeReflectApply(nativeHasOwnProperty, descriptor, ['value']) &&
230
+ typeof descriptor.value === 'function' ? descriptor.value : null;
231
+ }
232
+ cursor = nativeGetPrototypeOf(cursor);
233
+ }
234
+ } catch (_) { return null; }
235
+ return null;
236
+ }
237
+
179
238
  function acquirePlatformCapabilities() {
180
239
  if (platformCapabilitiesAcquired) return;
181
240
  platformCapabilitiesAcquired = true;
@@ -352,7 +411,8 @@ var __haystackWebAtlasModuleApi = (function installHaystackWebAtlas(host) {
352
411
  var conditionPairs = config[5];
353
412
  var fetchPairs = config[6];
354
413
  if (!nativeArrayIsArray(conditionPairs) || !nativeArrayIsArray(fetchPairs) ||
355
- conditionPairs.length > MAX_EVENTS || fetchPairs.length > MAX_EVENTS) return false;
414
+ conditionPairs.length > MAX_RUNTIME_SITE_MAPPINGS ||
415
+ fetchPairs.length > MAX_RUNTIME_SITE_MAPPINGS) return false;
356
416
  for (var compactConditionIndex = 0; compactConditionIndex < conditionPairs.length; compactConditionIndex++) {
357
417
  var conditionPair = conditionPairs[compactConditionIndex];
358
418
  if (!nativeArrayIsArray(conditionPair) || conditionPair.length !== 2 ||
@@ -364,6 +424,7 @@ var __haystackWebAtlasModuleApi = (function installHaystackWebAtlas(host) {
364
424
  var fetchPair = fetchPairs[compactFetchIndex];
365
425
  if (!nativeArrayIsArray(fetchPair) || fetchPair.length !== 3 ||
366
426
  typeof fetchPair[0] !== 'string' || !/^f-[0-9a-f]{16}$/.test(fetchPair[0]) ||
427
+ (fetchPair[2] !== null && (typeof fetchPair[2] !== 'string' || !/^site-[0-9a-f]{24}$/.test(fetchPair[2]))) ||
367
428
  compactFetches[fetchPair[0]] !== undefined) return false;
368
429
  compactFetches[fetchPair[0]] = { requestSiteId: fetchPair[1], responseSiteId: fetchPair[2] };
369
430
  }
@@ -393,7 +454,7 @@ var __haystackWebAtlasModuleApi = (function installHaystackWebAtlas(host) {
393
454
  var fetchSites = config.fetchSites[fetchTokens[fetchIndex]];
394
455
  if (!fetchSites) return false;
395
456
  pendingSites.push([fetchSites.requestSiteId, 'request']);
396
- pendingSites.push([fetchSites.responseSiteId, 'response']);
457
+ if (fetchSites.responseSiteId !== null) pendingSites.push([fetchSites.responseSiteId, 'response']);
397
458
  }
398
459
  var preparedSites = [];
399
460
  var preparedIds = Object.create(null);
@@ -433,16 +494,25 @@ var __haystackWebAtlasModuleApi = (function installHaystackWebAtlas(host) {
433
494
 
434
495
  function emit(siteId, kind, outcome, parentEventId) {
435
496
  try {
436
- if (!active) return null;
497
+ if (!active || active.saturated) return null;
498
+ if (kind === 'condition' && active.conditionEvents >= active.conditionEventLimit) {
499
+ if (!active.conditionBudgetOmitted) {
500
+ active.conditionBudgetOmitted = true;
501
+ omit(active);
502
+ }
503
+ return null;
504
+ }
437
505
  var site = siteFor(siteId);
438
506
  if (!site || site.actionId !== active.actionId || site.surface !== 'browser' ||
439
507
  site.kind !== kind || !Array.isArray(site.allowedOutcomes) ||
440
508
  site.allowedOutcomes.indexOf(outcome) === -1 || !trustedOutcome(outcome)) {
441
- active.omittedEvents++;
509
+ omit(active);
442
510
  return null;
443
511
  }
444
512
  if (active.events.length >= MAX_EVENTS) {
445
- active.omittedEvents++;
513
+ // The event buffer is the observation budget. Do not repeatedly
514
+ // validate and count the unobserved tail of a hot customer loop.
515
+ saturate(active);
446
516
  return null;
447
517
  }
448
518
  var eventId = 'browser-' + active.traceId + '-' + String(active.events.length + 1).padStart(4, '0');
@@ -455,6 +525,7 @@ var __haystackWebAtlasModuleApi = (function installHaystackWebAtlas(host) {
455
525
  ordinal: active.events.length + 1,
456
526
  };
457
527
  active.events.push(event);
528
+ if (kind === 'condition') active.conditionEvents++;
458
529
  active.parentEventId = eventId;
459
530
  return eventId;
460
531
  } catch (_) {
@@ -504,11 +575,13 @@ var __haystackWebAtlasModuleApi = (function installHaystackWebAtlas(host) {
504
575
  if (!applicationFetch) throw new TypeError('fetch is not available');
505
576
  var context = active;
506
577
  if (!context) return invokeApplicationFetch(applicationFetch, input, init, hasInit);
578
+ if (!admitProbe(context)) return invokeApplicationFetch(applicationFetch, input, init, hasInit);
579
+ if (context.saturated) return invokeApplicationFetch(applicationFetch, input, init, hasInit);
507
580
  // Adding correlation headers necessarily converts a string into Request.
508
581
  // That is invisible to the platform fetch but observable to an application
509
582
  // wrapper. Never alter a later-installed/customer fetch wrapper.
510
583
  if (!platformFetchCorrelationAllowed() || !initialFetchLooksNative || fetchImplementation !== nativeFetchFunction) {
511
- context.omittedEvents++;
584
+ omit(context);
512
585
  return invokeApplicationFetch(applicationFetch, input, init, hasInit);
513
586
  }
514
587
  var fetchInput = input;
@@ -523,18 +596,18 @@ var __haystackWebAtlasModuleApi = (function installHaystackWebAtlas(host) {
523
596
  // and disclose the missing continuation instead. Objects include Request
524
597
  // and URL here: avoiding `instanceof` also avoids Proxy prototype traps.
525
598
  if (typeof input !== 'string') {
526
- context.omittedEvents++;
599
+ omit(context);
527
600
  return invokeApplicationFetch(applicationFetch, input, init, hasInit);
528
601
  }
529
602
  if (!nativeLocationHref || !nativeLocationOrigin || !nativeUrlConstructor ||
530
603
  !nativeUrlCanParse || !nativeRequestConstructor || !nativeHeadersConstructor || !nativeUrlHrefGetter ||
531
604
  !nativeRequestHeadersGetter || !nativeHeadersHas || !nativeHeadersGet || !nativeHeadersSet ||
532
605
  !nativeResponseHeadersGetter || !nativeResponseOkGetter || !nativePromiseReject) {
533
- context.omittedEvents++;
606
+ omit(context);
534
607
  return invokeApplicationFetch(applicationFetch, input, init, hasInit);
535
608
  }
536
609
  if (!nativeReflectApply(nativeUrlCanParse, nativeUrlConstructor, [input, nativeLocationHref])) {
537
- context.omittedEvents++;
610
+ omit(context);
538
611
  return invokeApplicationFetch(applicationFetch, input, init, hasInit);
539
612
  }
540
613
  var urlValue = nativeReflectConstruct(nativeUrlConstructor, [input, nativeLocationHref]);
@@ -559,7 +632,7 @@ var __haystackWebAtlasModuleApi = (function installHaystackWebAtlas(host) {
559
632
  // Existing application/distributed-tracing headers win. The already
560
633
  // constructed native Request preserves their exact platform
561
634
  // semantics without evaluating the original init twice.
562
- context.omittedEvents++;
635
+ omit(context);
563
636
  fetchInput = request;
564
637
  fetchInit = undefined;
565
638
  } else {
@@ -583,7 +656,7 @@ var __haystackWebAtlasModuleApi = (function installHaystackWebAtlas(host) {
583
656
  }
584
657
  } catch (error) {
585
658
  failOpen();
586
- context.omittedEvents++;
659
+ omit(context);
587
660
  if (normalizedRequest) {
588
661
  // Request conversion already completed. A later telemetry-only failure
589
662
  // must still perform the application fetch exactly once.
@@ -601,7 +674,7 @@ var __haystackWebAtlasModuleApi = (function installHaystackWebAtlas(host) {
601
674
  if (!requestParent) return result;
602
675
  if (!nativePromiseThen || result === null ||
603
676
  (typeof result !== 'object' && typeof result !== 'function')) {
604
- context.omittedEvents++;
677
+ omit(context);
605
678
  scheduleFinish(context);
606
679
  return result;
607
680
  }
@@ -610,6 +683,10 @@ var __haystackWebAtlasModuleApi = (function installHaystackWebAtlas(host) {
610
683
  nativeReflectApply(nativePromiseThen, result, [function (response) {
611
684
  context.pendingFetches--;
612
685
  if (context === active) {
686
+ if (context.saturated) {
687
+ scheduleFinish(context);
688
+ return;
689
+ }
613
690
  try {
614
691
  var responseHeaders = nativeReflectApply(nativeResponseHeadersGetter, response, []);
615
692
  var serverParent = nativeReflectApply(nativeHeadersHas, responseHeaders, [PARENT_EVENT_HEADER])
@@ -617,7 +694,7 @@ var __haystackWebAtlasModuleApi = (function installHaystackWebAtlas(host) {
617
694
  : null;
618
695
  var safeServerParent = safeNodeResponseId(context.traceId, requestParent, serverParent);
619
696
  if (serverParent !== null && safeServerParent === null) {
620
- context.omittedEvents++;
697
+ omit(context);
621
698
  serverParent = null;
622
699
  } else {
623
700
  serverParent = safeServerParent;
@@ -629,7 +706,7 @@ var __haystackWebAtlasModuleApi = (function installHaystackWebAtlas(host) {
629
706
  serverParent || requestParent,
630
707
  );
631
708
  } catch (_) {
632
- context.omittedEvents++;
709
+ omit(context);
633
710
  failOpen();
634
711
  }
635
712
  scheduleFinish(context);
@@ -647,7 +724,7 @@ var __haystackWebAtlasModuleApi = (function installHaystackWebAtlas(host) {
647
724
  }]);
648
725
  } catch (_) {
649
726
  context.pendingFetches--;
650
- context.omittedEvents++;
727
+ omit(context);
651
728
  scheduleFinish(context);
652
729
  failOpen();
653
730
  }
@@ -656,45 +733,518 @@ var __haystackWebAtlasModuleApi = (function installHaystackWebAtlas(host) {
656
733
  return result;
657
734
  }
658
735
 
736
+ function axiosOmission(state) {
737
+ if (!state.omissionRecorded) {
738
+ state.omissionRecorded = true;
739
+ omit(state.context);
740
+ }
741
+ }
742
+
743
+ function cloneAxiosConfig(config) {
744
+ if (config === undefined || config === null) return {};
745
+ if (typeof config !== 'object' || nativeArrayIsArray(config)) return null;
746
+ if (nativeGetPrototypeOf(config) !== nativeObjectPrototype) return null;
747
+ var clone = {};
748
+ var keys = nativeObjectKeys(config);
749
+ for (var index = 0; index < keys.length; index++) {
750
+ var key = keys[index];
751
+ var descriptor = nativeGetOwnPropertyDescriptor(config, key);
752
+ if (!descriptor || !nativeReflectApply(nativeHasOwnProperty, descriptor, ['value'])) return null;
753
+ Object.defineProperty(clone, key, {
754
+ configurable: true, enumerable: true, writable: true, value: descriptor.value,
755
+ });
756
+ }
757
+ return clone;
758
+ }
759
+
760
+ function axiosTransformList(owner, config) {
761
+ var descriptor = nativeGetOwnPropertyDescriptor(config, 'transformRequest');
762
+ var configured;
763
+ if (descriptor) {
764
+ if (!nativeReflectApply(nativeHasOwnProperty, descriptor, ['value'])) return null;
765
+ configured = descriptor.value;
766
+ } else {
767
+ var defaultsDescriptor = owner && nativeGetOwnPropertyDescriptor(owner, 'defaults');
768
+ if (!defaultsDescriptor || !nativeReflectApply(nativeHasOwnProperty, defaultsDescriptor, ['value']) ||
769
+ !defaultsDescriptor.value) return null;
770
+ var transformDescriptor = nativeGetOwnPropertyDescriptor(defaultsDescriptor.value, 'transformRequest');
771
+ if (!transformDescriptor || !nativeReflectApply(nativeHasOwnProperty, transformDescriptor, ['value'])) return null;
772
+ configured = transformDescriptor.value;
773
+ }
774
+ if (typeof configured === 'function') return [configured];
775
+ if (nativeArrayIsArray(configured)) {
776
+ var copy = [];
777
+ for (var index = 0; index < configured.length; index++) {
778
+ if (typeof configured[index] !== 'function') return null;
779
+ copy[index] = configured[index];
780
+ }
781
+ return copy;
782
+ }
783
+ if (configured === undefined || configured === null) return [];
784
+ return null;
785
+ }
786
+
787
+ function axiosResponseHeader(headers, name) {
788
+ if (!headers) return null;
789
+ var get = headers.get;
790
+ if (typeof get !== 'function') return null;
791
+ var value = nativeReflectApply(get, headers, [name]);
792
+ return typeof value === 'string' ? value : null;
793
+ }
794
+
795
+ function observeAxiosResult(result, state) {
796
+ if (!nativePromiseThen || result === null ||
797
+ (typeof result !== 'object' && typeof result !== 'function')) {
798
+ axiosOmission(state);
799
+ scheduleFinish(state.context);
800
+ return result;
801
+ }
802
+ state.context.pendingFetches++;
803
+ try {
804
+ nativeReflectApply(nativePromiseThen, result, [function (response) {
805
+ state.context.pendingFetches--;
806
+ if (state.context === active) {
807
+ if (state.context.saturated) {
808
+ scheduleFinish(state.context);
809
+ return;
810
+ }
811
+ var requestParent = state.requestParents.length > 0
812
+ ? state.requestParents[state.requestParents.length - 1]
813
+ : null;
814
+ if (!requestParent) {
815
+ axiosOmission(state);
816
+ } else {
817
+ try {
818
+ var serverParentValue = axiosResponseHeader(response && response.headers, PARENT_EVENT_HEADER);
819
+ var serverParent = safeNodeResponseId(state.context.traceId, requestParent, serverParentValue);
820
+ if (serverParentValue !== null && serverParent === null) axiosOmission(state);
821
+ var status = response && response.status;
822
+ emit(
823
+ state.sites.responseSiteId,
824
+ 'response',
825
+ typeof status === 'number' && status >= 200 && status < 300 ? 'success' : 'error',
826
+ serverParent || requestParent,
827
+ );
828
+ } catch (_) { axiosOmission(state); failOpen(); }
829
+ }
830
+ scheduleFinish(state.context);
831
+ }
832
+ }, function (error) {
833
+ state.context.pendingFetches--;
834
+ if (state.context === active) {
835
+ var requestParent = state.requestParents.length > 0
836
+ ? state.requestParents[state.requestParents.length - 1]
837
+ : null;
838
+ if (!requestParent) {
839
+ axiosOmission(state);
840
+ } else {
841
+ try {
842
+ var response = error && error.response;
843
+ var serverParentValue = response
844
+ ? axiosResponseHeader(response.headers, PARENT_EVENT_HEADER)
845
+ : null;
846
+ var serverParent = response
847
+ ? safeNodeResponseId(state.context.traceId, requestParent, serverParentValue)
848
+ : null;
849
+ if (serverParentValue !== null && serverParent === null) axiosOmission(state);
850
+ emit(
851
+ state.sites.responseSiteId,
852
+ 'response',
853
+ response ? 'error' : 'network:error',
854
+ serverParent || requestParent,
855
+ );
856
+ } catch (_) { axiosOmission(state); failOpen(); }
857
+ }
858
+ scheduleFinish(state.context);
859
+ }
860
+ throw error;
861
+ }]);
862
+ } catch (_) {
863
+ state.context.pendingFetches--;
864
+ axiosOmission(state);
865
+ scheduleFinish(state.context);
866
+ failOpen();
867
+ }
868
+ return result;
869
+ }
870
+
871
+ function axiosAt(token, owner, callable, receiver, configIndex, safeConfig, applicationArguments) {
872
+ if (!nativeArrayIsArray(applicationArguments) || typeof callable !== 'function') {
873
+ return nativeReflectApply(callable, receiver, applicationArguments);
874
+ }
875
+ var context = active;
876
+ if (context && context.saturated) return nativeReflectApply(callable, receiver, applicationArguments);
877
+ if (context && !admitProbe(context)) return nativeReflectApply(callable, receiver, applicationArguments);
878
+ var sites = context && context.runtimeConfig && context.runtimeConfig.fetchSites[token];
879
+ if (!context || !sites) return nativeReflectApply(callable, receiver, applicationArguments);
880
+ if (safeConfig !== true || !Number.isInteger(configIndex) || configIndex < 0 || configIndex > 8 ||
881
+ !platformFetchCorrelationAllowed()) {
882
+ omit(context);
883
+ return nativeReflectApply(callable, receiver, applicationArguments);
884
+ }
885
+ var state = { context: context, sites: sites, requestParents: [], omissionRecorded: false };
886
+ var args = [];
887
+ var config;
888
+ try {
889
+ for (var argumentIndex = 0; argumentIndex < applicationArguments.length; argumentIndex++) {
890
+ args[argumentIndex] = applicationArguments[argumentIndex];
891
+ }
892
+ config = cloneAxiosConfig(args[configIndex]);
893
+ var transforms = config && axiosTransformList(owner, config);
894
+ if (!config || !transforms) {
895
+ axiosOmission(state);
896
+ return nativeReflectApply(callable, receiver, applicationArguments);
897
+ }
898
+ transforms.push(function haystackAxiosRequestTransform(data, headers) {
899
+ if (context !== active) return data;
900
+ if (context.saturated) return data;
901
+ try {
902
+ var requestConfig = this;
903
+ var requestUrl = requestConfig && requestConfig.url;
904
+ var baseUrl = requestConfig && requestConfig.baseURL;
905
+ if (typeof requestUrl !== 'string' || (baseUrl !== undefined && baseUrl !== null && typeof baseUrl !== 'string') ||
906
+ !nativeLocationHref || !nativeLocationOrigin || !nativeUrlConstructor || !nativeUrlHrefGetter ||
907
+ !headers || typeof headers.has !== 'function' || typeof headers.set !== 'function') {
908
+ axiosOmission(state);
909
+ return data;
910
+ }
911
+ var resolvedBase = baseUrl
912
+ ? nativeReflectApply(nativeUrlHrefGetter, nativeReflectConstruct(nativeUrlConstructor, [baseUrl, nativeLocationHref]), [])
913
+ : nativeLocationHref;
914
+ var resolvedUrl = nativeReflectApply(
915
+ nativeUrlHrefGetter,
916
+ nativeReflectConstruct(nativeUrlConstructor, [requestUrl, resolvedBase]),
917
+ [],
918
+ );
919
+ if (resolvedUrl !== nativeLocationOrigin && resolvedUrl.indexOf(nativeLocationOrigin + '/') !== 0) {
920
+ axiosOmission(state);
921
+ return data;
922
+ }
923
+ var reservedHeaders = [TRACE_HEADER, ACTION_HEADER, COHORT_HEADER, PARENT_EVENT_HEADER, REQUEST_SITE_HEADER, 'traceparent'];
924
+ for (var headerIndex = 0; headerIndex < reservedHeaders.length; headerIndex++) {
925
+ if (nativeReflectApply(headers.has, headers, [reservedHeaders[headerIndex]])) {
926
+ axiosOmission(state);
927
+ return data;
928
+ }
929
+ }
930
+ var requestParent = emit(sites.requestSiteId, 'request', 'sent', context.inputEventId || undefined);
931
+ if (!requestParent) {
932
+ axiosOmission(state);
933
+ return data;
934
+ }
935
+ nativeReflectApply(headers.set, headers, [TRACE_HEADER, context.traceId]);
936
+ nativeReflectApply(headers.set, headers, [ACTION_HEADER, context.actionId]);
937
+ nativeReflectApply(headers.set, headers, [COHORT_HEADER, '' + context.cohortIndex]);
938
+ nativeReflectApply(headers.set, headers, [PARENT_EVENT_HEADER, requestParent]);
939
+ nativeReflectApply(headers.set, headers, [REQUEST_SITE_HEADER, sites.requestSiteId]);
940
+ nativeReflectApply(headers.set, headers, ['traceparent', traceparent(context.traceId)]);
941
+ state.requestParents.push(requestParent);
942
+ } catch (_) { axiosOmission(state); failOpen(); }
943
+ return data;
944
+ });
945
+ config.transformRequest = transforms;
946
+ while (args.length < configIndex) args.push(undefined);
947
+ args[configIndex] = config;
948
+ } catch (_) {
949
+ axiosOmission(state);
950
+ return nativeReflectApply(callable, receiver, applicationArguments);
951
+ }
952
+ var result = nativeReflectApply(callable, receiver, args);
953
+ return observeAxiosResult(result, state);
954
+ }
955
+
956
+ function oazapftsAt(token, owner, callable, safeOptions, applicationArguments) {
957
+ if (!nativeArrayIsArray(applicationArguments) || typeof callable !== 'function') {
958
+ return nativeReflectApply(callable, owner, applicationArguments);
959
+ }
960
+ var context = active;
961
+ if (context && context.saturated) return nativeReflectApply(callable, owner, applicationArguments);
962
+ if (context && !admitProbe(context)) return nativeReflectApply(callable, owner, applicationArguments);
963
+ var sites = context && context.runtimeConfig && context.runtimeConfig.fetchSites[token];
964
+ if (!context || !sites) return nativeReflectApply(callable, owner, applicationArguments);
965
+ if (safeOptions !== true || !platformFetchCorrelationAllowed() || !nativeFetchFunction) {
966
+ omit(context);
967
+ return nativeReflectApply(callable, owner, applicationArguments);
968
+ }
969
+ var args = [];
970
+ try {
971
+ for (var argumentIndex = 0; argumentIndex < applicationArguments.length; argumentIndex++) {
972
+ args[argumentIndex] = applicationArguments[argumentIndex];
973
+ }
974
+ var options = cloneAxiosConfig(args[1]);
975
+ if (!options || nativeGetOwnPropertyDescriptor(options, 'fetch')) {
976
+ omit(context);
977
+ return nativeReflectApply(callable, owner, applicationArguments);
978
+ }
979
+ Object.defineProperty(options, 'fetch', {
980
+ configurable: true,
981
+ enumerable: true,
982
+ writable: true,
983
+ value: function haystackOazapftsFetch(input, init) {
984
+ if (arguments.length > 2) {
985
+ omit(context);
986
+ return nativeReflectApply(nativeFetchFunction, undefined, arguments);
987
+ }
988
+ if (context !== active) {
989
+ return invokeApplicationFetch(nativeFetchFunction, input, init, arguments.length >= 2);
990
+ }
991
+ return correlatedFetch(
992
+ nativeFetchFunction,
993
+ input,
994
+ init,
995
+ sites,
996
+ arguments.length >= 2,
997
+ );
998
+ },
999
+ });
1000
+ while (args.length < 1) args.push(undefined);
1001
+ args[1] = options;
1002
+ } catch (_) {
1003
+ omit(context);
1004
+ return nativeReflectApply(callable, owner, applicationArguments);
1005
+ }
1006
+ return nativeReflectApply(callable, owner, args);
1007
+ }
1008
+
659
1009
  function fetchAt(token, fetchImplementation, input, init) {
660
1010
  if (arguments.length > 4) {
661
1011
  var passthroughArguments = [];
662
1012
  for (var argumentIndex = 2; argumentIndex < arguments.length; argumentIndex++) {
663
1013
  passthroughArguments[argumentIndex - 2] = arguments[argumentIndex];
664
1014
  }
665
- if (active) active.omittedEvents++;
1015
+ if (active) omit(active);
666
1016
  return nativeReflectApply(fetchImplementation, undefined, passthroughArguments);
667
1017
  }
668
1018
  var hasInit = arguments.length >= 4;
669
1019
  var context = active;
1020
+ if (context && context.saturated) {
1021
+ return invokeApplicationFetch(fetchImplementation, input, init, hasInit);
1022
+ }
1023
+ if (context && !admitProbe(context)) {
1024
+ return invokeApplicationFetch(fetchImplementation, input, init, hasInit);
1025
+ }
670
1026
  var sites = context && context.runtimeConfig && context.runtimeConfig.fetchSites[token];
671
1027
  if (context && !sites) return invokeApplicationFetch(fetchImplementation, input, init, hasInit);
672
1028
  return correlatedFetch(fetchImplementation, input, init, sites, hasInit);
673
1029
  }
674
1030
 
1031
+ function mergeAngularHttpContractOptions(options, headerPairs) {
1032
+ try {
1033
+ if (!options || typeof options !== 'object' || nativeGetPrototypeOf(options) !== nativeObjectPrototype ||
1034
+ typeof nativeGetOwnPropertyDescriptors !== 'function' || typeof nativeObjectCreate !== 'function' ||
1035
+ typeof nativeDefineProperties !== 'function' || typeof nativeDefineProperty !== 'function') return null;
1036
+ var descriptors = nativeGetOwnPropertyDescriptors(options);
1037
+ var headersDescriptor = descriptors && descriptors.headers;
1038
+ if (!headersDescriptor || !nativeReflectApply(nativeHasOwnProperty, headersDescriptor, ['value']) ||
1039
+ !headersDescriptor.value || typeof headersDescriptor.value !== 'object') return null;
1040
+ var headers = headersDescriptor.value;
1041
+ var has = safeContractPrototypeMethod(headers, 'has');
1042
+ var set = safeContractPrototypeMethod(headers, 'set');
1043
+ if (!has || !set) return null;
1044
+ for (var checkIndex = 0; checkIndex < headerPairs.length; checkIndex++) {
1045
+ var present = nativeReflectApply(has, headers, [headerPairs[checkIndex][0]]);
1046
+ if (present !== false) return null;
1047
+ }
1048
+ var nextHeaders = headers;
1049
+ var headersPrototype = nativeGetPrototypeOf(headers);
1050
+ for (var setIndex = 0; setIndex < headerPairs.length; setIndex++) {
1051
+ nextHeaders = nativeReflectApply(set, nextHeaders, headerPairs[setIndex]);
1052
+ if (!nextHeaders || typeof nextHeaders !== 'object' ||
1053
+ nativeGetPrototypeOf(nextHeaders) !== headersPrototype) return null;
1054
+ }
1055
+ var clone = nativeObjectCreate(nativeObjectPrototype);
1056
+ nativeDefineProperties(clone, descriptors);
1057
+ nativeDefineProperty(clone, 'headers', {
1058
+ configurable: headersDescriptor.configurable,
1059
+ enumerable: headersDescriptor.enumerable,
1060
+ writable: headersDescriptor.writable,
1061
+ value: nextHeaders,
1062
+ });
1063
+ return clone;
1064
+ } catch (_) { return null; }
1065
+ }
1066
+
1067
+ // Angular HttpClient returns a cold Observable. Observing that Observable
1068
+ // would either subscribe twice or replace the application value. Instead,
1069
+ // the compiler-authenticated call site adds the exact correlation headers
1070
+ // before Angular constructs the request. Existing options are admitted only
1071
+ // for a build-declared source/export contract and are copied without reading
1072
+ // application fields. The correlated Node continuation is the terminal HTTP
1073
+ // outcome for this transport, so no browser response is fabricated.
1074
+ function angularHttpAt(token, callable, receiver, method, applicationArguments, optionsAdapter) {
1075
+ if (!nativeArrayIsArray(applicationArguments) || typeof callable !== 'function') {
1076
+ return nativeReflectApply(callable, receiver, applicationArguments);
1077
+ }
1078
+ var context = active;
1079
+ if (context && context.saturated) return nativeReflectApply(callable, receiver, applicationArguments);
1080
+ if (context && !admitProbe(context)) return nativeReflectApply(callable, receiver, applicationArguments);
1081
+ var sites = context && context.runtimeConfig && context.runtimeConfig.fetchSites[token];
1082
+ if (!context || !sites) return nativeReflectApply(callable, receiver, applicationArguments);
1083
+ var optionsIndex = method === 'delete' || method === 'get' || method === 'head' || method === 'options'
1084
+ ? 1
1085
+ : method === 'patch' || method === 'post' || method === 'put'
1086
+ ? 2
1087
+ : -1;
1088
+ var hasOptions = applicationArguments.length > optionsIndex;
1089
+ if (optionsIndex < 0 || !platformFetchCorrelationAllowed() ||
1090
+ (hasOptions && optionsAdapter !== 'angular-http-headers-set-v1') ||
1091
+ (!hasOptions && optionsAdapter !== null) || applicationArguments.length > optionsIndex + 1 ||
1092
+ typeof applicationArguments[0] !== 'string' ||
1093
+ !nativeLocationHref || !nativeLocationOrigin || !nativeUrlConstructor || !nativeUrlHrefGetter) {
1094
+ omit(context);
1095
+ return nativeReflectApply(callable, receiver, applicationArguments);
1096
+ }
1097
+ var args = [];
1098
+ try {
1099
+ var url = nativeReflectApply(
1100
+ nativeUrlHrefGetter,
1101
+ nativeReflectConstruct(nativeUrlConstructor, [applicationArguments[0], nativeLocationHref]),
1102
+ [],
1103
+ );
1104
+ if (url !== nativeLocationOrigin && url.indexOf(nativeLocationOrigin + '/') !== 0) {
1105
+ omit(context);
1106
+ return nativeReflectApply(callable, receiver, applicationArguments);
1107
+ }
1108
+ if (context.events.length >= MAX_EVENTS) {
1109
+ saturate(context);
1110
+ return nativeReflectApply(callable, receiver, applicationArguments);
1111
+ }
1112
+ var requestParent = 'browser-' + context.traceId + '-' + String(context.events.length + 1).padStart(4, '0');
1113
+ var headerPairs = [
1114
+ ['x-haystack-trace-id', context.traceId],
1115
+ ['x-haystack-action-id', context.actionId],
1116
+ ['x-haystack-cohort', '' + context.cohortIndex],
1117
+ ['x-haystack-parent-event-id', requestParent],
1118
+ ['x-haystack-request-site-id', sites.requestSiteId],
1119
+ ['traceparent', traceparent(context.traceId)],
1120
+ ];
1121
+ for (var index = 0; index < applicationArguments.length; index++) args[index] = applicationArguments[index];
1122
+ if (hasOptions) {
1123
+ var merged = mergeAngularHttpContractOptions(applicationArguments[optionsIndex], headerPairs);
1124
+ if (!merged) {
1125
+ omit(context);
1126
+ return nativeReflectApply(callable, receiver, applicationArguments);
1127
+ }
1128
+ args[optionsIndex] = merged;
1129
+ } else {
1130
+ while (args.length < optionsIndex) args.push(undefined);
1131
+ args[optionsIndex] = { headers: {
1132
+ 'x-haystack-trace-id': context.traceId,
1133
+ 'x-haystack-action-id': context.actionId,
1134
+ 'x-haystack-cohort': '' + context.cohortIndex,
1135
+ 'x-haystack-parent-event-id': requestParent,
1136
+ 'x-haystack-request-site-id': sites.requestSiteId,
1137
+ 'traceparent': traceparent(context.traceId),
1138
+ } };
1139
+ }
1140
+ var emittedParent = emit(sites.requestSiteId, 'request', 'sent', context.inputEventId || undefined);
1141
+ if (emittedParent !== requestParent) {
1142
+ return nativeReflectApply(callable, receiver, applicationArguments);
1143
+ }
1144
+ } catch (_) {
1145
+ omit(context);
1146
+ failOpen();
1147
+ return nativeReflectApply(callable, receiver, applicationArguments);
1148
+ }
1149
+ return nativeReflectApply(callable, receiver, args);
1150
+ }
1151
+
675
1152
  function deliver(segment) {
676
1153
  try {
1154
+ if (recorderDisabled) return false;
677
1155
  var endpoint = configuredEndpoint || ownDataValue('__HAYSTACK_WEB_ATLAS_ENDPOINT__');
678
- if (typeof endpoint !== 'string' || endpoint.length === 0) return false;
1156
+ if (typeof endpoint !== 'string' || endpoint.length === 0) {
1157
+ recorderDisabled = true;
1158
+ return false;
1159
+ }
1160
+ if (actionSegmentsAttempted >= MAX_ACTION_SEGMENTS_PER_PAGE ||
1161
+ actionSegmentBytesAttempted >= MAX_ACTION_SEGMENT_BYTES_PER_PAGE) {
1162
+ recorderDisabled = true;
1163
+ return false;
1164
+ }
1165
+ actionSegmentsAttempted++;
679
1166
  var body = nativeStringify(segment);
680
- if (nativeBeacon && nativeBeacon(endpoint, body)) return true;
681
- if (nativeFetch && configuredPlatformFetch && initialFetchLooksNative) {
682
- var delivery = nativeFetch(endpoint, {
1167
+ if (body.length > MAX_ACTION_SEGMENT_BYTES_PER_PAGE - actionSegmentBytesAttempted) {
1168
+ recorderDisabled = true;
1169
+ return false;
1170
+ }
1171
+ actionSegmentBytesAttempted += body.length;
1172
+ if (actionSegmentsAttempted >= MAX_ACTION_SEGMENTS_PER_PAGE ||
1173
+ actionSegmentBytesAttempted >= MAX_ACTION_SEGMENT_BYTES_PER_PAGE) recorderDisabled = true;
1174
+ if (nativeBeacon) {
1175
+ try { if (nativeBeacon(endpoint, body)) return true; } catch (_) { failOpen(); }
1176
+ }
1177
+ if (!nativeFetch || !configuredPlatformFetch || !initialFetchLooksNative ||
1178
+ !nativePromiseThen || fallbackDeliveryUnavailable ||
1179
+ fallbackDeliveriesInFlight >= MAX_FALLBACK_DELIVERIES_IN_FLIGHT) {
1180
+ // Backpressure is a terminal page-local telemetry condition. Dropping
1181
+ // later evidence is safer than letting a collector outage accumulate
1182
+ // customer-page requests, closures, or serialized trace bodies.
1183
+ recorderDisabled = true;
1184
+ return false;
1185
+ }
1186
+ fallbackDeliveriesInFlight++;
1187
+ var settled = false;
1188
+ var settleFallback = function (failed) {
1189
+ if (settled) return;
1190
+ settled = true;
1191
+ fallbackDeliveriesInFlight--;
1192
+ if (failed) {
1193
+ fallbackDeliveryUnavailable = true;
1194
+ recorderDisabled = true;
1195
+ }
1196
+ };
1197
+ var delivery;
1198
+ try {
1199
+ delivery = nativeFetch(endpoint, {
683
1200
  method: 'POST',
684
1201
  body: body,
685
1202
  keepalive: true,
686
1203
  headers: { 'Content-Type': 'text/plain' },
687
1204
  });
688
- if (nativePromiseThen && delivery !== null &&
689
- (typeof delivery === 'object' || typeof delivery === 'function')) {
690
- try { nativeReflectApply(nativePromiseThen, delivery, [function () {}, failOpen]); } catch (_) { failOpen(); }
691
- }
692
- return true;
1205
+ } catch (_) {
1206
+ settleFallback(true);
1207
+ failOpen();
1208
+ return false;
1209
+ }
1210
+ if (delivery === null ||
1211
+ (typeof delivery !== 'object' && typeof delivery !== 'function')) {
1212
+ settleFallback(true);
1213
+ return false;
1214
+ }
1215
+ try {
1216
+ nativeReflectApply(nativePromiseThen, delivery, [
1217
+ function () { settleFallback(false); },
1218
+ function () { settleFallback(true); },
1219
+ ]);
1220
+ } catch (_) {
1221
+ settleFallback(true);
1222
+ failOpen();
1223
+ return false;
693
1224
  }
1225
+ return true;
694
1226
  } catch (_) { failOpen(); }
695
1227
  return false;
696
1228
  }
697
1229
 
1230
+ function conditionEventLimit(sites) {
1231
+ // Action start and input consume two fixed slots. Reserve the output slot
1232
+ // plus one request and (when declared) response for every static fetch
1233
+ // site that can fit inside the hard action ceiling. Conditions use the
1234
+ // remainder and disclose one bounded omission if they exhaust it, rather
1235
+ // than starving higher-value continuations in ordinary actions. If the
1236
+ // static continuations alone exceed the ceiling, conditions receive no
1237
+ // slots and the existing whole-buffer cutoff remains the final bound.
1238
+ var reserved = 1;
1239
+ var tokens = nativeObjectKeys(sites.fetchSites);
1240
+ for (var index = 0; index < tokens.length; index++) {
1241
+ var fetchSites = sites.fetchSites[tokens[index]];
1242
+ reserved += fetchSites && fetchSites.responseSiteId !== null ? 2 : 1;
1243
+ }
1244
+ var available = MAX_EVENTS - 2 - reserved;
1245
+ return available > 0 ? available : 0;
1246
+ }
1247
+
698
1248
  function beginAction(actionId, sites) {
699
1249
  try {
700
1250
  if (active || recorderDisabled) return false;
@@ -716,6 +1266,12 @@ var __haystackWebAtlasModuleApi = (function installHaystackWebAtlas(host) {
716
1266
  rootReturned: false,
717
1267
  finishScheduled: false,
718
1268
  runtimeConfig: sites,
1269
+ conditionOutcomeKeys: Object.create(null),
1270
+ conditionEvents: 0,
1271
+ conditionEventLimit: conditionEventLimit(sites),
1272
+ conditionBudgetOmitted: false,
1273
+ quarantineProbeOmitted: false,
1274
+ saturated: false,
719
1275
  };
720
1276
  emit(sites.actionSiteId, 'action-start', 'started', null);
721
1277
  return true;
@@ -732,13 +1288,24 @@ var __haystackWebAtlasModuleApi = (function installHaystackWebAtlas(host) {
732
1288
  var sites = runtimeActions[actionId];
733
1289
  if (!sites) return nativeReflectApply(handler, this, arguments);
734
1290
  if (active) {
735
- // A single global action cannot safely attribute probes from overlapping
736
- // async roots. Close the partial trace with an explicit omission and
737
- // stop recording this page rather than fabricate either action's path.
738
- active.omittedEvents++;
739
- recorderDisabled = true;
740
- endAction();
741
- return nativeReflectApply(handler, this, arguments);
1291
+ // A synchronous root can finish in the same task that starts the next
1292
+ // user action, before its zero-delay cleanup callback has run. It has
1293
+ // no outstanding application work, so close it now and attribute the
1294
+ // new action normally. This is common with input followed immediately
1295
+ // by submit (autofill, keyboard submission, and fast automation).
1296
+ if (active.rootReturned && active.pendingFetches === 0) {
1297
+ endAction();
1298
+ } else {
1299
+ // A single global action cannot safely attribute probes from
1300
+ // overlapping roots. Close the older partial trace with an explicit
1301
+ // omission, then let the exact newer action become the root. Stable
1302
+ // identities still validate captured continuations. Token-only async
1303
+ // probes cannot carry a portable root owner, so direct-probe mode
1304
+ // stays enabled after the first overlap rather than guessing.
1305
+ omit(active);
1306
+ overlapQuarantine = true;
1307
+ endAction();
1308
+ }
742
1309
  }
743
1310
  var started = beginAction(actionId, sites);
744
1311
  if (!started) return nativeReflectApply(handler, this, arguments);
@@ -746,12 +1313,16 @@ var __haystackWebAtlasModuleApi = (function installHaystackWebAtlas(host) {
746
1313
  var inputEventId = emit(sites.inputSiteId, 'input-shape', shapeOutcome(arguments.length > 0 ? arguments[0] : undefined));
747
1314
  if (context) context.inputEventId = inputEventId;
748
1315
  var result;
1316
+ var previousDirectProbeContext = directProbeContext;
1317
+ directProbeContext = context;
749
1318
  try {
750
1319
  result = nativeReflectApply(handler, this, arguments);
751
1320
  } catch (error) {
752
1321
  if (context) context.rootReturned = true;
753
- endAction();
1322
+ if (context === active) endAction();
754
1323
  throw error;
1324
+ } finally {
1325
+ directProbeContext = previousDirectProbeContext;
755
1326
  }
756
1327
 
757
1328
  // Keep a real Promise-returning action open across awaits. We attach a
@@ -763,7 +1334,9 @@ var __haystackWebAtlasModuleApi = (function installHaystackWebAtlas(host) {
763
1334
  try {
764
1335
  nativeReflectApply(nativePromiseThen, result, [function (value) {
765
1336
  if (context === active) {
766
- emit(sites.outputSiteId, 'output-shape', shapeOutcome(value), context.inputEventId || undefined);
1337
+ if (!context.saturated) {
1338
+ emit(sites.outputSiteId, 'output-shape', shapeOutcome(value), context.inputEventId || undefined);
1339
+ }
767
1340
  context.rootReturned = true;
768
1341
  scheduleFinish(context);
769
1342
  }
@@ -780,8 +1353,10 @@ var __haystackWebAtlasModuleApi = (function installHaystackWebAtlas(host) {
780
1353
  }
781
1354
  if (!observesPromise) {
782
1355
  if (context && !nativePromiseThen && result !== null &&
783
- (typeof result === 'object' || typeof result === 'function')) context.omittedEvents++;
784
- emit(sites.outputSiteId, 'output-shape', shapeOutcome(result), context && context.inputEventId || undefined);
1356
+ (typeof result === 'object' || typeof result === 'function')) omit(context);
1357
+ if (context === active && !context.saturated) {
1358
+ emit(sites.outputSiteId, 'output-shape', shapeOutcome(result), context && context.inputEventId || undefined);
1359
+ }
785
1360
  if (context) {
786
1361
  context.rootReturned = true;
787
1362
  scheduleFinish(context);
@@ -794,12 +1369,34 @@ var __haystackWebAtlasModuleApi = (function installHaystackWebAtlas(host) {
794
1369
  function conditionAt(token, value) {
795
1370
  try {
796
1371
  var context = active;
797
- var siteId = context && context.runtimeConfig && context.runtimeConfig.conditionSites[token];
1372
+ if (context && !admitProbe(context)) return value;
1373
+ var siteId = context && !context.saturated && context.runtimeConfig && context.runtimeConfig.conditionSites[token];
798
1374
  if (siteId) emit(siteId, 'condition', value ? 'boolean:true' : 'boolean:false', context.inputEventId || undefined);
799
1375
  } catch (_) { failOpen(); }
800
1376
  return value;
801
1377
  }
802
1378
 
1379
+ // Loop and coarse-entry probes can execute many times in one action. Keep
1380
+ // the first observation of each fixed boolean outcome so they cannot crowd
1381
+ // the action's request/response evidence out of the bounded event buffer.
1382
+ function conditionOnceAt(token, value) {
1383
+ try {
1384
+ var context = active;
1385
+ if (context && !admitProbe(context)) return value;
1386
+ var siteId = context && !context.saturated && context.runtimeConfig && context.runtimeConfig.conditionSites[token];
1387
+ if (siteId) {
1388
+ var outcome = value ? 'boolean:true' : 'boolean:false';
1389
+ var key = siteId + '\0' + outcome;
1390
+ var seen = context.conditionOutcomeKeys;
1391
+ if (seen[key] !== true) {
1392
+ seen[key] = true;
1393
+ emit(siteId, 'condition', outcome, context.inputEventId || undefined);
1394
+ }
1395
+ }
1396
+ } catch (_) { failOpen(); }
1397
+ return value;
1398
+ }
1399
+
803
1400
  function endAction() {
804
1401
  try {
805
1402
  if (!active) return null;
@@ -829,19 +1426,30 @@ var __haystackWebAtlasModuleApi = (function installHaystackWebAtlas(host) {
829
1426
  configure: configure,
830
1427
  registerAction: registerAction,
831
1428
  beginAction: beginAction,
832
- inputShape: function (siteId, outcome) { emit(siteId, 'input-shape', outcome); },
833
- condition: function (siteId, outcome) { emit(siteId, 'condition', outcome); },
1429
+ inputShape: function (siteId, outcome) { if (admitProbe(active)) emit(siteId, 'input-shape', outcome); },
1430
+ condition: function (siteId, outcome) { if (admitProbe(active)) emit(siteId, 'condition', outcome); },
834
1431
  fetch: correlatedFetch,
835
1432
  fetchAt: fetchAt,
1433
+ angularHttpAt: angularHttpAt,
1434
+ axiosAt: axiosAt,
1435
+ oazapftsAt: oazapftsAt,
836
1436
  wrapAction: wrapAction,
837
1437
  conditionAt: conditionAt,
838
- outputShape: function (siteId, outcome) { emit(siteId, 'output-shape', outcome); },
839
- uiOutcome: function (siteId, outcome) { emit(siteId, 'ui-outcome', outcome); },
840
- error: function (siteId, outcome) { emit(siteId, 'error', outcome); },
1438
+ conditionOnceAt: conditionOnceAt,
1439
+ outputShape: function (siteId, outcome) { if (admitProbe(active)) emit(siteId, 'output-shape', outcome); },
1440
+ uiOutcome: function (siteId, outcome) { if (admitProbe(active)) emit(siteId, 'ui-outcome', outcome); },
1441
+ error: function (siteId, outcome) { if (admitProbe(active)) emit(siteId, 'error', outcome); },
841
1442
  endAction: endAction,
842
1443
  status: function () {
843
1444
  return active
844
- ? { active: true, disabled: recorderDisabled, traceId: active.traceId }
1445
+ ? {
1446
+ active: true,
1447
+ disabled: recorderDisabled,
1448
+ saturated: active.saturated,
1449
+ events: active.events.length,
1450
+ omittedEvents: active.omittedEvents,
1451
+ traceId: active.traceId,
1452
+ }
845
1453
  : { active: false, disabled: recorderDisabled };
846
1454
  },
847
1455
  });