@saguiitay/eventhouse-ai-observability 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/LICENSE +21 -0
  3. package/README.md +182 -2
  4. package/dist/adapters/copilot.d.ts +18 -0
  5. package/dist/chunk-XFSF25OP.js +946 -0
  6. package/dist/chunk-XFSF25OP.js.map +1 -0
  7. package/dist/copilot.d.ts +4 -0
  8. package/dist/copilot.js +474 -0
  9. package/dist/copilot.js.map +1 -0
  10. package/dist/diagnostics.d.ts +11 -0
  11. package/dist/engine.d.ts +55 -0
  12. package/dist/exporters/eventstream.d.ts +32 -0
  13. package/dist/exporters/serialize.d.ts +44 -0
  14. package/dist/index.d.ts +17 -0
  15. package/dist/index.js +17 -0
  16. package/dist/index.js.map +1 -0
  17. package/docs/architecture.md +29 -0
  18. package/docs/copilot-adapter.md +176 -0
  19. package/docs/dashboards.md +55 -0
  20. package/docs/eventstream-transport.md +35 -0
  21. package/docs/extending.md +33 -0
  22. package/docs/fabric-setup.md +131 -0
  23. package/docs/implementation-report.md +101 -0
  24. package/docs/performance.md +24 -0
  25. package/docs/quickstart.md +92 -0
  26. package/docs/research-copilot.md +92 -0
  27. package/docs/research-eventstream.md +221 -0
  28. package/docs/research-fabric.md +64 -0
  29. package/docs/research.md +36 -0
  30. package/docs/security.md +26 -0
  31. package/docs/telemetry-schema.md +33 -0
  32. package/docs/troubleshooting.md +38 -0
  33. package/examples/README.md +84 -0
  34. package/examples/copilot-basic/env.example +8 -0
  35. package/examples/copilot-basic/index.ts +19 -0
  36. package/examples/copilot-basic/package.json +8 -0
  37. package/examples/copilot-basic/tsconfig.json +7 -0
  38. package/examples/copilot-multi-agent/env.example +6 -0
  39. package/examples/copilot-multi-agent/index.ts +57 -0
  40. package/examples/copilot-tools/env.example +6 -0
  41. package/examples/copilot-tools/index.ts +54 -0
  42. package/examples/shared.ts +142 -0
  43. package/package.json +77 -3
package/CHANGELOG.md ADDED
@@ -0,0 +1,22 @@
1
+ # Changelog
2
+
3
+ ## 0.1.1 - 2026-11-12
4
+
5
+ - Fix the reported development-dependency advisories by upgrading AJV to 8.18.0
6
+ and fast-uri to 3.1.9.
7
+ - Publish with public access and require verified public GitHub package visibility
8
+ before publication. GitHub's one-time package visibility setting is separate
9
+ from npm's access flag.
10
+ - Derive the package-smoke tarball name from release metadata, and verify packed
11
+ metadata, instrumentation scope version, and the basic example's dependency pin.
12
+ - Update the basic example to consume published 0.1.1 once that version is released.
13
+ - Document successful operator-reported live validation of 0.1.0: installed
14
+ package, Copilot execution, Eventstream acknowledgement, Eventhouse ingestion,
15
+ and dashboard visibility. This does not claim automated live validation of 0.1.1.
16
+
17
+ ## 0.1.0 - 2026-11-12
18
+
19
+ - Initial GitHub Packages release with Fabric Eventstream and OTLP export,
20
+ GitHub Copilot SDK instrumentation, privacy filtering, and export diagnostics.
21
+ - Include Fabric schemas, analytics, dashboard assets, provisioning tools,
22
+ three Copilot examples, offline tests, and an opt-in live validation script.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Eventhouse AI Observability contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,183 @@
1
- # Temporary Holding Version
1
+ # Five-minute quick start
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Instrument an **existing GitHub Copilot SDK session** and send OpenTelemetry spans directly to Microsoft Fabric Eventstream. No Collector, gateway, or custom frontend.
4
+
5
+ 1. In Fabric, add an Eventstream **Custom endpoint source**, then connect its output to an Eventhouse KQL database. Use the source's **Event Hub** producer credentials, not an outward destination. Apply the [schema and setup](docs/fabric-setup.md).
6
+ 2. Set `FABRIC_EVENTSTREAM_CONNECTION_STRING` to the Fabric-provided connection string. If it omits `EntityPath`, also set `FABRIC_EVENTSTREAM_ENTITY_NAME` to the provided event hub name.
7
+ 3. Configure [GitHub Packages authentication](#installation-from-github-packages), then install and instrument:
8
+
9
+ ```sh
10
+ npm install @saguiitay/eventhouse-ai-observability
11
+ ```
12
+
13
+ ```typescript
14
+ import { observeCopilot } from "@saguiitay/eventhouse-ai-observability/copilot";
15
+
16
+ const session = await copilot.createSession(/* your existing configuration */);
17
+ const observer = observeCopilot(session, {
18
+ connectionString: process.env.FABRIC_EVENTSTREAM_CONNECTION_STRING!,
19
+ serviceName: "my-agent",
20
+ });
21
+
22
+ try {
23
+ await session.sendAndWait({ prompt: "Explain distributed tracing." });
24
+ } finally {
25
+ await observer.shutdown();
26
+ }
27
+ ```
28
+
29
+ Version 0.1.1 is published to **GitHub Packages**. A separate npmjs workflow
30
+ stages the same version for human approval; it does not publish directly.
31
+ Until the first npmjs approval, use the GitHub Packages installation below.
32
+ To test an unpublished release,
33
+ run `pnpm install` and `pnpm pack`; install the root tarball with npm.
34
+ Node.js **22.15+** (including Node 24 LTS), ESM, Copilot SDK **1.0.31** / compatible
35
+ 1.x, and a Fabric capacity/workspace with Eventstream and Eventhouse are required.
36
+ The repository's `.npmrc` routes only `@saguiitay` packages to GitHub Packages;
37
+ other dependencies continue to use your configured, organization-approved registry.
38
+
39
+ Packing with `pnpm pack` or `npm pack` automatically rebuilds the ESM runtime and
40
+ TypeScript declarations through `prepack`; a failed build stops packaging. Do not
41
+ disable lifecycle scripts when preparing a release.
42
+
43
+ The tarball includes these documentation pages and example sources/templates, so
44
+ relative links work from the installed package. Run example/provisioning commands
45
+ from the source checkout; Fabric assets remain there and are not shipped with
46
+ tenant-specific bindings.
47
+
48
+ Metadata only is captured by default. Prompts, responses, tool arguments, tool results, and error messages are not collected unless explicitly enabled. Credentials are redacted; review [security](docs/security.md) before enabling content.
49
+
50
+ ## What is included
51
+
52
+ One npm package with root and `/copilot` exports and ordinary internal modules under `src`. OpenTelemetry supplies batching, sampling, and OTLP export; our code supplies the Fabric exporter, privacy filtering, and Copilot event adapter. Includes versioned JSON, Eventhouse schema and twenty analytics queries, native dashboard assets, provisioning, three [examples](examples), local integration tests, and an opt-in live check.
53
+
54
+ ```typescript
55
+ import { createObservability } from "@saguiitay/eventhouse-ai-observability";
56
+
57
+ const observer = createObservability({
58
+ transport: "otlp",
59
+ endpoint: "https://your-existing-otlp-service.example/v1/traces",
60
+ });
61
+ const span = observer.startSpan("invoke_agent my-framework", {
62
+ attributes: { "gen_ai.operation.name": "invoke_agent" },
63
+ });
64
+ span.end();
65
+ await observer.flush();
66
+ await observer.shutdown();
67
+ ```
68
+
69
+ An OTLP endpoint is optional and **not required for Fabric**. Eventstream receives JSON events over the official Event Hubs AMQP producer protocol, not OTLP.
70
+
71
+ Examples print their selected transport and final export counters, and fail after
72
+ cleanup if telemetry failed or was dropped. In applications, use
73
+ `observer.getDiagnostics().lastError`, `onDiagnostic`, or `debug: true` for safe
74
+ failure categories without exposing credentials. Producer acknowledgements do
75
+ not prove Eventhouse ingestion. Existing Fabric deployments can use the
76
+ [previewable update command](docs/fabric-setup.md#updating-an-existing-deployment)
77
+ to update the helper and dashboard queries without replacing bindings.
78
+
79
+ ## Development and verification
80
+
81
+ ```sh
82
+ pnpm install
83
+ pnpm typecheck
84
+ pnpm test
85
+ pnpm build
86
+ pnpm lint
87
+ pnpm validate:fabric
88
+ pnpm bench
89
+ ```
90
+
91
+ All SDK and asset/schema tests run in Node/TypeScript with Vitest and Ajv. Fabric provisioning and its mocked REST tests require PowerShell 7.2+; Python is not required.
92
+
93
+ `pnpm test` uses SDK mocks and a real localhost OTLP HTTP receiver. It does **not**
94
+ establish Fabric compatibility. **Live Fabric compatibility: verified for the
95
+ operator's 0.1.0 deployment on 2026-11-12**, based on the operator's reported
96
+ published-package installation, successful Copilot execution, three acknowledged
97
+ spans with no drops/failures, rows in `AIObservabilityTraces`, and dashboard
98
+ visibility. This does not establish support for all tenants, automated
99
+ provisioning, or a live run of 0.1.1. The separate [live validation
100
+ script](docs/quickstart.md#live-fabric-validation) checks producer acceptance,
101
+ Eventhouse ingestion, KQL lookup, and parent-child relationships; its execution
102
+ has not been reported.
103
+
104
+ ## Installation from GitHub Packages
105
+
106
+ GitHub's npm registry requires authentication even for public packages. Your
107
+ organization must permit access to `https://npm.pkg.github.com`.
108
+ Add this scope mapping to the consuming project's `.npmrc`:
109
+
110
+ ```ini
111
+ @saguiitay:registry=https://npm.pkg.github.com
112
+ ```
113
+
114
+ Create a personal access token **(classic)** with `read:packages`. In PowerShell 7,
115
+ configure a user-level environment-variable reference instead of using the
116
+ `npm login` endpoint, which may return HTTP 403:
117
+
118
+ ```powershell
119
+ $env:GITHUB_PACKAGES_TOKEN = Read-Host "GitHub classic PAT" -MaskInput
120
+ npm config set '//npm.pkg.github.com/:_authToken' '${GITHUB_PACKAGES_TOKEN}' --location=user
121
+ npm install @saguiitay/eventhouse-ai-observability
122
+ ```
123
+
124
+ Keep credentials in user-level configuration or your CI secret store, never in
125
+ the repository. Set the environment variable again in each new terminal session.
126
+ This scope mapping does not change the registry for dependencies outside `@saguiitay`.
127
+
128
+ ## Publishing
129
+
130
+ Run **Publish to GitHub Packages** from the repository's Actions tab on `main`,
131
+ or publish a GitHub Release whose tag matches the package version, such as
132
+ `v0.1.1`. Update `package.json`, the instrumentation scope version in `src/engine.ts`,
133
+ and the basic example's dependency pin before releasing another version; published versions
134
+ cannot be overwritten. Prerelease versions use the `next` dist-tag instead of `latest`.
135
+
136
+ The workflow first verifies that the existing GitHub package is public, then
137
+ validates, builds via `prepack`, smoke-tests the tarball, publishes that exact
138
+ artifact with `--access public`, and checks its registry version. It uses the repository's
139
+ `GITHUB_TOKEN` with `packages: write`; no npm token or personal access token secret
140
+ is needed for publishing. Repository/organization Actions policy must allow this
141
+ permission.
142
+
143
+ GitHub controls visibility separately from npm's access flag. Before the next
144
+ publication, open the existing package's **Package settings → Change visibility**
145
+ and select **Public**. This is a one-time, irreversible setting; all subsequent
146
+ versions of this package remain public. The workflow fails before publishing if
147
+ the package is private or its visibility cannot be verified. New package names
148
+ must be bootstrapped and made public before using this workflow.
149
+ Public visibility still requires consumer authentication. See the [release notes](CHANGELOG.md).
150
+
151
+ ## Staging on npmjs
152
+
153
+ The separate **Stage package on npmjs** workflow runs manually on `main`. It uses
154
+ Node 24 and npm 12, validates the project, changes the registry only in its runner
155
+ checkout, packs, smoke-tests, and stages the exact tested tarball. The committed
156
+ GitHub Packages registry configuration and its publishing workflow are unchanged.
157
+ Packed metadata is checked against the selected publication settings.
158
+
159
+ For the first npmjs publication:
160
+
161
+ 1. Own the `@saguiitay` npm scope and enable npm account 2FA.
162
+ 2. Create a short-lived granular token with **Read and write (stage only)**
163
+ permission for that scope. Leave **Bypass two-factor authentication** unchecked.
164
+ 3. Store the token as the repository Actions secret **`NPM_STAGING_TOKEN`**.
165
+ The workflow exposes it only to the staging step, never to dependency installation
166
+ or package lifecycle scripts.
167
+ 4. Run **Stage package on npmjs** from Actions. On npmjs.com, open **Account >
168
+ Staged Packages**, review the package/version, and **Approve** with 2FA.
169
+
170
+ For a new package, npm creates a publicly visible `0.0.0-stage` placeholder.
171
+ The actual staged version's contents remain unavailable until approval. A staged
172
+ version reserves that version number; do not rerun staging for an already staged
173
+ or published version. `0.1.1` on GitHub Packages does not reserve `0.1.1` on npmjs.
174
+
175
+ After bootstrap, configure npm's GitHub Actions trusted publisher for
176
+ `saguiitay/ai-observability` and workflow filename `publish-npmjs.yml`, update the
177
+ workflow to use OIDC, and revoke the bootstrap token. Approval still requires
178
+ interactive 2FA if using staged publishing. See [npm staged publishing](https://docs.npmjs.com/staged-publishing/)
179
+ and [trusted publishing](https://docs.npmjs.com/trusted-publishers/).
180
+
181
+ ## Documentation
182
+
183
+ [Quickstart](docs/quickstart.md) · [Architecture](docs/architecture.md) · [Research](docs/research.md) · [Fabric setup](docs/fabric-setup.md) · [Transport](docs/eventstream-transport.md) · [Schema](docs/telemetry-schema.md) · [Copilot adapter](docs/copilot-adapter.md) · [Dashboards](docs/dashboards.md) · [Security](docs/security.md) · [Extending](docs/extending.md) · [Troubleshooting](docs/troubleshooting.md) · [Performance](docs/performance.md) · [Implementation report](docs/implementation-report.md).
@@ -0,0 +1,18 @@
1
+ import type { SessionEventHandler } from "@github/copilot-sdk";
2
+ import type { Diagnostics, Observability } from "../engine.js";
3
+ /** Compatible with CopilotSession without requiring its private implementation. */
4
+ export interface CopilotEventSource {
5
+ readonly sessionId: string;
6
+ on(handler: SessionEventHandler): () => void;
7
+ }
8
+ export interface CopilotObserver {
9
+ flush(): Promise<void>;
10
+ shutdown(): Promise<void>;
11
+ getDiagnostics(): Readonly<Diagnostics>;
12
+ }
13
+ export interface AttachCopilotOptions {
14
+ /** Defaults to true. Use false when several adapters share an externally owned engine. */
15
+ shutdownEngine?: boolean;
16
+ }
17
+ /** Attaches synchronously; event callbacks never perform or await network I/O. */
18
+ export declare function attachCopilot(session: CopilotEventSource, engine: Observability, options?: AttachCopilotOptions): CopilotObserver;