@osfactory/otel-hook 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -7
- package/dist/{adapter-BS7xHKGQ.d.ts → adapter-BJiz6lqM.d.ts} +2 -2
- package/dist/cli.js +207 -34
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +85 -1
- package/dist/config.js +135 -1
- package/dist/config.js.map +1 -1
- package/dist/{events-CzZ5kukS.d.ts → events-B3MHoJTD.d.ts} +72 -1
- package/dist/{filesystem-store-BcOveJYY.d.ts → filesystem-store-r-nNA3BA.d.ts} +1 -1
- package/dist/{hook-DxTakjAD.d.ts → hook-Dh8OO4Wa.d.ts} +4 -4
- package/dist/index.d.ts +12 -12
- package/dist/index.js +197 -31
- package/dist/index.js.map +1 -1
- package/dist/install.d.ts +4 -4
- package/dist/install.js +8 -2
- package/dist/install.js.map +1 -1
- package/dist/integration.d.ts +13 -8
- package/dist/integration.js +2273 -2256
- package/dist/integration.js.map +1 -1
- package/dist/lifecycle.d.ts +3 -3
- package/dist/lifecycle.js +761 -212
- package/dist/lifecycle.js.map +1 -1
- package/dist/{memory-DkTohdIa.d.ts → memory-Bl9ANVff.d.ts} +2 -2
- package/dist/model.d.ts +1 -1
- package/dist/model.js +13 -2
- package/dist/model.js.map +1 -1
- package/dist/{otlp-log-sink-DaZDPKnR.d.ts → otlp-log-sink-eUEjaLhk.d.ts} +3 -3
- package/dist/{payload-2lnpKodw.d.ts → payload-Ci8_ERm6.d.ts} +1 -1
- package/dist/{ports-B0rC49b3.d.ts → ports-n7KFOpKo.d.ts} +1 -1
- package/dist/providers.d.ts +10 -10
- package/dist/providers.js +32 -13
- package/dist/providers.js.map +1 -1
- package/dist/{registry-DVnPA_b6.d.ts → registry-CIVvRlVK.d.ts} +1 -1
- package/dist/runtime.d.ts +8 -8
- package/dist/runtime.js +11 -6
- package/dist/runtime.js.map +1 -1
- package/dist/{semconv-CtnDdsPk.d.ts → semconv-fPRb-dpU.d.ts} +1 -1
- package/dist/state.d.ts +4 -4
- package/dist/telemetry.d.ts +6 -6
- package/dist/telemetry.js +956 -418
- package/dist/telemetry.js.map +1 -1
- package/dist/testing.d.ts +14 -8
- package/dist/testing.js +36 -18
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
export { CANONICAL_SCHEMA_VERSION, CanonicalSchemaVersion, EMPTY_EXTENSIONS, EXTENSION_KEY_PATTERN, Extensions, MAX_EXTENSION_ENTRIES, RESERVED_EXTENSION_NAMESPACES, canonicalSchemaVersionSchema, emptyExtensions, extensionKeyNamespace, extensionsSchema, isReservedExtensionNamespace, isValidExtensionKey } from './model.js';
|
|
2
2
|
export { A as AttributePrimitive, a as AttributeValue, b as Attributes, D as DETECTION_CONFIDENCE_RANK, c as DetectionConfidence, E as EpochMillis, d as EventId, I as InvocationId, M as MAX_ATTRIBUTE_ARRAY_LENGTH, e as MAX_ATTRIBUTE_STRING_LENGTH, f as MAX_IDENTIFIER_LENGTH, P as PROVIDER_ID_PATTERN, g as ProviderId, R as ResolvedProviderId, S as SessionId, h as SourceTransport, U as UNKNOWN_PROVIDER_ID, i as UnknownProviderId, W as WORKSPACE_ID_PATTERN, j as WorkspaceId, k as attributePrimitiveSchema, l as attributeValueSchema, m as attributesSchema, n as compareDetectionConfidence, o as detectionConfidenceSchema, p as durationMillisSchema, q as epochMillisSchema, r as eventIdSchema, s as invocationIdSchema, t as isUnknownProvider, u as nonEmptyStringSchema, v as providerIdSchema, w as resolvedProviderIdSchema, x as sequenceNumberSchema, y as sessionIdSchema, z as sourceTransportSchema, B as tokenCountSchema, C as workspaceIdSchema } from './primitives-CJ8-rn-f.js';
|
|
3
3
|
export { C as CONTENT_HASH_PATTERN, a as ContentDisclosure, b as ContentFact, c as ContentKind, d as ContentRole, e as contentDisclosureSchema, f as contentFactSchema, g as contentFactsSchema, h as contentKindSchema, i as contentRoleSchema, j as isContentFactConsistent, k as isUnavailableContentFact } from './content-M9xIKG7h.js';
|
|
4
|
-
export { C as CANONICAL_EVENT_TYPES, a as CacheCreationAccounting, b as CanonicalEvent, c as CanonicalEventInput, d as CanonicalEventOfType, e as CanonicalEventType, f as CanonicalUsage, g as CompactionPerformedEvent, h as CostFacts, E as EMPTY_DELTA_USAGE, i as ErrorRaisedEvent, j as EventOutcome, k as EventValidationResult, G as GenerationEndEvent, l as GenerationStartEvent, M as MAX_TARGET_HINT_PATHS, m as MAX_TARGET_PATH_LENGTH, n as ModelDescriptor, P as PromptSubmittedEvent, o as ProviderTotalAgreement, S as SUBAGENT_ID_PATTERN, p as SessionEndEvent, q as SessionStartEvent, r as SubagentEndEvent, s as SubagentId, t as SubagentStartEvent, T as
|
|
4
|
+
export { C as CANONICAL_EVENT_TYPES, a as CacheCreationAccounting, b as CanonicalEvent, c as CanonicalEventInput, d as CanonicalEventOfType, e as CanonicalEventType, f as CanonicalUsage, g as CompactionPerformedEvent, h as CostFacts, E as EMPTY_DELTA_USAGE, i as ErrorRaisedEvent, j as EventOutcome, k as EventValidationResult, G as GenerationEndEvent, l as GenerationStartEvent, M as MAX_TARGET_HINT_PATHS, m as MAX_TARGET_PATH_LENGTH, n as ModelDescriptor, P as PromptSubmittedEvent, o as ProviderTotalAgreement, S as SUBAGENT_ID_PATTERN, p as SessionEndEvent, q as SessionStartEvent, r as SubagentEndEvent, s as SubagentId, t as SubagentStartEvent, T as TARGETED_EVENT_TYPES, u as TargetHint, v as TargetSource, w as TargetedEvent, x as TargetedEventType, y as ToolEndEvent, z as ToolKind, A as ToolStartEvent, U as UsageDeltaResult, B as UsageNormalizationError, D as UsageNormalizationIssue, F as UsageNormalizationResult, H as UsageReport, I as UsageTemporality, W as WorkspaceTarget, J as WorktreeKind, K as addUsage, L as cacheCreationAccountingSchema, N as canonicalEventSchema, O as canonicalEventTypeSchema, Q as canonicalUsageSchema, R as compactionPerformedEventSchema, V as compareEvents, X as costFactsSchema, Y as cumulativeToDelta, Z as errorRaisedEventSchema, _ as eventUsage, $ as generationEndEventSchema, a0 as generationStartEventSchema, a1 as isTargetedEvent, a2 as modelDescriptorSchema, a3 as normalizeUsage, a4 as normalizeUsageOrThrow, a5 as parseCanonicalEvent, a6 as promptSubmittedEventSchema, a7 as providerTotalAgreementSchema, a8 as sessionCwdHint, a9 as sessionEndEventSchema, aa as sessionStartEventSchema, ab as subagentEndEventSchema, ac as subagentIdSchema, ad as subagentStartEventSchema, ae as targetHintSchema, af as targetSourceSchema, ag as toReport, ah as toolEndEventSchema, ai as toolKindSchema, aj as toolStartEventSchema, ak as usageReportSchema, al as usageTemporalitySchema, am as validateCanonicalEvent, an as workspaceTargetSchema, ao as worktreeKindSchema } from './events-B3MHoJTD.js';
|
|
5
5
|
export { C as ConsumerAttributes, I as IdentityClaim, a as IdentityClaimFields, b as IdentityConflict, c as IdentityResolution, d as InvocationIdentity, R as ResolveIdentityInput, S as SourceProvenance, U as UNKNOWN_WORKSPACE_ID, W as WorkspaceIdentity, e as WorkspaceKeySource, f as consumerAttributesSchema, i as identityClaimFieldsSchema, g as identityClaimSchema, h as invocationIdentitySchema, r as resolveInvocationIdentity, s as sourceProvenanceSchema, u as unknownWorkspaceIdentity, w as workspaceIdentitySchema, j as workspaceKeySourceSchema } from './identity-BrVBs901.js';
|
|
6
6
|
export { CreateErrorInfoInput, OtelHookError, OtelHookErrorInfo, createErrorInfo, describeThrown, errorInfoFromThrown, isOtelHookError, otelHookErrorInfoSchema } from './errors.js';
|
|
7
7
|
export { C as CONTENT_MODE_DISCLOSURE, a as ContentMode, D as DEFAULT_PRIVACY_LIMITS, b as DEFAULT_PRIVACY_POLICY, c as DEFAULT_SECRET_KEY_PATTERNS, d as DEFAULT_SECRET_VALUE_PATTERNS, P as PolicyResolution, e as PrivacyLimits, f as PrivacyPolicy, g as contentModeSchema, p as privacyLimitsSchema, h as privacyPolicySchema, r as resolvePrivacyPolicy } from './policy-CimmCfRp.js';
|
|
8
8
|
export { D as DescribeContentInput, a as DescribeStructuredInput, P as PrivacyService, S as SanitizeExtensionsResult, b as SanitizeResult, c as SanitizeStats, d as SanitizedValue, e as createPrivacyService } from './service-CbI9CObT.js';
|
|
9
9
|
export { WorkspaceKeyInput, WorkspaceLabels, canonicalizeGitRemote, deriveWorkspaceIdentity } from './privacy.js';
|
|
10
|
-
export { CONFIG_SOURCE_PRECEDENCE, ConfigLayer, ConfigProvenance, ConfigResolution, ConfigSource, EMPTY_RESOURCE_ATTRIBUTES, ENVIRONMENT_VARIABLES, EnvironmentConfigResult, EnvironmentRecord, MAX_RESOURCE_ATTRIBUTES, MAX_RESOURCE_ATTRIBUTE_KEY_LENGTH, MAX_RESOURCE_ATTRIBUTE_VALUE_LENGTH, ParsedResourceAttributes, RESERVED_RESOURCE_ATTRIBUTE_KEYS, RESOURCE_ATTRIBUTE_KEY_PATTERN, RESOURCE_ATTRIBUTE_KEY_REJECTION_DETAIL, ResourceAttributeKeyRejection, ResourceAttributeValue, ResourceAttributes, checkResourceAttributeKey, configSourceSchema, describeResolvedConfig, describeResourceAttributeNames, isReservedResourceAttributeKey, isSecretResourceAttributeKey, parseEnvironmentConfig, parseResourceAttributesValue, resolveConfig, resourceAttributeValueSchema, resourceAttributesSchema, sanitizeResourceAttributes } from './config.js';
|
|
10
|
+
export { CONFIG_SOURCE_PRECEDENCE, ConfigLayer, ConfigProvenance, ConfigResolution, ConfigSource, EMPTY_RESOURCE_ATTRIBUTES, ENVIRONMENT_VARIABLES, EnvironmentConfigResult, EnvironmentRecord, MAX_OTLP_HEADERS, MAX_RESOURCE_ATTRIBUTES, MAX_RESOURCE_ATTRIBUTE_KEY_LENGTH, MAX_RESOURCE_ATTRIBUTE_VALUE_LENGTH, OTLP_HEADER_VARIABLES, ParsedOtlpHeaders, ParsedResourceAttributes, RESERVED_RESOURCE_ATTRIBUTE_KEYS, RESOURCE_ATTRIBUTE_KEY_PATTERN, RESOURCE_ATTRIBUTE_KEY_REJECTION_DETAIL, ResolvedOtlpHeaders, ResourceAttributeKeyRejection, ResourceAttributeValue, ResourceAttributes, checkResourceAttributeKey, configSourceSchema, describeOtlpHeaderNames, describeResolvedConfig, describeResourceAttributeNames, isReservedResourceAttributeKey, isSecretResourceAttributeKey, mergeOtlpHeaders, parseEnvironmentConfig, parseOtlpHeadersValue, parseResourceAttributesValue, resolveConfig, resolveOtlpHeaders, resourceAttributeValueSchema, resourceAttributesSchema, sanitizeResourceAttributes, unionOtlpHeaderNames } from './config.js';
|
|
11
11
|
export { D as DEFAULT_CONFIG, a as DEFAULT_DETECTION_POLICY, b as DEFAULT_DIAGNOSTICS_POLICY, c as DEFAULT_EXPORTER_POLICY, d as DEFAULT_LOGS_POLICY, e as DetectionPolicy, f as DiagnosticsPolicy, E as ExporterPolicy, L as LogsPolicy, O as OtelHookConfig, g as OtelHookConfigPatch, h as detectionPolicySchema, i as diagnosticsPolicySchema, j as exporterPolicySchema, l as logsPolicySchema, o as otelHookConfigPatchSchema, k as otelHookConfigSchema } from './schema-Cn0-xz8L.js';
|
|
12
|
-
export { A as AdapterDescription, D as DELIVERY_COMPONENT_PATTERN, a as DELIVERY_GAP_REASON_PATTERN, b as DeliveryIdentifierSupport, M as MAX_DELIVERY_COMPONENTS, c as MAX_DELIVERY_GAPS, P as ProviderAdapter, d as ProviderCapabilities, e as ProviderContext, f as ProviderDeliveryClaim, g as ProviderDeliveryGaps, h as ProviderDetection, i as ProviderDetectionInput, j as ProviderHookResponse, k as ProviderHookResponseInput, l as ProviderIdentityInput, m as ProviderParseInput, n as ProviderParseResult, S as SILENT_HOOK_RESPONSE, o as adapterSupports, p as asProviderId, q as deliveryComponentSchema, r as deliveryGapReasonSchema, s as deliveryIdentifierSupportSchema, t as describeAdapter, u as providerCapabilitiesSchema, v as providerDeliveryClaimSchema, w as providerDeliveryGapsSchema, x as providerDetectionSchema, y as providerHookResponseSchema, z as readDeliveryClaim, B as readDeliveryGap, C as unknownDetection } from './adapter-
|
|
12
|
+
export { A as AdapterDescription, D as DELIVERY_COMPONENT_PATTERN, a as DELIVERY_GAP_REASON_PATTERN, b as DeliveryIdentifierSupport, M as MAX_DELIVERY_COMPONENTS, c as MAX_DELIVERY_GAPS, P as ProviderAdapter, d as ProviderCapabilities, e as ProviderContext, f as ProviderDeliveryClaim, g as ProviderDeliveryGaps, h as ProviderDetection, i as ProviderDetectionInput, j as ProviderHookResponse, k as ProviderHookResponseInput, l as ProviderIdentityInput, m as ProviderParseInput, n as ProviderParseResult, S as SILENT_HOOK_RESPONSE, o as adapterSupports, p as asProviderId, q as deliveryComponentSchema, r as deliveryGapReasonSchema, s as deliveryIdentifierSupportSchema, t as describeAdapter, u as providerCapabilitiesSchema, v as providerDeliveryClaimSchema, w as providerDeliveryGapsSchema, x as providerDetectionSchema, y as providerHookResponseSchema, z as readDeliveryClaim, B as readDeliveryGap, C as unknownDetection } from './adapter-BJiz6lqM.js';
|
|
13
13
|
export { ANTIGRAVITY_PROMOTION_GATES, ANTIGRAVITY_PROVIDER_MATURITY, AntigravityProviderMaturity, CLAUDE_CODE_CAPABILITIES, CODEX_CAPABILITIES, CURSOR_ADAPTER_VERSION, CURSOR_CAPABILITIES, CanonicalEventDraft, ClaudeCodeAdapterOptions, CursorAdapterOptions, DELIVERY_IDENTIFIER_SUMMARY, DefaultRegistryOptions, EXPERIMENTAL_PROVIDER_IDS, EventFactory, EventFactoryInput, PROVIDER_DESCRIPTORS, ProviderCatalogEntry, ProviderDescriptor, ProviderMaturity, createClaudeCodeAdapter, createCodexAdapter, createCursorAdapter, createDefaultProviderRegistry, createEventFactory, describeProviderCatalog, findProviderDescriptor, isExperimentalProvider } from './providers.js';
|
|
14
|
-
export { B as BUILT_IN_PROVIDERS, D as DetectionCandidate, P as ProviderRegistry, R as RegistryDetectionResult, c as createProviderRegistry } from './registry-
|
|
15
|
-
export { A as ANTIGRAVITY_CAPABILITIES, a as ANTIGRAVITY_HOOK_EVENT_NAMES, b as ANTIGRAVITY_PROVIDER_ID, c as AntigravityAdapterOptions, d as AntigravityHookEventName, C as CLAUDE_CODE_PROVIDER_ID, e as CLAUDE_HOOK_EVENT_NAMES, f as CODEX_ADAPTER_VERSION, g as CODEX_HOOK_EVENT_NAMES, h as CODEX_PROVIDER_ID, i as CURSOR_DECISION_EVENTS, j as CURSOR_HOOK_EVENT_NAMES, k as CURSOR_PROVIDER_ID, l as CURSOR_UNMODELLED_HOOK_EVENT_NAMES, m as ClaudeHookEventName, n as CodexHookEventName, o as CursorHookEventName, D as DEFAULT_GEMINI_CAPABILITIES, G as GEMINI_ADAPTER_VERSION, p as GEMINI_HOOK_EVENT_NAMES, q as GEMINI_PROVIDER_ID, r as GeminiAdapterOptions, s as GeminiHookEventName, t as createAntigravityAdapter, u as createGeminiCliAdapter } from './payload-
|
|
16
|
-
export { A as AppliedDelivery, C as Clock, E as EventIdSeed, I as IdGenerator, a as InvocationIdSeed, L as LOG_LEVEL_RANK, b as LocatedWorktree, c as LogLevel, d as Logger, S as StateRecord, e as StateStore, f as StateValue, T as TelemetryEmitResult, g as TelemetrySink, W as WorktreeLocator, h as appliedDeliverySchema, l as logLevelSchema, s as stateRecordSchema, i as stateValueSchema } from './ports-
|
|
17
|
-
export { D as DeterministicIdOptions, F as FixedClock, a as FixedClockOptions, I as InMemoryStateStore, b as InMemoryStateStoreOptions, L as LogRecord, R as RecordingLogger, c as RecordingTelemetrySink, d as RecordingTelemetrySinkOptions, e as createDeterministicIdGenerator, f as createFixedClock, g as createInMemoryStateStore, h as createNullTelemetrySink, i as createRandomIdGenerator, j as createRecordingLogger, k as createRecordingTelemetrySink, l as createSystemClock } from './memory-
|
|
14
|
+
export { B as BUILT_IN_PROVIDERS, D as DetectionCandidate, P as ProviderRegistry, R as RegistryDetectionResult, c as createProviderRegistry } from './registry-CIVvRlVK.js';
|
|
15
|
+
export { A as ANTIGRAVITY_CAPABILITIES, a as ANTIGRAVITY_HOOK_EVENT_NAMES, b as ANTIGRAVITY_PROVIDER_ID, c as AntigravityAdapterOptions, d as AntigravityHookEventName, C as CLAUDE_CODE_PROVIDER_ID, e as CLAUDE_HOOK_EVENT_NAMES, f as CODEX_ADAPTER_VERSION, g as CODEX_HOOK_EVENT_NAMES, h as CODEX_PROVIDER_ID, i as CURSOR_DECISION_EVENTS, j as CURSOR_HOOK_EVENT_NAMES, k as CURSOR_PROVIDER_ID, l as CURSOR_UNMODELLED_HOOK_EVENT_NAMES, m as ClaudeHookEventName, n as CodexHookEventName, o as CursorHookEventName, D as DEFAULT_GEMINI_CAPABILITIES, G as GEMINI_ADAPTER_VERSION, p as GEMINI_HOOK_EVENT_NAMES, q as GEMINI_PROVIDER_ID, r as GeminiAdapterOptions, s as GeminiHookEventName, t as createAntigravityAdapter, u as createGeminiCliAdapter } from './payload-Ci8_ERm6.js';
|
|
16
|
+
export { A as AppliedDelivery, C as Clock, E as EventIdSeed, I as IdGenerator, a as InvocationIdSeed, L as LOG_LEVEL_RANK, b as LocatedWorktree, c as LogLevel, d as Logger, S as StateRecord, e as StateStore, f as StateValue, T as TelemetryEmitResult, g as TelemetrySink, W as WorktreeLocator, h as appliedDeliverySchema, l as logLevelSchema, s as stateRecordSchema, i as stateValueSchema } from './ports-n7KFOpKo.js';
|
|
17
|
+
export { D as DeterministicIdOptions, F as FixedClock, a as FixedClockOptions, I as InMemoryStateStore, b as InMemoryStateStoreOptions, L as LogRecord, R as RecordingLogger, c as RecordingTelemetrySink, d as RecordingTelemetrySinkOptions, e as createDeterministicIdGenerator, f as createFixedClock, g as createInMemoryStateStore, h as createNullTelemetrySink, i as createRandomIdGenerator, j as createRecordingLogger, k as createRecordingTelemetrySink, l as createSystemClock } from './memory-Bl9ANVff.js';
|
|
18
18
|
export { DEFAULT_TARGET_RESOLUTION_BUDGET_MILLIS, DEFAULT_WORKTREE_CACHE_TTL_MILLIS, FilesystemWorktreeLocatorOptions, MAX_WORKTREE_WALK_DEPTH, ResolveEventTargetsInput, ResolveEventTargetsResult, StderrLoggerOptions, createFilesystemWorktreeLocator, createNullLogger, createStderrLogger, parseCommonDirFile, parseGitDirFile, parseHeadBranch, resolveEventTargets } from './runtime.js';
|
|
19
|
-
export { C as CumulativeUsageSeries, D as DeliveryDurability, a as DeliveryOrigin, b as DeliveryResolution, c as DeliveryUnavailableReason, H as HookIngestInput, d as HookIngestOptions, e as HookIngestOutcome, O as OtelHook, f as OtelHookDependencies, R as ResolvedDeliveryIdentity, U as UsageObservation, g as UsageScope, h as classifyDurability, i as createOtelHook, j as hostDeliveryIdentity, k as isCommittable, r as resolveDeliveryIdentity, u as usageScopeSchema } from './hook-
|
|
19
|
+
export { C as CumulativeUsageSeries, D as DeliveryDurability, a as DeliveryOrigin, b as DeliveryResolution, c as DeliveryUnavailableReason, H as HookIngestInput, d as HookIngestOptions, e as HookIngestOutcome, O as OtelHook, f as OtelHookDependencies, R as ResolvedDeliveryIdentity, U as UsageObservation, g as UsageScope, h as classifyDurability, i as createOtelHook, j as hostDeliveryIdentity, k as isCommittable, r as resolveDeliveryIdentity, u as usageScopeSchema } from './hook-Dh8OO4Wa.js';
|
|
20
20
|
export { CallbackDeduplicator, CallbackDeduplicatorDependencies, DedupCheckResult, DedupCleanupResult, DeliveryClaimOptions, DeliveryClaimOutcome, DeliveryClaimResult, LifecycleCleanupReport, LifecycleJanitor, LifecycleJanitorOptions, LifecycleScope, LifecycleSweepStats, RollupCleanupResult, SPAN_RECORD_VERSION, SpanCleanupResult, SpanCorrelationFacts, SpanCorrelator, SpanCorrelatorDependencies, SpanEndInput, SpanEndOrphanReason, SpanEndResult, SpanStartInput, SpanStartResult, UsageAccumulator, UsageAccumulatorDependencies, UsageAccumulatorKey, UsageAccumulatorSnapshot, createCallbackDeduplicator, createLifecycleJanitor, createSpanCorrelator, createUsageAccumulator } from './lifecycle.js';
|
|
21
21
|
export { S as StoreNamespace } from './keys-Dej5bN3L.js';
|
|
22
|
-
export { F as FilesystemStateStore, a as FilesystemStateStoreOptions, L as LockingStateStore, S as StateStoreDependencies, c as createFilesystemStateStore, i as isLockingStateStore, w as withOptionalSessionLock } from './filesystem-store-
|
|
22
|
+
export { F as FilesystemStateStore, a as FilesystemStateStoreOptions, L as LockingStateStore, S as StateStoreDependencies, c as createFilesystemStateStore, i as isLockingStateStore, w as withOptionalSessionLock } from './filesystem-store-r-nNA3BA.js';
|
|
23
23
|
export { BoundedMemoryStateStore, BoundedMemoryStateStoreOptions, createBoundedMemoryStateStore } from './state.js';
|
|
24
|
-
export { D as DEFAULT_INSTRUMENTATION_SCOPE, E as EventTraceIdentity, M as MAX_RECOVERED_START_ATTRIBUTES, S as SemanticMappingOptions, a as SpanCorrelation, b as SpanCorrelationResolver, c as SpanDisposition, d as SpanFamily, e as SpanOrphanClassification, f as SpanPairing, g as SpanScopeRef, h as canonicalEventTraceIdentities, i as canonicalEventsToReadableSpans, p as parentScopeRefOf, s as spanScopeRefOf, j as startOnlySpanAttributes } from './semconv-
|
|
25
|
-
export { C as ContentWithholdingReason, D as DurableLogSpool, a as DurableLogSpoolOptions, b as DurableSpool, c as DurableSpoolOptions, L as LOG_MAPPING_VERSION, d as LOG_SIGNALS, e as LogContentPolicy, f as LogMappingOptions, g as LogMappingResult, h as LogSignal, i as LogSpoolBatch, j as LogsDeliverability, M as MAX_LOG_BODY_CHARACTERS, k as MAX_LOG_RECORDS_PER_BATCH, l as MAX_LOG_RECORDS_PER_EVENT, m as MCP_TOOL_NAME_PATTERN, N as NO_LOG_CONTENT, O as OtlpLogSinkOptions, n as OtlpLogTelemetrySink, o as OtlpTelemetrySink, p as OtlpTraceSinkOptions, S as SerializedLogRecord, q as SerializedSpan, r as SpoolBatch, s as SpoolDrainResult, t as SpoolEnqueueResult, u as canonicalEventsToLogRecords, v as createFileDurableLogSpool, w as createFileDurableSpool, x as createOtlpLogSink, y as createOtlpTraceSink, z as describeLogsDeliverability, A as logSignalOf, B as logSignalsForLifecycleEvents, E as resolveLogsEndpoint } from './otlp-log-sink-
|
|
24
|
+
export { D as DEFAULT_INSTRUMENTATION_SCOPE, E as EventTraceIdentity, M as MAX_RECOVERED_START_ATTRIBUTES, S as SemanticMappingOptions, a as SpanCorrelation, b as SpanCorrelationResolver, c as SpanDisposition, d as SpanFamily, e as SpanOrphanClassification, f as SpanPairing, g as SpanScopeRef, h as canonicalEventTraceIdentities, i as canonicalEventsToReadableSpans, p as parentScopeRefOf, s as spanScopeRefOf, j as startOnlySpanAttributes } from './semconv-fPRb-dpU.js';
|
|
25
|
+
export { C as ContentWithholdingReason, D as DurableLogSpool, a as DurableLogSpoolOptions, b as DurableSpool, c as DurableSpoolOptions, L as LOG_MAPPING_VERSION, d as LOG_SIGNALS, e as LogContentPolicy, f as LogMappingOptions, g as LogMappingResult, h as LogSignal, i as LogSpoolBatch, j as LogsDeliverability, M as MAX_LOG_BODY_CHARACTERS, k as MAX_LOG_RECORDS_PER_BATCH, l as MAX_LOG_RECORDS_PER_EVENT, m as MCP_TOOL_NAME_PATTERN, N as NO_LOG_CONTENT, O as OtlpLogSinkOptions, n as OtlpLogTelemetrySink, o as OtlpTelemetrySink, p as OtlpTraceSinkOptions, S as SerializedLogRecord, q as SerializedSpan, r as SpoolBatch, s as SpoolDrainResult, t as SpoolEnqueueResult, u as canonicalEventsToLogRecords, v as createFileDurableLogSpool, w as createFileDurableSpool, x as createOtlpLogSink, y as createOtlpTraceSink, z as describeLogsDeliverability, A as logSignalOf, B as logSignalsForLifecycleEvents, E as resolveLogsEndpoint } from './otlp-log-sink-eUEjaLhk.js';
|
|
26
26
|
export { SignalFanoutOptions, SignalFanoutSink, createSignalFanout, shareCorrelationPerBatch } from './telemetry.js';
|
|
27
27
|
export { DeliveryHealthSnapshot, DeliverySubsystem, HealthTracker, HealthTrackerOptions, OverallHealth, createHealthTracker, summarizeHealth } from './diagnostics.js';
|
|
28
28
|
export { DeliveryReport, HookProcessInput, HookProcessOutcome, HookRuntime, HookRuntimeDelivery, HookRuntimeOptions, HookShutdownReport, UsageRollup, createHookRuntime, minimumStaleClaimMillis } from './integration.js';
|
|
@@ -41,6 +41,6 @@ import '@opentelemetry/sdk-logs';
|
|
|
41
41
|
*
|
|
42
42
|
* Updated by `scripts/release/sync-version.mjs` during semantic-release.
|
|
43
43
|
*/
|
|
44
|
-
declare const VERSION = "0.
|
|
44
|
+
declare const VERSION = "0.7.0";
|
|
45
45
|
|
|
46
46
|
export { VERSION };
|
package/dist/index.js
CHANGED
|
@@ -576,6 +576,7 @@ var targetHintSchema = z7.strictObject({
|
|
|
576
576
|
/** Absolute directory that relative `paths` resolve against. */
|
|
577
577
|
baseDirectory: localPathSchema.optional()
|
|
578
578
|
}).readonly();
|
|
579
|
+
var sessionCwdHint = (cwd) => cwd === void 0 || cwd.length === 0 ? void 0 : { source: "session-cwd", paths: [cwd] };
|
|
579
580
|
var worktreeKindSchema = z7.enum(["main", "linked"]);
|
|
580
581
|
var workspaceTargetSchema = z7.strictObject({
|
|
581
582
|
workspaceId: workspaceIdSchema,
|
|
@@ -840,7 +841,9 @@ var sessionStartEventSchema = event({
|
|
|
840
841
|
sessionKind: z9.enum(["interactive", "non-interactive", "unknown"]),
|
|
841
842
|
agentName: nonEmptyStringSchema.optional(),
|
|
842
843
|
agentVersion: nonEmptyStringSchema.optional(),
|
|
843
|
-
model: modelDescriptorSchema.optional()
|
|
844
|
+
model: modelDescriptorSchema.optional(),
|
|
845
|
+
/** The git worktree the session runs in, resolved by the core (ADR 0008). */
|
|
846
|
+
target: workspaceTargetSchema.optional()
|
|
844
847
|
});
|
|
845
848
|
var sessionEndEventSchema = event({
|
|
846
849
|
type: z9.literal("session.end"),
|
|
@@ -854,7 +857,9 @@ var promptSubmittedEventSchema = event({
|
|
|
854
857
|
type: z9.literal("prompt.submitted"),
|
|
855
858
|
promptSource: z9.enum(["user", "automation", "resumed", "unknown"]),
|
|
856
859
|
content: contentFactSchema.optional(),
|
|
857
|
-
turnIndex: z9.number().int().min(0).optional()
|
|
860
|
+
turnIndex: z9.number().int().min(0).optional(),
|
|
861
|
+
/** The git worktree the session runs in, resolved by the core (ADR 0008). */
|
|
862
|
+
target: workspaceTargetSchema.optional()
|
|
858
863
|
});
|
|
859
864
|
var generationStartEventSchema = event({
|
|
860
865
|
type: z9.literal("generation.start"),
|
|
@@ -954,6 +959,9 @@ var canonicalEventSchema = z9.discriminatedUnion("type", [
|
|
|
954
959
|
compactionPerformedEventSchema,
|
|
955
960
|
errorRaisedEventSchema
|
|
956
961
|
]);
|
|
962
|
+
var TARGETED_EVENT_TYPES = ["session.start", "prompt.submitted", "tool.start", "tool.end"];
|
|
963
|
+
var TARGETED = new Set(TARGETED_EVENT_TYPES);
|
|
964
|
+
var isTargetedEvent = (event3) => TARGETED.has(event3.type);
|
|
957
965
|
var validateCanonicalEvent = (value) => {
|
|
958
966
|
const parsed = canonicalEventSchema.safeParse(value);
|
|
959
967
|
if (parsed.success) {
|
|
@@ -1918,6 +1926,127 @@ var describeResolvedConfig = (config) => {
|
|
|
1918
1926
|
};
|
|
1919
1927
|
};
|
|
1920
1928
|
|
|
1929
|
+
// src/config/otlp-headers.ts
|
|
1930
|
+
var MAX_OTLP_HEADERS = 32;
|
|
1931
|
+
var OTLP_HEADER_VARIABLES = Object.freeze({
|
|
1932
|
+
generic: "OTEL_EXPORTER_OTLP_HEADERS",
|
|
1933
|
+
traces: "OTEL_EXPORTER_OTLP_TRACES_HEADERS",
|
|
1934
|
+
logs: "OTEL_EXPORTER_OTLP_LOGS_HEADERS"
|
|
1935
|
+
});
|
|
1936
|
+
var HEADER_NAME_PATTERN = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
1937
|
+
var isUnsafeHeaderValue = (value) => [...value].some((char) => {
|
|
1938
|
+
const code = char.codePointAt(0) ?? 0;
|
|
1939
|
+
return code < 32 && code !== 9 || code === 127 || code > 255;
|
|
1940
|
+
});
|
|
1941
|
+
var decode = (raw) => {
|
|
1942
|
+
try {
|
|
1943
|
+
return decodeURIComponent(raw);
|
|
1944
|
+
} catch {
|
|
1945
|
+
return void 0;
|
|
1946
|
+
}
|
|
1947
|
+
};
|
|
1948
|
+
var parseOtlpHeadersValue = (raw) => {
|
|
1949
|
+
const headers = {};
|
|
1950
|
+
const warnings = [];
|
|
1951
|
+
let overflowed = false;
|
|
1952
|
+
for (const [index, rawEntry] of raw.split(",").entries()) {
|
|
1953
|
+
const position = String(index + 1);
|
|
1954
|
+
const entry = rawEntry.trim();
|
|
1955
|
+
if (entry === "") {
|
|
1956
|
+
continue;
|
|
1957
|
+
}
|
|
1958
|
+
const equals = entry.indexOf("=");
|
|
1959
|
+
if (equals <= 0) {
|
|
1960
|
+
warnings.push(`entry ${position} is not a key=value pair; ignored`);
|
|
1961
|
+
continue;
|
|
1962
|
+
}
|
|
1963
|
+
const key = decode(entry.slice(0, equals).trim());
|
|
1964
|
+
const value = decode(entry.slice(equals + 1).trim());
|
|
1965
|
+
if (key === void 0 || value === void 0) {
|
|
1966
|
+
warnings.push(`entry ${position} has malformed percent-encoding; ignored`);
|
|
1967
|
+
continue;
|
|
1968
|
+
}
|
|
1969
|
+
const name = key.trim();
|
|
1970
|
+
const trimmedValue = value.trim();
|
|
1971
|
+
if (!HEADER_NAME_PATTERN.test(name)) {
|
|
1972
|
+
warnings.push(`entry ${position} does not name a valid HTTP header; ignored`);
|
|
1973
|
+
continue;
|
|
1974
|
+
}
|
|
1975
|
+
if (trimmedValue === "") {
|
|
1976
|
+
warnings.push(`entry ${position} has an empty value; ignored`);
|
|
1977
|
+
continue;
|
|
1978
|
+
}
|
|
1979
|
+
if (isUnsafeHeaderValue(trimmedValue)) {
|
|
1980
|
+
warnings.push(`entry ${position} has a character not allowed in an HTTP header value; ignored`);
|
|
1981
|
+
continue;
|
|
1982
|
+
}
|
|
1983
|
+
const existing = findHeaderName(headers, name);
|
|
1984
|
+
if (existing === void 0 && Object.keys(headers).length >= MAX_OTLP_HEADERS) {
|
|
1985
|
+
overflowed = true;
|
|
1986
|
+
continue;
|
|
1987
|
+
}
|
|
1988
|
+
if (existing !== void 0) {
|
|
1989
|
+
delete headers[existing];
|
|
1990
|
+
}
|
|
1991
|
+
headers[name] = trimmedValue;
|
|
1992
|
+
}
|
|
1993
|
+
if (overflowed) {
|
|
1994
|
+
warnings.push(`more than ${String(MAX_OTLP_HEADERS)} headers were supplied; the excess was ignored`);
|
|
1995
|
+
}
|
|
1996
|
+
return { headers, warnings };
|
|
1997
|
+
};
|
|
1998
|
+
var findHeaderName = (headers, name) => {
|
|
1999
|
+
const lower = name.toLowerCase();
|
|
2000
|
+
return Object.keys(headers).find((candidate) => candidate.toLowerCase() === lower);
|
|
2001
|
+
};
|
|
2002
|
+
var mergeOtlpHeaders = (...sources) => {
|
|
2003
|
+
const merged = {};
|
|
2004
|
+
for (const source of sources) {
|
|
2005
|
+
for (const [name, value] of Object.entries(source)) {
|
|
2006
|
+
const existing = findHeaderName(merged, name);
|
|
2007
|
+
if (existing !== void 0) {
|
|
2008
|
+
delete merged[existing];
|
|
2009
|
+
}
|
|
2010
|
+
merged[name] = value;
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
return merged;
|
|
2014
|
+
};
|
|
2015
|
+
var resolveOtlpHeaders = (env, explicit = {}) => {
|
|
2016
|
+
const warnings = [];
|
|
2017
|
+
const read = (variable) => {
|
|
2018
|
+
const raw = env[variable];
|
|
2019
|
+
if (raw === void 0 || raw.trim() === "") {
|
|
2020
|
+
return {};
|
|
2021
|
+
}
|
|
2022
|
+
const parsed = parseOtlpHeadersValue(raw);
|
|
2023
|
+
for (const detail of parsed.warnings) {
|
|
2024
|
+
warnings.push({ variable, detail });
|
|
2025
|
+
}
|
|
2026
|
+
return parsed.headers;
|
|
2027
|
+
};
|
|
2028
|
+
const generic = read(OTLP_HEADER_VARIABLES.generic);
|
|
2029
|
+
const traces = read(OTLP_HEADER_VARIABLES.traces);
|
|
2030
|
+
const logs = read(OTLP_HEADER_VARIABLES.logs);
|
|
2031
|
+
return {
|
|
2032
|
+
traces: mergeOtlpHeaders(generic, traces, explicit),
|
|
2033
|
+
logs: mergeOtlpHeaders(generic, logs, explicit),
|
|
2034
|
+
warnings
|
|
2035
|
+
};
|
|
2036
|
+
};
|
|
2037
|
+
var unionOtlpHeaderNames = (...lists) => {
|
|
2038
|
+
const names = [];
|
|
2039
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2040
|
+
for (const name of lists.flat()) {
|
|
2041
|
+
if (!seen.has(name.toLowerCase())) {
|
|
2042
|
+
seen.add(name.toLowerCase());
|
|
2043
|
+
names.push(name);
|
|
2044
|
+
}
|
|
2045
|
+
}
|
|
2046
|
+
return names.sort().slice(0, MAX_OTLP_HEADERS);
|
|
2047
|
+
};
|
|
2048
|
+
var describeOtlpHeaderNames = (...sources) => unionOtlpHeaderNames(...sources.map((source) => Object.keys(source)));
|
|
2049
|
+
|
|
1921
2050
|
// src/config/environment.ts
|
|
1922
2051
|
var ENVIRONMENT_VARIABLES = Object.freeze({
|
|
1923
2052
|
exporterEnabled: "OTEL_HOOK_ENABLED",
|
|
@@ -2087,11 +2216,17 @@ var parseEnvironmentConfig = (env) => {
|
|
|
2087
2216
|
...logsEndpoint === void 0 ? {} : { endpoint: logsEndpoint },
|
|
2088
2217
|
...logsIncludeContent === void 0 ? {} : { includeContent: logsIncludeContent }
|
|
2089
2218
|
};
|
|
2219
|
+
const otlpHeaders = resolveOtlpHeaders(env);
|
|
2220
|
+
for (const { variable, detail } of otlpHeaders.warnings) {
|
|
2221
|
+
warn(variable, detail);
|
|
2222
|
+
}
|
|
2223
|
+
const headerNames = describeOtlpHeaderNames(otlpHeaders.traces, otlpHeaders.logs);
|
|
2090
2224
|
const exporter = {
|
|
2091
2225
|
...exporterEnabled === void 0 ? {} : { enabled: exporterEnabled },
|
|
2092
2226
|
...endpoint === void 0 ? {} : { endpoint },
|
|
2093
2227
|
...protocol === void 0 ? {} : { protocol },
|
|
2094
2228
|
...timeoutMillis === void 0 ? {} : { timeoutMillis },
|
|
2229
|
+
...headerNames.length === 0 ? {} : { headerNames: [...headerNames] },
|
|
2095
2230
|
...serviceName === void 0 ? {} : { serviceName },
|
|
2096
2231
|
...serviceNamespace === void 0 ? {} : { serviceNamespace },
|
|
2097
2232
|
...Object.keys(resourceAttributes).length === 0 ? {} : { resourceAttributes },
|
|
@@ -2314,7 +2449,7 @@ var createEventFactory = (input) => {
|
|
|
2314
2449
|
});
|
|
2315
2450
|
}
|
|
2316
2451
|
built.push(parsed.data);
|
|
2317
|
-
if (targetHint !== void 0 && (parsed.data
|
|
2452
|
+
if (targetHint !== void 0 && isTargetedEvent(parsed.data)) {
|
|
2318
2453
|
const hint = targetHintSchema.safeParse(targetHint);
|
|
2319
2454
|
if (hint.success) {
|
|
2320
2455
|
hints.set(parsed.data.eventId, hint.data);
|
|
@@ -3147,7 +3282,7 @@ var claudeTargetHint = (toolName, toolInput, cwd) => {
|
|
|
3147
3282
|
}
|
|
3148
3283
|
}
|
|
3149
3284
|
}
|
|
3150
|
-
return cwd
|
|
3285
|
+
return sessionCwdHint(cwd);
|
|
3151
3286
|
};
|
|
3152
3287
|
|
|
3153
3288
|
// src/providers/claude/tool-kind.ts
|
|
@@ -3239,6 +3374,8 @@ var parseClaudeCode = (input, context) => {
|
|
|
3239
3374
|
const hint = claudeTargetHint(toolName, toolInput, payload.cwd);
|
|
3240
3375
|
return hint === void 0 ? {} : { targetHint: hint };
|
|
3241
3376
|
};
|
|
3377
|
+
const sessionHint = sessionCwdHint(payload.cwd);
|
|
3378
|
+
const sessionTarget = sessionHint === void 0 ? {} : { targetHint: sessionHint };
|
|
3242
3379
|
const withUsage = (usage) => {
|
|
3243
3380
|
const normalized = normalizeClaudeUsage(usage);
|
|
3244
3381
|
warnings.push(...normalized.warnings);
|
|
@@ -3250,7 +3387,8 @@ var parseClaudeCode = (input, context) => {
|
|
|
3250
3387
|
type: "session.start",
|
|
3251
3388
|
sessionKind: "unknown",
|
|
3252
3389
|
agentName: "claude-code",
|
|
3253
|
-
...payload.model === void 0 ? {} : { model: { modelId: payload.model } }
|
|
3390
|
+
...payload.model === void 0 ? {} : { model: { modelId: payload.model } },
|
|
3391
|
+
...sessionTarget
|
|
3254
3392
|
});
|
|
3255
3393
|
break;
|
|
3256
3394
|
case "SessionEnd":
|
|
@@ -3264,7 +3402,8 @@ var parseClaudeCode = (input, context) => {
|
|
|
3264
3402
|
factory.build({
|
|
3265
3403
|
type: "prompt.submitted",
|
|
3266
3404
|
promptSource: "user",
|
|
3267
|
-
content: context.privacy.describeContent({ kind: "prompt", role: "user", text: payload.prompt })
|
|
3405
|
+
content: context.privacy.describeContent({ kind: "prompt", role: "user", text: payload.prompt }),
|
|
3406
|
+
...sessionTarget
|
|
3268
3407
|
});
|
|
3269
3408
|
break;
|
|
3270
3409
|
case "PreToolUse":
|
|
@@ -3755,23 +3894,24 @@ var singleWorkspaceRoot = (payload) => {
|
|
|
3755
3894
|
const roots = (payload.workspace_roots ?? []).filter((root) => root.length > 0);
|
|
3756
3895
|
return roots.length === 1 ? roots[0] : void 0;
|
|
3757
3896
|
};
|
|
3758
|
-
var sessionHint = (root) => root === void 0 ? void 0 : { source: "session-cwd", paths: [root] };
|
|
3759
3897
|
var cursorTargetHint = (payload) => {
|
|
3760
3898
|
const root = singleWorkspaceRoot(payload);
|
|
3761
3899
|
const base = root === void 0 ? {} : { baseDirectory: root };
|
|
3762
3900
|
switch (payload.hook_event_name) {
|
|
3763
3901
|
case "afterFileEdit":
|
|
3764
3902
|
case "beforeReadFile":
|
|
3765
|
-
return payload.file_path.length === 0 ?
|
|
3903
|
+
return payload.file_path.length === 0 ? sessionCwdHint(root) : { source: "tool-path", paths: [payload.file_path], ...base };
|
|
3766
3904
|
case "beforeShellExecution":
|
|
3767
3905
|
case "afterShellExecution":
|
|
3768
|
-
return payload.cwd !== void 0 && payload.cwd.length > 0 ? { source: "shell-cwd", paths: [payload.cwd], ...base } :
|
|
3906
|
+
return payload.cwd !== void 0 && payload.cwd.length > 0 ? { source: "shell-cwd", paths: [payload.cwd], ...base } : sessionCwdHint(root);
|
|
3907
|
+
case "sessionStart":
|
|
3908
|
+
case "beforeSubmitPrompt":
|
|
3769
3909
|
case "preToolUse":
|
|
3770
3910
|
case "postToolUse":
|
|
3771
3911
|
case "postToolUseFailure":
|
|
3772
3912
|
case "beforeMCPExecution":
|
|
3773
3913
|
case "afterMCPExecution":
|
|
3774
|
-
return
|
|
3914
|
+
return sessionCwdHint(root);
|
|
3775
3915
|
default:
|
|
3776
3916
|
return void 0;
|
|
3777
3917
|
}
|
|
@@ -4058,7 +4198,8 @@ var createCursorAdapter = (options = {}) => {
|
|
|
4058
4198
|
agentName: "cursor",
|
|
4059
4199
|
...payload.cursor_version === void 0 || payload.cursor_version.length === 0 ? {} : { agentVersion: payload.cursor_version },
|
|
4060
4200
|
...model === UNKNOWN_MODEL2 ? {} : { model },
|
|
4061
|
-
...payload.composer_mode === void 0 ? {} : { extensions: { "cursor.composer_mode": payload.composer_mode } }
|
|
4201
|
+
...payload.composer_mode === void 0 ? {} : { extensions: { "cursor.composer_mode": payload.composer_mode } },
|
|
4202
|
+
...targetHintField
|
|
4062
4203
|
});
|
|
4063
4204
|
break;
|
|
4064
4205
|
case "sessionEnd":
|
|
@@ -4075,6 +4216,7 @@ var createCursorAdapter = (options = {}) => {
|
|
|
4075
4216
|
// Cursor reports no prompt provenance. `user` would be a guess: this
|
|
4076
4217
|
// hook also fires for an automation-driven or resumed turn.
|
|
4077
4218
|
promptSource: "unknown",
|
|
4219
|
+
...targetHintField,
|
|
4078
4220
|
...payload.prompt === void 0 ? {} : {
|
|
4079
4221
|
content: context.privacy.describeContent({
|
|
4080
4222
|
kind: "prompt",
|
|
@@ -4625,7 +4767,7 @@ var codexTargetHint = (toolName, toolInput, cwd) => {
|
|
|
4625
4767
|
...cwd === void 0 ? {} : { baseDirectory: cwd }
|
|
4626
4768
|
};
|
|
4627
4769
|
}
|
|
4628
|
-
return cwd
|
|
4770
|
+
return sessionCwdHint(cwd);
|
|
4629
4771
|
};
|
|
4630
4772
|
|
|
4631
4773
|
// src/providers/codex/tool-kind.ts
|
|
@@ -4861,6 +5003,8 @@ var parse = (input, context) => {
|
|
|
4861
5003
|
const hint = codexTargetHint(toolName, toolInput, payload.cwd);
|
|
4862
5004
|
return hint === void 0 ? {} : { targetHint: hint };
|
|
4863
5005
|
};
|
|
5006
|
+
const sessionHint = sessionCwdHint(payload.cwd);
|
|
5007
|
+
const sessionTarget = sessionHint === void 0 ? {} : { targetHint: sessionHint };
|
|
4864
5008
|
const buildUsage = (usage) => {
|
|
4865
5009
|
if (usage === void 0) {
|
|
4866
5010
|
return void 0;
|
|
@@ -4880,7 +5024,8 @@ var parse = (input, context) => {
|
|
|
4880
5024
|
agentName: "codex",
|
|
4881
5025
|
occurredAt,
|
|
4882
5026
|
...payload.codex_version === void 0 ? {} : { agentVersion: payload.codex_version },
|
|
4883
|
-
...payload.model === void 0 ? {} : { model: { modelId: payload.model, vendor: "openai" } }
|
|
5027
|
+
...payload.model === void 0 ? {} : { model: { modelId: payload.model, vendor: "openai" } },
|
|
5028
|
+
...sessionTarget
|
|
4884
5029
|
});
|
|
4885
5030
|
break;
|
|
4886
5031
|
case "UserPromptSubmit":
|
|
@@ -4888,6 +5033,7 @@ var parse = (input, context) => {
|
|
|
4888
5033
|
type: "prompt.submitted",
|
|
4889
5034
|
promptSource: "user",
|
|
4890
5035
|
occurredAt,
|
|
5036
|
+
...sessionTarget,
|
|
4891
5037
|
...payload.prompt === void 0 ? {} : {
|
|
4892
5038
|
content: context.privacy.describeContent({
|
|
4893
5039
|
kind: "prompt",
|
|
@@ -6409,9 +6555,7 @@ var resolveHint = async (hint, locator, privacy) => {
|
|
|
6409
6555
|
return parsed.success ? parsed.data : void 0;
|
|
6410
6556
|
};
|
|
6411
6557
|
var resolveEventTargets = async (input) => {
|
|
6412
|
-
const pending = input.events.filter(
|
|
6413
|
-
(event3) => (event3.type === "tool.start" || event3.type === "tool.end") && input.hints.has(event3.eventId)
|
|
6414
|
-
);
|
|
6558
|
+
const pending = input.events.filter((event3) => isTargetedEvent(event3) && input.hints.has(event3.eventId));
|
|
6415
6559
|
if (pending.length === 0) {
|
|
6416
6560
|
return { events: input.events, resolved: 0, timedOut: false };
|
|
6417
6561
|
}
|
|
@@ -6443,7 +6587,7 @@ var resolveEventTargets = async (input) => {
|
|
|
6443
6587
|
const settled = new Map(targets);
|
|
6444
6588
|
const events = input.events.map((event3) => {
|
|
6445
6589
|
const target = settled.get(event3.eventId);
|
|
6446
|
-
if (target === void 0 || event3
|
|
6590
|
+
if (target === void 0 || !isTargetedEvent(event3)) {
|
|
6447
6591
|
return event3;
|
|
6448
6592
|
}
|
|
6449
6593
|
return { ...event3, target };
|
|
@@ -7664,7 +7808,7 @@ import {
|
|
|
7664
7808
|
} from "@opentelemetry/semantic-conventions/incubating";
|
|
7665
7809
|
|
|
7666
7810
|
// src/version.ts
|
|
7667
|
-
var VERSION = "0.
|
|
7811
|
+
var VERSION = "0.7.0";
|
|
7668
7812
|
|
|
7669
7813
|
// src/telemetry/export-identity.ts
|
|
7670
7814
|
import { ATTR_SESSION_ID } from "@opentelemetry/semantic-conventions/incubating";
|
|
@@ -7679,7 +7823,10 @@ var ATTR_OTELHOOK_INVOCATION_ID = "otelhook.invocation.id";
|
|
|
7679
7823
|
var ATTR_OTELHOOK_PROVIDER_ID = "otelhook.provider.id";
|
|
7680
7824
|
var ATTR_OTELHOOK_PROVIDER_VERSION = "otelhook.provider.version";
|
|
7681
7825
|
var ATTR_OTELHOOK_WORKSPACE_ID = "otelhook.workspace.id";
|
|
7682
|
-
var
|
|
7826
|
+
var EXTERNAL_SESSION_KEY_ATTRIBUTES = Object.freeze([
|
|
7827
|
+
ATTR_SESSION_ID,
|
|
7828
|
+
"har.session_key"
|
|
7829
|
+
]);
|
|
7683
7830
|
var ATTR_OTELHOOK_SUBAGENT_ID = "otelhook.subagent.id";
|
|
7684
7831
|
var ATTR_VCS_REF_HEAD_NAME = "vcs.ref.head.name";
|
|
7685
7832
|
var ATTR_OTELHOOK_TARGET_WORKSPACE_ID = "otelhook.target.workspace.id";
|
|
@@ -7688,7 +7835,7 @@ var ATTR_OTELHOOK_TARGET_REPOSITORY_ID = "otelhook.target.repository.id";
|
|
|
7688
7835
|
var ATTR_OTELHOOK_TARGET_WORKTREE_KIND = "otelhook.target.worktree.kind";
|
|
7689
7836
|
var ATTR_OTELHOOK_USAGE_TEMPORALITY = "otelhook.usage.temporality";
|
|
7690
7837
|
var targetAttributes = (event3) => {
|
|
7691
|
-
if (event3
|
|
7838
|
+
if (!isTargetedEvent(event3) || event3.target === void 0) {
|
|
7692
7839
|
return {};
|
|
7693
7840
|
}
|
|
7694
7841
|
const { target } = event3;
|
|
@@ -7712,11 +7859,13 @@ var passthroughHarAttributes = (resource) => {
|
|
|
7712
7859
|
return attributes;
|
|
7713
7860
|
};
|
|
7714
7861
|
var resolveExportedSessionId = (eventSessionId, resource) => {
|
|
7715
|
-
const
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7862
|
+
for (const key of EXTERNAL_SESSION_KEY_ATTRIBUTES) {
|
|
7863
|
+
const supplied = resource.attributes[key];
|
|
7864
|
+
if (typeof supplied === "string") {
|
|
7865
|
+
const trimmed = supplied.trim();
|
|
7866
|
+
if (trimmed.length > 0) {
|
|
7867
|
+
return { sessionId: trimmed, providerSessionId: eventSessionId };
|
|
7868
|
+
}
|
|
7720
7869
|
}
|
|
7721
7870
|
}
|
|
7722
7871
|
return { sessionId: eventSessionId, providerSessionId: eventSessionId };
|
|
@@ -7813,10 +7962,13 @@ var parentScopeRefOf = (event3) => {
|
|
|
7813
7962
|
};
|
|
7814
7963
|
var startOnlySpanAttributes = (event3) => {
|
|
7815
7964
|
switch (event3.type) {
|
|
7965
|
+
// The session's own worktree is carried forward like a tool's target, so
|
|
7966
|
+
// the session span a later `session.end` process exports still names it.
|
|
7816
7967
|
case "session.start":
|
|
7817
7968
|
return {
|
|
7818
7969
|
...event3.agentName === void 0 ? {} : { [ATTR_OTELHOOK_AGENT_NAME]: event3.agentName },
|
|
7819
|
-
...event3.agentVersion === void 0 ? {} : { [ATTR_OTELHOOK_AGENT_VERSION]: event3.agentVersion }
|
|
7970
|
+
...event3.agentVersion === void 0 ? {} : { [ATTR_OTELHOOK_AGENT_VERSION]: event3.agentVersion },
|
|
7971
|
+
...targetAttributes(event3)
|
|
7820
7972
|
};
|
|
7821
7973
|
case "generation.start":
|
|
7822
7974
|
return {
|
|
@@ -7994,7 +8146,8 @@ var buildLifecycleSpan = (plan, resource, scope) => {
|
|
|
7994
8146
|
name = "session";
|
|
7995
8147
|
kind = SpanKind.INTERNAL;
|
|
7996
8148
|
attributes = {
|
|
7997
|
-
...attributes,
|
|
8149
|
+
...withoutTarget(attributes),
|
|
8150
|
+
...strongestTarget([pickTarget(resolved.recovered), start === void 0 ? {} : targetAttributes(start)]),
|
|
7998
8151
|
...start?.agentName === void 0 ? {} : { [ATTR_OTELHOOK_AGENT_NAME]: start.agentName },
|
|
7999
8152
|
...start?.agentVersion === void 0 ? {} : { [ATTR_OTELHOOK_AGENT_VERSION]: start.agentVersion },
|
|
8000
8153
|
...end === void 0 ? {} : { [ATTR_OTELHOOK_OUTCOME]: end.reason },
|
|
@@ -8099,7 +8252,7 @@ var buildStandaloneSpan = (event3, resource, scope) => {
|
|
|
8099
8252
|
switch (event3.type) {
|
|
8100
8253
|
case "prompt.submitted":
|
|
8101
8254
|
name = "prompt";
|
|
8102
|
-
attributes = { ...attributes, "otelhook.prompt.source": event3.promptSource };
|
|
8255
|
+
attributes = { ...attributes, "otelhook.prompt.source": event3.promptSource, ...targetAttributes(event3) };
|
|
8103
8256
|
break;
|
|
8104
8257
|
case "compaction.performed":
|
|
8105
8258
|
name = "compaction";
|
|
@@ -9840,7 +9993,8 @@ var eventAttributes = (event3) => {
|
|
|
9840
9993
|
[ATTR_OTELHOOK_SESSION_KIND]: event3.sessionKind,
|
|
9841
9994
|
...event3.agentName === void 0 ? {} : { [ATTR_OTELHOOK_AGENT_NAME2]: event3.agentName },
|
|
9842
9995
|
...event3.agentVersion === void 0 ? {} : { [ATTR_OTELHOOK_AGENT_VERSION2]: event3.agentVersion },
|
|
9843
|
-
...event3.model === void 0 ? {} : { [ATTR_GEN_AI_REQUEST_MODEL2]: event3.model.modelId }
|
|
9996
|
+
...event3.model === void 0 ? {} : { [ATTR_GEN_AI_REQUEST_MODEL2]: event3.model.modelId },
|
|
9997
|
+
...targetAttributes(event3)
|
|
9844
9998
|
};
|
|
9845
9999
|
case "session.end":
|
|
9846
10000
|
return {
|
|
@@ -9850,7 +10004,8 @@ var eventAttributes = (event3) => {
|
|
|
9850
10004
|
case "prompt.submitted":
|
|
9851
10005
|
return {
|
|
9852
10006
|
[ATTR_OTELHOOK_PROMPT_SOURCE]: event3.promptSource,
|
|
9853
|
-
...event3.turnIndex === void 0 ? {} : { [ATTR_OTELHOOK_PROMPT_TURN_INDEX]: event3.turnIndex }
|
|
10007
|
+
...event3.turnIndex === void 0 ? {} : { [ATTR_OTELHOOK_PROMPT_TURN_INDEX]: event3.turnIndex },
|
|
10008
|
+
...targetAttributes(event3)
|
|
9854
10009
|
};
|
|
9855
10010
|
case "generation.start":
|
|
9856
10011
|
return {
|
|
@@ -10577,9 +10732,10 @@ var createHookRuntime = (options) => {
|
|
|
10577
10732
|
...spool === void 0 ? {} : { spool },
|
|
10578
10733
|
correlate
|
|
10579
10734
|
});
|
|
10735
|
+
const logHeaders = options.logHeaders ?? options.headers;
|
|
10580
10736
|
const logSink = createOtlpLogSink({
|
|
10581
10737
|
exporter: options.config.exporter,
|
|
10582
|
-
...
|
|
10738
|
+
...logHeaders === void 0 ? {} : { headers: logHeaders },
|
|
10583
10739
|
providerId: options.providerNamespace,
|
|
10584
10740
|
installationId: options.installationId,
|
|
10585
10741
|
clock,
|
|
@@ -12450,6 +12606,7 @@ export {
|
|
|
12450
12606
|
MAX_LOG_BODY_CHARACTERS,
|
|
12451
12607
|
MAX_LOG_RECORDS_PER_BATCH,
|
|
12452
12608
|
MAX_LOG_RECORDS_PER_EVENT,
|
|
12609
|
+
MAX_OTLP_HEADERS,
|
|
12453
12610
|
MAX_RECOVERED_START_ATTRIBUTES,
|
|
12454
12611
|
MAX_RESOURCE_ATTRIBUTES,
|
|
12455
12612
|
MAX_RESOURCE_ATTRIBUTE_KEY_LENGTH,
|
|
@@ -12459,6 +12616,7 @@ export {
|
|
|
12459
12616
|
MAX_WORKTREE_WALK_DEPTH,
|
|
12460
12617
|
MCP_TOOL_NAME_PATTERN,
|
|
12461
12618
|
NO_LOG_CONTENT,
|
|
12619
|
+
OTLP_HEADER_VARIABLES,
|
|
12462
12620
|
OtelHookError,
|
|
12463
12621
|
PROVIDERS_WITHOUT_VERIFIED_LOCATION,
|
|
12464
12622
|
PROVIDERS_WITH_VERIFIED_LOCATION,
|
|
@@ -12476,6 +12634,7 @@ export {
|
|
|
12476
12634
|
SPAN_RECORD_VERSION,
|
|
12477
12635
|
SUBAGENT_ID_PATTERN,
|
|
12478
12636
|
SUPPORTED_REGISTRATION_PROVIDER_IDS,
|
|
12637
|
+
TARGETED_EVENT_TYPES,
|
|
12479
12638
|
UNKNOWN_PROVIDER_ID,
|
|
12480
12639
|
UNKNOWN_WORKSPACE_ID,
|
|
12481
12640
|
UsageNormalizationError,
|
|
@@ -12558,6 +12717,7 @@ export {
|
|
|
12558
12717
|
describeAdapter,
|
|
12559
12718
|
describeErrorCode,
|
|
12560
12719
|
describeLogsDeliverability,
|
|
12720
|
+
describeOtlpHeaderNames,
|
|
12561
12721
|
describeProviderCatalog,
|
|
12562
12722
|
describeResolvedConfig,
|
|
12563
12723
|
describeResourceAttributeNames,
|
|
@@ -12598,6 +12758,7 @@ export {
|
|
|
12598
12758
|
isReservedExtensionNamespace,
|
|
12599
12759
|
isReservedResourceAttributeKey,
|
|
12600
12760
|
isSecretResourceAttributeKey,
|
|
12761
|
+
isTargetedEvent,
|
|
12601
12762
|
isUnavailableContentFact,
|
|
12602
12763
|
isUnknownProvider,
|
|
12603
12764
|
isValidExtensionKey,
|
|
@@ -12613,6 +12774,7 @@ export {
|
|
|
12613
12774
|
mergeCursorHookRegistration,
|
|
12614
12775
|
mergeGeminiHookRegistration,
|
|
12615
12776
|
mergeNestedHookRegistration,
|
|
12777
|
+
mergeOtlpHeaders,
|
|
12616
12778
|
minimumStaleClaimMillis,
|
|
12617
12779
|
modelDescriptorSchema,
|
|
12618
12780
|
nonEmptyStringSchema,
|
|
@@ -12628,6 +12790,7 @@ export {
|
|
|
12628
12790
|
parseEnvironmentConfig,
|
|
12629
12791
|
parseGitDirFile,
|
|
12630
12792
|
parseHeadBranch,
|
|
12793
|
+
parseOtlpHeadersValue,
|
|
12631
12794
|
parseResourceAttributesValue,
|
|
12632
12795
|
planProviderRegistration,
|
|
12633
12796
|
privacyLimitsSchema,
|
|
@@ -12663,6 +12826,7 @@ export {
|
|
|
12663
12826
|
resolveInstallPath,
|
|
12664
12827
|
resolveInvocationIdentity,
|
|
12665
12828
|
resolveLogsEndpoint,
|
|
12829
|
+
resolveOtlpHeaders,
|
|
12666
12830
|
resolvePrivacyPolicy,
|
|
12667
12831
|
resolvedProviderIdSchema,
|
|
12668
12832
|
resourceAttributeValueSchema,
|
|
@@ -12670,6 +12834,7 @@ export {
|
|
|
12670
12834
|
runRegistrationLifecycle,
|
|
12671
12835
|
sanitizeResourceAttributes,
|
|
12672
12836
|
sequenceNumberSchema,
|
|
12837
|
+
sessionCwdHint,
|
|
12673
12838
|
sessionEndEventSchema,
|
|
12674
12839
|
sessionIdSchema,
|
|
12675
12840
|
sessionStartEventSchema,
|
|
@@ -12691,6 +12856,7 @@ export {
|
|
|
12691
12856
|
toolEndEventSchema,
|
|
12692
12857
|
toolKindSchema,
|
|
12693
12858
|
toolStartEventSchema,
|
|
12859
|
+
unionOtlpHeaderNames,
|
|
12694
12860
|
unknownDetection,
|
|
12695
12861
|
unknownWorkspaceIdentity,
|
|
12696
12862
|
usageReportSchema,
|