@aaac/observability 0.1.14 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -76,6 +76,16 @@ interface CanonicalEvent {
76
76
  attributes: Record<string, AttrValue>;
77
77
  /** Cross-axis links (first-class; maps to OTEL SpanLinks). */
78
78
  links: CanonicalLink[];
79
+ /**
80
+ * Optional deterministic idempotency key (observability-integration.md §9.2).
81
+ *
82
+ * When set, SqliteSink enforces UNIQUE(dedup_key) via INSERT OR IGNORE so that
83
+ * re-running a Canonical Projection batch (e.g. `aaac-observ ingest-vendor-otel`)
84
+ * never duplicates the same logical record. Left undefined for the primary
85
+ * hook/runtime write path, whose records are the canonical source (NULL keys do
86
+ * not participate in the UNIQUE constraint — SQLite allows multiple NULLs).
87
+ */
88
+ dedupKey?: string;
79
89
  }
80
90
  /**
81
91
  * Query return type — hides storage-backend differences (event-catalog.md §1.4).
@@ -251,6 +261,61 @@ declare class NormalizationError extends Error {
251
261
  */
252
262
  declare function validateRawEvent(event: RawEvent): void;
253
263
 
264
+ /**
265
+ * vendor-otel-mapper — Canonical Projection of vendor OpenTelemetry exports.
266
+ *
267
+ * observability-integration.md §9.2 (T-D2): Claude Code (and other vendors) emit
268
+ * OTEL telemetry (token / cost / trace). This module projects a vendor OTLP **trace**
269
+ * export into CanonicalEvents so the data can be backfilled into the SQLite Ledger,
270
+ * which remains the canonical source of truth ("OTEL は補助証跡。正本は Canonical Event").
271
+ *
272
+ * ── Input format (assumption — see escalation note) ───────────────────────────
273
+ * The input is the standard OTLP/JSON `ExportTraceServiceRequest` shape, i.e. what
274
+ * an OTel Collector `file` exporter (or `OTEL_EXPORTER_OTLP_PROTOCOL=http/json`)
275
+ * produces:
276
+ *
277
+ * { resourceSpans: [ { resource: { attributes: [...] },
278
+ * scopeSpans: [ { spans: [ { traceId, spanId, name,
279
+ * startTimeUnixNano, attributes }, ... ] } ] } ] }
280
+ *
281
+ * The exact attribute keys Claude Code uses for session id / cost are vendor-specific;
282
+ * we resolve a small candidate set and otherwise pass attributes through verbatim, so
283
+ * the projection degrades gracefully if the precise schema differs.
284
+ *
285
+ * ── Idempotency / dedup (§9.2) ────────────────────────────────────────────────
286
+ * Each projected event carries a deterministic `dedupKey` = `vendor-otel:{traceId}:{spanId}`.
287
+ * Combined with SqliteSink's UNIQUE(dedup_key) + INSERT OR IGNORE, re-running the
288
+ * ingest batch never duplicates rows. Hook/runtime records (dedup_key = NULL) remain
289
+ * the primary source and are never overwritten — vendor OTEL is auxiliary evidence.
290
+ */
291
+
292
+ /** Default `source` tag applied to projected vendor events. */
293
+ declare const VENDOR_OTEL_SOURCE = "claude-code-otel";
294
+ /** Prefix for the deterministic dedup key namespace. */
295
+ declare const VENDOR_OTEL_DEDUP_PREFIX = "vendor-otel";
296
+ interface VendorOtelMapOptions {
297
+ /** `source` tag for projected events. Default: 'claude-code-otel'. */
298
+ source?: string;
299
+ }
300
+ interface VendorOtelMapResult {
301
+ /** Projected canonical events (ready for SqliteSink.write). */
302
+ events: CanonicalEvent[];
303
+ /** Number of input spans skipped because they lacked a usable identity. */
304
+ skipped: number;
305
+ }
306
+ /**
307
+ * Project a parsed vendor OTLP/JSON trace export into CanonicalEvents.
308
+ *
309
+ * Each vendor span becomes one `instant` CanonicalEvent (the Ledger records vendor
310
+ * telemetry as point-in-time evidence; original duration is preserved in the
311
+ * `vendor.duration_ns` attribute). Resource attributes (e.g. `service.name`) are
312
+ * merged into each span and surfaced as `project.id` for cross-project rollups.
313
+ *
314
+ * Spans without both a traceId and spanId are skipped (no stable dedup identity).
315
+ * Pure function — performs no IO; callers own reading/parsing and persistence.
316
+ */
317
+ declare function mapVendorOtelExport(doc: unknown, options?: VendorOtelMapOptions): VendorOtelMapResult;
318
+
254
319
  /**
255
320
  * CacheStore — pluggable backend for the Correlator's short-term key-value cache.
256
321
  *
@@ -530,10 +595,15 @@ declare class Enricher {
530
595
  * Build the standard Phase 5 enrichment rule set.
531
596
  *
532
597
  * Rule ordering:
533
- * 1. R7 artifact.ts resolve edit.artifact_id first (R3 disambiguation depends on it)
534
- * 2. R3/R4 process.ts maintain active-task stack; resolve process.edit/tool parent
535
- * 3. R5 cross-axis.ts materializes_as_commit on promotion.commit close
536
- * 4. R1/R2 promotion.ts — cache changes; emit promotion.file on commit close
598
+ * 1. R-ISSUE issue-anchor.ts cache/propagate issue.id early so downstream
599
+ * rules see it (#178 T-E1). Runs first.
600
+ * 2. R7 artifact.ts resolve edit.artifact_id first (R3 disambiguation depends on it)
601
+ * 3. R3/R4 process.ts — maintain active-task stack; resolve process.edit/tool parent
602
+ * 4. R5 cross-axis.ts — materializes_as_commit on promotion.commit close
603
+ * 5. R1/R2 promotion.ts — cache changes; emit promotion.file on commit close
604
+ * 6. R8 worktree.ts — provisional materializes_as_commit from the latest
605
+ * in-window same-repo worktree (out-of-band commits, #175).
606
+ * Runs last so it can observe R5's confirmed links.
537
607
  *
538
608
  * @param artifactPatterns Passed to createArtifactRule for R7 lookupArtifact.
539
609
  */
@@ -657,6 +727,89 @@ declare function createCrossAxisRule(): EnrichRule;
657
727
  */
658
728
  declare function createPromotionRule(): EnrichRule;
659
729
 
730
+ /** Default attribution window: 1 hour (ms). A snapshot older than this is stale. */
731
+ declare const WORKTREE_WINDOW_MS: number;
732
+ /** Cached latest worktree snapshot for a repo root. */
733
+ interface WorktreeRef {
734
+ spanId: string;
735
+ traceId: string;
736
+ sessionId?: string;
737
+ /** Snapshot time in epoch milliseconds (derived from timeUnixNano). */
738
+ timeMs: number;
739
+ }
740
+ declare function worktreeRepoKey(repoRoot: string): string;
741
+ /**
742
+ * Create the WS-B worktree-attribution enrichment rule.
743
+ *
744
+ * @param windowMs Attribution window in ms (default {@link WORKTREE_WINDOW_MS}).
745
+ */
746
+ declare function createWorktreeRule(windowMs?: number): EnrichRule;
747
+
748
+ /**
749
+ * R-ISSUE — Issue anchor enrichment rule (#178 T-E1).
750
+ *
751
+ * observability-integration.md §8 (Economic Conversion Layer):
752
+ * When a span carries `issue.id` (and optionally `issue.type`), cache the
753
+ * values per session. Subsequent spans in the same session that lack
754
+ * `issue.id` inherit the cached value (propagation within a session).
755
+ *
756
+ * When no `issue.id` is found on an event AND no cached value exists for
757
+ * that session, sets `issue.id_missing=true` so downstream monitoring can
758
+ * detect attribution gaps without guessing.
759
+ *
760
+ * Cache schema:
761
+ * session:{sid}:issue_id → string (first issue.id seen in session)
762
+ * session:{sid}:issue_type → string (first issue.type seen in session)
763
+ */
764
+
765
+ declare function issueIdCacheKey(sessionId: string): string;
766
+ declare function issueTypeCacheKey(sessionId: string): string;
767
+ /**
768
+ * Create the issue-anchor enrichment rule.
769
+ *
770
+ * Behaviour:
771
+ * 1. If event carries `issue.id` → cache per session (first-wins).
772
+ * 2. If event lacks `issue.id` but session has a cached value → propagate.
773
+ * 3. If event lacks `issue.id` AND no cached value → set `issue.id_missing=true`.
774
+ * 4. Same logic applies to `issue.type` (propagation only, no _missing flag).
775
+ *
776
+ * Only fires for events that have a sessionId (standalone CI events must
777
+ * carry issue.id themselves — this is already the case per the pipeline design).
778
+ */
779
+ declare function createIssueAnchorRule(): EnrichRule;
780
+
781
+ /** A best-effort snapshot of the working tree at a point in time. */
782
+ interface WorktreeSnapshot {
783
+ /** Working-tree HEAD sha (full 40-char). Absent on an empty repo (no commits). */
784
+ commitSha?: string;
785
+ /** Absolute repository root (`git rev-parse --show-toplevel`). */
786
+ repoRoot?: string;
787
+ /** True when there are uncommitted changes (staged or unstaged / untracked). */
788
+ dirty: boolean;
789
+ }
790
+ /**
791
+ * Injectable git runner: receives the argv (after `git`) and returns trimmed
792
+ * stdout, or `undefined` on any error / non-zero exit. Defaults to a real,
793
+ * timeout-bounded `git` invocation.
794
+ */
795
+ type GitRunner = (args: string[]) => string | undefined;
796
+ /** Real git runner — bounded by a short timeout; swallows all errors. */
797
+ declare function defaultGitRunner(args: string[]): string | undefined;
798
+ /**
799
+ * Capture the working-tree snapshot for `cwd`.
800
+ *
801
+ * Returns `undefined` when `cwd` is not inside a git repository (no repo root),
802
+ * so callers can skip emission entirely. A repo with no commits yet still
803
+ * returns a snapshot (commitSha absent, dirty reflects the index/worktree).
804
+ */
805
+ declare function captureWorktree(cwd: string, git?: GitRunner): WorktreeSnapshot | undefined;
806
+ /**
807
+ * Build the `promotion.worktree` attribute map from a snapshot + session id.
808
+ * `agent.session_id` is the catalog attribute (event-catalog.md §2.4); `session_id`
809
+ * is also set so the Normalizer resolves a non-null cross-axis correlation key.
810
+ */
811
+ declare function worktreeAttributes(snapshot: WorktreeSnapshot, sessionId: string | undefined): Record<string, AttrValue>;
812
+
660
813
  /**
661
814
  * SqliteSink — persists CanonicalEvents to a local SQLite database.
662
815
  *
@@ -676,13 +829,26 @@ declare const DEFAULT_DB_PATH = ".agent-logs/observability.db";
676
829
  declare class SqliteSink {
677
830
  private readonly db;
678
831
  constructor(dbPath?: string);
832
+ /**
833
+ * Restart-safe migration for the dedup_key column + UNIQUE index (§9.2).
834
+ *
835
+ * `CREATE TABLE IF NOT EXISTS` is a no-op on databases created before dedup_key
836
+ * existed, so the column must be added in-place. PRAGMA table_info lets us detect
837
+ * its absence and ALTER it in (idempotent: skipped once present). The UNIQUE index
838
+ * is created only after the column is guaranteed to exist.
839
+ */
840
+ private migrateDedupKey;
679
841
  /**
680
842
  * Persist a single CanonicalEvent.
681
843
  * 1. Append to canonical_events (immutable)
682
844
  * 2. Upsert spans materialised view
683
845
  * 3. Insert canonical_links rows
846
+ *
847
+ * Returns `false` when the event carried a dedup_key that already exists (the
848
+ * INSERT was ignored and no span/link side effects were applied — making
849
+ * re-runs of a Canonical Projection batch fully idempotent), otherwise `true`.
684
850
  */
685
- write(event: CanonicalEvent): void;
851
+ write(event: CanonicalEvent): boolean;
686
852
  /** Close the database connection. */
687
853
  close(): void;
688
854
  /**
@@ -690,6 +856,15 @@ declare class SqliteSink {
690
856
  * Should not be used in production write paths.
691
857
  */
692
858
  getDb(): DatabaseSync;
859
+ /**
860
+ * Append the immutable canonical_events row.
861
+ *
862
+ * Uses INSERT OR IGNORE so a dedup_key collision (UNIQUE idx_ce_dedup_key) is a
863
+ * silent no-op rather than an error — the basis of §9.2 idempotent re-ingestion.
864
+ * Returns true when a new row was written, false when ignored on conflict.
865
+ * Events without a dedup_key (NULL) are never ignored (multiple NULLs are
866
+ * distinct under SQLite's UNIQUE semantics).
867
+ */
693
868
  private insertCanonicalEvent;
694
869
  private upsertSpan;
695
870
  private insertLinks;
@@ -1094,6 +1269,210 @@ declare function emitPromotionPr(collector: EventCollector, options: {
1094
1269
  parentSpanId?: string;
1095
1270
  }): string | null;
1096
1271
 
1272
+ /** Parse GitHub Issue number from commit message, branch name, or PR title. */
1273
+ declare function parseIssueIdFromText(text: string): number | null;
1274
+ type GithubPromotionKind = "ci" | "deploy";
1275
+ interface GithubPromotionRecordInput {
1276
+ kind: GithubPromotionKind;
1277
+ runId: string;
1278
+ sha: string;
1279
+ verdict: string;
1280
+ commitMessage?: string;
1281
+ deployTarget?: string;
1282
+ workflowName?: string;
1283
+ }
1284
+ /**
1285
+ * Build attributes for promotion.ci / promotion.deploy external events.
1286
+ * Required correlation fields per observability-integration.md §7.1.
1287
+ */
1288
+ declare function buildGithubPromotionAttributes(input: GithubPromotionRecordInput): Record<string, AttrValue>;
1289
+ declare function githubPromotionEventType(kind: GithubPromotionKind): string;
1290
+
1291
+ /** Target Outcome chain stages (#176 T-C3). */
1292
+ declare const OUTCOME_CHAIN_STAGES: readonly ["agent.session", "process.task", "process.edit", "promotion.commit", "promotion.ci", "promotion.deploy"];
1293
+ type OutcomeChainStageName = (typeof OUTCOME_CHAIN_STAGES)[number];
1294
+ type OutcomeChainStageStatus = "present" | "missing" | "provisional";
1295
+ interface OutcomeChainStageResult {
1296
+ eventType: OutcomeChainStageName;
1297
+ status: OutcomeChainStageStatus;
1298
+ spanIds: string[];
1299
+ }
1300
+ interface OutcomeChainAnalysis {
1301
+ issueId: string;
1302
+ stages: OutcomeChainStageResult[];
1303
+ /** True when every stage is present (provisional counts as present but flagged). */
1304
+ complete: boolean;
1305
+ /** Stages with no matching span. */
1306
+ gaps: OutcomeChainStageName[];
1307
+ /** Stages present only via provisional correlation. */
1308
+ provisional: OutcomeChainStageName[];
1309
+ }
1310
+ /**
1311
+ * Detect Outcome chain coverage for one Issue (#176 T-C3).
1312
+ * Does not infer missing stages — gaps stay explicit.
1313
+ */
1314
+ declare function analyzeOutcomeChain(adapter: SqliteQueryAdapter, issueId: string | number): OutcomeChainAnalysis;
1315
+
1316
+ /**
1317
+ * diagnostic-report — Observability 診断レポート生成 (#179 WS-F T-F1).
1318
+ *
1319
+ * Computes the Layer 1–3 / link-completion / Person-Tier metrics that the
1320
+ * `aaac-diagnostic` Grafana dashboard renders from ClickHouse VIEWs, but over
1321
+ * the local SQLite Ledger via SqliteQueryAdapter so the same diagnostic can be
1322
+ * produced as a CLI report (Markdown / JSON) without a running stack.
1323
+ *
1324
+ * The formulas intentionally mirror docker/observability/analysis-views.sql so
1325
+ * the CLI report and the Grafana dashboard agree:
1326
+ * - aaac_layer1_issue → Layer1Row
1327
+ * - aaac_layer2_issue_efficiency → Layer2Row
1328
+ * - aaac_layer3_issue_outcome → Layer3Row
1329
+ * - aaac_kpi_session_link_rate → SessionLinkRateRow
1330
+ * - aaac_kpi_stage_arrival_rate → StageArrivalRow
1331
+ * - aaac_kpi_provisional_ratio → ProvisionalRow
1332
+ * - aaac_person_tier_ratio → TierRatioRow
1333
+ *
1334
+ * Before/After comparison: when a baseline window is supplied the same metrics
1335
+ * are computed over the baseline period and the summary deltas are reported.
1336
+ */
1337
+
1338
+ interface Layer1Row {
1339
+ issueId: string;
1340
+ issueType: string;
1341
+ projectId: string;
1342
+ sessionCount: number;
1343
+ editCount: number;
1344
+ commitCount: number;
1345
+ ciCount: number;
1346
+ ciPassed: number;
1347
+ leverage: number;
1348
+ }
1349
+ interface Layer2Row {
1350
+ issueId: string;
1351
+ projectId: string;
1352
+ sessions: number;
1353
+ commits: number;
1354
+ ciPassed: number;
1355
+ totalCostUsd: number;
1356
+ commitRate: number;
1357
+ ciPassRate: number;
1358
+ commitsPerDollar: number;
1359
+ }
1360
+ interface Layer3Row {
1361
+ issueId: string;
1362
+ issueType: string;
1363
+ projectId: string;
1364
+ stagesPresent: number;
1365
+ stagesTotal: number;
1366
+ chainCompleteness: number;
1367
+ totalCostUsd: number;
1368
+ totalInputTokens: number;
1369
+ totalOutputTokens: number;
1370
+ }
1371
+ interface SessionLinkRateRow {
1372
+ projectId: string;
1373
+ totalSessions: number;
1374
+ linkedSessions: number;
1375
+ linkRate: number;
1376
+ }
1377
+ interface StageArrivalRow {
1378
+ projectId: string;
1379
+ issuesWithCommit: number;
1380
+ issuesWithCi: number;
1381
+ issuesWithDeploy: number;
1382
+ ciArrivalRate: number;
1383
+ deployArrivalRate: number;
1384
+ }
1385
+ interface ProvisionalRow {
1386
+ projectId: string;
1387
+ totalSpans: number;
1388
+ unknownSessionSpans: number;
1389
+ provisionalSpans: number;
1390
+ unknownRatio: number;
1391
+ provisionalRatio: number;
1392
+ }
1393
+ type PersonTier = "high" | "mid" | "low";
1394
+ interface TierRatioRow {
1395
+ projectId: string;
1396
+ tier: PersonTier;
1397
+ personCount: number;
1398
+ tierCommits: number;
1399
+ tierIssues: number;
1400
+ }
1401
+ interface MetricsSummary {
1402
+ issueCount: number;
1403
+ sessionCount: number;
1404
+ totalCostUsd: number;
1405
+ avgLeverage: number;
1406
+ avgCommitRate: number;
1407
+ avgCiPassRate: number;
1408
+ avgChainCompleteness: number;
1409
+ /** Overall linked / total sessions across all selected projects. */
1410
+ sessionLinkRate: number;
1411
+ tierCounts: Record<PersonTier, number>;
1412
+ }
1413
+ interface DiagnosticMetrics {
1414
+ layer1: Layer1Row[];
1415
+ layer2: Layer2Row[];
1416
+ layer3: Layer3Row[];
1417
+ linkCompletion: {
1418
+ sessionLinkRate: SessionLinkRateRow[];
1419
+ stageArrival: StageArrivalRow[];
1420
+ provisional: ProvisionalRow[];
1421
+ };
1422
+ tierRatio: TierRatioRow[];
1423
+ summary: MetricsSummary;
1424
+ }
1425
+ interface PeriodWindow {
1426
+ from: string | null;
1427
+ to: string | null;
1428
+ }
1429
+ interface ComparisonDelta {
1430
+ issueCount: number;
1431
+ sessionCount: number;
1432
+ totalCostUsd: number;
1433
+ avgLeverage: number;
1434
+ avgCommitRate: number;
1435
+ avgCiPassRate: number;
1436
+ avgChainCompleteness: number;
1437
+ sessionLinkRate: number;
1438
+ }
1439
+ interface DiagnosticReport {
1440
+ generatedAt: string;
1441
+ /** Project filter applied, or null when all projects are included. */
1442
+ projectId: string | null;
1443
+ period: PeriodWindow;
1444
+ metrics: DiagnosticMetrics;
1445
+ baseline?: {
1446
+ period: PeriodWindow;
1447
+ metrics: DiagnosticMetrics;
1448
+ comparison: ComparisonDelta;
1449
+ };
1450
+ }
1451
+ interface DiagnosticReportOptions {
1452
+ /** Restrict to a single project_id (matches project.id attr / service.name). */
1453
+ projectId?: string;
1454
+ /** Inclusive lower bound (ISO 8601) for the current/after window. */
1455
+ from?: string;
1456
+ /** Inclusive upper bound (ISO 8601) for the current/after window. */
1457
+ to?: string;
1458
+ /** Inclusive lower bound (ISO 8601) for the baseline/before window. */
1459
+ baselineFrom?: string;
1460
+ /** Inclusive upper bound (ISO 8601) for the baseline/before window. */
1461
+ baselineTo?: string;
1462
+ }
1463
+ /**
1464
+ * Generate a diagnostic report from the SQLite Ledger.
1465
+ *
1466
+ * Reads all materialised spans once, then derives Layer 1–3 / link-completion /
1467
+ * Tier metrics over the (optionally project- and time-filtered) span set. When
1468
+ * a baseline window is supplied, the same metrics are computed over the baseline
1469
+ * period and a summary-level Before/After comparison is attached.
1470
+ */
1471
+ declare function generateDiagnosticReport(adapter: SqliteQueryAdapter, options?: DiagnosticReportOptions): DiagnosticReport;
1472
+ declare function renderReportJson(report: DiagnosticReport): string;
1473
+ /** Render the report as Markdown (customer-facing diagnostic). */
1474
+ declare function renderReportMarkdown(report: DiagnosticReport): string;
1475
+
1097
1476
  /**
1098
1477
  * @aaac/observability — Phase 0–5 public API
1099
1478
  *
@@ -1166,4 +1545,4 @@ interface Pipeline {
1166
1545
  */
1167
1546
  declare function createPipeline(options?: PipelineOptions): Pipeline;
1168
1547
 
1169
- export { type ActiveTask, type ArtifactPattern, type AttrValue, type CacheStore, type CanonicalEvent, type CanonicalLink, Correlator, DEFAULT_DB_PATH, DefaultExternalRegistrar, type EmitInput, type EnrichApi, type EnrichContext, type EnrichResult, type EnrichRule, Enricher, type EnricherOptions, EventCollector, type EventMappingConfig, type EventMappingResult, type EventMappingRule, type EventQueryFilter, type ExecutionEnvelope, type ExternalEventRegistrar, type Lifecycle, type LinkDirection, type LinkRecord, type LinkRule, type MappedSpan, type MappedSpanEvent, type MappedSpanLink, MemoryCacheStore, NormalizationError, Normalizer, OtelEmitter, type OtelEmitterOptions, type Pipeline, type PipelineOptions, QUALITY_GATE_PATTERNS, type QueryAdapter, type RawEvent, type RawEventHandler, type RawExternalEvent, type ResolvedLink, type ResolvedSpan, type SpanQueryFilter, type SpanRecord, type SpanRule, SqliteCacheStore, SqliteQueryAdapter, SqliteSink, type StoredEvent, activeTasksKey, allTaskSpansKey, keys as correlateKeys, createArtifactRule, createCrossAxisRule, createDefaultRules, createPipeline, createProcessRule, createPromotionRule, currentTimeUnixNano, emitHumanInstruction, emitPromotionPr, emitQualityGateResult, evaluateMapping, extractPrUrl, generateArtifactLookup, generateId, generateTaskPatterns, globToRegex, isoToUnixNano, loadEventMappingConfig, lookupArtifact, mapAllEventsToSpans, mapEventsToSpan, matchQualityGate, parseStructuredTags, recordTaskArtifact, resolveTemplate, taskFilesKey, validateRawEvent };
1548
+ export { type ActiveTask, type ArtifactPattern, type AttrValue, type CacheStore, type CanonicalEvent, type CanonicalLink, type ComparisonDelta, Correlator, DEFAULT_DB_PATH, DefaultExternalRegistrar, type DiagnosticMetrics, type DiagnosticReport, type DiagnosticReportOptions, type EmitInput, type EnrichApi, type EnrichContext, type EnrichResult, type EnrichRule, Enricher, type EnricherOptions, EventCollector, type EventMappingConfig, type EventMappingResult, type EventMappingRule, type EventQueryFilter, type ExecutionEnvelope, type ExternalEventRegistrar, type GitRunner, type GithubPromotionKind, type GithubPromotionRecordInput, type Layer1Row, type Layer2Row, type Layer3Row, type Lifecycle, type LinkDirection, type LinkRecord, type LinkRule, type MappedSpan, type MappedSpanEvent, type MappedSpanLink, MemoryCacheStore, type MetricsSummary, NormalizationError, Normalizer, OUTCOME_CHAIN_STAGES, OtelEmitter, type OtelEmitterOptions, type OutcomeChainAnalysis, type OutcomeChainStageName, type OutcomeChainStageResult, type OutcomeChainStageStatus, type PeriodWindow, type PersonTier, type Pipeline, type PipelineOptions, type ProvisionalRow, QUALITY_GATE_PATTERNS, type QueryAdapter, type RawEvent, type RawEventHandler, type RawExternalEvent, type ResolvedLink, type ResolvedSpan, type SessionLinkRateRow, type SpanQueryFilter, type SpanRecord, type SpanRule, SqliteCacheStore, SqliteQueryAdapter, SqliteSink, type StageArrivalRow, type StoredEvent, type TierRatioRow, VENDOR_OTEL_DEDUP_PREFIX, VENDOR_OTEL_SOURCE, type VendorOtelMapOptions, type VendorOtelMapResult, WORKTREE_WINDOW_MS, type WorktreeRef, type WorktreeSnapshot, activeTasksKey, allTaskSpansKey, analyzeOutcomeChain, buildGithubPromotionAttributes, captureWorktree, keys as correlateKeys, createArtifactRule, createCrossAxisRule, createDefaultRules, createIssueAnchorRule, createPipeline, createProcessRule, createPromotionRule, createWorktreeRule, currentTimeUnixNano, defaultGitRunner, emitHumanInstruction, emitPromotionPr, emitQualityGateResult, evaluateMapping, extractPrUrl, generateArtifactLookup, generateDiagnosticReport, generateId, generateTaskPatterns, githubPromotionEventType, globToRegex, isoToUnixNano, issueIdCacheKey, issueTypeCacheKey, loadEventMappingConfig, lookupArtifact, mapAllEventsToSpans, mapEventsToSpan, mapVendorOtelExport, matchQualityGate, parseIssueIdFromText, parseStructuredTags, recordTaskArtifact, renderReportJson, renderReportMarkdown, resolveTemplate, taskFilesKey, validateRawEvent, worktreeAttributes, worktreeRepoKey };
package/dist/index.js CHANGED
@@ -7,42 +7,62 @@ import {
7
7
  MemoryCacheStore,
8
8
  NormalizationError,
9
9
  Normalizer,
10
+ OUTCOME_CHAIN_STAGES,
10
11
  OtelEmitter,
11
12
  QUALITY_GATE_PATTERNS,
12
13
  SqliteCacheStore,
13
14
  SqliteQueryAdapter,
14
15
  SqliteSink,
16
+ VENDOR_OTEL_DEDUP_PREFIX,
17
+ VENDOR_OTEL_SOURCE,
18
+ WORKTREE_WINDOW_MS,
15
19
  activeTasksKey,
16
20
  allTaskSpansKey,
21
+ analyzeOutcomeChain,
22
+ buildGithubPromotionAttributes,
23
+ captureWorktree,
17
24
  createArtifactRule,
18
25
  createCrossAxisRule,
19
26
  createDefaultRules,
27
+ createIssueAnchorRule,
20
28
  createPipeline,
21
29
  createProcessRule,
22
30
  createPromotionRule,
31
+ createWorktreeRule,
23
32
  currentTimeUnixNano,
33
+ defaultGitRunner,
24
34
  emitHumanInstruction,
25
35
  emitPromotionPr,
26
36
  emitQualityGateResult,
27
37
  evaluateMapping,
28
38
  extractPrUrl,
29
39
  generateArtifactLookup,
40
+ generateDiagnosticReport,
30
41
  generateId,
31
42
  generateTaskPatterns,
43
+ githubPromotionEventType,
32
44
  globToRegex,
33
45
  isoToUnixNano,
46
+ issueIdCacheKey,
47
+ issueTypeCacheKey,
34
48
  keys,
35
49
  loadEventMappingConfig,
36
50
  lookupArtifact,
37
51
  mapAllEventsToSpans,
38
52
  mapEventsToSpan,
53
+ mapVendorOtelExport,
39
54
  matchQualityGate,
55
+ parseIssueIdFromText,
40
56
  parseStructuredTags,
41
57
  recordTaskArtifact,
58
+ renderReportJson,
59
+ renderReportMarkdown,
42
60
  resolveTemplate,
43
61
  taskFilesKey,
44
- validateRawEvent
45
- } from "./chunk-J2F5GEMO.js";
62
+ validateRawEvent,
63
+ worktreeAttributes,
64
+ worktreeRepoKey
65
+ } from "./chunk-3DXZNA3E.js";
46
66
  export {
47
67
  Correlator,
48
68
  DEFAULT_DB_PATH,
@@ -52,40 +72,60 @@ export {
52
72
  MemoryCacheStore,
53
73
  NormalizationError,
54
74
  Normalizer,
75
+ OUTCOME_CHAIN_STAGES,
55
76
  OtelEmitter,
56
77
  QUALITY_GATE_PATTERNS,
57
78
  SqliteCacheStore,
58
79
  SqliteQueryAdapter,
59
80
  SqliteSink,
81
+ VENDOR_OTEL_DEDUP_PREFIX,
82
+ VENDOR_OTEL_SOURCE,
83
+ WORKTREE_WINDOW_MS,
60
84
  activeTasksKey,
61
85
  allTaskSpansKey,
86
+ analyzeOutcomeChain,
87
+ buildGithubPromotionAttributes,
88
+ captureWorktree,
62
89
  keys as correlateKeys,
63
90
  createArtifactRule,
64
91
  createCrossAxisRule,
65
92
  createDefaultRules,
93
+ createIssueAnchorRule,
66
94
  createPipeline,
67
95
  createProcessRule,
68
96
  createPromotionRule,
97
+ createWorktreeRule,
69
98
  currentTimeUnixNano,
99
+ defaultGitRunner,
70
100
  emitHumanInstruction,
71
101
  emitPromotionPr,
72
102
  emitQualityGateResult,
73
103
  evaluateMapping,
74
104
  extractPrUrl,
75
105
  generateArtifactLookup,
106
+ generateDiagnosticReport,
76
107
  generateId,
77
108
  generateTaskPatterns,
109
+ githubPromotionEventType,
78
110
  globToRegex,
79
111
  isoToUnixNano,
112
+ issueIdCacheKey,
113
+ issueTypeCacheKey,
80
114
  loadEventMappingConfig,
81
115
  lookupArtifact,
82
116
  mapAllEventsToSpans,
83
117
  mapEventsToSpan,
118
+ mapVendorOtelExport,
84
119
  matchQualityGate,
120
+ parseIssueIdFromText,
85
121
  parseStructuredTags,
86
122
  recordTaskArtifact,
123
+ renderReportJson,
124
+ renderReportMarkdown,
87
125
  resolveTemplate,
88
126
  taskFilesKey,
89
- validateRawEvent
127
+ validateRawEvent,
128
+ worktreeAttributes,
129
+ worktreeRepoKey
90
130
  };
91
131
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aaac/observability",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "In-process observability for @aaac — EventCollector / Normalizer / Correlator / SqliteSink",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -14,7 +14,8 @@
14
14
  "main": "dist/index.js",
15
15
  "types": "dist/index.d.ts",
16
16
  "bin": {
17
- "aaac-observ": "./dist/cli/index.js"
17
+ "aaac-observ": "./dist/cli/index.js",
18
+ "aaac-observ-global-record": "./dist/cli/global-record.js"
18
19
  },
19
20
  "exports": {
20
21
  ".": {