@osfactory/otel-hook 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{adapter-BS7xHKGQ.d.ts → adapter-BJiz6lqM.d.ts} +2 -2
- package/dist/cli.js +47 -24
- package/dist/cli.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 +11 -11
- package/dist/index.js +50 -24
- 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 +8 -8
- package/dist/integration.js +2264 -2253
- package/dist/integration.js.map +1 -1
- package/dist/lifecycle.d.ts +3 -3
- package/dist/lifecycle.js +757 -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 +945 -412
- 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
|
@@ -209,6 +209,11 @@ declare const targetHintSchema: z.ZodReadonly<z.ZodObject<{
|
|
|
209
209
|
baseDirectory: z.ZodOptional<z.ZodString>;
|
|
210
210
|
}, z.core.$strict>>;
|
|
211
211
|
type TargetHint = z.infer<typeof targetHintSchema>;
|
|
212
|
+
/**
|
|
213
|
+
* The weakest hint: the session's own directory. Every adapter gives it to a
|
|
214
|
+
* session start and a prompt, and to a tool call that names no path.
|
|
215
|
+
*/
|
|
216
|
+
declare const sessionCwdHint: (cwd: string | undefined) => TargetHint | undefined;
|
|
212
217
|
/**
|
|
213
218
|
* Whether a worktree is its repository's main checkout (`main`) or one added
|
|
214
219
|
* beside it with `git worktree add` (`linked`).
|
|
@@ -347,6 +352,20 @@ declare const sessionStartEventSchema: z.ZodObject<{
|
|
|
347
352
|
vendor: z.ZodOptional<z.ZodString>;
|
|
348
353
|
family: z.ZodOptional<z.ZodString>;
|
|
349
354
|
}, z.core.$strict>>;
|
|
355
|
+
target: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
|
|
356
|
+
workspaceId: z.core.$ZodBranded<z.ZodString, "WorkspaceId", "out">;
|
|
357
|
+
vcsBranchName: z.ZodOptional<z.ZodString>;
|
|
358
|
+
source: z.ZodEnum<{
|
|
359
|
+
"tool-path": "tool-path";
|
|
360
|
+
"shell-cwd": "shell-cwd";
|
|
361
|
+
"session-cwd": "session-cwd";
|
|
362
|
+
}>;
|
|
363
|
+
repositoryId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "WorkspaceId", "out">>;
|
|
364
|
+
worktreeKind: z.ZodOptional<z.ZodEnum<{
|
|
365
|
+
main: "main";
|
|
366
|
+
linked: "linked";
|
|
367
|
+
}>>;
|
|
368
|
+
}, z.core.$strict>>>;
|
|
350
369
|
}, z.core.$strict>;
|
|
351
370
|
declare const sessionEndEventSchema: z.ZodObject<{
|
|
352
371
|
schemaVersion: z.ZodLiteral<1>;
|
|
@@ -512,6 +531,20 @@ declare const promptSubmittedEventSchema: z.ZodObject<{
|
|
|
512
531
|
label: z.ZodOptional<z.ZodString>;
|
|
513
532
|
}, z.core.$strict>>;
|
|
514
533
|
turnIndex: z.ZodOptional<z.ZodNumber>;
|
|
534
|
+
target: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
|
|
535
|
+
workspaceId: z.core.$ZodBranded<z.ZodString, "WorkspaceId", "out">;
|
|
536
|
+
vcsBranchName: z.ZodOptional<z.ZodString>;
|
|
537
|
+
source: z.ZodEnum<{
|
|
538
|
+
"tool-path": "tool-path";
|
|
539
|
+
"shell-cwd": "shell-cwd";
|
|
540
|
+
"session-cwd": "session-cwd";
|
|
541
|
+
}>;
|
|
542
|
+
repositoryId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "WorkspaceId", "out">>;
|
|
543
|
+
worktreeKind: z.ZodOptional<z.ZodEnum<{
|
|
544
|
+
main: "main";
|
|
545
|
+
linked: "linked";
|
|
546
|
+
}>>;
|
|
547
|
+
}, z.core.$strict>>>;
|
|
515
548
|
}, z.core.$strict>;
|
|
516
549
|
declare const generationStartEventSchema: z.ZodObject<{
|
|
517
550
|
schemaVersion: z.ZodLiteral<1>;
|
|
@@ -1304,6 +1337,20 @@ declare const canonicalEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1304
1337
|
vendor: z.ZodOptional<z.ZodString>;
|
|
1305
1338
|
family: z.ZodOptional<z.ZodString>;
|
|
1306
1339
|
}, z.core.$strict>>;
|
|
1340
|
+
target: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
|
|
1341
|
+
workspaceId: z.core.$ZodBranded<z.ZodString, "WorkspaceId", "out">;
|
|
1342
|
+
vcsBranchName: z.ZodOptional<z.ZodString>;
|
|
1343
|
+
source: z.ZodEnum<{
|
|
1344
|
+
"tool-path": "tool-path";
|
|
1345
|
+
"shell-cwd": "shell-cwd";
|
|
1346
|
+
"session-cwd": "session-cwd";
|
|
1347
|
+
}>;
|
|
1348
|
+
repositoryId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "WorkspaceId", "out">>;
|
|
1349
|
+
worktreeKind: z.ZodOptional<z.ZodEnum<{
|
|
1350
|
+
main: "main";
|
|
1351
|
+
linked: "linked";
|
|
1352
|
+
}>>;
|
|
1353
|
+
}, z.core.$strict>>>;
|
|
1307
1354
|
}, z.core.$strict>, z.ZodObject<{
|
|
1308
1355
|
schemaVersion: z.ZodLiteral<1>;
|
|
1309
1356
|
eventId: z.core.$ZodBranded<z.ZodString, "EventId", "out">;
|
|
@@ -1467,6 +1514,20 @@ declare const canonicalEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1467
1514
|
label: z.ZodOptional<z.ZodString>;
|
|
1468
1515
|
}, z.core.$strict>>;
|
|
1469
1516
|
turnIndex: z.ZodOptional<z.ZodNumber>;
|
|
1517
|
+
target: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
|
|
1518
|
+
workspaceId: z.core.$ZodBranded<z.ZodString, "WorkspaceId", "out">;
|
|
1519
|
+
vcsBranchName: z.ZodOptional<z.ZodString>;
|
|
1520
|
+
source: z.ZodEnum<{
|
|
1521
|
+
"tool-path": "tool-path";
|
|
1522
|
+
"shell-cwd": "shell-cwd";
|
|
1523
|
+
"session-cwd": "session-cwd";
|
|
1524
|
+
}>;
|
|
1525
|
+
repositoryId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "WorkspaceId", "out">>;
|
|
1526
|
+
worktreeKind: z.ZodOptional<z.ZodEnum<{
|
|
1527
|
+
main: "main";
|
|
1528
|
+
linked: "linked";
|
|
1529
|
+
}>>;
|
|
1530
|
+
}, z.core.$strict>>>;
|
|
1470
1531
|
}, z.core.$strict>, z.ZodObject<{
|
|
1471
1532
|
schemaVersion: z.ZodLiteral<1>;
|
|
1472
1533
|
eventId: z.core.$ZodBranded<z.ZodString, "EventId", "out">;
|
|
@@ -2202,6 +2263,16 @@ type ErrorRaisedEvent = z.infer<typeof errorRaisedEventSchema>;
|
|
|
2202
2263
|
type CanonicalEventOfType<TType extends CanonicalEventType> = Extract<CanonicalEvent, {
|
|
2203
2264
|
type: TType;
|
|
2204
2265
|
}>;
|
|
2266
|
+
/**
|
|
2267
|
+
* The event types that may carry a resolved `target` (ADR 0008): a tool call
|
|
2268
|
+
* names the worktree it touched; a session start and a prompt name the one the
|
|
2269
|
+
* session runs in, so a consumer knows the session's place before its first
|
|
2270
|
+
* tool call.
|
|
2271
|
+
*/
|
|
2272
|
+
declare const TARGETED_EVENT_TYPES: readonly ["session.start", "prompt.submitted", "tool.start", "tool.end"];
|
|
2273
|
+
type TargetedEventType = (typeof TARGETED_EVENT_TYPES)[number];
|
|
2274
|
+
type TargetedEvent = CanonicalEventOfType<TargetedEventType>;
|
|
2275
|
+
declare const isTargetedEvent: (event: CanonicalEvent) => event is TargetedEvent;
|
|
2205
2276
|
type EventValidationResult = {
|
|
2206
2277
|
readonly status: "ok";
|
|
2207
2278
|
readonly event: CanonicalEvent;
|
|
@@ -2217,4 +2288,4 @@ declare const eventUsage: (event: CanonicalEvent) => CanonicalUsage | undefined;
|
|
|
2217
2288
|
/** Stable ordering: by sequence, then by timestamp, then by event id. */
|
|
2218
2289
|
declare const compareEvents: (a: CanonicalEvent, b: CanonicalEvent) => number;
|
|
2219
2290
|
|
|
2220
|
-
export {
|
|
2291
|
+
export { generationEndEventSchema as $, type ToolStartEvent as A, UsageNormalizationError as B, CANONICAL_EVENT_TYPES as C, type UsageNormalizationIssue as D, EMPTY_DELTA_USAGE as E, type UsageNormalizationResult as F, type GenerationEndEvent as G, type UsageReport as H, type UsageTemporality as I, type WorktreeKind as J, addUsage as K, cacheCreationAccountingSchema as L, MAX_TARGET_HINT_PATHS as M, canonicalEventSchema as N, canonicalEventTypeSchema as O, type PromptSubmittedEvent as P, canonicalUsageSchema as Q, compactionPerformedEventSchema as R, SUBAGENT_ID_PATTERN as S, TARGETED_EVENT_TYPES as T, type UsageDeltaResult as U, compareEvents as V, type WorkspaceTarget as W, costFactsSchema as X, cumulativeToDelta as Y, errorRaisedEventSchema as Z, eventUsage as _, type CacheCreationAccounting as a, generationStartEventSchema as a0, isTargetedEvent as a1, modelDescriptorSchema as a2, normalizeUsage as a3, normalizeUsageOrThrow as a4, parseCanonicalEvent as a5, promptSubmittedEventSchema as a6, providerTotalAgreementSchema as a7, sessionCwdHint as a8, sessionEndEventSchema as a9, sessionStartEventSchema as aa, subagentEndEventSchema as ab, subagentIdSchema as ac, subagentStartEventSchema as ad, targetHintSchema as ae, targetSourceSchema as af, toReport as ag, toolEndEventSchema as ah, toolKindSchema as ai, toolStartEventSchema as aj, usageReportSchema as ak, usageTemporalitySchema as al, validateCanonicalEvent as am, workspaceTargetSchema as an, worktreeKindSchema as ao, type CanonicalEvent as b, type CanonicalEventInput as c, type CanonicalEventOfType as d, type CanonicalEventType as e, type CanonicalUsage as f, type CompactionPerformedEvent as g, type CostFacts as h, type ErrorRaisedEvent as i, type EventOutcome as j, type EventValidationResult as k, type GenerationStartEvent as l, MAX_TARGET_PATH_LENGTH as m, type ModelDescriptor as n, type ProviderTotalAgreement as o, type SessionEndEvent as p, type SessionStartEvent as q, type SubagentEndEvent as r, type SubagentId as s, type SubagentStartEvent as t, type TargetHint as u, type TargetSource as v, type TargetedEvent as w, type TargetedEventType as x, type ToolEndEvent as y, type ToolKind as z };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { O as OtelHookConfig } from './schema-Cn0-xz8L.js';
|
|
3
3
|
import { OtelHookErrorInfo } from './errors.js';
|
|
4
|
-
import { b as CanonicalEvent,
|
|
4
|
+
import { b as CanonicalEvent, I as UsageTemporality, f as CanonicalUsage } from './events-B3MHoJTD.js';
|
|
5
5
|
import { I as IdentityClaim, W as WorkspaceIdentity, d as InvocationIdentity } from './identity-BrVBs901.js';
|
|
6
6
|
import { h as SourceTransport, R as ResolvedProviderId, c as DetectionConfidence, d as EventId } from './primitives-CJ8-rn-f.js';
|
|
7
7
|
import { P as PrivacyService } from './service-CbI9CObT.js';
|
|
8
|
-
import { b as DeliveryIdentifierSupport, f as ProviderDeliveryClaim, j as ProviderHookResponse } from './adapter-
|
|
9
|
-
import { P as ProviderRegistry } from './registry-
|
|
10
|
-
import { I as IdGenerator, g as TelemetrySink, e as StateStore, C as Clock, d as Logger, W as WorktreeLocator } from './ports-
|
|
8
|
+
import { b as DeliveryIdentifierSupport, f as ProviderDeliveryClaim, j as ProviderHookResponse } from './adapter-BJiz6lqM.js';
|
|
9
|
+
import { P as ProviderRegistry } from './registry-CIVvRlVK.js';
|
|
10
|
+
import { I as IdGenerator, g as TelemetrySink, e as StateStore, C as Clock, d as Logger, W as WorktreeLocator } from './ports-n7KFOpKo.js';
|
|
11
11
|
import { A as AttributionOutcome, a as AttributionReason } from './taxonomy-DwhTtuWd.js';
|
|
12
12
|
|
|
13
13
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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';
|
|
@@ -9,20 +9,20 @@ export { D as DescribeContentInput, a as DescribeStructuredInput, P as PrivacySe
|
|
|
9
9
|
export { WorkspaceKeyInput, WorkspaceLabels, canonicalizeGitRemote, deriveWorkspaceIdentity } from './privacy.js';
|
|
10
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';
|
|
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.6.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) {
|
|
@@ -2314,7 +2322,7 @@ var createEventFactory = (input) => {
|
|
|
2314
2322
|
});
|
|
2315
2323
|
}
|
|
2316
2324
|
built.push(parsed.data);
|
|
2317
|
-
if (targetHint !== void 0 && (parsed.data
|
|
2325
|
+
if (targetHint !== void 0 && isTargetedEvent(parsed.data)) {
|
|
2318
2326
|
const hint = targetHintSchema.safeParse(targetHint);
|
|
2319
2327
|
if (hint.success) {
|
|
2320
2328
|
hints.set(parsed.data.eventId, hint.data);
|
|
@@ -3147,7 +3155,7 @@ var claudeTargetHint = (toolName, toolInput, cwd) => {
|
|
|
3147
3155
|
}
|
|
3148
3156
|
}
|
|
3149
3157
|
}
|
|
3150
|
-
return cwd
|
|
3158
|
+
return sessionCwdHint(cwd);
|
|
3151
3159
|
};
|
|
3152
3160
|
|
|
3153
3161
|
// src/providers/claude/tool-kind.ts
|
|
@@ -3239,6 +3247,8 @@ var parseClaudeCode = (input, context) => {
|
|
|
3239
3247
|
const hint = claudeTargetHint(toolName, toolInput, payload.cwd);
|
|
3240
3248
|
return hint === void 0 ? {} : { targetHint: hint };
|
|
3241
3249
|
};
|
|
3250
|
+
const sessionHint = sessionCwdHint(payload.cwd);
|
|
3251
|
+
const sessionTarget = sessionHint === void 0 ? {} : { targetHint: sessionHint };
|
|
3242
3252
|
const withUsage = (usage) => {
|
|
3243
3253
|
const normalized = normalizeClaudeUsage(usage);
|
|
3244
3254
|
warnings.push(...normalized.warnings);
|
|
@@ -3250,7 +3260,8 @@ var parseClaudeCode = (input, context) => {
|
|
|
3250
3260
|
type: "session.start",
|
|
3251
3261
|
sessionKind: "unknown",
|
|
3252
3262
|
agentName: "claude-code",
|
|
3253
|
-
...payload.model === void 0 ? {} : { model: { modelId: payload.model } }
|
|
3263
|
+
...payload.model === void 0 ? {} : { model: { modelId: payload.model } },
|
|
3264
|
+
...sessionTarget
|
|
3254
3265
|
});
|
|
3255
3266
|
break;
|
|
3256
3267
|
case "SessionEnd":
|
|
@@ -3264,7 +3275,8 @@ var parseClaudeCode = (input, context) => {
|
|
|
3264
3275
|
factory.build({
|
|
3265
3276
|
type: "prompt.submitted",
|
|
3266
3277
|
promptSource: "user",
|
|
3267
|
-
content: context.privacy.describeContent({ kind: "prompt", role: "user", text: payload.prompt })
|
|
3278
|
+
content: context.privacy.describeContent({ kind: "prompt", role: "user", text: payload.prompt }),
|
|
3279
|
+
...sessionTarget
|
|
3268
3280
|
});
|
|
3269
3281
|
break;
|
|
3270
3282
|
case "PreToolUse":
|
|
@@ -3755,23 +3767,24 @@ var singleWorkspaceRoot = (payload) => {
|
|
|
3755
3767
|
const roots = (payload.workspace_roots ?? []).filter((root) => root.length > 0);
|
|
3756
3768
|
return roots.length === 1 ? roots[0] : void 0;
|
|
3757
3769
|
};
|
|
3758
|
-
var sessionHint = (root) => root === void 0 ? void 0 : { source: "session-cwd", paths: [root] };
|
|
3759
3770
|
var cursorTargetHint = (payload) => {
|
|
3760
3771
|
const root = singleWorkspaceRoot(payload);
|
|
3761
3772
|
const base = root === void 0 ? {} : { baseDirectory: root };
|
|
3762
3773
|
switch (payload.hook_event_name) {
|
|
3763
3774
|
case "afterFileEdit":
|
|
3764
3775
|
case "beforeReadFile":
|
|
3765
|
-
return payload.file_path.length === 0 ?
|
|
3776
|
+
return payload.file_path.length === 0 ? sessionCwdHint(root) : { source: "tool-path", paths: [payload.file_path], ...base };
|
|
3766
3777
|
case "beforeShellExecution":
|
|
3767
3778
|
case "afterShellExecution":
|
|
3768
|
-
return payload.cwd !== void 0 && payload.cwd.length > 0 ? { source: "shell-cwd", paths: [payload.cwd], ...base } :
|
|
3779
|
+
return payload.cwd !== void 0 && payload.cwd.length > 0 ? { source: "shell-cwd", paths: [payload.cwd], ...base } : sessionCwdHint(root);
|
|
3780
|
+
case "sessionStart":
|
|
3781
|
+
case "beforeSubmitPrompt":
|
|
3769
3782
|
case "preToolUse":
|
|
3770
3783
|
case "postToolUse":
|
|
3771
3784
|
case "postToolUseFailure":
|
|
3772
3785
|
case "beforeMCPExecution":
|
|
3773
3786
|
case "afterMCPExecution":
|
|
3774
|
-
return
|
|
3787
|
+
return sessionCwdHint(root);
|
|
3775
3788
|
default:
|
|
3776
3789
|
return void 0;
|
|
3777
3790
|
}
|
|
@@ -4058,7 +4071,8 @@ var createCursorAdapter = (options = {}) => {
|
|
|
4058
4071
|
agentName: "cursor",
|
|
4059
4072
|
...payload.cursor_version === void 0 || payload.cursor_version.length === 0 ? {} : { agentVersion: payload.cursor_version },
|
|
4060
4073
|
...model === UNKNOWN_MODEL2 ? {} : { model },
|
|
4061
|
-
...payload.composer_mode === void 0 ? {} : { extensions: { "cursor.composer_mode": payload.composer_mode } }
|
|
4074
|
+
...payload.composer_mode === void 0 ? {} : { extensions: { "cursor.composer_mode": payload.composer_mode } },
|
|
4075
|
+
...targetHintField
|
|
4062
4076
|
});
|
|
4063
4077
|
break;
|
|
4064
4078
|
case "sessionEnd":
|
|
@@ -4075,6 +4089,7 @@ var createCursorAdapter = (options = {}) => {
|
|
|
4075
4089
|
// Cursor reports no prompt provenance. `user` would be a guess: this
|
|
4076
4090
|
// hook also fires for an automation-driven or resumed turn.
|
|
4077
4091
|
promptSource: "unknown",
|
|
4092
|
+
...targetHintField,
|
|
4078
4093
|
...payload.prompt === void 0 ? {} : {
|
|
4079
4094
|
content: context.privacy.describeContent({
|
|
4080
4095
|
kind: "prompt",
|
|
@@ -4625,7 +4640,7 @@ var codexTargetHint = (toolName, toolInput, cwd) => {
|
|
|
4625
4640
|
...cwd === void 0 ? {} : { baseDirectory: cwd }
|
|
4626
4641
|
};
|
|
4627
4642
|
}
|
|
4628
|
-
return cwd
|
|
4643
|
+
return sessionCwdHint(cwd);
|
|
4629
4644
|
};
|
|
4630
4645
|
|
|
4631
4646
|
// src/providers/codex/tool-kind.ts
|
|
@@ -4861,6 +4876,8 @@ var parse = (input, context) => {
|
|
|
4861
4876
|
const hint = codexTargetHint(toolName, toolInput, payload.cwd);
|
|
4862
4877
|
return hint === void 0 ? {} : { targetHint: hint };
|
|
4863
4878
|
};
|
|
4879
|
+
const sessionHint = sessionCwdHint(payload.cwd);
|
|
4880
|
+
const sessionTarget = sessionHint === void 0 ? {} : { targetHint: sessionHint };
|
|
4864
4881
|
const buildUsage = (usage) => {
|
|
4865
4882
|
if (usage === void 0) {
|
|
4866
4883
|
return void 0;
|
|
@@ -4880,7 +4897,8 @@ var parse = (input, context) => {
|
|
|
4880
4897
|
agentName: "codex",
|
|
4881
4898
|
occurredAt,
|
|
4882
4899
|
...payload.codex_version === void 0 ? {} : { agentVersion: payload.codex_version },
|
|
4883
|
-
...payload.model === void 0 ? {} : { model: { modelId: payload.model, vendor: "openai" } }
|
|
4900
|
+
...payload.model === void 0 ? {} : { model: { modelId: payload.model, vendor: "openai" } },
|
|
4901
|
+
...sessionTarget
|
|
4884
4902
|
});
|
|
4885
4903
|
break;
|
|
4886
4904
|
case "UserPromptSubmit":
|
|
@@ -4888,6 +4906,7 @@ var parse = (input, context) => {
|
|
|
4888
4906
|
type: "prompt.submitted",
|
|
4889
4907
|
promptSource: "user",
|
|
4890
4908
|
occurredAt,
|
|
4909
|
+
...sessionTarget,
|
|
4891
4910
|
...payload.prompt === void 0 ? {} : {
|
|
4892
4911
|
content: context.privacy.describeContent({
|
|
4893
4912
|
kind: "prompt",
|
|
@@ -6409,9 +6428,7 @@ var resolveHint = async (hint, locator, privacy) => {
|
|
|
6409
6428
|
return parsed.success ? parsed.data : void 0;
|
|
6410
6429
|
};
|
|
6411
6430
|
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
|
-
);
|
|
6431
|
+
const pending = input.events.filter((event3) => isTargetedEvent(event3) && input.hints.has(event3.eventId));
|
|
6415
6432
|
if (pending.length === 0) {
|
|
6416
6433
|
return { events: input.events, resolved: 0, timedOut: false };
|
|
6417
6434
|
}
|
|
@@ -6443,7 +6460,7 @@ var resolveEventTargets = async (input) => {
|
|
|
6443
6460
|
const settled = new Map(targets);
|
|
6444
6461
|
const events = input.events.map((event3) => {
|
|
6445
6462
|
const target = settled.get(event3.eventId);
|
|
6446
|
-
if (target === void 0 || event3
|
|
6463
|
+
if (target === void 0 || !isTargetedEvent(event3)) {
|
|
6447
6464
|
return event3;
|
|
6448
6465
|
}
|
|
6449
6466
|
return { ...event3, target };
|
|
@@ -7664,7 +7681,7 @@ import {
|
|
|
7664
7681
|
} from "@opentelemetry/semantic-conventions/incubating";
|
|
7665
7682
|
|
|
7666
7683
|
// src/version.ts
|
|
7667
|
-
var VERSION = "0.
|
|
7684
|
+
var VERSION = "0.6.0";
|
|
7668
7685
|
|
|
7669
7686
|
// src/telemetry/export-identity.ts
|
|
7670
7687
|
import { ATTR_SESSION_ID } from "@opentelemetry/semantic-conventions/incubating";
|
|
@@ -7688,7 +7705,7 @@ var ATTR_OTELHOOK_TARGET_REPOSITORY_ID = "otelhook.target.repository.id";
|
|
|
7688
7705
|
var ATTR_OTELHOOK_TARGET_WORKTREE_KIND = "otelhook.target.worktree.kind";
|
|
7689
7706
|
var ATTR_OTELHOOK_USAGE_TEMPORALITY = "otelhook.usage.temporality";
|
|
7690
7707
|
var targetAttributes = (event3) => {
|
|
7691
|
-
if (event3
|
|
7708
|
+
if (!isTargetedEvent(event3) || event3.target === void 0) {
|
|
7692
7709
|
return {};
|
|
7693
7710
|
}
|
|
7694
7711
|
const { target } = event3;
|
|
@@ -7813,10 +7830,13 @@ var parentScopeRefOf = (event3) => {
|
|
|
7813
7830
|
};
|
|
7814
7831
|
var startOnlySpanAttributes = (event3) => {
|
|
7815
7832
|
switch (event3.type) {
|
|
7833
|
+
// The session's own worktree is carried forward like a tool's target, so
|
|
7834
|
+
// the session span a later `session.end` process exports still names it.
|
|
7816
7835
|
case "session.start":
|
|
7817
7836
|
return {
|
|
7818
7837
|
...event3.agentName === void 0 ? {} : { [ATTR_OTELHOOK_AGENT_NAME]: event3.agentName },
|
|
7819
|
-
...event3.agentVersion === void 0 ? {} : { [ATTR_OTELHOOK_AGENT_VERSION]: event3.agentVersion }
|
|
7838
|
+
...event3.agentVersion === void 0 ? {} : { [ATTR_OTELHOOK_AGENT_VERSION]: event3.agentVersion },
|
|
7839
|
+
...targetAttributes(event3)
|
|
7820
7840
|
};
|
|
7821
7841
|
case "generation.start":
|
|
7822
7842
|
return {
|
|
@@ -7994,7 +8014,8 @@ var buildLifecycleSpan = (plan, resource, scope) => {
|
|
|
7994
8014
|
name = "session";
|
|
7995
8015
|
kind = SpanKind.INTERNAL;
|
|
7996
8016
|
attributes = {
|
|
7997
|
-
...attributes,
|
|
8017
|
+
...withoutTarget(attributes),
|
|
8018
|
+
...strongestTarget([pickTarget(resolved.recovered), start === void 0 ? {} : targetAttributes(start)]),
|
|
7998
8019
|
...start?.agentName === void 0 ? {} : { [ATTR_OTELHOOK_AGENT_NAME]: start.agentName },
|
|
7999
8020
|
...start?.agentVersion === void 0 ? {} : { [ATTR_OTELHOOK_AGENT_VERSION]: start.agentVersion },
|
|
8000
8021
|
...end === void 0 ? {} : { [ATTR_OTELHOOK_OUTCOME]: end.reason },
|
|
@@ -8099,7 +8120,7 @@ var buildStandaloneSpan = (event3, resource, scope) => {
|
|
|
8099
8120
|
switch (event3.type) {
|
|
8100
8121
|
case "prompt.submitted":
|
|
8101
8122
|
name = "prompt";
|
|
8102
|
-
attributes = { ...attributes, "otelhook.prompt.source": event3.promptSource };
|
|
8123
|
+
attributes = { ...attributes, "otelhook.prompt.source": event3.promptSource, ...targetAttributes(event3) };
|
|
8103
8124
|
break;
|
|
8104
8125
|
case "compaction.performed":
|
|
8105
8126
|
name = "compaction";
|
|
@@ -9840,7 +9861,8 @@ var eventAttributes = (event3) => {
|
|
|
9840
9861
|
[ATTR_OTELHOOK_SESSION_KIND]: event3.sessionKind,
|
|
9841
9862
|
...event3.agentName === void 0 ? {} : { [ATTR_OTELHOOK_AGENT_NAME2]: event3.agentName },
|
|
9842
9863
|
...event3.agentVersion === void 0 ? {} : { [ATTR_OTELHOOK_AGENT_VERSION2]: event3.agentVersion },
|
|
9843
|
-
...event3.model === void 0 ? {} : { [ATTR_GEN_AI_REQUEST_MODEL2]: event3.model.modelId }
|
|
9864
|
+
...event3.model === void 0 ? {} : { [ATTR_GEN_AI_REQUEST_MODEL2]: event3.model.modelId },
|
|
9865
|
+
...targetAttributes(event3)
|
|
9844
9866
|
};
|
|
9845
9867
|
case "session.end":
|
|
9846
9868
|
return {
|
|
@@ -9850,7 +9872,8 @@ var eventAttributes = (event3) => {
|
|
|
9850
9872
|
case "prompt.submitted":
|
|
9851
9873
|
return {
|
|
9852
9874
|
[ATTR_OTELHOOK_PROMPT_SOURCE]: event3.promptSource,
|
|
9853
|
-
...event3.turnIndex === void 0 ? {} : { [ATTR_OTELHOOK_PROMPT_TURN_INDEX]: event3.turnIndex }
|
|
9875
|
+
...event3.turnIndex === void 0 ? {} : { [ATTR_OTELHOOK_PROMPT_TURN_INDEX]: event3.turnIndex },
|
|
9876
|
+
...targetAttributes(event3)
|
|
9854
9877
|
};
|
|
9855
9878
|
case "generation.start":
|
|
9856
9879
|
return {
|
|
@@ -12476,6 +12499,7 @@ export {
|
|
|
12476
12499
|
SPAN_RECORD_VERSION,
|
|
12477
12500
|
SUBAGENT_ID_PATTERN,
|
|
12478
12501
|
SUPPORTED_REGISTRATION_PROVIDER_IDS,
|
|
12502
|
+
TARGETED_EVENT_TYPES,
|
|
12479
12503
|
UNKNOWN_PROVIDER_ID,
|
|
12480
12504
|
UNKNOWN_WORKSPACE_ID,
|
|
12481
12505
|
UsageNormalizationError,
|
|
@@ -12598,6 +12622,7 @@ export {
|
|
|
12598
12622
|
isReservedExtensionNamespace,
|
|
12599
12623
|
isReservedResourceAttributeKey,
|
|
12600
12624
|
isSecretResourceAttributeKey,
|
|
12625
|
+
isTargetedEvent,
|
|
12601
12626
|
isUnavailableContentFact,
|
|
12602
12627
|
isUnknownProvider,
|
|
12603
12628
|
isValidExtensionKey,
|
|
@@ -12670,6 +12695,7 @@ export {
|
|
|
12670
12695
|
runRegistrationLifecycle,
|
|
12671
12696
|
sanitizeResourceAttributes,
|
|
12672
12697
|
sequenceNumberSchema,
|
|
12698
|
+
sessionCwdHint,
|
|
12673
12699
|
sessionEndEventSchema,
|
|
12674
12700
|
sessionIdSchema,
|
|
12675
12701
|
sessionStartEventSchema,
|