@osfactory/otel-hook 0.14.0 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +17 -3
  2. package/dist/{adapter-D5R8lhfl.d.ts → adapter-But5fFCk.d.ts} +8 -1
  3. package/dist/cli.js +210 -45
  4. package/dist/cli.js.map +1 -1
  5. package/dist/{export-destinations-DvoH4QOe.d.ts → export-destinations-8tNkIC8a.d.ts} +12 -4
  6. package/dist/{filesystem-store-B3CpiIRl.d.ts → filesystem-store-Z8XgDtFj.d.ts} +1 -1
  7. package/dist/{hook-DVK8Don-.d.ts → hook-D7XABd4f.d.ts} +17 -3
  8. package/dist/index.d.ts +10 -10
  9. package/dist/index.js +211 -45
  10. package/dist/index.js.map +1 -1
  11. package/dist/install.d.ts +3 -3
  12. package/dist/install.js.map +1 -1
  13. package/dist/integration.d.ts +6 -6
  14. package/dist/integration.js +188 -40
  15. package/dist/integration.js.map +1 -1
  16. package/dist/lifecycle.d.ts +1 -1
  17. package/dist/lifecycle.js +1 -1
  18. package/dist/lifecycle.js.map +1 -1
  19. package/dist/{memory-B3r6sZtC.d.ts → memory-gipZUiXP.d.ts} +1 -1
  20. package/dist/{payload-D4r71EL-.d.ts → payload-DWdx9yk3.d.ts} +1 -1
  21. package/dist/{ports-DhpSDIkp.d.ts → ports-qZTwK-z2.d.ts} +22 -2
  22. package/dist/providers.d.ts +7 -7
  23. package/dist/providers.js +22 -5
  24. package/dist/providers.js.map +1 -1
  25. package/dist/{registry-DOJh9mzB.d.ts → registry-D9rmMYxw.d.ts} +1 -1
  26. package/dist/runtime.d.ts +22 -7
  27. package/dist/runtime.js +154 -28
  28. package/dist/runtime.js.map +1 -1
  29. package/dist/state.d.ts +3 -3
  30. package/dist/state.js.map +1 -1
  31. package/dist/telemetry.d.ts +2 -2
  32. package/dist/telemetry.js +26 -9
  33. package/dist/telemetry.js.map +1 -1
  34. package/dist/testing.d.ts +6 -6
  35. package/dist/testing.js +57 -8
  36. package/dist/testing.js.map +1 -1
  37. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { C as Clock, I as IdGenerator, j as StateStore, i as StateRecord, c as LogLevel, d as Logger, l as TelemetrySink } from './ports-DhpSDIkp.js';
1
+ import { C as Clock, I as IdGenerator, j as StateStore, i as StateRecord, c as LogLevel, d as Logger, m as TelemetrySink } from './ports-qZTwK-z2.js';
2
2
  import { b as CanonicalEvent } from './events-fcomX6d5.js';
3
3
  import { b as Attributes } from './primitives-CJ8-rn-f.js';
4
4
 
@@ -1,7 +1,7 @@
1
1
  import * as zod from 'zod';
2
2
  import { z } from 'zod';
3
3
  import { g as ProviderId } from './primitives-CJ8-rn-f.js';
4
- import { d as ProviderCapabilities, P as ProviderAdapter } from './adapter-D5R8lhfl.js';
4
+ import { d as ProviderCapabilities, P as ProviderAdapter } from './adapter-But5fFCk.js';
5
5
 
6
6
  /** Stable, hyphenated provider id for Claude Code. */
7
7
  declare const CLAUDE_CODE_PROVIDER_ID: string & zod.$brand<"ProviderId">;
@@ -215,8 +215,20 @@ type TelemetryEmitResult = {
215
215
  * The sink receives canonical events only — never provider payloads — so an
216
216
  * exporter cannot become a second, unaudited disclosure path.
217
217
  */
218
+ /**
219
+ * What a sink may know about a batch beyond its events, for routing only.
220
+ * Nothing here is exported: it decides where a record may go, never what it says.
221
+ */
222
+ type TelemetryEmitOptions = {
223
+ /**
224
+ * Repository key of the session workspace's `origin` remote. Scoped
225
+ * destinations route an event without a context stamp of its own by it,
226
+ * ahead of the exporter Resource's repository.
227
+ */
228
+ readonly workspaceRepositoryKey?: string;
229
+ };
218
230
  interface TelemetrySink {
219
- emit(events: readonly CanonicalEvent[]): Promise<TelemetryEmitResult>;
231
+ emit(events: readonly CanonicalEvent[], options?: TelemetryEmitOptions): Promise<TelemetryEmitResult>;
220
232
  flush(): Promise<void>;
221
233
  shutdown(): Promise<void>;
222
234
  }
@@ -267,6 +279,14 @@ type LocatedWorktree = {
267
279
  */
268
280
  interface WorktreeLocator {
269
281
  locate(absolutePath: string): Promise<LocatedWorktree | undefined>;
282
+ /**
283
+ * The repository key (`normalizeRepositoryKey`) of the `origin` remote of the
284
+ * repository whose worktree contains the path, or `undefined` when there is
285
+ * none, it is a local path, or it cannot be read. Used for routing only: the
286
+ * key decides which scoped destinations may receive a record and is never
287
+ * exported. Optional: a locator without it routes nothing by remote.
288
+ */
289
+ originRepositoryKey?(absolutePath: string): Promise<string | undefined>;
270
290
  }
271
291
  /** Where an enricher stopped reading a session's source; see the `read-cursor` state value. */
272
292
  type ReadCursor = {
@@ -346,4 +366,4 @@ interface SessionContextReader {
346
366
  read(request: SessionContextRequest): Promise<readonly SessionContextSegment[] | undefined>;
347
367
  }
348
368
 
349
- export { type AppliedDelivery as A, type Clock as C, type EventIdSeed as E, type IdGenerator as I, LOG_LEVEL_RANK as L, type PayloadEnricher as P, type ReadCursor as R, type SessionContextReader as S, type TelemetryEmitResult as T, type WorktreeLocator as W, type InvocationIdSeed as a, type LocatedWorktree as b, type LogLevel as c, type Logger as d, type PayloadEnrichment as e, type PayloadEnrichmentInput as f, type SessionContextRequest as g, type SessionContextSegment as h, type StateRecord as i, type StateStore as j, type StateValue as k, type TelemetrySink as l, appliedDeliverySchema as m, logLevelSchema as n, stateValueSchema as o, stateRecordSchema as s };
369
+ export { type AppliedDelivery as A, type Clock as C, type EventIdSeed as E, type IdGenerator as I, LOG_LEVEL_RANK as L, type PayloadEnricher as P, type ReadCursor as R, type SessionContextReader as S, type TelemetryEmitOptions as T, type WorktreeLocator as W, type InvocationIdSeed as a, type LocatedWorktree as b, type LogLevel as c, type Logger as d, type PayloadEnrichment as e, type PayloadEnrichmentInput as f, type SessionContextRequest as g, type SessionContextSegment as h, type StateRecord as i, type StateStore as j, type StateValue as k, type TelemetryEmitResult as l, type TelemetrySink as m, appliedDeliverySchema as n, logLevelSchema as o, stateValueSchema as p, stateRecordSchema as s };
@@ -1,13 +1,13 @@
1
- import { e as ProviderContext, P as ProviderAdapter, d as ProviderCapabilities, b as DeliveryIdentifierSupport, A as AdapterDescription } from './adapter-D5R8lhfl.js';
2
- export { D as DELIVERY_COMPONENT_PATTERN, a as DELIVERY_GAP_REASON_PATTERN, M as MAX_DELIVERY_COMPONENTS, c as MAX_DELIVERY_GAPS, 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-D5R8lhfl.js';
1
+ import { e as ProviderContext, P as ProviderAdapter, d as ProviderCapabilities, b as DeliveryIdentifierSupport, A as AdapterDescription } from './adapter-But5fFCk.js';
2
+ export { D as DELIVERY_COMPONENT_PATTERN, a as DELIVERY_GAP_REASON_PATTERN, M as MAX_DELIVERY_COMPONENTS, c as MAX_DELIVERY_GAPS, 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-But5fFCk.js';
3
3
  import { b as CanonicalEvent, u as TargetHint, q as SessionStartEvent, p as SessionEndEvent, P as PromptSubmittedEvent, l as GenerationStartEvent, G as GenerationEndEvent, A as ToolStartEvent, y as ToolEndEvent, t as SubagentStartEvent, r as SubagentEndEvent, g as CompactionPerformedEvent, i as ErrorRaisedEvent } from './events-fcomX6d5.js';
4
4
  import { d as InvocationIdentity } from './identity-BrVBs901.js';
5
5
  import { d as EventId } from './primitives-CJ8-rn-f.js';
6
- import { P as ProviderRegistry } from './registry-DOJh9mzB.js';
7
- export { B as BUILT_IN_PROVIDERS, D as DetectionCandidate, R as RegistryDetectionResult, c as createProviderRegistry } from './registry-DOJh9mzB.js';
8
- import { v as ClaudeUsage, w as CodexUsage } from './payload-D4r71EL-.js';
9
- 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-D4r71EL-.js';
10
- import { P as PayloadEnricher } from './ports-DhpSDIkp.js';
6
+ import { P as ProviderRegistry } from './registry-D9rmMYxw.js';
7
+ export { B as BUILT_IN_PROVIDERS, D as DetectionCandidate, R as RegistryDetectionResult, c as createProviderRegistry } from './registry-D9rmMYxw.js';
8
+ import { v as ClaudeUsage, w as CodexUsage } from './payload-DWdx9yk3.js';
9
+ 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-DWdx9yk3.js';
10
+ import { P as PayloadEnricher } from './ports-qZTwK-z2.js';
11
11
  import 'zod';
12
12
  import './errors.js';
13
13
  import './taxonomy-DwhTtuWd.js';
package/dist/providers.js CHANGED
@@ -2271,7 +2271,8 @@ var parseClaudeCode = (input, context) => {
2271
2271
  status: "parsed",
2272
2272
  events: factory.events(),
2273
2273
  ...warnings.length === 0 ? {} : { warnings },
2274
- ...targetHints.size === 0 ? {} : { targetHints }
2274
+ ...targetHints.size === 0 ? {} : { targetHints },
2275
+ ...payload.cwd === void 0 || payload.cwd.length === 0 ? {} : { workspaceDirectory: payload.cwd }
2275
2276
  };
2276
2277
  };
2277
2278
 
@@ -3136,6 +3137,13 @@ var deriveWorkspace = (context, payload) => {
3136
3137
  }
3137
3138
  return void 0;
3138
3139
  };
3140
+ var workspaceDirectoryOf = (payload) => {
3141
+ const roots = (payload.workspace_roots ?? []).filter((root) => root.length > 0);
3142
+ if (roots.length > 0) {
3143
+ return roots.length === 1 ? roots[0] : void 0;
3144
+ }
3145
+ return payload.cwd !== void 0 && payload.cwd.length > 0 ? payload.cwd : void 0;
3146
+ };
3139
3147
  var invocationDiscriminator = (payload) => {
3140
3148
  switch (payload.hook_event_name) {
3141
3149
  case "sessionStart":
@@ -3595,11 +3603,13 @@ var createCursorAdapter = (options = {}) => {
3595
3603
  }
3596
3604
  }
3597
3605
  const targetHints = factory.targetHints();
3606
+ const workspaceDirectory = workspaceDirectoryOf(payload);
3598
3607
  return {
3599
3608
  status: "parsed",
3600
3609
  events: factory.events(),
3601
3610
  ...warnings.length === 0 ? {} : { warnings },
3602
- ...targetHints.size === 0 ? {} : { targetHints }
3611
+ ...targetHints.size === 0 ? {} : { targetHints },
3612
+ ...workspaceDirectory === void 0 ? {} : { workspaceDirectory }
3603
3613
  };
3604
3614
  };
3605
3615
  const hookResponse2 = (input) => {
@@ -4274,7 +4284,8 @@ var parse = (input, context) => {
4274
4284
  status: "parsed",
4275
4285
  events: factory.events(),
4276
4286
  ...warnings.length === 0 ? {} : { warnings },
4277
- ...targetHints.size === 0 ? {} : { targetHints }
4287
+ ...targetHints.size === 0 ? {} : { targetHints },
4288
+ ...payload.cwd === void 0 || payload.cwd.length === 0 ? {} : { workspaceDirectory: payload.cwd }
4278
4289
  };
4279
4290
  };
4280
4291
  var hookResponse = () => SILENT_HOOK_RESPONSE;
@@ -5199,7 +5210,8 @@ var createGeminiCliAdapter = (options = {}) => {
5199
5210
  return {
5200
5211
  status: "parsed",
5201
5212
  events: factory.events(),
5202
- ...warnings.length === 0 ? {} : { warnings }
5213
+ ...warnings.length === 0 ? {} : { warnings },
5214
+ ...payload.cwd === void 0 || payload.cwd.length === 0 ? {} : { workspaceDirectory: payload.cwd }
5203
5215
  };
5204
5216
  };
5205
5217
  const hookResponse2 = () => SILENT_HOOK_RESPONSE;
@@ -5468,7 +5480,12 @@ var createAntigravityAdapter = (options = {}) => {
5468
5480
  reason: payload.fullyIdle ? "Stop signals execution/turn completion (fullyIdle=true) but exposes no session or generation identity, so it cannot become session.end or generation.end without inventing one" : "Stop received while the agent is not fully idle; the conversation continues and the hook exposes no lifecycle fact the canonical model can represent"
5469
5481
  };
5470
5482
  }
5471
- return { status: "parsed", events: factory.events() };
5483
+ const [onlyWorkspacePath, ...otherWorkspacePaths] = payload.workspacePaths;
5484
+ return {
5485
+ status: "parsed",
5486
+ events: factory.events(),
5487
+ ...onlyWorkspacePath === void 0 || onlyWorkspacePath.length === 0 || otherWorkspacePaths.length > 0 ? {} : { workspaceDirectory: onlyWorkspacePath }
5488
+ };
5472
5489
  };
5473
5490
  const hookResponse2 = () => SILENT_HOOK_RESPONSE;
5474
5491
  return {