@saguiitay/eventhouse-ai-observability 0.1.1 → 0.2.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.
Files changed (42) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +159 -43
  3. package/dist/adapters/openai.d.ts +25 -0
  4. package/dist/adapters/vercel.d.ts +25 -0
  5. package/dist/{chunk-XFSF25OP.js → chunk-XGCHW72B.js} +11 -55
  6. package/dist/{chunk-XFSF25OP.js.map → chunk-XGCHW72B.js.map} +1 -1
  7. package/dist/copilot.js +5 -3
  8. package/dist/copilot.js.map +1 -1
  9. package/dist/index.d.ts +1 -6
  10. package/dist/index.js +3 -11
  11. package/dist/openai.d.ts +12 -0
  12. package/dist/openai.js +408 -0
  13. package/dist/openai.js.map +1 -0
  14. package/dist/validate.d.ts +2 -0
  15. package/dist/validate.js +237 -0
  16. package/dist/validate.js.map +1 -0
  17. package/dist/validation/fabric.d.ts +29 -0
  18. package/dist/vercel.d.ts +15 -0
  19. package/dist/vercel.js +369 -0
  20. package/dist/vercel.js.map +1 -0
  21. package/docs/architecture.md +19 -3
  22. package/docs/copilot-adapter.md +1 -1
  23. package/docs/extending.md +45 -1
  24. package/docs/fabric-setup.md +24 -0
  25. package/docs/implementation-report.md +62 -18
  26. package/docs/openai-adapter.md +137 -0
  27. package/docs/quickstart.md +75 -6
  28. package/docs/research-eventstream.md +8 -6
  29. package/docs/research.md +1 -1
  30. package/docs/security.md +1 -1
  31. package/docs/telemetry-schema.md +18 -0
  32. package/docs/vercel-adapter.md +201 -0
  33. package/examples/README.md +85 -5
  34. package/examples/copilot-basic/package.json +1 -1
  35. package/examples/openai-basic/env.example +8 -0
  36. package/examples/openai-basic/index.ts +46 -0
  37. package/examples/shared.ts +3 -62
  38. package/examples/telemetry.ts +124 -0
  39. package/examples/vercel-basic/env.example +8 -0
  40. package/examples/vercel-basic/index.ts +60 -0
  41. package/fabric-setup.zip +0 -0
  42. package/package.json +39 -5
@@ -0,0 +1,237 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ createObservability
4
+ } from "./chunk-XGCHW72B.js";
5
+
6
+ // src/validation/fabric.ts
7
+ import { randomUUID } from "crypto";
8
+ import { setTimeout as sleep } from "timers/promises";
9
+ var IngestionValidationError = class extends Error {
10
+ constructor(stage, message) {
11
+ super(message);
12
+ this.stage = stage;
13
+ this.name = "IngestionValidationError";
14
+ }
15
+ stage;
16
+ };
17
+ function interval(value, name, maximum) {
18
+ if (!Number.isSafeInteger(value) || value < 1 || value > maximum)
19
+ throw new IngestionValidationError(
20
+ "configuration",
21
+ `${name} must be a positive integer no greater than ${maximum}.`
22
+ );
23
+ return value;
24
+ }
25
+ function rows(value) {
26
+ const tables = value?.Tables;
27
+ if (Array.isArray(tables)) {
28
+ for (const table of tables) {
29
+ if (table === null || typeof table !== "object") continue;
30
+ const data = table;
31
+ if (!Array.isArray(data.Columns) || !Array.isArray(data.Rows)) continue;
32
+ const columns = data.Columns.map(
33
+ (column) => typeof column?.ColumnName === "string" ? column.ColumnName : ""
34
+ );
35
+ if (["traceId", "spanId", "parentSpanId"].every(
36
+ (name) => columns.includes(name)
37
+ )) {
38
+ if (data.Rows.every(Array.isArray))
39
+ return { columns, rows: data.Rows };
40
+ }
41
+ }
42
+ }
43
+ throw new IngestionValidationError(
44
+ "query",
45
+ "Unexpected query response; verify the Eventhouse query endpoint and trace schema."
46
+ );
47
+ }
48
+ async function validateFabricIngestion(options, dependencies = {}) {
49
+ let endpoint;
50
+ try {
51
+ endpoint = new URL(options.queryEndpoint);
52
+ if (endpoint.protocol !== "https:" || endpoint.username || endpoint.password || endpoint.search || endpoint.hash)
53
+ throw new Error();
54
+ } catch {
55
+ throw new IngestionValidationError(
56
+ "configuration",
57
+ "FABRIC_KQL_QUERY_ENDPOINT must be a credential-free HTTPS query URI."
58
+ );
59
+ }
60
+ if (!options.connectionString.trim() || !options.database.trim() || !options.accessToken.trim() || /[\r\n\0]/u.test(options.accessToken))
61
+ throw new IngestionValidationError(
62
+ "configuration",
63
+ "Supply producer credentials, a database name, and a valid query access token through the environment."
64
+ );
65
+ const timeout = interval(options.timeoutMs ?? 18e4, "timeoutMs", 9e5);
66
+ const poll = interval(
67
+ options.pollIntervalMs ?? 5e3,
68
+ "pollIntervalMs",
69
+ 6e4
70
+ );
71
+ const now = dependencies.now ?? Date.now;
72
+ const wait = dependencies.sleep ?? sleep;
73
+ const send = dependencies.fetch ?? fetch;
74
+ const notify = (stage, message) => {
75
+ try {
76
+ void Promise.resolve(options.onProgress?.(stage, message)).catch(
77
+ () => {
78
+ }
79
+ );
80
+ } catch {
81
+ }
82
+ };
83
+ const runId = `validation-${randomUUID()}`;
84
+ let rootId = "";
85
+ let childId = "";
86
+ let traceId = "";
87
+ let observer;
88
+ let producerFailed = false;
89
+ notify("producer", "Sending two metadata-only validation spans.");
90
+ try {
91
+ observer = (dependencies.createObserver ?? createObservability)({
92
+ connectionString: options.connectionString,
93
+ ...options.entityName ? { entityName: options.entityName } : {},
94
+ serviceName: "eventhouse-ingestion-validation",
95
+ environment: "validation",
96
+ captureContent: false,
97
+ samplingRatio: 1,
98
+ exportTimeoutMs: Math.min(timeout, 15e3),
99
+ shutdownTimeoutMs: Math.min(timeout, 15e3)
100
+ });
101
+ const attributes = { "validation.run.id": runId };
102
+ const root = observer.startSpan("validation.root", { attributes });
103
+ const child = observer.startSpan("invoke_agent validation", {
104
+ parent: root,
105
+ attributes: { ...attributes, "gen_ai.operation.name": "invoke_agent" }
106
+ });
107
+ rootId = root.spanContext().spanId;
108
+ childId = child.spanContext().spanId;
109
+ traceId = root.spanContext().traceId;
110
+ child.end();
111
+ root.end();
112
+ } catch {
113
+ producerFailed = true;
114
+ } finally {
115
+ try {
116
+ await observer?.shutdown();
117
+ } catch {
118
+ producerFailed = true;
119
+ }
120
+ }
121
+ const diagnostics = observer?.getDiagnostics();
122
+ if (producerFailed || diagnostics?.eventsExported !== 2 || diagnostics.eventsDropped !== 0 || diagnostics.exportFailures !== 0)
123
+ throw new IngestionValidationError(
124
+ "producer",
125
+ "Producer acknowledgement failed; check source Send credentials, entity name, and network access."
126
+ );
127
+ notify(
128
+ "producer",
129
+ "Both spans acknowledged. This does not yet prove Eventhouse ingestion."
130
+ );
131
+ notify("ingestion", "Waiting for matching Eventhouse rows.");
132
+ const deadline = now() + timeout;
133
+ while (now() < deadline) {
134
+ let response;
135
+ let result;
136
+ try {
137
+ response = await send(new URL("/v1/rest/query", endpoint), {
138
+ method: "POST",
139
+ headers: {
140
+ authorization: `Bearer ${options.accessToken}`,
141
+ "content-type": "application/json"
142
+ },
143
+ body: JSON.stringify({
144
+ db: options.database,
145
+ csl: `AIObservabilityTraces | where tostring(spanAttributes["validation.run.id"]) == "${runId}" | summarize arg_max(timestamp, *) by traceId, spanId | project traceId, spanId, parentSpanId | take 3`
146
+ }),
147
+ signal: AbortSignal.timeout(
148
+ Math.max(1, Math.min(15e3, deadline - now()))
149
+ )
150
+ });
151
+ if (!response.ok) {
152
+ const message = response.status === 401 || response.status === 403 ? "Query authorization failed; check the separate Kusto query token and database permissions." : `Query failed with HTTP ${response.status}; check the query endpoint, database schema, and capacity.`;
153
+ throw new IngestionValidationError("query", message);
154
+ }
155
+ result = rows(await response.json());
156
+ } catch (error) {
157
+ if (error instanceof IngestionValidationError) throw error;
158
+ throw new IngestionValidationError(
159
+ "query",
160
+ "Query request failed; check endpoint availability, network access, and token validity."
161
+ );
162
+ }
163
+ const trace = result.columns.indexOf("traceId");
164
+ const span = result.columns.indexOf("spanId");
165
+ const parent = result.columns.indexOf("parentSpanId");
166
+ const root = result.rows.find((row) => row[span] === rootId);
167
+ const child = result.rows.find((row) => row[span] === childId);
168
+ if (root && child) {
169
+ notify("ingestion", "Both validation spans are present in Eventhouse.");
170
+ if (root[trace] !== traceId || child[trace] !== traceId || child[parent] !== rootId)
171
+ throw new IngestionValidationError(
172
+ "correlation",
173
+ "Rows were ingested, but trace or parent-child identifiers do not match; verify the JSON mapping."
174
+ );
175
+ notify(
176
+ "correlation",
177
+ "Trace and parent-child identifiers are preserved."
178
+ );
179
+ return;
180
+ }
181
+ const remaining = deadline - now();
182
+ if (remaining > 0) await wait(Math.min(poll, remaining));
183
+ }
184
+ throw new IngestionValidationError(
185
+ "ingestion",
186
+ "Producer acknowledged both spans, but ingestion timed out; check Eventstream routing, table/mapping, and capacity."
187
+ );
188
+ }
189
+ async function runValidationCli(args, environment = process.env, dependencies = {}, output = {
190
+ info: console.log,
191
+ error: console.error
192
+ }) {
193
+ if (args.length === 1 && args[0] === "--help") {
194
+ output.info(
195
+ "Validate Fabric producer acknowledgement, Eventhouse ingestion, and trace correlation.\nRunning validation writes two metadata-only spans, not AI requests. --help performs no network I/O.\nSet FABRIC_EVENTSTREAM_CONNECTION_STRING, FABRIC_KQL_QUERY_ENDPOINT, FABRIC_KQL_DATABASE,\nand FABRIC_KQL_ACCESS_TOKEN in the environment. Optionally set FABRIC_EVENTSTREAM_ENTITY_NAME\nand FABRIC_VALIDATION_TIMEOUT_MS (default 180000, maximum 900000).\nCredentials are never accepted as command-line arguments."
196
+ );
197
+ return 0;
198
+ }
199
+ try {
200
+ if (args.length)
201
+ throw new IngestionValidationError(
202
+ "configuration",
203
+ "Only --help is accepted; configure credentials through the environment."
204
+ );
205
+ const required = (name) => {
206
+ const value = environment[name];
207
+ if (!value?.trim())
208
+ throw new IngestionValidationError("configuration", `Missing ${name}.`);
209
+ return value;
210
+ };
211
+ const entityName = environment.FABRIC_EVENTSTREAM_ENTITY_NAME;
212
+ const timeout = environment.FABRIC_VALIDATION_TIMEOUT_MS;
213
+ await validateFabricIngestion(
214
+ {
215
+ connectionString: required("FABRIC_EVENTSTREAM_CONNECTION_STRING"),
216
+ queryEndpoint: required("FABRIC_KQL_QUERY_ENDPOINT"),
217
+ database: required("FABRIC_KQL_DATABASE"),
218
+ accessToken: required("FABRIC_KQL_ACCESS_TOKEN"),
219
+ ...entityName ? { entityName } : {},
220
+ ...timeout !== void 0 ? { timeoutMs: Number(timeout) } : {},
221
+ onProgress: (stage, message) => output.info(`[${stage}] ${message}`)
222
+ },
223
+ dependencies
224
+ );
225
+ output.info("Fabric ingestion validation passed.");
226
+ return 0;
227
+ } catch (error) {
228
+ output.error(
229
+ error instanceof IngestionValidationError ? `[${error.stage}] ${error.message}` : "Validation failed; check producer/query configuration and network access."
230
+ );
231
+ return 1;
232
+ }
233
+ }
234
+
235
+ // src/validate.ts
236
+ process.exitCode = await runValidationCli(process.argv.slice(2));
237
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/validation/fabric.ts","../src/validate.ts"],"sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport { setTimeout as sleep } from \"node:timers/promises\";\nimport {\n createObservability,\n type EventhouseObservabilityOptions,\n} from \"../index.js\";\nimport type { Observability } from \"../engine.js\";\n\ntype Stage =\n \"configuration\" | \"producer\" | \"ingestion\" | \"correlation\" | \"query\";\n\nexport class IngestionValidationError extends Error {\n constructor(\n readonly stage: Stage,\n message: string,\n ) {\n super(message);\n this.name = \"IngestionValidationError\";\n }\n}\n\nexport interface IngestionValidationOptions {\n connectionString: string;\n entityName?: string;\n queryEndpoint: string;\n database: string;\n accessToken: string;\n timeoutMs?: number;\n pollIntervalMs?: number;\n onProgress?: (stage: Stage, message: string) => void;\n}\n\ninterface Dependencies {\n createObserver?: (options: EventhouseObservabilityOptions) => Observability;\n fetch?: typeof fetch;\n now?: () => number;\n sleep?: (milliseconds: number) => Promise<void>;\n}\n\nfunction interval(value: number, name: string, maximum: number): number {\n if (!Number.isSafeInteger(value) || value < 1 || value > maximum)\n throw new IngestionValidationError(\n \"configuration\",\n `${name} must be a positive integer no greater than ${maximum}.`,\n );\n return value;\n}\n\nfunction rows(value: unknown): { columns: string[]; rows: unknown[][] } {\n const tables = (value as { Tables?: unknown } | null)?.Tables;\n if (Array.isArray(tables)) {\n for (const table of tables) {\n if (table === null || typeof table !== \"object\") continue;\n const data = table as { Columns?: unknown; Rows?: unknown };\n if (!Array.isArray(data.Columns) || !Array.isArray(data.Rows)) continue;\n const columns = data.Columns.map((column: { ColumnName?: unknown }) =>\n typeof column?.ColumnName === \"string\" ? column.ColumnName : \"\",\n );\n if (\n [\"traceId\", \"spanId\", \"parentSpanId\"].every((name) =>\n columns.includes(name),\n )\n ) {\n if (data.Rows.every(Array.isArray))\n return { columns, rows: data.Rows as unknown[][] };\n }\n }\n }\n throw new IngestionValidationError(\n \"query\",\n \"Unexpected query response; verify the Eventhouse query endpoint and trace schema.\",\n );\n}\n\nexport async function validateFabricIngestion(\n options: IngestionValidationOptions,\n dependencies: Dependencies = {},\n): Promise<void> {\n let endpoint: URL;\n try {\n endpoint = new URL(options.queryEndpoint);\n if (\n endpoint.protocol !== \"https:\" ||\n endpoint.username ||\n endpoint.password ||\n endpoint.search ||\n endpoint.hash\n )\n throw new Error();\n } catch {\n throw new IngestionValidationError(\n \"configuration\",\n \"FABRIC_KQL_QUERY_ENDPOINT must be a credential-free HTTPS query URI.\",\n );\n }\n if (\n !options.connectionString.trim() ||\n !options.database.trim() ||\n !options.accessToken.trim() ||\n /[\\r\\n\\0]/u.test(options.accessToken)\n )\n throw new IngestionValidationError(\n \"configuration\",\n \"Supply producer credentials, a database name, and a valid query access token through the environment.\",\n );\n const timeout = interval(options.timeoutMs ?? 180000, \"timeoutMs\", 900000);\n const poll = interval(\n options.pollIntervalMs ?? 5000,\n \"pollIntervalMs\",\n 60000,\n );\n const now = dependencies.now ?? Date.now;\n const wait = dependencies.sleep ?? sleep;\n const send = dependencies.fetch ?? fetch;\n const notify = (stage: Stage, message: string) => {\n try {\n void Promise.resolve(options.onProgress?.(stage, message)).catch(\n () => {},\n );\n } catch {}\n };\n const runId = `validation-${randomUUID()}`;\n let rootId = \"\";\n let childId = \"\";\n let traceId = \"\";\n let observer: Observability | undefined;\n let producerFailed = false;\n notify(\"producer\", \"Sending two metadata-only validation spans.\");\n try {\n observer = (dependencies.createObserver ?? createObservability)({\n connectionString: options.connectionString,\n ...(options.entityName ? { entityName: options.entityName } : {}),\n serviceName: \"eventhouse-ingestion-validation\",\n environment: \"validation\",\n captureContent: false,\n samplingRatio: 1,\n exportTimeoutMs: Math.min(timeout, 15000),\n shutdownTimeoutMs: Math.min(timeout, 15000),\n });\n const attributes = { \"validation.run.id\": runId };\n const root = observer.startSpan(\"validation.root\", { attributes });\n const child = observer.startSpan(\"invoke_agent validation\", {\n parent: root,\n attributes: { ...attributes, \"gen_ai.operation.name\": \"invoke_agent\" },\n });\n rootId = root.spanContext().spanId;\n childId = child.spanContext().spanId;\n traceId = root.spanContext().traceId;\n child.end();\n root.end();\n } catch {\n producerFailed = true;\n } finally {\n try {\n await observer?.shutdown();\n } catch {\n producerFailed = true;\n }\n }\n const diagnostics = observer?.getDiagnostics();\n if (\n producerFailed ||\n diagnostics?.eventsExported !== 2 ||\n diagnostics.eventsDropped !== 0 ||\n diagnostics.exportFailures !== 0\n )\n throw new IngestionValidationError(\n \"producer\",\n \"Producer acknowledgement failed; check source Send credentials, entity name, and network access.\",\n );\n notify(\n \"producer\",\n \"Both spans acknowledged. This does not yet prove Eventhouse ingestion.\",\n );\n notify(\"ingestion\", \"Waiting for matching Eventhouse rows.\");\n const deadline = now() + timeout;\n while (now() < deadline) {\n let response: Response;\n let result: ReturnType<typeof rows>;\n try {\n response = await send(new URL(\"/v1/rest/query\", endpoint), {\n method: \"POST\",\n headers: {\n authorization: `Bearer ${options.accessToken}`,\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({\n db: options.database,\n csl: `AIObservabilityTraces | where tostring(spanAttributes[\"validation.run.id\"]) == \"${runId}\" | summarize arg_max(timestamp, *) by traceId, spanId | project traceId, spanId, parentSpanId | take 3`,\n }),\n signal: AbortSignal.timeout(\n Math.max(1, Math.min(15000, deadline - now())),\n ),\n });\n if (!response.ok) {\n const message =\n response.status === 401 || response.status === 403\n ? \"Query authorization failed; check the separate Kusto query token and database permissions.\"\n : `Query failed with HTTP ${response.status}; check the query endpoint, database schema, and capacity.`;\n throw new IngestionValidationError(\"query\", message);\n }\n result = rows(await response.json());\n } catch (error) {\n if (error instanceof IngestionValidationError) throw error;\n throw new IngestionValidationError(\n \"query\",\n \"Query request failed; check endpoint availability, network access, and token validity.\",\n );\n }\n const trace = result.columns.indexOf(\"traceId\");\n const span = result.columns.indexOf(\"spanId\");\n const parent = result.columns.indexOf(\"parentSpanId\");\n const root = result.rows.find((row) => row[span] === rootId);\n const child = result.rows.find((row) => row[span] === childId);\n if (root && child) {\n notify(\"ingestion\", \"Both validation spans are present in Eventhouse.\");\n if (\n root[trace] !== traceId ||\n child[trace] !== traceId ||\n child[parent] !== rootId\n )\n throw new IngestionValidationError(\n \"correlation\",\n \"Rows were ingested, but trace or parent-child identifiers do not match; verify the JSON mapping.\",\n );\n notify(\n \"correlation\",\n \"Trace and parent-child identifiers are preserved.\",\n );\n return;\n }\n const remaining = deadline - now();\n if (remaining > 0) await wait(Math.min(poll, remaining));\n }\n throw new IngestionValidationError(\n \"ingestion\",\n \"Producer acknowledged both spans, but ingestion timed out; check Eventstream routing, table/mapping, and capacity.\",\n );\n}\n\nexport async function runValidationCli(\n args: string[],\n environment: NodeJS.ProcessEnv = process.env,\n dependencies: Dependencies = {},\n output: {\n info: (message: string) => void;\n error: (message: string) => void;\n } = {\n info: console.log,\n error: console.error,\n },\n): Promise<number> {\n if (args.length === 1 && args[0] === \"--help\") {\n output.info(\n \"Validate Fabric producer acknowledgement, Eventhouse ingestion, and trace correlation.\\n\" +\n \"Running validation writes two metadata-only spans, not AI requests. --help performs no network I/O.\\n\" +\n \"Set FABRIC_EVENTSTREAM_CONNECTION_STRING, FABRIC_KQL_QUERY_ENDPOINT, FABRIC_KQL_DATABASE,\\n\" +\n \"and FABRIC_KQL_ACCESS_TOKEN in the environment. Optionally set FABRIC_EVENTSTREAM_ENTITY_NAME\\n\" +\n \"and FABRIC_VALIDATION_TIMEOUT_MS (default 180000, maximum 900000).\\n\" +\n \"Credentials are never accepted as command-line arguments.\",\n );\n return 0;\n }\n try {\n if (args.length)\n throw new IngestionValidationError(\n \"configuration\",\n \"Only --help is accepted; configure credentials through the environment.\",\n );\n const required = (name: string) => {\n const value = environment[name];\n if (!value?.trim())\n throw new IngestionValidationError(\"configuration\", `Missing ${name}.`);\n return value;\n };\n const entityName = environment.FABRIC_EVENTSTREAM_ENTITY_NAME;\n const timeout = environment.FABRIC_VALIDATION_TIMEOUT_MS;\n await validateFabricIngestion(\n {\n connectionString: required(\"FABRIC_EVENTSTREAM_CONNECTION_STRING\"),\n queryEndpoint: required(\"FABRIC_KQL_QUERY_ENDPOINT\"),\n database: required(\"FABRIC_KQL_DATABASE\"),\n accessToken: required(\"FABRIC_KQL_ACCESS_TOKEN\"),\n ...(entityName ? { entityName } : {}),\n ...(timeout !== undefined ? { timeoutMs: Number(timeout) } : {}),\n onProgress: (stage, message) => output.info(`[${stage}] ${message}`),\n },\n dependencies,\n );\n output.info(\"Fabric ingestion validation passed.\");\n return 0;\n } catch (error) {\n output.error(\n error instanceof IngestionValidationError\n ? `[${error.stage}] ${error.message}`\n : \"Validation failed; check producer/query configuration and network access.\",\n );\n return 1;\n }\n}\n","#!/usr/bin/env node\nimport { runValidationCli } from \"./validation/fabric.js\";\n\nprocess.exitCode = await runValidationCli(process.argv.slice(2));\n"],"mappings":";;;;;;AAAA,SAAS,kBAAkB;AAC3B,SAAS,cAAc,aAAa;AAU7B,IAAM,2BAAN,cAAuC,MAAM;AAAA,EAClD,YACW,OACT,SACA;AACA,UAAM,OAAO;AAHJ;AAIT,SAAK,OAAO;AAAA,EACd;AAAA,EALW;AAMb;AAoBA,SAAS,SAAS,OAAe,MAAc,SAAyB;AACtE,MAAI,CAAC,OAAO,cAAc,KAAK,KAAK,QAAQ,KAAK,QAAQ;AACvD,UAAM,IAAI;AAAA,MACR;AAAA,MACA,GAAG,IAAI,+CAA+C,OAAO;AAAA,IAC/D;AACF,SAAO;AACT;AAEA,SAAS,KAAK,OAA0D;AACtE,QAAM,SAAU,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EAAE,WAAW,OAAO,OAAO,EAAE,IAAI,CAAC;AAAA,QAC9D,YAAY,CAAC,OAAO,YAAY,OAAO,KAAK,IAAI,KAAK,KAAK,OAAO,EAAE;AAAA,MACrE;AAAA,MACA;AAAA,IACF;AACA,WAAO,KAAK,qCAAqC;AACjD,WAAO;AAAA,EACT,SAAS,OAAO;AACd,WAAO;AAAA,MACL,iBAAiB,2BACb,IAAI,MAAM,KAAK,KAAK,MAAM,OAAO,KACjC;AAAA,IACN;AACA,WAAO;AAAA,EACT;AACF;;;ACxSA,QAAQ,WAAW,MAAM,iBAAiB,QAAQ,KAAK,MAAM,CAAC,CAAC;","names":[]}
@@ -0,0 +1,29 @@
1
+ import { type EventhouseObservabilityOptions } from "../index.js";
2
+ import type { Observability } from "../engine.js";
3
+ type Stage = "configuration" | "producer" | "ingestion" | "correlation" | "query";
4
+ export declare class IngestionValidationError extends Error {
5
+ readonly stage: Stage;
6
+ constructor(stage: Stage, message: string);
7
+ }
8
+ export interface IngestionValidationOptions {
9
+ connectionString: string;
10
+ entityName?: string;
11
+ queryEndpoint: string;
12
+ database: string;
13
+ accessToken: string;
14
+ timeoutMs?: number;
15
+ pollIntervalMs?: number;
16
+ onProgress?: (stage: Stage, message: string) => void;
17
+ }
18
+ interface Dependencies {
19
+ createObserver?: (options: EventhouseObservabilityOptions) => Observability;
20
+ fetch?: typeof fetch;
21
+ now?: () => number;
22
+ sleep?: (milliseconds: number) => Promise<void>;
23
+ }
24
+ export declare function validateFabricIngestion(options: IngestionValidationOptions, dependencies?: Dependencies): Promise<void>;
25
+ export declare function runValidationCli(args: string[], environment?: NodeJS.ProcessEnv, dependencies?: Dependencies, output?: {
26
+ info: (message: string) => void;
27
+ error: (message: string) => void;
28
+ }): Promise<number>;
29
+ export {};
@@ -0,0 +1,15 @@
1
+ import { type VercelAdapterOptions } from "./adapters/vercel.js";
2
+ import { type EventhouseObservabilityOptions } from "./index.js";
3
+ import type { Observability } from "./engine.js";
4
+ export type { VercelAdapterOptions, VercelTelemetrySettings, } from "./adapters/vercel.js";
5
+ export type VercelObservabilityOptions = VercelAdapterOptions & ((EventhouseObservabilityOptions & {
6
+ engine?: never;
7
+ }) | {
8
+ engine: Observability;
9
+ });
10
+ export declare function observeVercelAI(options: VercelObservabilityOptions): {
11
+ telemetry: import("./adapters/vercel.js").VercelTelemetrySettings;
12
+ flush: () => Promise<void>;
13
+ getDiagnostics: () => Readonly<import("./engine.js").Diagnostics>;
14
+ shutdown(): Promise<void>;
15
+ };