@osfactory/otel-hook 0.13.2 → 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 (46) hide show
  1. package/README.md +57 -0
  2. package/dist/{adapter-DyCb7y1N.d.ts → adapter-But5fFCk.d.ts} +9 -2
  3. package/dist/cli.js +628 -73
  4. package/dist/cli.js.map +1 -1
  5. package/dist/config.d.ts +30 -4
  6. package/dist/config.js +161 -9
  7. package/dist/config.js.map +1 -1
  8. package/dist/{destinations-C4sSKjDO.d.ts → destinations-2KrcRslo.d.ts} +92 -2
  9. package/dist/{export-destinations-BjRXDots.d.ts → export-destinations-8tNkIC8a.d.ts} +110 -10
  10. package/dist/{filesystem-store-B3CpiIRl.d.ts → filesystem-store-Z8XgDtFj.d.ts} +1 -1
  11. package/dist/{hook-CKLpgrYP.d.ts → hook-D7XABd4f.d.ts} +19 -5
  12. package/dist/index.d.ts +14 -14
  13. package/dist/index.js +626 -72
  14. package/dist/index.js.map +1 -1
  15. package/dist/install.d.ts +4 -4
  16. package/dist/install.js.map +1 -1
  17. package/dist/integration.d.ts +9 -9
  18. package/dist/integration.js +555 -65
  19. package/dist/integration.js.map +1 -1
  20. package/dist/lifecycle.d.ts +1 -1
  21. package/dist/lifecycle.js +1 -1
  22. package/dist/lifecycle.js.map +1 -1
  23. package/dist/{memory-B3r6sZtC.d.ts → memory-gipZUiXP.d.ts} +1 -1
  24. package/dist/{payload-DLK7QaBB.d.ts → payload-DWdx9yk3.d.ts} +1 -1
  25. package/dist/{ports-DhpSDIkp.d.ts → ports-qZTwK-z2.d.ts} +22 -2
  26. package/dist/privacy.d.ts +2 -2
  27. package/dist/privacy.js +42 -1
  28. package/dist/privacy.js.map +1 -1
  29. package/dist/providers.d.ts +9 -9
  30. package/dist/providers.js +22 -5
  31. package/dist/providers.js.map +1 -1
  32. package/dist/{registry-DM-4YvIA.d.ts → registry-D9rmMYxw.d.ts} +2 -2
  33. package/dist/runtime.d.ts +24 -9
  34. package/dist/runtime.js +282 -30
  35. package/dist/runtime.js.map +1 -1
  36. package/dist/{schema-CD61uW99.d.ts → schema-oRsbo7WO.d.ts} +45 -0
  37. package/dist/{service-CbI9CObT.d.ts → service-DySC7KQM.d.ts} +6 -1
  38. package/dist/state.d.ts +3 -3
  39. package/dist/state.js.map +1 -1
  40. package/dist/telemetry.d.ts +6 -5
  41. package/dist/telemetry.js +304 -17
  42. package/dist/telemetry.js.map +1 -1
  43. package/dist/testing.d.ts +8 -8
  44. package/dist/testing.js +185 -10
  45. package/dist/testing.js.map +1 -1
  46. package/package.json +1 -1
@@ -153,6 +153,60 @@ var OTLP_HEADER_VARIABLES = Object.freeze({
153
153
  logs: "OTEL_EXPORTER_OTLP_LOGS_HEADERS"
154
154
  });
155
155
 
156
+ // src/config/repository-key.ts
157
+ var ATTR_VCS_REPOSITORY_URL_FULL = "vcs.repository.url.full";
158
+ var MAX_REPOSITORY_REFERENCE_LENGTH = 2048;
159
+ var SCHEME_PATTERN = /^[a-z][a-z0-9+.-]*:\/\//i;
160
+ var SCP_LIKE_PATTERN = /^(?:[^@/\s]+@)?([^:/\s]+):(?!\/\/)(.+)$/;
161
+ var trimTrailingSlashes = (value) => {
162
+ let end = value.length;
163
+ while (end > 0 && value.charCodeAt(end - 1) === 47) end -= 1;
164
+ return value.slice(0, end);
165
+ };
166
+ var keyOf = (host, pathname) => {
167
+ const withoutSlashes = trimTrailingSlashes(pathname);
168
+ const cleanedPath = trimTrailingSlashes(
169
+ withoutSlashes.toLowerCase().endsWith(".git") ? withoutSlashes.slice(0, -4) : withoutSlashes
170
+ );
171
+ if (host.length === 0 || cleanedPath.length === 0 || cleanedPath === "/") {
172
+ return void 0;
173
+ }
174
+ const withSlash = cleanedPath.startsWith("/") ? cleanedPath : `/${cleanedPath}`;
175
+ return `${host}${withSlash}`.toLowerCase();
176
+ };
177
+ var normalizeRepositoryKey = (reference) => {
178
+ const trimmed = reference.trim();
179
+ if (trimmed.length === 0 || trimmed.length > MAX_REPOSITORY_REFERENCE_LENGTH) {
180
+ return void 0;
181
+ }
182
+ if (SCHEME_PATTERN.test(trimmed)) {
183
+ let url;
184
+ try {
185
+ url = new URL(trimmed);
186
+ } catch {
187
+ return void 0;
188
+ }
189
+ if (url.protocol === "file:") {
190
+ return void 0;
191
+ }
192
+ return keyOf(url.hostname, url.pathname);
193
+ }
194
+ if (trimmed.startsWith("/") || trimmed.startsWith(".") || trimmed.includes("\\")) {
195
+ return void 0;
196
+ }
197
+ const scp = SCP_LIKE_PATTERN.exec(trimmed);
198
+ if (scp !== null && !trimmed.split(":")[0]?.includes("/")) {
199
+ const [, host, pathPart] = scp;
200
+ return host === void 0 || pathPart === void 0 ? void 0 : keyOf(host, pathPart);
201
+ }
202
+ try {
203
+ const url = new URL(`https://${trimmed}`);
204
+ return keyOf(url.hostname, url.pathname);
205
+ } catch {
206
+ return void 0;
207
+ }
208
+ };
209
+
156
210
  // src/config/destinations.ts
157
211
  var DEFAULT_DESTINATION_NAME = "default";
158
212
  var DESTINATION_NAME_PATTERN = /^[a-z0-9][a-z0-9_-]{0,62}$/;
@@ -171,6 +225,30 @@ var headerValueSchema = z3.string().min(1).max(MAX_HEADER_VALUE_LENGTH).refine(
171
225
  "an env: header reference must name an environment variable, e.g. env:COLLECTOR_TOKEN"
172
226
  );
173
227
  var endpointSchema = z3.string().url().max(2048);
228
+ var MAX_DESTINATION_SCOPES = 64;
229
+ var MAX_SCOPE_REPOSITORIES = 256;
230
+ var ALL_REPOSITORIES = "*";
231
+ var repositoryReferenceSchema = z3.string().min(1).max(MAX_REPOSITORY_REFERENCE_LENGTH).refine(
232
+ (value) => normalizeRepositoryKey(value) !== void 0,
233
+ "not a repository URL: use https://host/owner/repo, git@host:owner/repo.git, or host/owner/repo"
234
+ );
235
+ var destinationScopeSchema = z3.strictObject({
236
+ /**
237
+ * Repository URLs (any spelling of the remote; compared by host and path,
238
+ * case-insensitively, without `.git`), or `"*"` for every record that names
239
+ * a repository. A record that names none never matches a scope.
240
+ */
241
+ repositories: z3.union([
242
+ z3.literal(ALL_REPOSITORIES),
243
+ z3.array(repositoryReferenceSchema).min(1).max(MAX_SCOPE_REPOSITORIES).readonly()
244
+ ]),
245
+ /** Signals sent for these repositories. Default: every signal the destination takes. */
246
+ signals: z3.array(exportSignalSchema).min(1).max(3).readonly().optional(),
247
+ /** Content disclosure for these repositories, never above `privacy.contentMode`. Default: unchanged. */
248
+ contentMode: contentModeSchema.optional(),
249
+ /** False leaves `session.id` off metric data points for these repositories. Default true. */
250
+ includeSessionId: z3.boolean().optional()
251
+ });
174
252
  var exportDestinationSchema = z3.strictObject({
175
253
  /** Unique, lowercase, filesystem-safe. `default` is reserved for the single-endpoint settings. */
176
254
  name: z3.string().regex(DESTINATION_NAME_PATTERN, "destination names are lowercase letters, digits, _ and -"),
@@ -204,7 +282,15 @@ var exportDestinationSchema = z3.strictObject({
204
282
  * opt-in for content-bearing records leaving the host. `metrics` is never on by
205
283
  * default: a destination receives hook-derived metrics only when it lists them.
206
284
  */
207
- signals: z3.array(exportSignalSchema).min(1).max(3).readonly().optional()
285
+ signals: z3.array(exportSignalSchema).min(1).max(3).readonly().optional(),
286
+ /**
287
+ * Per-repository filter. Absent: every record goes to this destination, as
288
+ * before scopes existed. Present: a record goes only when its repository
289
+ * (`vcs.repository.url.full`) matches a scope — the first matching scope
290
+ * decides its signals, content mode, and session id — and a record that
291
+ * names no repository is not sent here at all.
292
+ */
293
+ scopes: z3.array(destinationScopeSchema).min(1).max(MAX_DESTINATION_SCOPES).readonly().optional()
208
294
  }).refine(
209
295
  (destination) => destination.endpoint !== void 0 || destination.tracesEndpoint !== void 0 || destination.logsEndpoint !== void 0 || destination.metricsEndpoint !== void 0,
210
296
  "a destination needs an endpoint, or a tracesEndpoint / logsEndpoint / metricsEndpoint"
@@ -248,6 +334,32 @@ var effectiveSpoolPolicy = (exporter) => ({
248
334
  maxAgeMillis: exporter.spool?.maxAgeMillis ?? DEFAULT_SPOOL_POLICY.maxAgeMillis,
249
335
  maxBatches: exporter.spool?.maxBatches ?? DEFAULT_SPOOL_POLICY.maxBatches
250
336
  });
337
+ var resolveDestinationScopes = (scopes, destinationSignals) => scopes.map((scope) => {
338
+ const listed = scope.signals ?? exportSignalSchema.options;
339
+ return {
340
+ repositories: scope.repositories === ALL_REPOSITORIES ? ALL_REPOSITORIES : new Set(
341
+ scope.repositories.flatMap((reference) => {
342
+ const key = normalizeRepositoryKey(reference);
343
+ return key === void 0 ? [] : [key];
344
+ })
345
+ ),
346
+ signals: {
347
+ traces: destinationSignals.traces && listed.includes("traces"),
348
+ logs: destinationSignals.logs && listed.includes("logs"),
349
+ metrics: destinationSignals.metrics && listed.includes("metrics")
350
+ },
351
+ ...scope.contentMode === void 0 ? {} : { contentMode: scope.contentMode },
352
+ includeSessionId: scope.includeSessionId ?? true
353
+ };
354
+ });
355
+ var matchDestinationScope = (scopes, repositoryKey) => {
356
+ if (repositoryKey === void 0) {
357
+ return void 0;
358
+ }
359
+ return scopes.find(
360
+ (scope) => scope.repositories === ALL_REPOSITORIES || scope.repositories.has(repositoryKey)
361
+ );
362
+ };
251
363
  var legacyDestination = (exporter) => ({
252
364
  name: DEFAULT_DESTINATION_NAME,
253
365
  source: "exporter",
@@ -272,6 +384,11 @@ var resolveExportDestinations = (exporter) => {
272
384
  continue;
273
385
  }
274
386
  const signals = destination.signals ?? DEFAULT_DESTINATION_SIGNALS;
387
+ const flags = {
388
+ traces: signals.includes("traces"),
389
+ logs: exporter.logs.enabled && signals.includes("logs"),
390
+ metrics: signals.includes("metrics")
391
+ };
275
392
  resolved.push({
276
393
  name: destination.name,
277
394
  source: "destinations",
@@ -280,12 +397,9 @@ var resolveExportDestinations = (exporter) => {
280
397
  ...destination.tracesEndpoint === void 0 ? {} : { tracesEndpoint: destination.tracesEndpoint },
281
398
  ...destination.logsEndpoint === void 0 ? {} : { logsEndpoint: destination.logsEndpoint },
282
399
  ...destination.metricsEndpoint === void 0 ? {} : { metricsEndpoint: destination.metricsEndpoint },
283
- signals: {
284
- traces: signals.includes("traces"),
285
- logs: exporter.logs.enabled && signals.includes("logs"),
286
- metrics: signals.includes("metrics")
287
- },
288
- headers: { ...destination.headers ?? {} }
400
+ signals: flags,
401
+ headers: { ...destination.headers ?? {} },
402
+ ...destination.scopes === void 0 ? {} : { scopes: resolveDestinationScopes(destination.scopes, flags) }
289
403
  });
290
404
  }
291
405
  return resolved;
@@ -2443,7 +2557,7 @@ import {
2443
2557
  } from "@opentelemetry/semantic-conventions/incubating";
2444
2558
 
2445
2559
  // src/version.ts
2446
- var VERSION = "0.13.2";
2560
+ var VERSION = "0.14.1";
2447
2561
 
2448
2562
  // src/telemetry/semconv.ts
2449
2563
  var SCOPE_NAME = "@osfactory/otel-hook";
@@ -2926,6 +3040,17 @@ var planGroup = (group, correlation, correlationAvailable) => {
2926
3040
  };
2927
3041
  var runDiscriminatorOf = (correlation) => correlation?.runSpanIdDiscriminator === void 0 ? void 0 : `run:${correlation.runSpanIdDiscriminator}`;
2928
3042
  var resumedSessionParent = (ref, correlation) => ref.family === "session" && correlation?.runSpanIdDiscriminator !== void 0 ? ref : void 0;
3043
+ var spanEndEdgesOf = (events) => {
3044
+ const layout = layoutBatch(events);
3045
+ const ends = /* @__PURE__ */ new Map();
3046
+ for (const [eventId, groupKey] of layout.groupOf) {
3047
+ const end = layout.groups.get(groupKey)?.end;
3048
+ if (end !== void 0) {
3049
+ ends.set(eventId, end);
3050
+ }
3051
+ }
3052
+ return ends;
3053
+ };
2929
3054
  var canonicalEventTraceIdentities = (events, options = {}) => {
2930
3055
  const layout = layoutBatch(events);
2931
3056
  const correlations = indexCorrelations(options.correlations);
@@ -3493,6 +3618,23 @@ var createUsageAccumulator = (deps) => {
3493
3618
 
3494
3619
  // src/privacy/service.ts
3495
3620
  import { createHash as createHash3 } from "crypto";
3621
+ var DISCLOSURE_RANK = Object.freeze({
3622
+ omitted: 0,
3623
+ masked: 1,
3624
+ redacted: 2,
3625
+ raw: 3
3626
+ });
3627
+ var WHITESPACE = /\s/u;
3628
+ var withoutTrailingToken = (text) => {
3629
+ let end = text.length;
3630
+ while (end > 0) {
3631
+ const low = text.charCodeAt(end - 1);
3632
+ const width = end >= 2 && low >= 56320 && low <= 57343 ? 2 : 1;
3633
+ if (WHITESPACE.test(text.slice(end - width, end))) break;
3634
+ end -= width;
3635
+ }
3636
+ return text.slice(0, end);
3637
+ };
3496
3638
  var compilePatterns = (sources, flags) => {
3497
3639
  const compiled = [];
3498
3640
  for (const source of sources) {
@@ -3830,7 +3972,31 @@ var createPrivacyService = (policyInput) => {
3830
3972
  flattenToAttributes,
3831
3973
  sanitizeAttributes,
3832
3974
  sanitizeExtensions,
3833
- boundString
3975
+ boundString,
3976
+ restrictContent: (fact, mode) => {
3977
+ const target = CONTENT_MODE_DISCLOSURE[mode];
3978
+ if (fact.text === void 0 || DISCLOSURE_RANK[fact.disclosure] <= DISCLOSURE_RANK[target]) {
3979
+ return fact;
3980
+ }
3981
+ const { text, ...rest } = fact;
3982
+ switch (target) {
3983
+ case "omitted":
3984
+ return { ...rest, disclosure: "omitted", truncated: false };
3985
+ case "masked":
3986
+ return { ...rest, disclosure: "masked", text: maskText(text) };
3987
+ case "redacted": {
3988
+ const redacted = redactSecretSpans(fact.truncated ? withoutTrailingToken(text) : text);
3989
+ return {
3990
+ ...rest,
3991
+ disclosure: "redacted",
3992
+ text: redacted.text,
3993
+ secretsRedacted: fact.secretsRedacted + redacted.count
3994
+ };
3995
+ }
3996
+ case "raw":
3997
+ return fact;
3998
+ }
3999
+ }
3834
4000
  };
3835
4001
  };
3836
4002
 
@@ -5690,6 +5856,28 @@ var classifyDurability = (input) => {
5690
5856
  };
5691
5857
  var isCommittable = (durability) => durability !== "lost";
5692
5858
  var MAX_ERROR_EVENTS = 8;
5859
+ var resolveWorkspaceRepositoryKey = async (locator, directory, budgetMillis) => {
5860
+ if (locator?.originRepositoryKey === void 0) {
5861
+ return void 0;
5862
+ }
5863
+ let timer;
5864
+ const deadline = new Promise((resolve3) => {
5865
+ timer = setTimeout(() => resolve3(void 0), Math.max(0, budgetMillis));
5866
+ timer.unref?.();
5867
+ });
5868
+ try {
5869
+ return await Promise.race([
5870
+ locator.originRepositoryKey(directory).catch(() => void 0),
5871
+ deadline
5872
+ ]);
5873
+ } catch {
5874
+ return void 0;
5875
+ } finally {
5876
+ if (timer !== void 0) {
5877
+ clearTimeout(timer);
5878
+ }
5879
+ }
5880
+ };
5693
5881
  var collectContentFacts = (event2) => {
5694
5882
  const facts = [];
5695
5883
  const push = (fact) => {
@@ -6333,7 +6521,8 @@ var createOtelHook = (deps) => {
6333
6521
  kind: "ready",
6334
6522
  batch: batch2,
6335
6523
  dropped: screened.dropped,
6336
- ...parsed.targetHints === void 0 ? {} : { targetHints: parsed.targetHints }
6524
+ ...parsed.targetHints === void 0 ? {} : { targetHints: parsed.targetHints },
6525
+ ...parsed.workspaceDirectory === void 0 ? {} : { workspaceDirectory: parsed.workspaceDirectory }
6337
6526
  };
6338
6527
  };
6339
6528
  let prepared;
@@ -6401,11 +6590,19 @@ var createOtelHook = (deps) => {
6401
6590
  batch,
6402
6591
  !suppress && batch.length > 0 && deps.sessionContext !== void 0 ? await readSessionContext(deps.sessionContext, detection.providerId, identity.sessionId) : void 0
6403
6592
  );
6593
+ const workspaceRepositoryKey = !suppress && batch.length > 0 && deps.routeByWorkspaceRepository === true && prepared.workspaceDirectory !== void 0 ? await resolveWorkspaceRepositoryKey(
6594
+ deps.worktreeLocator,
6595
+ prepared.workspaceDirectory,
6596
+ deps.targetResolutionBudgetMillis ?? DEFAULT_TARGET_RESOLUTION_BUDGET_MILLIS
6597
+ ) : void 0;
6404
6598
  let emitted = 0;
6405
6599
  let exportRejected = 0;
6406
6600
  if (!suppress && batch.length > 0) {
6407
6601
  try {
6408
- const result = await deps.sink.emit(batch);
6602
+ const result = await deps.sink.emit(
6603
+ batch,
6604
+ workspaceRepositoryKey === void 0 ? void 0 : { workspaceRepositoryKey }
6605
+ );
6409
6606
  emitted = result.accepted;
6410
6607
  exportRejected = result.rejected;
6411
6608
  diagnostics.push(...result.errors);
@@ -6464,7 +6661,8 @@ var createOtelHook = (deps) => {
6464
6661
  durability,
6465
6662
  dropped,
6466
6663
  hookResponse: hookResponseFor(adapter, detection, "attributed", void 0, emitted, diagnostics),
6467
- diagnostics
6664
+ diagnostics,
6665
+ ...workspaceRepositoryKey === void 0 ? {} : { workspaceRepositoryKey }
6468
6666
  };
6469
6667
  } catch (thrown) {
6470
6668
  const info = errorInfoFromThrown(thrown, { code: "internal-error", phase: "parsing" });
@@ -6563,15 +6761,16 @@ var MAX_WORKTREE_WALK_DEPTH = 128;
6563
6761
  var MAX_GIT_FILE_BYTES = 4096;
6564
6762
  var MAX_CACHE_ENTRIES = 1024;
6565
6763
  var DEFAULT_WORKTREE_CACHE_TTL_MILLIS = 5e3;
6764
+ var MAX_GIT_CONFIG_BYTES = 64 * 1024;
6566
6765
  var MAX_BRANCH_NAME_LENGTH = 255;
6567
6766
  var ABSENT = Object.freeze({ kind: "absent" });
6568
6767
  var INVALID = Object.freeze({ kind: "invalid" });
6569
- var readBounded2 = async (filePath) => {
6768
+ var readBounded2 = async (filePath, maxBytes = MAX_GIT_FILE_BYTES) => {
6570
6769
  let handle;
6571
6770
  try {
6572
6771
  handle = await open4(filePath, "r");
6573
- const buffer = Buffer.alloc(MAX_GIT_FILE_BYTES);
6574
- const { bytesRead } = await handle.read(buffer, 0, MAX_GIT_FILE_BYTES, 0);
6772
+ const buffer = Buffer.alloc(maxBytes);
6773
+ const { bytesRead } = await handle.read(buffer, 0, maxBytes, 0);
6575
6774
  return buffer.subarray(0, bytesRead).toString("utf8");
6576
6775
  } catch {
6577
6776
  return void 0;
@@ -6599,6 +6798,60 @@ var parseGitDirFile = (content, worktreeRoot) => {
6599
6798
  );
6600
6799
  };
6601
6800
  var parseCommonDirFile = (content, gitDir) => resolveGitPath(firstLine(content), gitDir);
6801
+ var unquoteConfigValue = (raw) => {
6802
+ let value = "";
6803
+ let quoted = false;
6804
+ for (let index = 0; index < raw.length; index += 1) {
6805
+ const char = raw[index];
6806
+ if (char === "\\") {
6807
+ const next = raw[index + 1];
6808
+ if (next === void 0) {
6809
+ return void 0;
6810
+ }
6811
+ value += next === "n" ? "\n" : next === "t" ? " " : next;
6812
+ index += 1;
6813
+ } else if (char === '"') {
6814
+ quoted = !quoted;
6815
+ } else if (!quoted && (char === "#" || char === ";")) {
6816
+ break;
6817
+ } else {
6818
+ value += char;
6819
+ }
6820
+ }
6821
+ return quoted ? void 0 : value.trim();
6822
+ };
6823
+ var parseOriginRemoteUrl = (content) => {
6824
+ const lines = content.split(/\r?\n/);
6825
+ if (!content.endsWith("\n")) {
6826
+ lines.pop();
6827
+ }
6828
+ let inOrigin = false;
6829
+ for (const rawLine of lines) {
6830
+ const line = rawLine.trim();
6831
+ if (line.startsWith("[")) {
6832
+ const close = line.indexOf("]");
6833
+ const header = close === -1 ? "" : line.slice(1, close).trim();
6834
+ const rest = close === -1 ? "" : line.slice(close + 1).trim();
6835
+ inOrigin = /^remote\s+"origin"$/i.test(header) && header.endsWith('"origin"') || header.toLowerCase() === "remote.origin";
6836
+ if (!inOrigin || rest.length === 0 || rest.startsWith("#") || rest.startsWith(";")) {
6837
+ continue;
6838
+ }
6839
+ const entry2 = /^url\s*=(.*)$/i.exec(rest);
6840
+ if (entry2 !== null) {
6841
+ return unquoteConfigValue(entry2[1] ?? "");
6842
+ }
6843
+ continue;
6844
+ }
6845
+ if (!inOrigin) {
6846
+ continue;
6847
+ }
6848
+ const entry = /^url\s*=(.*)$/i.exec(line);
6849
+ if (entry !== null) {
6850
+ return unquoteConfigValue(entry[1] ?? "");
6851
+ }
6852
+ }
6853
+ return void 0;
6854
+ };
6602
6855
  var isMissing = async (filePath) => {
6603
6856
  try {
6604
6857
  await lstat(filePath);
@@ -6619,11 +6872,15 @@ var repositoryOf = async (worktreeRoot, gitDir) => {
6619
6872
  const commonDirFile = path5.join(gitDir, "commondir");
6620
6873
  const content = await readBounded2(commonDirFile);
6621
6874
  if (content === void 0) {
6622
- return await isMissing(commonDirFile) ? { kind: "main", mainRoot: worktreeRoot } : { kind: "linked" };
6875
+ return await isMissing(commonDirFile) ? { kind: "main", mainRoot: worktreeRoot, configDir: gitDir } : { kind: "linked" };
6623
6876
  }
6624
6877
  const commonDir = parseCommonDirFile(content, gitDir);
6625
6878
  const mainRoot = commonDir !== void 0 && path5.basename(commonDir) === ".git" && await isDirectory(commonDir) ? path5.dirname(commonDir) : void 0;
6626
- return { kind: "linked", ...mainRoot === void 0 ? {} : { mainRoot } };
6879
+ return {
6880
+ kind: "linked",
6881
+ ...mainRoot === void 0 ? {} : { mainRoot },
6882
+ ...commonDir === void 0 ? {} : { configDir: commonDir }
6883
+ };
6627
6884
  };
6628
6885
  var probeDirectory = async (directory) => {
6629
6886
  const dotGit = path5.join(directory, ".git");
@@ -6648,12 +6905,21 @@ var probeDirectory = async (directory) => {
6648
6905
  return INVALID;
6649
6906
  }
6650
6907
  const branch = parseHeadBranch(head);
6651
- const repository = info.isDirectory() ? { kind: "main", mainRoot: directory } : await repositoryOf(directory, gitDir);
6908
+ const { configDir, ...repository } = info.isDirectory() ? { kind: "main", mainRoot: directory, configDir: gitDir } : await repositoryOf(directory, gitDir);
6652
6909
  return {
6653
6910
  kind: "worktree",
6654
- located: { root: directory, ...branch === void 0 ? {} : { branch }, ...repository }
6911
+ located: { root: directory, ...branch === void 0 ? {} : { branch }, ...repository },
6912
+ configDir: configDir ?? ""
6655
6913
  };
6656
6914
  };
6915
+ var readOriginRepositoryKey = async (configDir) => {
6916
+ if (configDir.length === 0) {
6917
+ return void 0;
6918
+ }
6919
+ const content = await readBounded2(path5.join(configDir, "config"), MAX_GIT_CONFIG_BYTES);
6920
+ const url = content === void 0 ? void 0 : parseOriginRemoteUrl(content);
6921
+ return url === void 0 ? void 0 : normalizeRepositoryKey(url);
6922
+ };
6657
6923
  var createFilesystemWorktreeLocator = (options = {}) => {
6658
6924
  const now = options.monotonicMillis ?? (() => performance.now());
6659
6925
  const ttl = options.cacheTtlMillis ?? DEFAULT_WORKTREE_CACHE_TTL_MILLIS;
@@ -6671,32 +6937,57 @@ var createFilesystemWorktreeLocator = (options = {}) => {
6671
6937
  cache.set(directory, { at, probe });
6672
6938
  return probe;
6673
6939
  };
6674
- const locate = async (absolutePath) => {
6675
- try {
6676
- if (!path5.isAbsolute(absolutePath) || absolutePath.includes("\0")) {
6940
+ const remoteCache = /* @__PURE__ */ new Map();
6941
+ const cachedOriginKey = (configDir) => {
6942
+ const hit = remoteCache.get(configDir);
6943
+ const at = now();
6944
+ if (hit !== void 0 && at - hit.at <= ttl) {
6945
+ return hit.key;
6946
+ }
6947
+ if (remoteCache.size >= MAX_CACHE_ENTRIES) {
6948
+ remoteCache.clear();
6949
+ }
6950
+ const key = readOriginRepositoryKey(configDir).catch(() => void 0);
6951
+ remoteCache.set(configDir, { at, key });
6952
+ return key;
6953
+ };
6954
+ const findWorktree = async (absolutePath) => {
6955
+ if (!path5.isAbsolute(absolutePath) || absolutePath.includes("\0")) {
6956
+ return void 0;
6957
+ }
6958
+ let directory = path5.resolve(absolutePath);
6959
+ for (let depth = 0; depth < MAX_WORKTREE_WALK_DEPTH; depth += 1) {
6960
+ const probe = await cachedProbe(directory);
6961
+ if (probe.kind === "worktree") {
6962
+ return probe;
6963
+ }
6964
+ if (probe.kind === "invalid") {
6677
6965
  return void 0;
6678
6966
  }
6679
- let directory = path5.resolve(absolutePath);
6680
- for (let depth = 0; depth < MAX_WORKTREE_WALK_DEPTH; depth += 1) {
6681
- const probe = await cachedProbe(directory);
6682
- if (probe.kind === "worktree") {
6683
- return probe.located;
6684
- }
6685
- if (probe.kind === "invalid") {
6686
- return void 0;
6687
- }
6688
- const parent = path5.dirname(directory);
6689
- if (parent === directory) {
6690
- return void 0;
6691
- }
6692
- directory = parent;
6967
+ const parent = path5.dirname(directory);
6968
+ if (parent === directory) {
6969
+ return void 0;
6693
6970
  }
6971
+ directory = parent;
6972
+ }
6973
+ return void 0;
6974
+ };
6975
+ const locate = async (absolutePath) => {
6976
+ try {
6977
+ return (await findWorktree(absolutePath))?.located;
6978
+ } catch {
6694
6979
  return void 0;
6980
+ }
6981
+ };
6982
+ const originRepositoryKey = async (absolutePath) => {
6983
+ try {
6984
+ const probe = await findWorktree(absolutePath);
6985
+ return probe === void 0 ? void 0 : await cachedOriginKey(probe.configDir);
6695
6986
  } catch {
6696
6987
  return void 0;
6697
6988
  }
6698
6989
  };
6699
- return { locate };
6990
+ return { locate, originRepositoryKey };
6700
6991
  };
6701
6992
 
6702
6993
  // src/state/filesystem-store.ts
@@ -9172,6 +9463,117 @@ var createOtlpTraceSink = (options) => {
9172
9463
  };
9173
9464
  };
9174
9465
 
9466
+ // src/telemetry/destination-scope.ts
9467
+ var DISCLOSURE_RANK2 = Object.freeze({
9468
+ omitted: 0,
9469
+ masked: 1,
9470
+ redacted: 2,
9471
+ raw: 3
9472
+ });
9473
+ var omitRestrictedContent = (fact, mode) => {
9474
+ if (fact.text === void 0 || DISCLOSURE_RANK2[fact.disclosure] <= DISCLOSURE_RANK2[CONTENT_MODE_DISCLOSURE[mode]]) {
9475
+ return fact;
9476
+ }
9477
+ const { text, ...rest } = fact;
9478
+ void text;
9479
+ return { ...rest, disclosure: "omitted", truncated: false };
9480
+ };
9481
+ var keyOfValue = (value) => typeof value === "string" ? normalizeRepositoryKey(value) : void 0;
9482
+ var resourceRepositoryKey = (attributes) => keyOfValue(attributes[ATTR_VCS_REPOSITORY_URL_FULL]);
9483
+ var repositoryUrlForKey = (key) => `https://${key}`;
9484
+ var hasOwnStamp = (attributes) => attributes?.[ATTR_VCS_REPOSITORY_URL_FULL] !== void 0;
9485
+ var withRoutedRepository = (event2, key) => hasOwnStamp(event2.contextAttributes) ? event2 : {
9486
+ ...event2,
9487
+ contextAttributes: { ...event2.contextAttributes, [ATTR_VCS_REPOSITORY_URL_FULL]: repositoryUrlForKey(key) }
9488
+ };
9489
+ var eventRepositoryKey = (event2, fallbackKey) => {
9490
+ const stamped = event2.contextAttributes?.[ATTR_VCS_REPOSITORY_URL_FULL];
9491
+ return stamped === void 0 ? fallbackKey : keyOfValue(stamped);
9492
+ };
9493
+ var pointRepositoryKey = (point, fallbackKey) => {
9494
+ const stamped = point.attributes[ATTR_VCS_REPOSITORY_URL_FULL];
9495
+ return stamped === void 0 ? fallbackKey : keyOfValue(stamped);
9496
+ };
9497
+ var restrictFacts = (facts, mode, restrict) => facts?.map((fact) => restrict(fact, mode));
9498
+ var restrictEventContent = (event2, mode, restrict) => {
9499
+ switch (event2.type) {
9500
+ case "prompt.submitted":
9501
+ return event2.content === void 0 ? event2 : { ...event2, content: restrict(event2.content, mode) };
9502
+ case "generation.start": {
9503
+ const inputContent = restrictFacts(event2.inputContent, mode, restrict);
9504
+ return inputContent === void 0 ? event2 : { ...event2, inputContent };
9505
+ }
9506
+ case "generation.end": {
9507
+ const outputContent = restrictFacts(event2.outputContent, mode, restrict);
9508
+ return outputContent === void 0 ? event2 : { ...event2, outputContent };
9509
+ }
9510
+ case "tool.start":
9511
+ return event2.input === void 0 ? event2 : { ...event2, input: restrict(event2.input, mode) };
9512
+ case "tool.end":
9513
+ return event2.output === void 0 ? event2 : { ...event2, output: restrict(event2.output, mode) };
9514
+ case "error.raised":
9515
+ return event2.message === void 0 ? event2 : { ...event2, message: restrict(event2.message, mode) };
9516
+ default:
9517
+ return event2;
9518
+ }
9519
+ };
9520
+ var routeEventsToScopes = (events, scopes, options) => {
9521
+ const ends = spanEndEdgesOf(events);
9522
+ const fallbackKey = options.workspaceRepositoryKey ?? options.resourceRepositoryKey;
9523
+ const traces = [];
9524
+ const logs = [];
9525
+ let unchanged = true;
9526
+ for (const event2 of events) {
9527
+ const anchor = ends.get(event2.eventId) ?? event2;
9528
+ const scope = matchDestinationScope(scopes, eventRepositoryKey(anchor, fallbackKey));
9529
+ if (scope === void 0 || !scope.signals.traces || !scope.signals.logs) {
9530
+ unchanged = false;
9531
+ }
9532
+ if (scope === void 0) {
9533
+ continue;
9534
+ }
9535
+ const lowered = scope.contentMode === void 0 ? event2 : restrictEventContent(event2, scope.contentMode, options.restrict);
9536
+ const restricted = hasOwnStamp(anchor.contextAttributes) || fallbackKey === void 0 ? lowered : withRoutedRepository(lowered, fallbackKey);
9537
+ if (restricted !== event2) {
9538
+ unchanged = false;
9539
+ }
9540
+ if (scope.signals.traces) {
9541
+ traces.push(restricted);
9542
+ }
9543
+ if (scope.signals.logs) {
9544
+ logs.push(restricted);
9545
+ }
9546
+ }
9547
+ return unchanged ? { traces: events, logs: events } : { traces, logs };
9548
+ };
9549
+ var routePointsToScopes = (scopes, pointsFor, options) => {
9550
+ const effective = (scope) => options.includeSessionId && scope.includeSessionId;
9551
+ const kept = [];
9552
+ for (const variant of [true, false]) {
9553
+ if (!scopes.some((scope) => scope.signals.metrics && effective(scope) === variant)) {
9554
+ continue;
9555
+ }
9556
+ for (const point of pointsFor(variant) ?? []) {
9557
+ const scope = matchDestinationScope(scopes, pointRepositoryKey(point, options.fallbackKey));
9558
+ if (scope?.signals.metrics === true && effective(scope) === variant) {
9559
+ kept.push(
9560
+ hasOwnStamp(point.attributes) || options.fallbackKey === void 0 ? point : {
9561
+ ...point,
9562
+ attributes: {
9563
+ ...point.attributes,
9564
+ [ATTR_VCS_REPOSITORY_URL_FULL]: repositoryUrlForKey(options.fallbackKey)
9565
+ }
9566
+ }
9567
+ );
9568
+ }
9569
+ }
9570
+ }
9571
+ return kept;
9572
+ };
9573
+ var sessionIdVariantsFor = (scopes, includeSessionId) => new Set(
9574
+ scopes.filter((scope) => scope.signals.metrics).map((scope) => includeSessionId && scope.includeSessionId)
9575
+ );
9576
+
9175
9577
  // src/telemetry/signal-fanout.ts
9176
9578
  var createSignalFanout = (options) => {
9177
9579
  const emit = async (events) => {
@@ -9204,14 +9606,20 @@ var createSignalFanout = (options) => {
9204
9606
  };
9205
9607
  var shareCorrelationPerBatch = (correlate) => {
9206
9608
  let pending;
9207
- return (events) => {
9208
- if (pending?.events === events) {
9609
+ const resolve3 = (events) => {
9610
+ if (pending !== void 0 && (pending.events === events || pending.aliases.has(events))) {
9209
9611
  return pending.result;
9210
9612
  }
9211
9613
  const result = correlate(events);
9212
- pending = { events, result };
9614
+ pending = { events, aliases: /* @__PURE__ */ new Set(), result };
9213
9615
  return result;
9214
9616
  };
9617
+ const alias = (subset, batch) => {
9618
+ if (pending?.events === batch && subset !== batch) {
9619
+ pending.aliases.add(subset);
9620
+ }
9621
+ };
9622
+ return Object.assign(resolve3, { alias });
9215
9623
  };
9216
9624
 
9217
9625
  // src/telemetry/export-destinations.ts
@@ -9280,6 +9688,8 @@ var createExportDestinationSinks = (options) => {
9280
9688
  ...options.exporter.endpointDownMillis === void 0 ? {} : { downMillis: options.exporter.endpointDownMillis },
9281
9689
  probeMillis: effectiveExportTimeoutMillis(options.exporter) + 1e3
9282
9690
  });
9691
+ const scopedResourceKey = resourceRepositoryKey(resourceFromExporterPolicy(options.exporter).attributes);
9692
+ const restrict = options.restrictContent ?? omitRestrictedContent;
9283
9693
  for (const destination of resolveExportDestinations(options.exporter)) {
9284
9694
  let headers;
9285
9695
  let logHeaders;
@@ -9369,24 +9779,59 @@ var createExportDestinationSinks = (options) => {
9369
9779
  metrics,
9370
9780
  ...spool === void 0 ? {} : { spool },
9371
9781
  ...logSpool === void 0 ? {} : { logSpool },
9372
- ...metricSpool === void 0 ? {} : { metricSpool }
9782
+ ...metricSpool === void 0 ? {} : { metricSpool },
9783
+ ...destination.scopes === void 0 ? {} : {
9784
+ scopes: destination.scopes,
9785
+ route: (events, workspaceRepositoryKey) => routeEventsToScopes(events, destination.scopes ?? [], {
9786
+ ...scopedResourceKey === void 0 ? {} : { resourceRepositoryKey: scopedResourceKey },
9787
+ ...workspaceRepositoryKey === void 0 ? {} : { workspaceRepositoryKey },
9788
+ restrict
9789
+ })
9790
+ }
9373
9791
  });
9374
9792
  }
9375
9793
  return { destinations, skipped };
9376
9794
  };
9377
- var createDestinationFanout = (destinations) => {
9795
+ var createScopedFanout = (destination, correlate) => {
9796
+ const route = destination.route;
9797
+ const unscoped = createSignalFanout({ traces: destination.traces, logs: destination.logs });
9798
+ if (route === void 0) {
9799
+ return unscoped;
9800
+ }
9801
+ const none = { accepted: 0, rejected: 0, errors: [] };
9802
+ return {
9803
+ ...unscoped,
9804
+ emit: async (events, emitOptions) => {
9805
+ const batch = route(events, emitOptions?.workspaceRepositoryKey);
9806
+ if (correlate !== void 0 && (batch.traces.length > 0 || batch.logs.length > 0)) {
9807
+ await correlate(events);
9808
+ correlate.alias(batch.traces, events);
9809
+ correlate.alias(batch.logs, events);
9810
+ }
9811
+ const traces = batch.traces.length === 0 ? none : await destination.traces.emit(batch.traces);
9812
+ const logs = batch.logs.length === 0 ? none : await destination.logs.emit(batch.logs);
9813
+ return {
9814
+ accepted: traces.accepted + logs.accepted,
9815
+ rejected: traces.rejected + logs.rejected,
9816
+ errors: [...traces.errors, ...logs.errors]
9817
+ };
9818
+ }
9819
+ };
9820
+ };
9821
+ var createDestinationFanout = (destinations, options = {}) => {
9378
9822
  const fanouts = destinations.map((destination) => ({
9379
9823
  name: destination.name,
9380
- sink: createSignalFanout({ traces: destination.traces, logs: destination.logs })
9824
+ sink: createScopedFanout(destination, options.correlate)
9381
9825
  }));
9382
- const only = fanouts.length === 1 ? fanouts[0] : void 0;
9826
+ const scoped = destinations.some((destination) => destination.route !== void 0);
9827
+ const only = fanouts.length === 1 && !scoped ? fanouts[0] : void 0;
9383
9828
  if (only !== void 0) {
9384
9829
  return only.sink;
9385
9830
  }
9386
- const emit = async (events) => {
9831
+ const emit = async (events, emitOptions) => {
9387
9832
  const results = await Promise.all(
9388
9833
  fanouts.map(
9389
- (fanout) => fanout.sink.emit(events).catch(
9834
+ (fanout) => fanout.sink.emit(events, emitOptions).catch(
9390
9835
  (thrown) => ({
9391
9836
  accepted: 0,
9392
9837
  rejected: events.length,
@@ -9500,7 +9945,8 @@ var createHookRuntime = (options) => {
9500
9945
  // has always been governed by.
9501
9946
  allowRawContent: privacy.policy.allowRawContent
9502
9947
  },
9503
- correlate
9948
+ correlate,
9949
+ restrictContent: (fact, mode) => privacy.restrictContent(fact, mode)
9504
9950
  });
9505
9951
  const primary = exportDestinations.destinations[0];
9506
9952
  const traceSink = primary?.traces ?? createOtlpTraceSink({
@@ -9517,7 +9963,7 @@ var createHookRuntime = (options) => {
9517
9963
  });
9518
9964
  const spool = primary?.spool;
9519
9965
  const logSpool = primary?.logSpool;
9520
- const sink = createDestinationFanout(exportDestinations.destinations);
9966
+ const sink = createDestinationFanout(exportDestinations.destinations, { correlate });
9521
9967
  const hookDeps = {
9522
9968
  stateStore,
9523
9969
  config: options.config,
@@ -9547,7 +9993,12 @@ var createHookRuntime = (options) => {
9547
9993
  })(),
9548
9994
  ...options.worktreeLocator === null ? {} : {
9549
9995
  worktreeLocator: options.worktreeLocator ?? createFilesystemWorktreeLocator({ monotonicMillis: () => clock.monotonicMillis() })
9550
- }
9996
+ },
9997
+ // Only a scoped destination routes by repository, so only then is the session
9998
+ // directory's remote read at all.
9999
+ routeByWorkspaceRepository: exportDestinations.destinations.some(
10000
+ (destination) => destination.scopes !== void 0
10001
+ )
9551
10002
  };
9552
10003
  const hook = createOtelHook({ ...hookDeps, sink });
9553
10004
  const deduplicator = createCallbackDeduplicator({ stateStore, clock });
@@ -9558,6 +10009,8 @@ var createHookRuntime = (options) => {
9558
10009
  (destination) => destination.metrics.enabled
9559
10010
  );
9560
10011
  const metricResource = resourceFromExporterPolicy(options.config.exporter);
10012
+ const scopedMetricDestinations = metricDestinations.filter((destination) => destination.scopes !== void 0);
10013
+ const unscopedMetricDestinations = metricDestinations.filter((destination) => destination.scopes === void 0);
9561
10014
  const deliveryRetentionMillis = options.deliveryRetentionMillis ?? lifecycleMaxAge;
9562
10015
  if (deliveryRetentionMillis < staleClaimMillis) {
9563
10016
  logger.warn("delivery retention is shorter than the stale-claim window", {
@@ -9623,28 +10076,64 @@ var createHookRuntime = (options) => {
9623
10076
  turnStarts.set(event2.sessionId, await metricSeries.readTurnStart(event2.sessionId));
9624
10077
  }
9625
10078
  }
9626
- const observations = deriveMetricObservations({
9627
- events: ingest.events,
9628
- usage: ingest.usageObservations,
9629
- resource: metricResource,
9630
- includeSessionId: metricsPolicy.includeSessionId,
9631
- ...generationStarts === void 0 ? {} : { generationStarts },
9632
- turnStart: (sessionId) => turnStarts.get(sessionId)
9633
- });
9634
- if (observations.length === 0) {
10079
+ const resourceFallback = scopedMetricDestinations.length === 0 ? void 0 : resourceRepositoryKey(metricResource.attributes);
10080
+ const scopedRepositoryFallback = scopedMetricDestinations.length === 0 ? void 0 : ingest.workspaceRepositoryKey ?? resourceFallback;
10081
+ const resourceRepository = metricResource.attributes[ATTR_VCS_REPOSITORY_URL_FULL];
10082
+ const metricEvents = resourceFallback === void 0 || ingest.workspaceRepositoryKey !== void 0 || typeof resourceRepository !== "string" ? ingest.events : ingest.events.map(
10083
+ (event2) => event2.contextAttributes?.[ATTR_VCS_REPOSITORY_URL_FULL] === void 0 ? {
10084
+ ...event2,
10085
+ contextAttributes: {
10086
+ ...event2.contextAttributes,
10087
+ [ATTR_VCS_REPOSITORY_URL_FULL]: resourceRepository
10088
+ }
10089
+ } : event2
10090
+ );
10091
+ const pointsByVariant = /* @__PURE__ */ new Map();
10092
+ const variants = new Set(
10093
+ unscopedMetricDestinations.length > 0 ? [metricsPolicy.includeSessionId] : []
10094
+ );
10095
+ for (const destination of scopedMetricDestinations) {
10096
+ for (const variant of sessionIdVariantsFor(destination.scopes ?? [], metricsPolicy.includeSessionId)) {
10097
+ variants.add(variant);
10098
+ }
10099
+ }
10100
+ for (const includeSessionId of variants) {
10101
+ const observations = deriveMetricObservations({
10102
+ events: metricEvents,
10103
+ usage: ingest.usageObservations,
10104
+ resource: metricResource,
10105
+ includeSessionId,
10106
+ ...generationStarts === void 0 ? {} : { generationStarts },
10107
+ turnStart: (sessionId) => turnStarts.get(sessionId)
10108
+ });
10109
+ if (observations.length === 0) {
10110
+ continue;
10111
+ }
10112
+ pointsByVariant.set(
10113
+ includeSessionId,
10114
+ metricsPolicy.temporality === "delta" ? aggregateDeltaPoints(observations, clock.now()) : await metricSeries.recordCumulative(observations, {
10115
+ perSession: includeSessionId,
10116
+ ...deliveryToken === void 0 ? {} : { deliveryToken }
10117
+ })
10118
+ );
10119
+ }
10120
+ if (pointsByVariant.size === 0) {
9635
10121
  return void 0;
9636
10122
  }
9637
- const points = metricsPolicy.temporality === "delta" ? aggregateDeltaPoints(observations, clock.now()) : await metricSeries.recordCumulative(observations, {
9638
- perSession: metricsPolicy.includeSessionId,
9639
- ...deliveryToken === void 0 ? {} : { deliveryToken }
9640
- });
9641
10123
  const context = agreedContextAttributes(ingest.events);
9642
10124
  const results = await Promise.all(
9643
10125
  metricDestinations.map(async (destination) => {
9644
- const result = await destination.metrics.exportPoints(points, context).catch(
10126
+ const points2 = destination.scopes === void 0 ? pointsByVariant.get(metricsPolicy.includeSessionId) ?? [] : routePointsToScopes(destination.scopes, (variant) => pointsByVariant.get(variant), {
10127
+ fallbackKey: scopedRepositoryFallback,
10128
+ includeSessionId: metricsPolicy.includeSessionId
10129
+ });
10130
+ if (points2.length === 0) {
10131
+ return { name: destination.name, accepted: 0, rejected: 0 };
10132
+ }
10133
+ const result = await destination.metrics.exportPoints(points2, context).catch(
9645
10134
  (thrown) => ({
9646
10135
  accepted: 0,
9647
- rejected: points.length,
10136
+ rejected: points2.length,
9648
10137
  errors: [
9649
10138
  errorInfoFromThrown(thrown, { code: "telemetry-export-failure", phase: "export" })
9650
10139
  ]
@@ -9654,7 +10143,8 @@ var createHookRuntime = (options) => {
9654
10143
  return { name: destination.name, accepted: result.accepted, rejected: result.rejected };
9655
10144
  })
9656
10145
  );
9657
- return { points: points.length, destinations: results };
10146
+ const points = Math.max(0, ...[...pointsByVariant.values()].map((variant) => variant.length));
10147
+ return { points, destinations: results };
9658
10148
  } catch (thrown) {
9659
10149
  diagnostics.push(stateDiagnostic(thrown));
9660
10150
  logger.warn("hook-derived metrics could not be recorded for this callback", {});