@descryy/runtime-remote-log-ingestion 0.2.0 → 0.4.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/LICENSE ADDED
@@ -0,0 +1,6 @@
1
+ Copyright (c) Descry
2
+
3
+ All rights reserved. This software is proprietary and confidential.
4
+ No license, express or implied, to reproduce, distribute, modify, or
5
+ create derivative works is granted except as explicitly agreed in
6
+ writing.
@@ -1,29 +1,22 @@
1
1
  /**
2
2
  * Correlation between a captured browser/proxy request and an ingested
3
- * remote log line (DEC-271's remote side). Follows the same pattern
4
- * `backend-observation/correlator.ts`'s `correlateBackendEvidence` already
5
- * establishes -- prefer a real shared identifier, never fall back to timing
6
- * on its own -- rather than inventing a second correlation shape.
3
+ * remote log line (DEC-271's remote side). Follows the same pattern as
4
+ * `backend-observation/correlator.ts`'s `correlateBackendEvidence`: prefer
5
+ * a real shared identifier, never fall back to timing alone.
7
6
  *
8
7
  * Reuses `@descryy/runtime-contracts`' `Correlation`/`createCorrelation`
9
- * directly: `method` is drawn from the same closed `CorrelationMethod`
10
- * union everywhere else in this repo uses, so `isConfirmed` is derived the
11
- * same way (`isStructuralCorrelation` -- true for `trace-id`/`request-id`,
12
- * false for `timing-context-fallback`) and a reader who already knows that
13
- * contract does not have to learn a second one for the remote case.
8
+ * directly -- same `CorrelationMethod` union and `isConfirmed` derivation
9
+ * (`isStructuralCorrelation`) as everywhere else in this repo.
14
10
  */
15
11
  import type { Correlation } from "@descryy/runtime-contracts";
16
12
  import type { IngestedLogLine } from "./log-line.ts";
17
13
  /**
18
- * A captured browser/proxy request, reduced to the fields correlation
19
- * needs. `timestamp` and `path` are always available -- every captured
20
- * request has both; `traceId`/`requestId` are populated only when the
21
- * capturing side actually found them (real headers, W3C `traceparent` --
22
- * see `external-service-observation/header-correlation.ts`), null
23
- * otherwise. `id` is caller-assigned (an `Evidence.evidenceId`, typically)
24
- * -- this module never generates one, mirroring
25
- * `correlateBackendEvidence`'s use of pre-existing `evidenceId`s rather
26
- * than minting its own.
14
+ * A captured browser/proxy request, reduced to what correlation needs.
15
+ * `timestamp`/`path` are always present; `traceId`/`requestId` are null
16
+ * unless the capturing side found real headers (W3C `traceparent`, see
17
+ * `external-service-observation/header-correlation.ts`). `id` is
18
+ * caller-assigned (typically an `Evidence.evidenceId`) -- this module never
19
+ * mints its own, mirroring `correlateBackendEvidence`.
27
20
  */
28
21
  export interface CapturedRequestRef {
29
22
  readonly id: string;
@@ -35,33 +28,25 @@ export interface CapturedRequestRef {
35
28
  }
36
29
  export interface CorrelateOptions {
37
30
  /**
38
- * Widest gap between the request's and the line's timestamp still
39
- * considered for a timestamp+path match, in milliseconds. Default 5000 --
40
- * generous enough for real network and log-flush latency between a
41
- * request landing and its log line appearing, narrow enough not to pair
42
- * unrelated activity in a busy log.
31
+ * Widest gap between request and line timestamp still considered a
32
+ * timestamp+path match, in ms. Default 5000 -- generous for real
33
+ * network/log-flush latency, narrow enough not to pair unrelated activity.
43
34
  */
44
35
  readonly windowMs?: number;
45
36
  }
46
37
  /**
47
- * Best-effort correlation between one captured request and one ingested log
48
- * line, in DEC-271's stated preference order:
38
+ * Best-effort correlation, DEC-271's preference order:
39
+ * 1. shared trace id (`"trace-id"`, confidence 1) -- same rule as
40
+ * `correlateBackendEvidence`'s local case.
41
+ * 2. shared request id (`"request-id"`, confidence 1).
42
+ * 3. request timestamp within `windowMs` of the line's AND request's
43
+ * `path` found in the line's redacted text (`"timing-context-fallback"`,
44
+ * confidence `TIMESTAMP_PATH_CONFIDENCE`, `isConfirmed: false`). Both
45
+ * signals required -- timestamp proximity alone is never evidence
46
+ * (DEC-271).
49
47
  *
50
- * 1. a shared trace id (`method: "trace-id"`, confidence 1) -- the same
51
- * rule and confidence `correlateBackendEvidence` uses for the local case.
52
- * 2. a shared request id (`method: "request-id"`, confidence 1).
53
- * 3. the request's timestamp within `windowMs` of the line's **and** the
54
- * request's `path` appearing in the line's (already-redacted) text --
55
- * `method: "timing-context-fallback"`, confidence
56
- * `TIMESTAMP_PATH_CONFIDENCE`, `isConfirmed: false`. Both signals are
57
- * required together; timestamp proximity alone is not treated as
58
- * evidence of anything, per DEC-271's warning against inferring from
59
- * timing on its own.
60
- *
61
- * Returns `null` -- DEC-271's "not observable here" for this one
62
- * request/line pair -- when none of the above hold: no shared identifier,
63
- * and either the line carries no parseable timestamp or the path/window
64
- * test fails. Never fabricates a match to fill the gap.
48
+ * Returns `null` ("not observable here") when none hold. Never fabricates
49
+ * a match.
65
50
  */
66
51
  export declare function correlateLogLine(request: CapturedRequestRef, line: IngestedLogLine, options?: CorrelateOptions): Correlation | null;
67
52
  //# sourceMappingURL=correlator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"correlator.d.ts","sourceRoot":"","sources":["../src/correlator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAG9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAED,MAAM,WAAW,gBAAgB;IAC/B;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAmBD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,GAAE,gBAAqB,GAAG,WAAW,GAAG,IAAI,CAqCvI"}
1
+ {"version":3,"file":"correlator.d.ts","sourceRoot":"","sources":["../src/correlator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAG9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAED,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAcD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,GAAE,gBAAqB,GAAG,WAAW,GAAG,IAAI,CAoCvI"}
@@ -1,53 +1,38 @@
1
1
  /**
2
2
  * Correlation between a captured browser/proxy request and an ingested
3
- * remote log line (DEC-271's remote side). Follows the same pattern
4
- * `backend-observation/correlator.ts`'s `correlateBackendEvidence` already
5
- * establishes -- prefer a real shared identifier, never fall back to timing
6
- * on its own -- rather than inventing a second correlation shape.
3
+ * remote log line (DEC-271's remote side). Follows the same pattern as
4
+ * `backend-observation/correlator.ts`'s `correlateBackendEvidence`: prefer
5
+ * a real shared identifier, never fall back to timing alone.
7
6
  *
8
7
  * Reuses `@descryy/runtime-contracts`' `Correlation`/`createCorrelation`
9
- * directly: `method` is drawn from the same closed `CorrelationMethod`
10
- * union everywhere else in this repo uses, so `isConfirmed` is derived the
11
- * same way (`isStructuralCorrelation` -- true for `trace-id`/`request-id`,
12
- * false for `timing-context-fallback`) and a reader who already knows that
13
- * contract does not have to learn a second one for the remote case.
8
+ * directly -- same `CorrelationMethod` union and `isConfirmed` derivation
9
+ * (`isStructuralCorrelation`) as everywhere else in this repo.
14
10
  */
15
11
  import { randomUUID } from "node:crypto";
16
12
  import { createCorrelation } from "@descryy/runtime-contracts";
17
13
  const DEFAULT_WINDOW_MS = 5000;
18
14
  /**
19
- * Confidence assigned to every `"timing-context-fallback"` match. Fixed
20
- * rather than scaled by how close the two timestamps are -- DEC-271 asks
21
- * for an honestly-stated tier, not a manufactured precision this signal
22
- * doesn't actually have: there is no identifier behind it, only two
23
- * independent weak cues (a clock and a substring search), so one
24
- * deliberately-below-"confirmed" number stands for the whole tier rather
25
- * than implying a false gradation within it. The structural distinction
26
- * from a confirmed match (`isConfirmed: false`, via `isStructuralCorrelation`)
27
- * is what actually matters; this number exists only so two
28
- * `Correlation`s are never rendered as equally certain by a reader who
29
- * looks at `confidence` alone.
15
+ * Confidence for every `"timing-context-fallback"` match. Fixed, not
16
+ * scaled by timestamp closeness -- DEC-271 wants an honest tier, not
17
+ * manufactured precision: there's no identifier, just two weak cues (a
18
+ * clock and a substring search). The real distinction is `isConfirmed:
19
+ * false`; this number only keeps two `Correlation`s from reading as
20
+ * equally certain via `confidence` alone.
30
21
  */
31
22
  const TIMESTAMP_PATH_CONFIDENCE = 0.4;
32
23
  /**
33
- * Best-effort correlation between one captured request and one ingested log
34
- * line, in DEC-271's stated preference order:
24
+ * Best-effort correlation, DEC-271's preference order:
25
+ * 1. shared trace id (`"trace-id"`, confidence 1) -- same rule as
26
+ * `correlateBackendEvidence`'s local case.
27
+ * 2. shared request id (`"request-id"`, confidence 1).
28
+ * 3. request timestamp within `windowMs` of the line's AND request's
29
+ * `path` found in the line's redacted text (`"timing-context-fallback"`,
30
+ * confidence `TIMESTAMP_PATH_CONFIDENCE`, `isConfirmed: false`). Both
31
+ * signals required -- timestamp proximity alone is never evidence
32
+ * (DEC-271).
35
33
  *
36
- * 1. a shared trace id (`method: "trace-id"`, confidence 1) -- the same
37
- * rule and confidence `correlateBackendEvidence` uses for the local case.
38
- * 2. a shared request id (`method: "request-id"`, confidence 1).
39
- * 3. the request's timestamp within `windowMs` of the line's **and** the
40
- * request's `path` appearing in the line's (already-redacted) text --
41
- * `method: "timing-context-fallback"`, confidence
42
- * `TIMESTAMP_PATH_CONFIDENCE`, `isConfirmed: false`. Both signals are
43
- * required together; timestamp proximity alone is not treated as
44
- * evidence of anything, per DEC-271's warning against inferring from
45
- * timing on its own.
46
- *
47
- * Returns `null` -- DEC-271's "not observable here" for this one
48
- * request/line pair -- when none of the above hold: no shared identifier,
49
- * and either the line carries no parseable timestamp or the path/window
50
- * test fails. Never fabricates a match to fill the gap.
34
+ * Returns `null` ("not observable here") when none hold. Never fabricates
35
+ * a match.
51
36
  */
52
37
  export function correlateLogLine(request, line, options = {}) {
53
38
  if (request.traceId !== null && request.traceId === line.traceId) {
@@ -68,8 +53,7 @@ export function correlateLogLine(request, line, options = {}) {
68
53
  evidenceIds: [request.id, line.lineId],
69
54
  });
70
55
  }
71
- // No clock on this line to window against -- not a weaker match, no
72
- // match at all. Claiming one would be a guess this module refuses.
56
+ // No clock to window against -- no match, not a weaker one.
73
57
  if (line.timestamp === null)
74
58
  return null;
75
59
  const windowMs = options.windowMs ?? DEFAULT_WINDOW_MS;
@@ -1 +1 @@
1
- {"version":3,"file":"correlator.js","sourceRoot":"","sources":["../src/correlator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAmC/D,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAE/B;;;;;;;;;;;;GAYG;AACH,MAAM,yBAAyB,GAAG,GAAG,CAAC;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AAC,WAAW;YAChC,MAAM,EAAE,YAAY;YACpB,UAAU,EAAE,CAAC;YACb,WAAW,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC;SACvC,CAAC,CAAC;IACL,CAAC;IAED,4DAA4D;IAC5D,IAAI,IAAI,CAAC,SAAS,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEzC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,iBAAiB,CAAC;IACvD,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IACrG,IAAI,OAAO,GAAG,QAAQ;QAAE,OAAO,IAAI,CAAC;IACpC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAElD,OAAO,iBAAiB,CAAC;QACvB,aAAa,EAAE,UAAU,EAAE;QAC3B,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,MAAM,EAAE,yBAAyB;QACjC,UAAU,EAAE,yBAAyB;QACrC,WAAW,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC;KACvC,CAAC,CAAC;AACL,CAAC"}
@@ -1,19 +1,16 @@
1
1
  /**
2
- * Concrete adapter #1 for DEC-271's remote side: a log **file** the user
2
+ * Concrete adapter #1 for DEC-271's remote side: a log file the user
3
3
  * points us at.
4
4
  *
5
- * **Chosen over a command-stdout adapter** (`RemoteLogLocation`'s other
6
- * named-and-typed option) because it is the simpler case to build correctly
7
- * and verify in this pass: deterministic content on disk, no child-process
8
- * lifecycle, no question of how a running command's stdout encoding or
9
- * buffering interacts with line splitting. A command adapter is the natural
10
- * next one -- it would reuse `buildIngestedLogLine` unchanged and differ
11
- * only in where the lines come from -- not built this pass.
5
+ * Chosen over a command-stdout adapter (`RemoteLogLocation`'s other option)
6
+ * as the simpler case to build correctly this pass: deterministic content
7
+ * on disk, no child-process lifecycle, no stdout encoding/buffering
8
+ * question. A command adapter is the natural next one -- reuses
9
+ * `buildIngestedLogLine` unchanged, differs only in line source -- not
10
+ * built this pass.
12
11
  *
13
- * **One-shot, not a continuous tail.** This reads the file's contents as of
14
- * the call; it does not follow appended writes. Stated rather than silently
15
- * partial, per this repo's "honest degradation" rule: a caller that needs
16
- * live tailing does not get it from this function today.
12
+ * One-shot, not a continuous tail: reads the file's contents as of the
13
+ * call, doesn't follow appended writes (honest-degradation disclosure).
17
14
  */
18
15
  import type { RedactionPolicy } from "@descryy/runtime-evidence-store";
19
16
  import { type IngestedLogLine } from "./log-line.ts";
@@ -29,14 +26,11 @@ export interface FileLogAdapterOptions {
29
26
  readonly redactionPolicy?: RedactionPolicy;
30
27
  }
31
28
  /**
32
- * Reads `config.location.path` and returns one `IngestedLogLine` per
33
- * non-empty line, in file order. Every line has already been through
34
- * `redact()` by the time it is returned -- see `log-line.ts`.
29
+ * Reads `config.location.path`, one `IngestedLogLine` per non-empty line,
30
+ * in file order, already through `redact()` (see `log-line.ts`).
35
31
  *
36
- * A file that cannot be read (missing, permission denied) throws with the
37
- * path and the underlying error in the message -- "not observable here" for
38
- * this source, surfaced as a rejection a caller must handle, not a silent
39
- * empty result indistinguishable from an empty log.
32
+ * Throws with path + underlying error on read failure (missing, denied)
33
+ * rather than a silent empty result indistinguishable from an empty log.
40
34
  */
41
35
  export declare function ingestFileLog(options: FileLogAdapterOptions): Promise<readonly IngestedLogLine[]>;
42
36
  //# sourceMappingURL=file-log-adapter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"file-log-adapter.d.ts","sourceRoot":"","sources":["../src/file-log-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE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AAS,eAAe,EAAE,CAAC,CAcvG"}
@@ -1,31 +1,25 @@
1
1
  /**
2
- * Concrete adapter #1 for DEC-271's remote side: a log **file** the user
2
+ * Concrete adapter #1 for DEC-271's remote side: a log file the user
3
3
  * points us at.
4
4
  *
5
- * **Chosen over a command-stdout adapter** (`RemoteLogLocation`'s other
6
- * named-and-typed option) because it is the simpler case to build correctly
7
- * and verify in this pass: deterministic content on disk, no child-process
8
- * lifecycle, no question of how a running command's stdout encoding or
9
- * buffering interacts with line splitting. A command adapter is the natural
10
- * next one -- it would reuse `buildIngestedLogLine` unchanged and differ
11
- * only in where the lines come from -- not built this pass.
5
+ * Chosen over a command-stdout adapter (`RemoteLogLocation`'s other option)
6
+ * as the simpler case to build correctly this pass: deterministic content
7
+ * on disk, no child-process lifecycle, no stdout encoding/buffering
8
+ * question. A command adapter is the natural next one -- reuses
9
+ * `buildIngestedLogLine` unchanged, differs only in line source -- not
10
+ * built this pass.
12
11
  *
13
- * **One-shot, not a continuous tail.** This reads the file's contents as of
14
- * the call; it does not follow appended writes. Stated rather than silently
15
- * partial, per this repo's "honest degradation" rule: a caller that needs
16
- * live tailing does not get it from this function today.
12
+ * One-shot, not a continuous tail: reads the file's contents as of the
13
+ * call, doesn't follow appended writes (honest-degradation disclosure).
17
14
  */
18
15
  import { readFile } from "node:fs/promises";
19
16
  import { buildIngestedLogLine } from "./log-line.js";
20
17
  /**
21
- * Reads `config.location.path` and returns one `IngestedLogLine` per
22
- * non-empty line, in file order. Every line has already been through
23
- * `redact()` by the time it is returned -- see `log-line.ts`.
18
+ * Reads `config.location.path`, one `IngestedLogLine` per non-empty line,
19
+ * in file order, already through `redact()` (see `log-line.ts`).
24
20
  *
25
- * A file that cannot be read (missing, permission denied) throws with the
26
- * path and the underlying error in the message -- "not observable here" for
27
- * this source, surfaced as a rejection a caller must handle, not a silent
28
- * empty result indistinguishable from an empty log.
21
+ * Throws with path + underlying error on read failure (missing, denied)
22
+ * rather than a silent empty result indistinguishable from an empty log.
29
23
  */
30
24
  export async function ingestFileLog(options) {
31
25
  const { config, redactionPolicy } = options;
@@ -1 +1 @@
1
- {"version":3,"file":"file-log-adapter.js","sourceRoot":"","sources":["../src/file-log-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EAAE,oBAAoB,EAAwB,MAAM,eAAe,CAAC;AAY3E;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAA8B;IAChE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;IAC5C,IAAI,OAAe,CAAC;IACpB,IAAI,CAAC;QACH,OAAO,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACzD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACtE,MAAM,IAAI,KAAK,CAAC,kDAAkD,MAAM,CAAC,QAAQ,CAAC,IAAI,MAAM,MAAM,EAAE,CAAC,CAAC;IACxG,CAAC;IAED,OAAO,OAAO;SACX,KAAK,CAAC,OAAO,CAAC;SACd,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;SACjC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;AACxE,CAAC"}
1
+ {"version":3,"file":"file-log-adapter.js","sourceRoot":"","sources":["../src/file-log-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EAAE,oBAAoB,EAAwB,MAAM,eAAe,CAAC;AAY3E;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAA8B;IAChE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;IAC5C,IAAI,OAAe,CAAC;IACpB,IAAI,CAAC;QACH,OAAO,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACzD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACtE,MAAM,IAAI,KAAK,CAAC,kDAAkD,MAAM,CAAC,QAAQ,CAAC,IAAI,MAAM,MAAM,EAAE,CAAC,CAAC;IACxG,CAAC;IAED,OAAO,OAAO;SACX,KAAK,CAAC,OAAO,CAAC;SACd,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;SACjC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;AACxE,CAAC"}
@@ -1,19 +1,14 @@
1
1
  /**
2
- * One ingested log line, redacted before it is ever handed back to a
3
- * caller (DEC-271: "log content is redacted before it reaches the model,
4
- * not just before display -- the exposure is the read, not the render").
2
+ * One ingested log line, redacted before it's ever handed back (DEC-271:
3
+ * "log content is redacted before it reaches the model, not just before
4
+ * display -- the exposure is the read, not the render").
5
5
  *
6
6
  * Reuses `@descryy/runtime-evidence-store`'s `redact()` rather than
7
- * reimplementing key-name/body/PII/command scanning -- the same reuse
8
- * discipline `database-observation`'s and `browser`'s collectors already
9
- * follow for evidence payloads. `redact()`'s own body-bearing-key
10
- * convention (`raw`, documented there as the `LogCollector`'s payload key
11
- * for captured text) is reused verbatim: every line is wrapped as
12
- * `{ raw: line }` before redaction, so a JSON-shaped line gets `redact()`'s
13
- * full key-name + text-scan treatment (parsed, walked, redacted key by
14
- * key), and a plain-text line gets its text scanned for emails, card
15
- * numbers and long tokens -- the same two paths `redactBodyString` already
16
- * implements, not a new one.
7
+ * reimplementing key-name/body/PII/command scanning, same discipline
8
+ * `database-observation`/`browser` collectors follow. Every line is
9
+ * wrapped as `{ raw: line }` before redaction, reusing `redact()`'s
10
+ * body-bearing-key convention (`raw`) -- JSON lines get key-by-key
11
+ * redaction, plain-text lines get scanned for emails/card numbers/tokens.
17
12
  */
18
13
  import type { RedactionStatus } from "@descryy/runtime-contracts";
19
14
  import { type RedactionPolicy } from "@descryy/runtime-evidence-store";
@@ -29,23 +24,19 @@ export interface IngestedLogLine {
29
24
  readonly redactionStatus: RedactionStatus;
30
25
  }
31
26
  /**
32
- * Builds one `IngestedLogLine` from one raw text line plus the user's
33
- * declared `RemoteLogSourceConfig`.
27
+ * Builds one `IngestedLogLine` from raw text plus the user's
28
+ * `RemoteLogSourceConfig`.
34
29
  *
35
- * Identifier extraction always runs against the **pre-redaction** text --
36
- * a trace/request id is evidence metadata, not payload content, the same
37
- * distinction `Evidence.traceId`/`requestId` draw by living outside
38
- * `Evidence.payload` and therefore outside `redact()`'s reach entirely.
39
- * Extracting after redaction would try to read an id out of a line that
40
- * may already read `[REDACTED]` where the id was.
30
+ * Identifier extraction always runs against the pre-redaction text -- a
31
+ * trace/request id is metadata, not payload, same distinction
32
+ * `Evidence.traceId`/`requestId` draw by living outside `Evidence.payload`
33
+ * and `redact()`'s reach. Extracting after redaction risks reading an id
34
+ * out of a line already showing `[REDACTED]` where it was.
41
35
  *
42
- * Priority, weakest signal overridden by the strongest available, per
43
- * DEC-271's "ask, don't guess": `extractCorrelationIds`'s generic
44
- * `trace_id=`/`traceparent`/`request_id=` heuristic runs first as a
45
- * baseline; a JSON line's own `requestId`/`request_id` field overrides it
46
- * when present; and the user's declared `traceIdField`, when it names a
47
- * real value on this line, wins over both -- it is the one signal the user
48
- * actually told us about rather than one this module inferred.
36
+ * Priority (DEC-271 "ask, don't guess"): `extractCorrelationIds`'s generic
37
+ * heuristic runs first as baseline; a JSON line's own `requestId`/
38
+ * `request_id` field overrides it; the user's declared `traceIdField`,
39
+ * when it names a real value, wins over both.
49
40
  */
50
41
  export declare function buildIngestedLogLine(rawLine: string, config: Pick<RemoteLogSourceConfig, "format" | "traceIdField">, redactionPolicy?: RedactionPolicy): IngestedLogLine;
51
42
  //# sourceMappingURL=log-line.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"log-line.d.ts","sourceRoot":"","sources":["../src/log-line.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAU,KAAK,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAG/E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAEpE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,8HAA8H;IAC9H,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,8GAA8G;IAC9G,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;CAC3C;AAkCD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,IAAI,CAAC,qBAAqB,EAAE,QAAQ,GAAG,cAAc,CAAC,EAC9D,eAAe,GAAE,eAAoB,GACpC,eAAe,CAoCjB"}
1
+ {"version":3,"file":"log-line.d.ts","sourceRoot":"","sources":["../src/log-line.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAU,KAAK,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAG/E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAEpE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,8HAA8H;IAC9H,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,8GAA8G;IAC9G,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;CAC3C;AAkCD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,IAAI,CAAC,qBAAqB,EAAE,QAAQ,GAAG,cAAc,CAAC,EAC9D,eAAe,GAAE,eAAoB,GACpC,eAAe,CAoCjB"}
package/dist/log-line.js CHANGED
@@ -1,19 +1,14 @@
1
1
  /**
2
- * One ingested log line, redacted before it is ever handed back to a
3
- * caller (DEC-271: "log content is redacted before it reaches the model,
4
- * not just before display -- the exposure is the read, not the render").
2
+ * One ingested log line, redacted before it's ever handed back (DEC-271:
3
+ * "log content is redacted before it reaches the model, not just before
4
+ * display -- the exposure is the read, not the render").
5
5
  *
6
6
  * Reuses `@descryy/runtime-evidence-store`'s `redact()` rather than
7
- * reimplementing key-name/body/PII/command scanning -- the same reuse
8
- * discipline `database-observation`'s and `browser`'s collectors already
9
- * follow for evidence payloads. `redact()`'s own body-bearing-key
10
- * convention (`raw`, documented there as the `LogCollector`'s payload key
11
- * for captured text) is reused verbatim: every line is wrapped as
12
- * `{ raw: line }` before redaction, so a JSON-shaped line gets `redact()`'s
13
- * full key-name + text-scan treatment (parsed, walked, redacted key by
14
- * key), and a plain-text line gets its text scanned for emails, card
15
- * numbers and long tokens -- the same two paths `redactBodyString` already
16
- * implements, not a new one.
7
+ * reimplementing key-name/body/PII/command scanning, same discipline
8
+ * `database-observation`/`browser` collectors follow. Every line is
9
+ * wrapped as `{ raw: line }` before redaction, reusing `redact()`'s
10
+ * body-bearing-key convention (`raw`) -- JSON lines get key-by-key
11
+ * redaction, plain-text lines get scanned for emails/card numbers/tokens.
17
12
  */
18
13
  import { randomUUID } from "node:crypto";
19
14
  import { redact } from "@descryy/runtime-evidence-store";
@@ -47,23 +42,19 @@ function namedFieldFromText(text, field) {
47
42
  return pattern.exec(text)?.[1] ?? null;
48
43
  }
49
44
  /**
50
- * Builds one `IngestedLogLine` from one raw text line plus the user's
51
- * declared `RemoteLogSourceConfig`.
45
+ * Builds one `IngestedLogLine` from raw text plus the user's
46
+ * `RemoteLogSourceConfig`.
52
47
  *
53
- * Identifier extraction always runs against the **pre-redaction** text --
54
- * a trace/request id is evidence metadata, not payload content, the same
55
- * distinction `Evidence.traceId`/`requestId` draw by living outside
56
- * `Evidence.payload` and therefore outside `redact()`'s reach entirely.
57
- * Extracting after redaction would try to read an id out of a line that
58
- * may already read `[REDACTED]` where the id was.
48
+ * Identifier extraction always runs against the pre-redaction text -- a
49
+ * trace/request id is metadata, not payload, same distinction
50
+ * `Evidence.traceId`/`requestId` draw by living outside `Evidence.payload`
51
+ * and `redact()`'s reach. Extracting after redaction risks reading an id
52
+ * out of a line already showing `[REDACTED]` where it was.
59
53
  *
60
- * Priority, weakest signal overridden by the strongest available, per
61
- * DEC-271's "ask, don't guess": `extractCorrelationIds`'s generic
62
- * `trace_id=`/`traceparent`/`request_id=` heuristic runs first as a
63
- * baseline; a JSON line's own `requestId`/`request_id` field overrides it
64
- * when present; and the user's declared `traceIdField`, when it names a
65
- * real value on this line, wins over both -- it is the one signal the user
66
- * actually told us about rather than one this module inferred.
54
+ * Priority (DEC-271 "ask, don't guess"): `extractCorrelationIds`'s generic
55
+ * heuristic runs first as baseline; a JSON line's own `requestId`/
56
+ * `request_id` field overrides it; the user's declared `traceIdField`,
57
+ * when it names a real value, wins over both.
67
58
  */
68
59
  export function buildIngestedLogLine(rawLine, config, redactionPolicy = {}) {
69
60
  const parsedRecord = config.format === "json-lines" ? tryParseJsonObject(rawLine) : null;
@@ -1 +1 @@
1
- {"version":3,"file":"log-line.js","sourceRoot":"","sources":["../src/log-line.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAwB,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAe7E,MAAM,aAAa,GAAG,6EAA6E,CAAC;AAEpG,SAAS,cAAc,CAAC,IAAY;IAClC,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvC,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAChC,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IACpD,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;AACtE,CAAC;AAED,SAAS,kBAAkB,CAAC,IAAY;IACtC,IAAI,CAAC;QACH,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACzC,OAAO,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ,I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G,UAAU,CAAC,WAAW,EAAE,CAAC;QAChF,CAAC;QACD,MAAM,aAAa,GAAG,gBAAgB,CAAC,YAAY,EAAE,WAAW,CAAC,IAAI,gBAAgB,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;QAClH,IAAI,aAAa,KAAK,IAAI;YAAE,SAAS,GAAG,aAAa,CAAC;IACxD,CAAC;IAED,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;QACxB,MAAM,KAAK,GACT,YAAY,KAAK,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,OAAO,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;QACjI,IAAI,KAAK,KAAK,IAAI;YAAE,OAAO,GAAG,KAAK,CAAC;IACtC,CAAC;IAED,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,MAAM,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,eAAe,CAAC,CAAC;IAC/E,MAAM,WAAW,GAAI,OAA2B,CAAC,GAAG,CAAC;IAErD,OAAO;QACL,MAAM,EAAE,UAAU,EAAE;QACpB,SAAS;QACT,GAAG,EAAE,WAAW;QAChB,OAAO;QACP,SAAS;QACT,eAAe;KAChB,CAAC;AACJ,CAAC"}
@@ -1,28 +1,20 @@
1
1
  /**
2
2
  * The "ask, don't guess" input contract for remote log ingestion (DEC-271).
3
3
  *
4
- * For local/booted execution Descry injects its own proxy and needs to ask
5
- * the user nothing. For remote environments (staging/preview/production,
6
- * DEC-266) Descry does not own the infra and cannot inject anything -- the
7
- * only mechanism left is ingesting whatever the target already has, and
8
- * DEC-271's own "rejected: one universal mechanism" clause says that target
9
- * is heterogeneous by nature (Datadog, CloudWatch, plain stdout, full
10
- * OpenTelemetry, or nothing at all). So setup has to ask: where are the
11
- * logs, what shape are they in, and is there a field that already carries a
12
- * trace/request id.
4
+ * Local/booted execution injects its own proxy, nothing to ask. Remote
5
+ * environments (DEC-266) aren't owned by Descry, so the only mechanism is
6
+ * ingesting whatever the target already has -- heterogeneous by nature
7
+ * (Datadog, CloudWatch, stdout, OpenTelemetry, or nothing), so setup must
8
+ * ask: where are the logs, what shape, is there a trace/request id field.
13
9
  *
14
- * This file defines that shape only -- it is filled in by whatever asks the
15
- * user (a CLI prompt, a UI form, elsewhere), never inferred or defaulted
16
- * here. The logic that consumes it lives in the adapters
17
- * (`file-log-adapter.ts` today) and in `correlator.ts`.
10
+ * This file defines the shape only -- filled in by whatever asks the user
11
+ * (CLI prompt, UI form), never inferred here. Consumers: `file-log-adapter.ts`, `correlator.ts`.
18
12
  */
19
13
  /**
20
- * What the user says they have. `file` and `command` are both plausible
21
- * ("here's our log file" / "here's how we tail it") and named so a future
22
- * adapter for either has an unambiguous slot; `url` covers a log-query API
23
- * or a signed export link. Only `file` has a concrete adapter this pass --
24
- * see `file-log-adapter.ts`'s own doc comment for why it was chosen over
25
- * `command`, and why `url` isn't built at all yet.
14
+ * What the user says they have. `file`/`command` are both plausible
15
+ * ("here's our log file" / "here's how we tail it"); `url` covers a
16
+ * log-query API or signed export link. Only `file` has a concrete adapter
17
+ * this pass -- see `file-log-adapter.ts` for why.
26
18
  */
27
19
  export type RemoteLogLocation = {
28
20
  readonly kind: "file";
@@ -37,11 +29,10 @@ export type RemoteLogLocation = {
37
29
  };
38
30
  export declare const REMOTE_LOG_FORMATS: readonly ["plain-text", "json-lines"];
39
31
  /**
40
- * The two shapes this pass knows how to read. Not a claim these are the
41
- * only shapes a real target log ever takes (a named convention such as
42
- * "Heroku router format" or "Rails tagged logging" is a real future case)
43
- * -- narrowed to what `buildIngestedLogLine` actually parses, honestly,
44
- * rather than accepting a value it would silently mishandle.
32
+ * The two shapes this pass parses. Not a claim these are the only shapes a
33
+ * real target uses (e.g. "Heroku router format") -- narrowed to what
34
+ * `buildIngestedLogLine` actually handles, rather than silently mishandling
35
+ * an unsupported one.
45
36
  */
46
37
  export type RemoteLogFormat = (typeof REMOTE_LOG_FORMATS)[number];
47
38
  export interface RemoteLogSourceConfig {
@@ -49,16 +40,12 @@ export interface RemoteLogSourceConfig {
49
40
  readonly format: RemoteLogFormat;
50
41
  /**
51
42
  * The field the user says already carries a trace/request id -- a JSON
52
- * key for `"json-lines"`, or a `name=`/`name:` field for `"plain-text"`.
43
+ * key for `"json-lines"`, a `name=`/`name:` field for `"plain-text"`.
53
44
  *
54
- * `null`/absent when the user doesn't have one (or doesn't know), in
55
- * which case correlation falls back first to `extractCorrelationIds`'s
56
- * generic key-shape heuristic and, failing that, to a timestamp+path
57
- * window -- both weaker than a declared field, and both disclosed via
58
- * `Correlation.method`/`confidence` on the result, never silently
59
- * promoted to look as certain as a field the user actually named. This is
60
- * the same "ask rather than guess" principle DEC-266 applies to target
61
- * URLs, applied here to trace identity.
45
+ * `null`/absent falls back first to `extractCorrelationIds`'s generic
46
+ * heuristic, then to a timestamp+path window -- both weaker, both
47
+ * disclosed via `Correlation.method`/`confidence`, never promoted to
48
+ * look as certain as a declared field (DEC-266's "ask, don't guess").
62
49
  */
63
50
  readonly traceIdField?: string | null;
64
51
  }
@@ -1 +1 @@
1
- {"version":3,"file":"log-source-config.d.ts","sourceRoot":"","sources":["../src/log-source-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GACzB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAChD;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GACzF;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnD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ask, don't guess" input contract for remote log ingestion (DEC-271).
3
3
  *
4
- * For local/booted execution Descry injects its own proxy and needs to ask
5
- * the user nothing. For remote environments (staging/preview/production,
6
- * DEC-266) Descry does not own the infra and cannot inject anything -- the
7
- * only mechanism left is ingesting whatever the target already has, and
8
- * DEC-271's own "rejected: one universal mechanism" clause says that target
9
- * is heterogeneous by nature (Datadog, CloudWatch, plain stdout, full
10
- * OpenTelemetry, or nothing at all). So setup has to ask: where are the
11
- * logs, what shape are they in, and is there a field that already carries a
12
- * trace/request id.
4
+ * Local/booted execution injects its own proxy, nothing to ask. Remote
5
+ * environments (DEC-266) aren't owned by Descry, so the only mechanism is
6
+ * ingesting whatever the target already has -- heterogeneous by nature
7
+ * (Datadog, CloudWatch, stdout, OpenTelemetry, or nothing), so setup must
8
+ * ask: where are the logs, what shape, is there a trace/request id field.
13
9
  *
14
- * This file defines that shape only -- it is filled in by whatever asks the
15
- * user (a CLI prompt, a UI form, elsewhere), never inferred or defaulted
16
- * here. The logic that consumes it lives in the adapters
17
- * (`file-log-adapter.ts` today) and in `correlator.ts`.
10
+ * This file defines the shape only -- filled in by whatever asks the user
11
+ * (CLI prompt, UI form), never inferred here. Consumers: `file-log-adapter.ts`, `correlator.ts`.
18
12
  */
19
13
  export const REMOTE_LOG_FORMATS = ["plain-text", "json-lines"];
20
14
  //# sourceMappingURL=log-source-config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"log-source-config.js","sourceRoot":"","sources":["../src/log-source-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAeH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,YAAY,EAAE,YAAY,CAAU,CAAC"}
1
+ {"version":3,"file":"log-source-config.js","sourceRoot":"","sources":["../src/log-source-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAaH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,YAAY,EAAE,YAAY,CAAU,CAAC"}
package/package.json CHANGED
@@ -1,9 +1,14 @@
1
1
  {
2
2
  "name": "@descryy/runtime-remote-log-ingestion",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "description": "Remote-environment log ingestion (DEC-271): for staging/preview/production, where Descry cannot inject a proxy into infra it doesn't own, ingest whatever the target already has -- logs, and trace ids if a field is declared -- and correlate best-effort against a captured browser/proxy request, with confidence disclosed rather than assumed.",
6
6
  "license": "UNLICENSED",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/descryhq-wq/descry-runtime.git",
10
+ "directory": "packages/remote-log-ingestion"
11
+ },
7
12
  "engines": {
8
13
  "node": ">=22.5"
9
14
  },
@@ -24,8 +29,8 @@
24
29
  "build": "tsc -b"
25
30
  },
26
31
  "dependencies": {
27
- "@descryy/runtime-contracts": "0.2.0",
28
- "@descryy/runtime-backend-observation": "0.2.0",
29
- "@descryy/runtime-evidence-store": "0.2.0"
32
+ "@descryy/runtime-contracts": "0.3.0",
33
+ "@descryy/runtime-backend-observation": "0.3.0",
34
+ "@descryy/runtime-evidence-store": "0.4.0"
30
35
  }
31
36
  }