@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.
- package/README.md +17 -3
- package/dist/{adapter-D5R8lhfl.d.ts → adapter-But5fFCk.d.ts} +8 -1
- package/dist/cli.js +210 -45
- package/dist/cli.js.map +1 -1
- package/dist/{export-destinations-DvoH4QOe.d.ts → export-destinations-8tNkIC8a.d.ts} +12 -4
- package/dist/{filesystem-store-B3CpiIRl.d.ts → filesystem-store-Z8XgDtFj.d.ts} +1 -1
- package/dist/{hook-DVK8Don-.d.ts → hook-D7XABd4f.d.ts} +17 -3
- package/dist/index.d.ts +10 -10
- package/dist/index.js +211 -45
- package/dist/index.js.map +1 -1
- package/dist/install.d.ts +3 -3
- package/dist/install.js.map +1 -1
- package/dist/integration.d.ts +6 -6
- package/dist/integration.js +188 -40
- package/dist/integration.js.map +1 -1
- package/dist/lifecycle.d.ts +1 -1
- package/dist/lifecycle.js +1 -1
- package/dist/lifecycle.js.map +1 -1
- package/dist/{memory-B3r6sZtC.d.ts → memory-gipZUiXP.d.ts} +1 -1
- package/dist/{payload-D4r71EL-.d.ts → payload-DWdx9yk3.d.ts} +1 -1
- package/dist/{ports-DhpSDIkp.d.ts → ports-qZTwK-z2.d.ts} +22 -2
- package/dist/providers.d.ts +7 -7
- package/dist/providers.js +22 -5
- package/dist/providers.js.map +1 -1
- package/dist/{registry-DOJh9mzB.d.ts → registry-D9rmMYxw.d.ts} +1 -1
- package/dist/runtime.d.ts +22 -7
- package/dist/runtime.js +154 -28
- package/dist/runtime.js.map +1 -1
- package/dist/state.d.ts +3 -3
- package/dist/state.js.map +1 -1
- package/dist/telemetry.d.ts +2 -2
- package/dist/telemetry.js +26 -9
- package/dist/telemetry.js.map +1 -1
- package/dist/testing.d.ts +6 -6
- package/dist/testing.js +57 -8
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
package/dist/testing.d.ts
CHANGED
|
@@ -2,12 +2,12 @@ import { O as OtelHookConfig, k as OtelHookConfigPatch } from './schema-oRsbo7WO
|
|
|
2
2
|
import { b as CanonicalEvent } from './events-fcomX6d5.js';
|
|
3
3
|
import { I as IdentityClaim, d as InvocationIdentity, S as SourceProvenance } from './identity-BrVBs901.js';
|
|
4
4
|
import { P as PrivacyService } from './service-DySC7KQM.js';
|
|
5
|
-
import { d as ProviderCapabilities, h as ProviderDetection, i as ProviderDetectionInput, e as ProviderContext, l as ProviderIdentityInput, f as ProviderDeliveryClaim, k as ProviderHookResponseInput, j as ProviderHookResponse, P as ProviderAdapter } from './adapter-
|
|
6
|
-
import { P as ProviderRegistry } from './registry-
|
|
7
|
-
import { I as IdGenerator, W as WorktreeLocator, P as PayloadEnricher, S as SessionContextReader } from './ports-
|
|
8
|
-
import { c as RecordingTelemetrySink, I as InMemoryStateStore, F as FixedClock, R as RecordingLogger } from './memory-
|
|
9
|
-
export { e as createDeterministicIdGenerator, f as createFixedClock, g as createInMemoryStateStore, j as createRecordingLogger, k as createRecordingTelemetrySink } from './memory-
|
|
10
|
-
import { O as OtelHook } from './hook-
|
|
5
|
+
import { d as ProviderCapabilities, h as ProviderDetection, i as ProviderDetectionInput, e as ProviderContext, l as ProviderIdentityInput, f as ProviderDeliveryClaim, k as ProviderHookResponseInput, j as ProviderHookResponse, P as ProviderAdapter } from './adapter-But5fFCk.js';
|
|
6
|
+
import { P as ProviderRegistry } from './registry-D9rmMYxw.js';
|
|
7
|
+
import { I as IdGenerator, W as WorktreeLocator, P as PayloadEnricher, S as SessionContextReader } from './ports-qZTwK-z2.js';
|
|
8
|
+
import { c as RecordingTelemetrySink, I as InMemoryStateStore, F as FixedClock, R as RecordingLogger } from './memory-gipZUiXP.js';
|
|
9
|
+
export { e as createDeterministicIdGenerator, f as createFixedClock, g as createInMemoryStateStore, j as createRecordingLogger, k as createRecordingTelemetrySink } from './memory-gipZUiXP.js';
|
|
10
|
+
import { O as OtelHook } from './hook-D7XABd4f.js';
|
|
11
11
|
import { z } from 'zod';
|
|
12
12
|
import { a as ContentDisclosure, b as ContentFact } from './content-M9xIKG7h.js';
|
|
13
13
|
import './primitives-CJ8-rn-f.js';
|
package/dist/testing.js
CHANGED
|
@@ -3350,7 +3350,8 @@ var parseClaudeCode = (input, context) => {
|
|
|
3350
3350
|
status: "parsed",
|
|
3351
3351
|
events: factory.events(),
|
|
3352
3352
|
...warnings.length === 0 ? {} : { warnings },
|
|
3353
|
-
...targetHints.size === 0 ? {} : { targetHints }
|
|
3353
|
+
...targetHints.size === 0 ? {} : { targetHints },
|
|
3354
|
+
...payload.cwd === void 0 || payload.cwd.length === 0 ? {} : { workspaceDirectory: payload.cwd }
|
|
3354
3355
|
};
|
|
3355
3356
|
};
|
|
3356
3357
|
|
|
@@ -3843,6 +3844,13 @@ var deriveWorkspace = (context, payload) => {
|
|
|
3843
3844
|
}
|
|
3844
3845
|
return void 0;
|
|
3845
3846
|
};
|
|
3847
|
+
var workspaceDirectoryOf = (payload) => {
|
|
3848
|
+
const roots = (payload.workspace_roots ?? []).filter((root) => root.length > 0);
|
|
3849
|
+
if (roots.length > 0) {
|
|
3850
|
+
return roots.length === 1 ? roots[0] : void 0;
|
|
3851
|
+
}
|
|
3852
|
+
return payload.cwd !== void 0 && payload.cwd.length > 0 ? payload.cwd : void 0;
|
|
3853
|
+
};
|
|
3846
3854
|
var invocationDiscriminator = (payload) => {
|
|
3847
3855
|
switch (payload.hook_event_name) {
|
|
3848
3856
|
case "sessionStart":
|
|
@@ -4302,11 +4310,13 @@ var createCursorAdapter = (options = {}) => {
|
|
|
4302
4310
|
}
|
|
4303
4311
|
}
|
|
4304
4312
|
const targetHints = factory.targetHints();
|
|
4313
|
+
const workspaceDirectory = workspaceDirectoryOf(payload);
|
|
4305
4314
|
return {
|
|
4306
4315
|
status: "parsed",
|
|
4307
4316
|
events: factory.events(),
|
|
4308
4317
|
...warnings.length === 0 ? {} : { warnings },
|
|
4309
|
-
...targetHints.size === 0 ? {} : { targetHints }
|
|
4318
|
+
...targetHints.size === 0 ? {} : { targetHints },
|
|
4319
|
+
...workspaceDirectory === void 0 ? {} : { workspaceDirectory }
|
|
4310
4320
|
};
|
|
4311
4321
|
};
|
|
4312
4322
|
const hookResponse2 = (input) => {
|
|
@@ -4981,7 +4991,8 @@ var parse = (input, context) => {
|
|
|
4981
4991
|
status: "parsed",
|
|
4982
4992
|
events: factory.events(),
|
|
4983
4993
|
...warnings.length === 0 ? {} : { warnings },
|
|
4984
|
-
...targetHints.size === 0 ? {} : { targetHints }
|
|
4994
|
+
...targetHints.size === 0 ? {} : { targetHints },
|
|
4995
|
+
...payload.cwd === void 0 || payload.cwd.length === 0 ? {} : { workspaceDirectory: payload.cwd }
|
|
4985
4996
|
};
|
|
4986
4997
|
};
|
|
4987
4998
|
var hookResponse = () => SILENT_HOOK_RESPONSE;
|
|
@@ -5626,7 +5637,8 @@ var createGeminiCliAdapter = (options = {}) => {
|
|
|
5626
5637
|
return {
|
|
5627
5638
|
status: "parsed",
|
|
5628
5639
|
events: factory.events(),
|
|
5629
|
-
...warnings.length === 0 ? {} : { warnings }
|
|
5640
|
+
...warnings.length === 0 ? {} : { warnings },
|
|
5641
|
+
...payload.cwd === void 0 || payload.cwd.length === 0 ? {} : { workspaceDirectory: payload.cwd }
|
|
5630
5642
|
};
|
|
5631
5643
|
};
|
|
5632
5644
|
const hookResponse2 = () => SILENT_HOOK_RESPONSE;
|
|
@@ -5895,7 +5907,12 @@ var createAntigravityAdapter = (options = {}) => {
|
|
|
5895
5907
|
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"
|
|
5896
5908
|
};
|
|
5897
5909
|
}
|
|
5898
|
-
|
|
5910
|
+
const [onlyWorkspacePath, ...otherWorkspacePaths] = payload.workspacePaths;
|
|
5911
|
+
return {
|
|
5912
|
+
status: "parsed",
|
|
5913
|
+
events: factory.events(),
|
|
5914
|
+
...onlyWorkspacePath === void 0 || onlyWorkspacePath.length === 0 || otherWorkspacePaths.length > 0 ? {} : { workspaceDirectory: onlyWorkspacePath }
|
|
5915
|
+
};
|
|
5899
5916
|
};
|
|
5900
5917
|
const hookResponse2 = () => SILENT_HOOK_RESPONSE;
|
|
5901
5918
|
return {
|
|
@@ -6343,6 +6360,28 @@ var classifyDurability = (input) => {
|
|
|
6343
6360
|
return input.accepted === 0 ? "lost" : "partial";
|
|
6344
6361
|
};
|
|
6345
6362
|
var MAX_ERROR_EVENTS = 8;
|
|
6363
|
+
var resolveWorkspaceRepositoryKey = async (locator, directory, budgetMillis) => {
|
|
6364
|
+
if (locator?.originRepositoryKey === void 0) {
|
|
6365
|
+
return void 0;
|
|
6366
|
+
}
|
|
6367
|
+
let timer;
|
|
6368
|
+
const deadline = new Promise((resolve2) => {
|
|
6369
|
+
timer = setTimeout(() => resolve2(void 0), Math.max(0, budgetMillis));
|
|
6370
|
+
timer.unref?.();
|
|
6371
|
+
});
|
|
6372
|
+
try {
|
|
6373
|
+
return await Promise.race([
|
|
6374
|
+
locator.originRepositoryKey(directory).catch(() => void 0),
|
|
6375
|
+
deadline
|
|
6376
|
+
]);
|
|
6377
|
+
} catch {
|
|
6378
|
+
return void 0;
|
|
6379
|
+
} finally {
|
|
6380
|
+
if (timer !== void 0) {
|
|
6381
|
+
clearTimeout(timer);
|
|
6382
|
+
}
|
|
6383
|
+
}
|
|
6384
|
+
};
|
|
6346
6385
|
var collectContentFacts = (event3) => {
|
|
6347
6386
|
const facts = [];
|
|
6348
6387
|
const push = (fact) => {
|
|
@@ -6986,7 +7025,8 @@ var createOtelHook = (deps) => {
|
|
|
6986
7025
|
kind: "ready",
|
|
6987
7026
|
batch: batch2,
|
|
6988
7027
|
dropped: screened.dropped,
|
|
6989
|
-
...parsed.targetHints === void 0 ? {} : { targetHints: parsed.targetHints }
|
|
7028
|
+
...parsed.targetHints === void 0 ? {} : { targetHints: parsed.targetHints },
|
|
7029
|
+
...parsed.workspaceDirectory === void 0 ? {} : { workspaceDirectory: parsed.workspaceDirectory }
|
|
6990
7030
|
};
|
|
6991
7031
|
};
|
|
6992
7032
|
let prepared;
|
|
@@ -7054,11 +7094,19 @@ var createOtelHook = (deps) => {
|
|
|
7054
7094
|
batch,
|
|
7055
7095
|
!suppress && batch.length > 0 && deps.sessionContext !== void 0 ? await readSessionContext(deps.sessionContext, detection.providerId, identity.sessionId) : void 0
|
|
7056
7096
|
);
|
|
7097
|
+
const workspaceRepositoryKey = !suppress && batch.length > 0 && deps.routeByWorkspaceRepository === true && prepared.workspaceDirectory !== void 0 ? await resolveWorkspaceRepositoryKey(
|
|
7098
|
+
deps.worktreeLocator,
|
|
7099
|
+
prepared.workspaceDirectory,
|
|
7100
|
+
deps.targetResolutionBudgetMillis ?? DEFAULT_TARGET_RESOLUTION_BUDGET_MILLIS
|
|
7101
|
+
) : void 0;
|
|
7057
7102
|
let emitted = 0;
|
|
7058
7103
|
let exportRejected = 0;
|
|
7059
7104
|
if (!suppress && batch.length > 0) {
|
|
7060
7105
|
try {
|
|
7061
|
-
const result = await deps.sink.emit(
|
|
7106
|
+
const result = await deps.sink.emit(
|
|
7107
|
+
batch,
|
|
7108
|
+
workspaceRepositoryKey === void 0 ? void 0 : { workspaceRepositoryKey }
|
|
7109
|
+
);
|
|
7062
7110
|
emitted = result.accepted;
|
|
7063
7111
|
exportRejected = result.rejected;
|
|
7064
7112
|
diagnostics.push(...result.errors);
|
|
@@ -7117,7 +7165,8 @@ var createOtelHook = (deps) => {
|
|
|
7117
7165
|
durability,
|
|
7118
7166
|
dropped,
|
|
7119
7167
|
hookResponse: hookResponseFor(adapter, detection, "attributed", void 0, emitted, diagnostics),
|
|
7120
|
-
diagnostics
|
|
7168
|
+
diagnostics,
|
|
7169
|
+
...workspaceRepositoryKey === void 0 ? {} : { workspaceRepositoryKey }
|
|
7121
7170
|
};
|
|
7122
7171
|
} catch (thrown) {
|
|
7123
7172
|
const info = errorInfoFromThrown(thrown, { code: "internal-error", phase: "parsing" });
|