@armoriq/sdk-dev 0.8.6 → 0.8.7

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 (42) hide show
  1. package/dist/_version.d.ts +1 -1
  2. package/dist/_version.js +1 -1
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +3 -1
  6. package/dist/index.js.map +1 -1
  7. package/dist/observability/index.d.ts +4 -2
  8. package/dist/observability/index.d.ts.map +1 -1
  9. package/dist/observability/index.js.map +1 -1
  10. package/dist/observability/otel-runtime.d.ts +44 -3
  11. package/dist/observability/otel-runtime.d.ts.map +1 -1
  12. package/dist/observability/otel-runtime.js +190 -44
  13. package/dist/observability/otel-runtime.js.map +1 -1
  14. package/dist/observability/otel-session.d.ts +10 -3
  15. package/dist/observability/otel-session.d.ts.map +1 -1
  16. package/dist/observability/otel-session.js +13 -7
  17. package/dist/observability/otel-session.js.map +1 -1
  18. package/dist/observability/otel-shutdown.d.ts +1 -1
  19. package/dist/observability/otel-shutdown.d.ts.map +1 -1
  20. package/dist/observability/otel-shutdown.js +1 -13
  21. package/dist/observability/otel-shutdown.js.map +1 -1
  22. package/dist/observability/otel-span-spool.d.ts +55 -0
  23. package/dist/observability/otel-span-spool.d.ts.map +1 -0
  24. package/dist/observability/otel-span-spool.js +94 -0
  25. package/dist/observability/otel-span-spool.js.map +1 -0
  26. package/dist/observability/otel-spool-export.d.ts +64 -0
  27. package/dist/observability/otel-spool-export.d.ts.map +1 -0
  28. package/dist/observability/otel-spool-export.js +279 -0
  29. package/dist/observability/otel-spool-export.js.map +1 -0
  30. package/dist/observability/otlp-http-transport.d.ts +20 -0
  31. package/dist/observability/otlp-http-transport.d.ts.map +1 -0
  32. package/dist/observability/otlp-http-transport.js +141 -0
  33. package/dist/observability/otlp-http-transport.js.map +1 -0
  34. package/dist/observability/policy-lease.d.ts +25 -0
  35. package/dist/observability/policy-lease.d.ts.map +1 -1
  36. package/dist/observability/policy-lease.js +49 -0
  37. package/dist/observability/policy-lease.js.map +1 -1
  38. package/dist/session.d.ts +4 -3
  39. package/dist/session.d.ts.map +1 -1
  40. package/dist/session.js +5 -4
  41. package/dist/session.js.map +1 -1
  42. package/package.json +2 -2
@@ -8,5 +8,5 @@
8
8
  * Must match `version` in package.json and the locked version in
9
9
  * package-lock.json. tests/package_metadata.test.ts enforces they agree.
10
10
  */
11
- export declare const VERSION = "0.8.6";
11
+ export declare const VERSION = "0.8.7";
12
12
  //# sourceMappingURL=_version.d.ts.map
package/dist/_version.js CHANGED
@@ -11,5 +11,5 @@
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports.VERSION = void 0;
14
- exports.VERSION = '0.8.6';
14
+ exports.VERSION = '0.8.7';
15
15
  //# sourceMappingURL=_version.js.map
package/dist/index.d.ts CHANGED
@@ -18,7 +18,7 @@ export { ArmorIQException, InvalidTokenException, IntentMismatchException, MCPIn
18
18
  export { IntentToken, PlanCapture, MCPInvocation, MCPInvocationResult, DelegationRequest, DelegationResult, SDKConfig, MCPSemanticMetadata, ToolSemanticEntry, PolicyContext, InvokeOptions, HoldInfo, DelegationRequestParams, DelegationRequestResult, ApprovedDelegation, ToolCall, McpCredential, McpCredentialMap, } from './models';
19
19
  export { defaultToolNameParser, buildPlanFromToolCalls, hashToolCalls, ToolNameParser, PlanStep, BuiltPlan, } from './plan_builder';
20
20
  export { ArmorIQConfig, ArmorIQConfigError, IdentityConfig, ProxyConfig, MCPAuthConfig, MCPAuthType, MCPServerConfig, PolicyConfig, IntentConfig, Environment, loadArmorIQConfig, parseArmorIQConfig, resolveEnvReference, resolveEnvReferences, saveArmorIQConfig, DEFAULT_PROXY_URL, } from './config';
21
- export { computeCostUsd, MODEL_PRICES, ArmorIQTelemetryRuntime, OtelSession, resolveOtelConfig, type ObservabilityOptions, type ResolvedOtelConfig, type CaptureMode, type OtelExporterMode, type OtelProtocol, type AttributeContext, type SpanIds, type TelemetryRuntimeOptions, type TelemetryAttributes, type TelemetryAttributeValue, type PolicyLease, type OtelSessionOptions, type OtelSessionRoot, type OtelTerminalStatus, type SpanHandle, type PlanInput, type PolicyInput, type PolicyResult, type ToolResult, type RootInput, type ModelInput, type ModelOutput, type ContentReasonCode, type ContentCaptureAuthority, type TelemetryContent, type ProjectedTelemetryContent, projectTelemetryContent, METADATA_CONTENT_PLACEHOLDER, } from './observability';
21
+ export { computeCostUsd, MODEL_PRICES, ArmorIQTelemetryRuntime, OtelSession, resolveOtelConfig, type ObservabilityOptions, type ResolvedOtelConfig, type CaptureMode, type OtelExporterMode, type OtelProtocol, type AttributeContext, type SpanIds, type TelemetryRuntimeOptions, type PolicyLeaseRecord, type PolicyLeaseStore, type SpanSink, type SpooledExportResult, type SpooledSpan, type SpooledSpanBatch, parsePolicyLease, isLeaseCurrent, type TelemetryAttributes, type TelemetryAttributeValue, type PolicyLease, type OtelSessionCloseOptions, type OtelSessionOptions, type OtelSessionRoot, type OtelTerminalStatus, type SpanHandle, type PlanInput, type PolicyInput, type PolicyResult, type ToolResult, type RootInput, type ModelInput, type ModelOutput, type ContentReasonCode, type ContentCaptureAuthority, type TelemetryContent, type ProjectedTelemetryContent, projectTelemetryContent, METADATA_CONTENT_PLACEHOLDER, } from './observability';
22
22
  export { splitPrefixedToolName } from './tool_name';
23
23
  export { VERSION } from './_version';
24
24
  export declare const AUTHOR = "ArmorIQ Team";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC3D,OAAO,EACL,wBAAwB,EACxB,6BAA6B,EAC7B,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,KAAK,eAAe,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,cAAc,EACd,cAAc,EACd,WAAW,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AAW,EAChB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,yBAAyB,EAC9B,uBAAuB,EACvB,4BAA4B,GAC7B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,eAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,eAAO,MAAM,KAAK,uBAAuB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC3D,OAAO,EACL,wBAAwB,EACxB,6BAA6B,EAC7B,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,KAAK,eAAe,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,cAAc,EACd,cAAc,EACd,WAAW,EACX,aAAa,EACb,aAAa,GACd,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,WAAW,EACX,WAAW,EACX,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,SAAS,EACT,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,QAAQ,EACR,uBAAuB,EACvB,uBAAuB,EACvB,kBAAkB,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AE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,eAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,eAAO,MAAM,KAAK,uBAAuB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@
13
13
  * against package.json, so it only drifts.
14
14
  */
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.instrumentOpenAI = exports.EMAIL = exports.AUTHOR = exports.VERSION = exports.splitPrefixedToolName = exports.METADATA_CONTENT_PLACEHOLDER = exports.projectTelemetryContent = exports.resolveOtelConfig = exports.OtelSession = exports.ArmorIQTelemetryRuntime = exports.MODEL_PRICES = exports.computeCostUsd = exports.DEFAULT_PROXY_URL = exports.saveArmorIQConfig = exports.resolveEnvReferences = exports.resolveEnvReference = exports.parseArmorIQConfig = exports.loadArmorIQConfig = exports.ArmorIQConfigError = exports.hashToolCalls = exports.buildPlanFromToolCalls = exports.defaultToolNameParser = exports.IntentToken = exports.PolicyHoldException = exports.PolicyBlockedException = exports.ConfigurationException = exports.RevokedTokenError = exports.DelegationException = exports.TokenExpiredException = exports.MCPInvocationException = exports.IntentMismatchException = exports.InvalidTokenException = exports.ArmorIQException = exports.ArmorIQSession = exports.summarizeTranscriptUsageByDay = exports.summarizeTranscriptUsage = exports.ArmorIQUserScope = exports.ArmorIQClient = void 0;
16
+ exports.instrumentOpenAI = exports.EMAIL = exports.AUTHOR = exports.VERSION = exports.splitPrefixedToolName = exports.METADATA_CONTENT_PLACEHOLDER = exports.projectTelemetryContent = exports.isLeaseCurrent = exports.parsePolicyLease = exports.resolveOtelConfig = exports.OtelSession = exports.ArmorIQTelemetryRuntime = exports.MODEL_PRICES = exports.computeCostUsd = exports.DEFAULT_PROXY_URL = exports.saveArmorIQConfig = exports.resolveEnvReferences = exports.resolveEnvReference = exports.parseArmorIQConfig = exports.loadArmorIQConfig = exports.ArmorIQConfigError = exports.hashToolCalls = exports.buildPlanFromToolCalls = exports.defaultToolNameParser = exports.IntentToken = exports.PolicyHoldException = exports.PolicyBlockedException = exports.ConfigurationException = exports.RevokedTokenError = exports.DelegationException = exports.TokenExpiredException = exports.MCPInvocationException = exports.IntentMismatchException = exports.InvalidTokenException = exports.ArmorIQException = exports.ArmorIQSession = exports.summarizeTranscriptUsageByDay = exports.summarizeTranscriptUsage = exports.ArmorIQUserScope = exports.ArmorIQClient = void 0;
17
17
  var client_1 = require("./client");
18
18
  Object.defineProperty(exports, "ArmorIQClient", { enumerable: true, get: function () { return client_1.ArmorIQClient; } });
19
19
  Object.defineProperty(exports, "ArmorIQUserScope", { enumerable: true, get: function () { return client_1.ArmorIQUserScope; } });
@@ -53,6 +53,8 @@ Object.defineProperty(exports, "MODEL_PRICES", { enumerable: true, get: function
53
53
  Object.defineProperty(exports, "ArmorIQTelemetryRuntime", { enumerable: true, get: function () { return observability_1.ArmorIQTelemetryRuntime; } });
54
54
  Object.defineProperty(exports, "OtelSession", { enumerable: true, get: function () { return observability_1.OtelSession; } });
55
55
  Object.defineProperty(exports, "resolveOtelConfig", { enumerable: true, get: function () { return observability_1.resolveOtelConfig; } });
56
+ Object.defineProperty(exports, "parsePolicyLease", { enumerable: true, get: function () { return observability_1.parsePolicyLease; } });
57
+ Object.defineProperty(exports, "isLeaseCurrent", { enumerable: true, get: function () { return observability_1.isLeaseCurrent; } });
56
58
  Object.defineProperty(exports, "projectTelemetryContent", { enumerable: true, get: function () { return observability_1.projectTelemetryContent; } });
57
59
  Object.defineProperty(exports, "METADATA_CONTENT_PLACEHOLDER", { enumerable: true, get: function () { return observability_1.METADATA_CONTENT_PLACEHOLDER; } });
58
60
  var tool_name_1 = require("./tool_name");
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAEH,mCAA2D;AA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AAO,OAAA;AACH,QAAA,MAAM,GAAG,cAAc,CAAC;AACxB,QAAA,KAAK,GAAG,oBAAoB,CAAC;AAC1C,gDAAyD;AAAhD,0GAAA,gBAAgB,OAAA"}
@@ -7,8 +7,10 @@
7
7
  export { computeCostUsd, MODEL_PRICES, type ModelPrice } from './model-prices';
8
8
  export { resolveOtelConfig, lowerCaptureMode, CAPTURE_RANK, type CaptureMode, type OtelExporterMode, type OtelProtocol, type ObservabilityOptions, type ResolvedOtelConfig, } from './otel-config';
9
9
  export { ArmorIQTelemetryRuntime, type AttributeContext, type SpanIds, type TelemetryRuntimeOptions, type TelemetryAttributes, type TelemetryAttributeValue, } from './otel-runtime';
10
- export { parsePolicyLease, fallbackPolicyLease, isLeaseCurrent, type PolicyLease } from './policy-lease';
10
+ export { parsePolicyLease, fallbackPolicyLease, isLeaseCurrent, type PolicyLease, type PolicyLeaseRecord, type PolicyLeaseStore, } from './policy-lease';
11
11
  export { projectTelemetryContent, METADATA_CONTENT_PLACEHOLDER, type ContentReasonCode, type ContentCaptureAuthority, type TelemetryContent, type ProjectedTelemetryContent, } from './content-capture';
12
+ export { type SpanSink, type SpooledSpan, type SpooledSpanBatch } from './otel-span-spool';
13
+ export { type SpooledExportResult } from './otel-spool-export';
12
14
  export { __ownedTelemetryRuntimeCountForTests } from './otel-shutdown';
13
- export { OtelSession, type OtelSessionOptions, type OtelSessionRoot, type OtelTerminalStatus, type SpanHandle, type PlanInput, type PolicyInput, type PolicyResult, type ToolResult, type RootInput, type ModelInput, type ModelOutput, } from './otel-session';
15
+ export { OtelSession, type OtelSessionCloseOptions, type OtelSessionOptions, type OtelSessionRoot, type OtelTerminalStatus, type SpanHandle, type PlanInput, type PolicyInput, type PolicyResult, type ToolResult, type RootInput, type ModelInput, type ModelOutput, } from './otel-session';
14
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/observability/index.ts"],"names":[],"mappings":"AAA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,EACrB,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,GACxB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,uBAAuB,EACvB,KAAK,gBAAgB,EACrB,KAAK,OAAO,EACZ,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,GAC7B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,GACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,uBAAuB,EACvB,4BAA4B,EAC5B,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,yBAAyB,GAC/B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC3F,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,oCAAoC,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EACL,WAAW,EACX,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,WAAW,GACjB,MAAM,gBAAgB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/observability/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,+CAA+E;AAAtE,8GAAA,cAAc,OAAA;AAAE,4GAAA,YAAY,OAAA;AAErC,6CASuB;AARrB,gHAAA,iBAAiB,OAAA;AACjB,+GAAA,gBAAgB,OAAA;AAChB,2GAAA,YAAY,OAAA;AAQd,+CAOwB;AANtB,uHAAA,uBAAuB,OAAA;AAOzB,+CAAyG;AAAhG,gHAAA,gBAAgB,OAAA;AAAE,mHAAA,mBAAmB,OAAA;AAAE,8GAAA,cAAc,OAAA;AAC9D,qDAO2B;AANzB,0HAAA,uBAAuB,OAAA;AACvB,+HAAA,4BAA4B,OAAA;AAM9B,iDAAuE;AAA9D,qIAAA,oCAAoC,OAAA;AAC7C,+CAawB;AAZtB,2GAAA,WAAW,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/observability/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,+CAA+E;AAAtE,8GAAA,cAAc,OAAA;AAAE,4GAAA,YAAY,OAAA;AAErC,6CASuB;AARrB,gHAAA,iBAAiB,OAAA;AACjB,+GAAA,gBAAgB,OAAA;AAChB,2GAAA,YAAY,OAAA;AAQd,+CAOwB;AANtB,uHAAA,uBAAuB,OAAA;AAOzB,+CAOwB;AANtB,gHAAA,gBAAgB,OAAA;AAChB,mHAAA,mBAAmB,OAAA;AACnB,8GAAA,cAAc,OAAA;AAKhB,qDAO2B;AANzB,0HAAA,uBAAuB,OAAA;AACvB,+HAAA,4BAA4B,OAAA;AAQ9B,iDAAuE;AAA9D,qIAAA,oCAAoC,OAAA;AAC7C,+CAcwB;AAbtB,2GAAA,WAAW,OAAA"}
@@ -1,8 +1,10 @@
1
1
  /** SDK-owned OpenTelemetry runtime. It never registers a global provider. */
2
2
  import { type Span, type SpanOptions, type Tracer } from '@opentelemetry/api';
3
3
  import { type ObservabilityOptions, type ResolvedOtelConfig } from './otel-config';
4
- import { type PolicyLease } from './policy-lease';
4
+ import { type PolicyLease, type PolicyLeaseStore } from './policy-lease';
5
5
  import { type ContentCaptureAuthority } from './content-capture';
6
+ import { type SpanSink } from './otel-span-spool';
7
+ import { type SpooledExportResult } from './otel-spool-export';
6
8
  export type TelemetryAttributeValue = string | number | boolean | string[];
7
9
  export type TelemetryAttributes = Readonly<Record<string, unknown>>;
8
10
  export interface AttributeContext {
@@ -18,6 +20,9 @@ export interface TelemetryRuntimeOptions {
18
20
  options?: ObservabilityOptions;
19
21
  /** Test/host hook; production defaults to the policy-lease HTTP endpoint. */
20
22
  leaseFetcher?: (signal?: AbortSignal) => Promise<PolicyLease>;
23
+ leaseStore?: PolicyLeaseStore;
24
+ /** Takes the place of the OTLP request for the `armoriq` exporter. */
25
+ spanSink?: SpanSink;
21
26
  }
22
27
  export interface SpanIds {
23
28
  traceId: string;
@@ -38,21 +43,38 @@ export declare class ArmorIQTelemetryRuntime {
38
43
  private readonly apiKey;
39
44
  private readonly sdkVersion;
40
45
  private readonly leaseFetcher?;
46
+ private readonly leaseStore?;
47
+ private readonly spanSink?;
48
+ private readonly leaseBinding;
49
+ private readonly spoolKey;
50
+ private readonly storeAbort;
41
51
  private lease;
42
52
  private refreshing;
43
53
  private firstExternalAuthorityAwaited;
44
54
  private externalAuthorityUnavailable;
45
55
  private nextRefreshAt;
46
56
  private provider;
57
+ private exporter;
47
58
  private policyLeaseAbort;
48
- private readonly ownedAgents;
59
+ private transport;
60
+ private readonly spoolCalls;
61
+ private readonly spoolSlots;
49
62
  private closed;
50
63
  constructor(options: TelemetryRuntimeOptions);
64
+ currentOrFreshSnapshot(): Promise<PolicyLease>;
51
65
  policySnapshot(options?: {
52
66
  awaitFresh?: boolean;
53
67
  }): Promise<PolicyLease>;
68
+ /**
69
+ * Resolves at once while a current lease is held. Otherwise it adopts a
70
+ * current lease from the store, or waits for a lease request: the real
71
+ * lease, or the fallback after a failure or the request's 5 s abort.
72
+ */
73
+ refreshPolicy(): Promise<void>;
74
+ private adoptStoredLease;
54
75
  /** Start at most one control-plane request; request callers never await it. */
55
76
  private refreshInBackground;
77
+ private startRefresh;
56
78
  private applyCeiling;
57
79
  /**
58
80
  * The ceiling-applied lease this runtime already knows about, computed
@@ -87,9 +109,14 @@ export declare class ArmorIQTelemetryRuntime {
87
109
  * time for a disallowed capture mode.
88
110
  */
89
111
  reapplyContentCeiling(snapshot: PolicyLease, attributes: TelemetryAttributes): Record<string, TelemetryAttributeValue>;
112
+ private storeLease;
90
113
  private fetchPolicyLease;
91
114
  tracer(snapshot: PolicyLease): Tracer | null;
92
115
  private privateProvider;
116
+ private resource;
117
+ private pipelineExporter;
118
+ private firstPartyTracesUrl;
119
+ private ownedTransport;
93
120
  /**
94
121
  * Construct the OTLP delegate from explicit values. The convenience
95
122
  * exporter reads process.env while merging defaults, which could leak a
@@ -107,6 +134,20 @@ export declare class ArmorIQTelemetryRuntime {
107
134
  /** Stable, externally safe root span names prevent identifier leakage. */
108
135
  externalTraceName(value: string): string;
109
136
  forceFlush(): Promise<void>;
110
- close(): Promise<void>;
137
+ /** Process-exit drain: a bounded flush that then fails what is still in flight; the runtime stays open. */
138
+ drainForExit(): Promise<void>;
139
+ private drainExports;
140
+ /** The `binding` of every batch this runtime's `spanSink` receives. */
141
+ get spoolBinding(): string;
142
+ /**
143
+ * Ships batches this runtime's `spanSink` wrote, one OTLP request each,
144
+ * under its current authoritative lease. Resolves to one result per entry of
145
+ * `batches`, in order.
146
+ */
147
+ exportSpooled(batches: readonly unknown[]): Promise<SpooledExportResult[]>;
148
+ private openSpoolCall;
149
+ private shipSpooled;
150
+ private shippedAttributes;
151
+ close(deadlineMs?: number): Promise<void>;
111
152
  }
112
153
  //# sourceMappingURL=otel-runtime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"otel-runtime.d.ts","sourceRoot":"","sources":["../../src/observability/otel-runtime.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAE7E,OAAO,EAAgB,KAAK,IAAI,EAAE,KAAK,WAAW,EAAE,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAY5F,OAAO,EAIL,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACxB,MAAM,eAAe,CAAC;AACvB,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,gBAAgB,CAAC;AACxB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AAM,EAAE,uBAAuB,CAAC;IAI/I,OAAO,CAAC,2BAA2B;IA8CnC,OAAO,CAAC,wBAAwB;IAMhC,gFAAgF;IAChF,gBAAgB,CAAC,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,GAAG,uBAAuB;IAgBnF,OAAO,CAAC,cAAc;IAkBtB,0EAA0E;IAC1E,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAKlC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IASjC,2GAA2G;IACrG,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;YAKrB,YAAY;IAQ1B,uEAAuE;IACvE,IAAI,YAAY,IAAI,MAAM,CAEzB;IAED;;;;OAIG;IACG,aAAa,CAAC,OAAO,EAAE,SAAS,OAAO,EAAE,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAoBhF,OAAO,CAAC,aAAa;IAcrB,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,iBAAiB;IAQnB,KAAK,CAAC,UAAU,GAAE,MAA0B,GAAG,OAAO,CAAC,IAAI,CAAC;CAuBnE"}
@@ -15,6 +15,9 @@ const policy_lease_1 = require("./policy-lease");
15
15
  const content_capture_1 = require("./content-capture");
16
16
  const otel_shutdown_1 = require("./otel-shutdown");
17
17
  const otel_export_ceiling_1 = require("./otel-export-ceiling");
18
+ const otlp_http_transport_1 = require("./otlp-http-transport");
19
+ const otel_span_spool_1 = require("./otel-span-spool");
20
+ const otel_spool_export_1 = require("./otel-spool-export");
18
21
  const SENSITIVE_KEY = /(?:api[_-]?key|auth(?:orization)?|bearer|cookie|credential|password|passphrase|secret|private[_-]?key|ssn|card(?:_number)?)/i;
19
22
  const SECRET_TOKEN_KEY = /(?:^|[_.-])token(?:$|[_.-])/i;
20
23
  const USAGE_TOKEN_KEY = /^gen_ai\.usage\.(?:input|output|cache_read|cache_write)_tokens$/;
@@ -39,7 +42,7 @@ const MAX_FINISH_REASONS = 16;
39
42
  const MAX_FINISH_REASON_CANDIDATES = 64;
40
43
  const SENSITIVE_VALUE = /(?:\beyJ[A-Za-z0-9_-]{5,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b|\b(?:ak|sk|pk|rk|ghp|github_pat)_[A-Za-z0-9_-]{12,}\b|-----BEGIN [A-Z0-9 ]+-----)/i;
41
44
  const EMAIL = /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/i;
42
- const CONTENT_KEY = /^(?:armoriq\.(?:content\.|observability\.error\.summary$)|gen_ai\.(?:prompt|completion|input\.messages|output\.messages|tool\.(?:args|arguments|result|call\.(?:arguments|result))))$/;
45
+ const CONTENT_KEY = /^(?:armoriq\.(?:content\..*|observability\.error\.summary)|gen_ai\.(?:prompt|completion|input\.messages|output\.messages|tool\.(?:args|arguments|result|call\.(?:arguments|result))))$/;
43
46
  const EXTERNAL_METADATA_ATTRIBUTES = new Set([
44
47
  'gen_ai.request.model',
45
48
  'gen_ai.response.model',
@@ -120,7 +123,11 @@ const EXTERNAL_CONTENT_ATTRIBUTES = new Set([
120
123
  'gen_ai.tool.call.arguments', 'gen_ai.tool.call.result',
121
124
  ]);
122
125
  const CLOSE_DEADLINE_MS = 1_500;
126
+ const EXPORT_CONCURRENCY_LIMIT = 30;
127
+ const MAX_TIMER_MS = 2_147_483_647;
123
128
  const FIRST_EXTERNAL_AUTHORITY_WAIT_MS = 1_400;
129
+ const SPOOL_EXPORT_CONCURRENCY = 8;
130
+ const TRACER_NAME = 'armoriq-sdk';
124
131
  class PresetIdGenerator {
125
132
  random = new sdk_trace_base_1.RandomIdGenerator();
126
133
  preset = null;
@@ -168,6 +175,9 @@ function bounded(promise, timeoutMillis = CLOSE_DEADLINE_MS) {
168
175
  });
169
176
  });
170
177
  }
178
+ function validDeadline(value) {
179
+ return value > 0 ? Math.min(value, MAX_TIMER_MS) : CLOSE_DEADLINE_MS;
180
+ }
171
181
  function cleanString(value, length = 256) {
172
182
  if (SENSITIVE_VALUE.test(value))
173
183
  return '[REDACTED:CREDENTIAL]';
@@ -235,6 +245,9 @@ function sessionIdentity(context, external) {
235
245
  function hasOwn(value, key) {
236
246
  return Object.prototype.hasOwnProperty.call(value, key);
237
247
  }
248
+ function holdsCurrentAuthority(lease) {
249
+ return Boolean(lease?.authoritative && (0, policy_lease_1.isLeaseCurrent)(lease));
250
+ }
238
251
  /**
239
252
  * Manages one private exporter, or borrows a caller-owned provider. A runtime
240
253
  * is request/session scoped and `close()` is idempotent and fail-open.
@@ -245,14 +258,22 @@ class ArmorIQTelemetryRuntime {
245
258
  apiKey;
246
259
  sdkVersion;
247
260
  leaseFetcher;
261
+ leaseStore;
262
+ spanSink;
263
+ leaseBinding;
264
+ spoolKey;
265
+ storeAbort = new AbortController();
248
266
  lease = null;
249
267
  refreshing = null;
250
268
  firstExternalAuthorityAwaited = false;
251
269
  externalAuthorityUnavailable = false;
252
270
  nextRefreshAt = 0;
253
271
  provider = null;
272
+ exporter = null;
254
273
  policyLeaseAbort = null;
255
- ownedAgents = new Set();
274
+ transport = null;
275
+ spoolCalls = new Set();
276
+ spoolSlots = new otel_spool_export_1.ExportSlots(SPOOL_EXPORT_CONCURRENCY);
256
277
  closed = false;
257
278
  constructor(options) {
258
279
  this.config = (0, otel_config_1.resolveOtelConfig)(options.options);
@@ -260,17 +281,24 @@ class ArmorIQTelemetryRuntime {
260
281
  this.apiKey = options.apiKey;
261
282
  this.sdkVersion = options.sdkVersion;
262
283
  this.leaseFetcher = options.leaseFetcher;
284
+ this.leaseStore = options.leaseStore;
285
+ this.spanSink = options.spanSink;
286
+ this.leaseBinding = (0, policy_lease_1.policyLeaseBinding)(this.backendEndpoint, options.apiKey);
287
+ this.spoolKey = { apiKey: options.apiKey, binding: this.leaseBinding };
263
288
  if (this.config.enabled && this.config.exporter !== 'provider') {
264
289
  (0, otel_shutdown_1.registerOwnedTelemetryRuntime)(this);
265
290
  }
266
291
  }
292
+ async currentOrFreshSnapshot() {
293
+ return this.policySnapshot({ awaitFresh: !holdsCurrentAuthority(this.lease) });
294
+ }
267
295
  async policySnapshot(options = {}) {
268
296
  if (!this.config.enabled || this.closed)
269
297
  return Object.freeze({ ...(0, policy_lease_1.fallbackPolicyLease)(), captureMode: 'off' });
270
298
  if (this.externalAuthorityUnavailable && this.config.exporter === 'external') {
271
299
  return Object.freeze({ ...(0, policy_lease_1.fallbackPolicyLease)(), captureMode: 'off' });
272
300
  }
273
- if (!options.awaitFresh && this.lease?.authoritative && (0, policy_lease_1.isLeaseCurrent)(this.lease))
301
+ if (!options.awaitFresh && holdsCurrentAuthority(this.lease))
274
302
  return this.applyCeiling(this.lease);
275
303
  const refresh = this.refreshInBackground(options.awaitFresh === true);
276
304
  const mustAwaitExternalAuthority = this.config.exporter === 'external' && !this.firstExternalAuthorityAwaited;
@@ -294,16 +322,40 @@ class ArmorIQTelemetryRuntime {
294
322
  }
295
323
  return this.applyCeiling(this.lease && (0, policy_lease_1.isLeaseCurrent)(this.lease) ? this.lease : (0, policy_lease_1.fallbackPolicyLease)());
296
324
  }
325
+ /**
326
+ * Resolves at once while a current lease is held. Otherwise it adopts a
327
+ * current lease from the store, or waits for a lease request: the real
328
+ * lease, or the fallback after a failure or the request's 5 s abort.
329
+ */
330
+ async refreshPolicy() {
331
+ if (!this.config.enabled || this.closed || holdsCurrentAuthority(this.lease))
332
+ return;
333
+ await this.adoptStoredLease();
334
+ if (this.closed || holdsCurrentAuthority(this.lease))
335
+ return;
336
+ await (this.refreshing ?? this.startRefresh());
337
+ }
338
+ async adoptStoredLease() {
339
+ if (!this.leaseStore)
340
+ return;
341
+ const stored = await (0, policy_lease_1.readStoredPolicyLease)(this.leaseStore, this.leaseBinding, this.storeAbort.signal);
342
+ if (stored && !holdsCurrentAuthority(this.lease))
343
+ this.lease = stored;
344
+ }
297
345
  /** Start at most one control-plane request; request callers never await it. */
298
346
  refreshInBackground(force = false) {
299
347
  if (this.refreshing)
300
348
  return this.refreshing;
301
349
  if (!force && Date.now() < this.nextRefreshAt)
302
350
  return null;
351
+ return this.startRefresh();
352
+ }
353
+ startRefresh() {
303
354
  this.nextRefreshAt = Date.now() + 1_000;
304
355
  this.refreshing = this.fetchPolicyLease()
305
356
  .then((lease) => {
306
357
  this.lease = lease;
358
+ this.storeLease(lease);
307
359
  return lease;
308
360
  })
309
361
  .finally(() => {
@@ -472,6 +524,11 @@ class ArmorIQTelemetryRuntime {
472
524
  next['armoriq.observability.policy.revision'] = snapshot.revision;
473
525
  return next;
474
526
  }
527
+ storeLease(lease) {
528
+ if (!lease.authoritative || !this.leaseStore)
529
+ return;
530
+ (0, policy_lease_1.writeStoredPolicyLease)(this.leaseStore, lease, this.leaseBinding, this.storeAbort.signal);
531
+ }
475
532
  async fetchPolicyLease() {
476
533
  const controller = new AbortController();
477
534
  this.policyLeaseAbort = controller;
@@ -502,9 +559,9 @@ class ArmorIQTelemetryRuntime {
502
559
  return null;
503
560
  try {
504
561
  if (this.config.exporter === 'provider') {
505
- return this.config.tracerProvider?.getTracer('armoriq-sdk', this.sdkVersion) ?? null;
562
+ return this.config.tracerProvider?.getTracer(TRACER_NAME, this.sdkVersion) ?? null;
506
563
  }
507
- return this.privateProvider()?.getTracer('armoriq-sdk', this.sdkVersion) ?? null;
564
+ return this.privateProvider()?.getTracer(TRACER_NAME, this.sdkVersion) ?? null;
508
565
  }
509
566
  catch {
510
567
  return null;
@@ -513,19 +570,14 @@ class ArmorIQTelemetryRuntime {
513
570
  privateProvider() {
514
571
  if (this.provider || this.closed || !this.config.enabled)
515
572
  return this.provider;
516
- const isExternal = this.config.exporter === 'external';
517
- const url = isExternal ? this.config.endpoint : `${this.backendEndpoint}/v1/traces`;
518
- if (!url)
519
- return null;
520
573
  try {
521
- const exporter = this.createExporter(url, isExternal ? this.config.headers : { 'x-api-key': this.apiKey });
574
+ const exporter = this.pipelineExporter();
575
+ if (!exporter)
576
+ return null;
577
+ this.exporter = exporter;
522
578
  this.provider = new sdk_trace_node_1.NodeTracerProvider({
523
579
  idGenerator: presetIdGenerator(this),
524
- resource: (0, resources_1.resourceFromAttributes)({
525
- 'service.name': this.config.serviceName,
526
- 'service.version': this.sdkVersion,
527
- ...this.config.resourceAttributes,
528
- }),
580
+ resource: this.resource(),
529
581
  // A span queued under a permissive lease may still be sitting in
530
582
  // BatchSpanProcessor's in-memory buffer when the lease becomes
531
583
  // stricter (or is revoked). Wrap both the exporter -- the true
@@ -536,7 +588,7 @@ class ArmorIQTelemetryRuntime {
536
588
  // not whatever was authoritative at creation time, governs what
537
589
  // actually ships.
538
590
  spanProcessors: [
539
- new otel_export_ceiling_1.CeilingReapplyingSpanProcessor(new sdk_trace_base_1.BatchSpanProcessor(new otel_export_ceiling_1.CeilingReapplyingSpanExporter(exporter, this), { exportTimeoutMillis: Math.min(this.config.timeoutMillis, CLOSE_DEADLINE_MS) }), this),
591
+ new otel_export_ceiling_1.CeilingReapplyingSpanProcessor(new sdk_trace_base_1.BatchSpanProcessor(new otel_export_ceiling_1.CeilingReapplyingSpanExporter(exporter, this), { exportTimeoutMillis: this.config.timeoutMillis }), this),
540
592
  ],
541
593
  });
542
594
  return this.provider;
@@ -545,28 +597,50 @@ class ArmorIQTelemetryRuntime {
545
597
  return null;
546
598
  }
547
599
  }
600
+ resource() {
601
+ return (0, resources_1.resourceFromAttributes)({
602
+ 'service.name': this.config.serviceName,
603
+ 'service.version': this.sdkVersion,
604
+ ...this.config.resourceAttributes,
605
+ });
606
+ }
607
+ pipelineExporter() {
608
+ const isExternal = this.config.exporter === 'external';
609
+ if (this.spanSink && !isExternal) {
610
+ const sink = new otel_span_spool_1.SpanSinkExporter(this.spanSink, this.spoolKey);
611
+ this.transport = sink;
612
+ return sink;
613
+ }
614
+ const url = isExternal ? this.config.endpoint : this.firstPartyTracesUrl();
615
+ if (!url)
616
+ return null;
617
+ const headers = isExternal ? this.config.headers : { 'x-api-key': this.apiKey };
618
+ const transport = this.ownedTransport(url, headers);
619
+ this.transport = transport;
620
+ return this.createExporter(url, transport, this.config.timeoutMillis);
621
+ }
622
+ firstPartyTracesUrl() {
623
+ return `${this.backendEndpoint}/v1/traces`;
624
+ }
625
+ ownedTransport(url, headers) {
626
+ // The wire serializer is protobuf. Content type is SDK-owned and must
627
+ // be set after arbitrary caller headers.
628
+ return new otlp_http_transport_1.OwnedOtlpHttpTransport(new URL(url), {
629
+ ...headers,
630
+ 'content-type': 'application/x-protobuf',
631
+ });
632
+ }
548
633
  /**
549
634
  * Construct the OTLP delegate from explicit values. The convenience
550
635
  * exporter reads process.env while merging defaults, which could leak a
551
636
  * caller's external headers into an ArmorIQ-only exporter.
552
637
  */
553
- createExporter(url, headers) {
554
- const agentFactory = async (protocol) => {
555
- const { Agent } = protocol === 'http:' ? await import('node:http') : await import('node:https');
556
- const agent = new Agent({ keepAlive: false });
557
- this.ownedAgents.add(agent);
558
- return agent;
559
- };
560
- return new otlp_exporter_base_1.OTLPExporterBase((0, node_http_1.createOtlpHttpExportDelegate)({
561
- url,
562
- // The wire serializer is protobuf. Content type is SDK-owned and must
563
- // be set after arbitrary caller headers.
564
- headers: async () => ({ ...headers, 'content-type': 'application/x-protobuf' }),
565
- timeoutMillis: Math.min(this.config.timeoutMillis, CLOSE_DEADLINE_MS),
566
- concurrencyLimit: 1,
638
+ createExporter(url, transport, timeoutMillis) {
639
+ return new otlp_exporter_base_1.OTLPExporterBase((0, otlp_exporter_base_1.createOtlpNetworkExportDelegate)({
640
+ timeoutMillis,
641
+ concurrencyLimit: EXPORT_CONCURRENCY_LIMIT,
567
642
  compression: 'none',
568
- agentFactory,
569
- }, otlp_transformer_1.ProtobufTraceSerializer, 'otlp_http_span_exporter', otlp_transformer_1.TraceExporterMetricsHelper, undefined));
643
+ }, otlp_transformer_1.ProtobufTraceSerializer, (0, node_http_1.createOtlpHttpExporterMetrics)('otlp_http_span_exporter', otlp_transformer_1.TraceExporterMetricsHelper, url, undefined), transport));
570
644
  }
571
645
  safeAttributes(snapshot, attributes, context) {
572
646
  return this.safeAttributesWithAuthority(snapshot, attributes, context, false);
@@ -686,39 +760,111 @@ class ArmorIQTelemetryRuntime {
686
760
  if (this.config.exporter === 'provider')
687
761
  return;
688
762
  try {
689
- await bounded(this.provider?.forceFlush() ?? Promise.resolve());
763
+ await bounded(this.drainExports(this.provider?.forceFlush(), this.exporter));
690
764
  }
691
765
  catch {
692
766
  // Export failure is intentionally fail-open.
693
767
  }
694
768
  }
695
- async close() {
769
+ /** Process-exit drain: a bounded flush that then fails what is still in flight; the runtime stays open. */
770
+ async drainForExit() {
771
+ await this.forceFlush();
772
+ this.transport?.abandon(false);
773
+ }
774
+ async drainExports(batches, exporter) {
775
+ await batches?.catch(() => undefined);
776
+ await exporter?.forceFlush?.();
777
+ }
778
+ /** The `binding` of every batch this runtime's `spanSink` receives. */
779
+ get spoolBinding() {
780
+ return this.leaseBinding;
781
+ }
782
+ /**
783
+ * Ships batches this runtime's `spanSink` wrote, one OTLP request each,
784
+ * under its current authoritative lease. Resolves to one result per entry of
785
+ * `batches`, in order.
786
+ */
787
+ async exportSpooled(batches) {
788
+ const parsed = await (0, otel_spool_export_1.parseSpooledSpanBatches)(batches, {
789
+ key: this.spoolKey,
790
+ resource: this.resource(),
791
+ scope: { name: TRACER_NAME, version: this.sdkVersion },
792
+ });
793
+ const available = this.config.enabled && !this.closed && this.config.exporter === 'armoriq';
794
+ const shippable = available && parsed.some((entry) => 'spans' in entry);
795
+ const call = shippable && this.openSpoolCall();
796
+ if (!call)
797
+ return (0, otel_spool_export_1.settleShippable)(parsed, otel_spool_export_1.SPOOL_UNAVAILABLE);
798
+ try {
799
+ await (0, otel_spool_export_1.untilAborted)(this.refreshPolicy(), call.signal);
800
+ const ship = (spans) => this.shipSpooled(spans, call);
801
+ return await (0, otel_spool_export_1.exportSpooledBatches)(parsed, ship, this.spoolSlots, call.signal);
802
+ }
803
+ finally {
804
+ call.end();
805
+ this.spoolCalls.delete(call);
806
+ }
807
+ }
808
+ openSpoolCall() {
809
+ const url = this.firstPartyTracesUrl();
810
+ let transport;
811
+ try {
812
+ transport = this.ownedTransport(url, { 'x-api-key': this.apiKey });
813
+ }
814
+ catch {
815
+ return null;
816
+ }
817
+ const exporter = this.createExporter(url, transport, this.config.timeoutMillis);
818
+ const call = new otel_spool_export_1.SpoolExportCall(transport, exporter);
819
+ this.spoolCalls.add(call);
820
+ return call;
821
+ }
822
+ shipSpooled(spans, call) {
823
+ if (!holdsCurrentAuthority(this.lease))
824
+ return Promise.resolve(otel_spool_export_1.SPOOL_POLICY_UNAVAILABLE);
825
+ const snapshot = this.applyCeiling(this.lease);
826
+ if (snapshot.captureMode === 'off')
827
+ return Promise.resolve(otel_spool_export_1.SPOOL_DISCARDED);
828
+ const project = (span) => ({
829
+ ...span,
830
+ attributes: this.shippedAttributes(snapshot, span.attributes),
831
+ });
832
+ return call.send(spans.map(project));
833
+ }
834
+ shippedAttributes(snapshot, attributes) {
835
+ const governed = this.reapplyContentCeiling(snapshot, attributes);
836
+ Object.assign(governed, (0, content_capture_1.trustedContentDiagnostics)(attributes, governed));
837
+ const shipped = {};
838
+ for (const key of Object.keys(attributes))
839
+ if (hasOwn(governed, key))
840
+ shipped[key] = governed[key];
841
+ return Object.assign(shipped, governed);
842
+ }
843
+ async close(deadlineMs = CLOSE_DEADLINE_MS) {
696
844
  if (this.closed)
697
845
  return;
698
846
  this.closed = true;
699
847
  (0, otel_shutdown_1.unregisterOwnedTelemetryRuntime)(this);
848
+ this.storeAbort.abort();
700
849
  this.policyLeaseAbort?.abort();
701
850
  this.policyLeaseAbort = null;
851
+ this.spoolCalls.forEach((call) => call.abort(otel_spool_export_1.SPOOL_UNAVAILABLE));
702
852
  if (this.config.exporter === 'provider')
703
853
  return;
704
854
  const provider = this.provider;
855
+ const exporter = this.exporter;
856
+ const transport = this.transport;
705
857
  this.provider = null;
858
+ this.exporter = null;
859
+ this.transport = null;
706
860
  try {
707
- await bounded(provider?.shutdown() ?? Promise.resolve());
861
+ await bounded(this.drainExports(provider?.shutdown(), exporter), validDeadline(deadlineMs));
708
862
  }
709
863
  catch {
710
864
  // Export failure is intentionally fail-open.
711
865
  }
712
866
  finally {
713
- for (const agent of this.ownedAgents) {
714
- try {
715
- agent.destroy();
716
- }
717
- catch {
718
- // Agents are SDK-owned and are best-effort only.
719
- }
720
- }
721
- this.ownedAgents.clear();
867
+ transport?.abandon(true);
722
868
  }
723
869
  }
724
870
  }