@osfactory/otel-hook 0.3.0 → 0.4.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.
- package/dist/{adapter-DXpNtnaf.d.ts → adapter-BgqtlADe.d.ts} +10 -3
- package/dist/cli.js +1001 -487
- package/dist/cli.js.map +1 -1
- package/dist/{events-VxBnDFaO.d.ts → events-C3h3GvHj.d.ts} +58 -0
- package/dist/{filesystem-store-J8jjDMTh.d.ts → filesystem-store-BAq3VGVv.d.ts} +1 -1
- package/dist/{hook-_mlO3akA.d.ts → hook-CQiNa88Q.d.ts} +12 -4
- package/dist/index.d.ts +13 -12
- package/dist/index.js +1127 -599
- package/dist/index.js.map +1 -1
- package/dist/install.d.ts +5 -4
- package/dist/install.js +99 -68
- package/dist/install.js.map +1 -1
- package/dist/integration.d.ts +15 -8
- package/dist/integration.js +505 -121
- package/dist/integration.js.map +1 -1
- package/dist/lifecycle.d.ts +3 -3
- package/dist/lifecycle.js +23 -2
- package/dist/lifecycle.js.map +1 -1
- package/dist/{memory-DXVBc8V9.d.ts → memory-kflYgZbg.d.ts} +2 -2
- package/dist/model.d.ts +2 -1
- package/dist/model.js +79 -41
- package/dist/model.js.map +1 -1
- package/dist/{otlp-log-sink-DTSa0KRF.d.ts → otlp-log-sink-BZIgYPKN.d.ts} +3 -3
- package/dist/{payload-BWV5-4n3.d.ts → payload-DpyU8F-z.d.ts} +1 -1
- package/dist/{ports-Q8x0ODhs.d.ts → ports-B_iwJQPQ.d.ts} +20 -2
- package/dist/providers.d.ts +27 -9
- package/dist/providers.js +664 -452
- package/dist/providers.js.map +1 -1
- package/dist/{registry-Dqr3VNmT.d.ts → registry-BSBS8t7S.d.ts} +1 -1
- package/dist/runtime.d.ts +87 -11
- package/dist/runtime.js +379 -67
- package/dist/runtime.js.map +1 -1
- package/dist/{semconv-CIU-2kGO.d.ts → semconv-BeUPQ7_q.d.ts} +1 -1
- package/dist/state.d.ts +4 -4
- package/dist/state.js.map +1 -1
- package/dist/target-8RfaVxp8.d.ts +83 -0
- package/dist/telemetry.d.ts +6 -6
- package/dist/telemetry.js +86 -10
- package/dist/telemetry.js.map +1 -1
- package/dist/testing.d.ts +14 -7
- package/dist/testing.js +814 -492
- package/dist/testing.js.map +1 -1
- package/package.json +4 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { e as DetectionPolicy } from './schema-Cn0-xz8L.js';
|
|
2
2
|
import { OtelHookErrorInfo } from './errors.js';
|
|
3
|
-
import { P as ProviderAdapter, h as ProviderDetection, i as ProviderDetectionInput, e as ProviderContext } from './adapter-
|
|
3
|
+
import { P as ProviderAdapter, h as ProviderDetection, i as ProviderDetectionInput, e as ProviderContext } from './adapter-BgqtlADe.js';
|
|
4
4
|
|
|
5
5
|
type DetectionCandidate = {
|
|
6
6
|
readonly adapter: ProviderAdapter;
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { A as AppliedDelivery, C as Clock, E as EventIdSeed, I as IdGenerator, a as InvocationIdSeed, L as LOG_LEVEL_RANK, S as StateRecord,
|
|
3
|
-
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-
|
|
4
|
-
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-
|
|
1
|
+
import { c as LogLevel, d as Logger, W as WorktreeLocator } from './ports-B_iwJQPQ.js';
|
|
2
|
+
export { A as AppliedDelivery, C as Clock, E as EventIdSeed, I as IdGenerator, a as InvocationIdSeed, L as LOG_LEVEL_RANK, b as LocatedWorktree, S as StateRecord, e as StateStore, f as StateValue, T as TelemetryEmitResult, g as TelemetrySink, h as appliedDeliverySchema, l as logLevelSchema, s as stateRecordSchema, i as stateValueSchema } from './ports-B_iwJQPQ.js';
|
|
3
|
+
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-kflYgZbg.js';
|
|
4
|
+
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-CQiNa88Q.js';
|
|
5
|
+
import { b as CanonicalEvent } from './events-C3h3GvHj.js';
|
|
6
|
+
import { d as EventId } from './primitives-CJ8-rn-f.js';
|
|
7
|
+
import { T as TargetHint } from './target-8RfaVxp8.js';
|
|
8
|
+
import { P as PrivacyService } from './service-CbI9CObT.js';
|
|
5
9
|
import 'zod';
|
|
6
10
|
import './errors.js';
|
|
7
|
-
import './primitives-CJ8-rn-f.js';
|
|
8
11
|
import './taxonomy-DwhTtuWd.js';
|
|
9
|
-
import './events-VxBnDFaO.js';
|
|
10
12
|
import './schema-Cn0-xz8L.js';
|
|
11
13
|
import './identity-BrVBs901.js';
|
|
12
|
-
import './
|
|
13
|
-
import './content-M9xIKG7h.js';
|
|
14
|
+
import './adapter-BgqtlADe.js';
|
|
14
15
|
import './policy-CimmCfRp.js';
|
|
15
|
-
import './
|
|
16
|
-
import './registry-
|
|
16
|
+
import './content-M9xIKG7h.js';
|
|
17
|
+
import './registry-BSBS8t7S.js';
|
|
17
18
|
|
|
18
19
|
declare const createNullLogger: () => Logger;
|
|
19
20
|
type StderrLoggerOptions = {
|
|
@@ -29,4 +30,79 @@ type StderrLoggerOptions = {
|
|
|
29
30
|
*/
|
|
30
31
|
declare const createStderrLogger: (options?: StderrLoggerOptions) => Logger;
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Filesystem {@link WorktreeLocator}: finds the git worktree containing a path
|
|
35
|
+
* by reading the files git itself reads, without spawning `git` (ADR 0008).
|
|
36
|
+
*
|
|
37
|
+
* From the path upward, the first directory holding a `.git` entry is the
|
|
38
|
+
* worktree root:
|
|
39
|
+
*
|
|
40
|
+
* - `.git` is a **directory** — the main worktree; its git dir is that directory.
|
|
41
|
+
* - `.git` is a **file** — a linked worktree (or a submodule): it holds
|
|
42
|
+
* `gitdir: <path>`, relative to the worktree root when not absolute.
|
|
43
|
+
*
|
|
44
|
+
* The branch is read from `<gitdir>/HEAD`: `ref: refs/heads/<name>` names a
|
|
45
|
+
* branch; anything else (a detached commit id) names none. A `.git` entry that
|
|
46
|
+
* cannot be read, points nowhere, or has no readable `HEAD` makes the answer
|
|
47
|
+
* `undefined` — a broken worktree is not evidence, and the walk does not skip
|
|
48
|
+
* past it to an enclosing repository that the event did not target.
|
|
49
|
+
*
|
|
50
|
+
* Everything is bounded: walk depth, bytes read per file, and cache size. Every
|
|
51
|
+
* failure is `undefined`; nothing throws.
|
|
52
|
+
*/
|
|
53
|
+
/** Deepest directory chain walked before giving up. */
|
|
54
|
+
declare const MAX_WORKTREE_WALK_DEPTH = 128;
|
|
55
|
+
/** Default lifetime of a cached probe. Short: a branch can be switched. */
|
|
56
|
+
declare const DEFAULT_WORKTREE_CACHE_TTL_MILLIS = 5000;
|
|
57
|
+
/** `ref: refs/heads/<name>` → `<name>`; anything else → no branch. */
|
|
58
|
+
declare const parseHeadBranch: (head: string) => string | undefined;
|
|
59
|
+
/** `gitdir: <path>` → the path, resolved against the worktree root. */
|
|
60
|
+
declare const parseGitDirFile: (content: string, worktreeRoot: string) => string | undefined;
|
|
61
|
+
type FilesystemWorktreeLocatorOptions = {
|
|
62
|
+
/** Monotonic milliseconds for cache expiry. Defaults to `performance.now()`. */
|
|
63
|
+
readonly monotonicMillis?: () => number;
|
|
64
|
+
readonly cacheTtlMillis?: number;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Create a locator with its own cache. The cache is instance state, never
|
|
68
|
+
* module state: two hooks in one process do not share it.
|
|
69
|
+
*/
|
|
70
|
+
declare const createFilesystemWorktreeLocator: (options?: FilesystemWorktreeLocatorOptions) => WorktreeLocator;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Turns adapters' target hints into exported worktree targets (ADR 0008).
|
|
74
|
+
*
|
|
75
|
+
* This is where local paths stop. A hint's paths are resolved to a worktree
|
|
76
|
+
* root and branch through the injected {@link WorktreeLocator}; only the salted
|
|
77
|
+
* `git-root` handle of that root and the branch name survive onto the event.
|
|
78
|
+
*
|
|
79
|
+
* Fail-open in both directions that matter: a slow or failing filesystem costs
|
|
80
|
+
* the event its target, never the event — and never the host more than the
|
|
81
|
+
* time budget. Fail-closed on meaning: a hint whose paths land in two different
|
|
82
|
+
* worktrees, or that names a relative path with nothing to resolve it against,
|
|
83
|
+
* yields no target rather than a guess.
|
|
84
|
+
*/
|
|
85
|
+
/** Default ceiling on target resolution per callback. */
|
|
86
|
+
declare const DEFAULT_TARGET_RESOLUTION_BUDGET_MILLIS = 50;
|
|
87
|
+
type ResolveEventTargetsInput = {
|
|
88
|
+
readonly events: readonly CanonicalEvent[];
|
|
89
|
+
readonly hints: ReadonlyMap<EventId, TargetHint>;
|
|
90
|
+
readonly locator: WorktreeLocator;
|
|
91
|
+
readonly privacy: PrivacyService;
|
|
92
|
+
readonly budgetMillis: number;
|
|
93
|
+
};
|
|
94
|
+
type ResolveEventTargetsResult = {
|
|
95
|
+
readonly events: readonly CanonicalEvent[];
|
|
96
|
+
/** Hints that produced a target. */
|
|
97
|
+
readonly resolved: number;
|
|
98
|
+
/** True when the time budget expired before every hint was answered. */
|
|
99
|
+
readonly timedOut: boolean;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Attach a `target` to each tool event that has a resolvable hint. Never
|
|
103
|
+
* throws or rejects; events without a hint, or whose hint does not resolve,
|
|
104
|
+
* are returned unchanged.
|
|
105
|
+
*/
|
|
106
|
+
declare const resolveEventTargets: (input: ResolveEventTargetsInput) => Promise<ResolveEventTargetsResult>;
|
|
107
|
+
|
|
108
|
+
export { DEFAULT_TARGET_RESOLUTION_BUDGET_MILLIS, DEFAULT_WORKTREE_CACHE_TTL_MILLIS, type FilesystemWorktreeLocatorOptions, LogLevel, Logger, MAX_WORKTREE_WALK_DEPTH, type ResolveEventTargetsInput, type ResolveEventTargetsResult, type StderrLoggerOptions, WorktreeLocator, createFilesystemWorktreeLocator, createNullLogger, createStderrLogger, parseGitDirFile, parseHeadBranch, resolveEventTargets };
|