@holonograph/client 0.1.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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Precision Innovations LLC
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 ADDED
@@ -0,0 +1,103 @@
1
+ # @holonograph/client
2
+
3
+ The TypeScript HTTP client for a **Holonograph lens**.
4
+
5
+ A Holonograph lens sits in front of your LLM calls and turns every call into a
6
+ longitudinal, gradeable record. This package is the client you integrate into
7
+ your application: it sends messages through the lens over HTTP and reports the
8
+ scored outcome of each call back to it. Nothing else — no engine, no model
9
+ keys, no server. The lens does the work; this is the wire to reach it.
10
+
11
+ ## Install
12
+
13
+ ```sh
14
+ npm install @holonograph/client
15
+ ```
16
+
17
+ The package is a single self-contained ES module with **no runtime
18
+ dependencies**. It targets Node 18+ and any runtime with a global `fetch`.
19
+
20
+ ## Quickstart
21
+
22
+ ```ts
23
+ import { HolonographClient } from '@holonograph/client';
24
+
25
+ const client = new HolonographClient({
26
+ // Where your running lens is reachable.
27
+ endpoint: 'http://127.0.0.1:8080',
28
+ // Optional bearer token, if the lens requires one.
29
+ token: process.env.HOLONOGRAPH_TOKEN,
30
+ // Optional run mode, forwarded on every request.
31
+ runMode: 'production',
32
+ // Pinned into every evaluation event this client produces.
33
+ lensVersion: 'lv_2026_07_01',
34
+ substrate: {
35
+ lensVersion: 'lv_2026_07_01',
36
+ lightSourceIdentifier: 'anthropic/claude/4',
37
+ runMode: 'production',
38
+ provenance: 'production',
39
+ operatorColumns: {},
40
+ },
41
+ });
42
+
43
+ // 1. Send a message through the lens.
44
+ const handle = await client.messages.create({
45
+ surfaceId: 'support.triage',
46
+ messages: [{ role: 'user', content: 'My order never arrived.' }],
47
+ });
48
+
49
+ // Read the model's output off the returned handle.
50
+ const result = handle.result;
51
+
52
+ // 2. Score the call however you like, then report the outcome back to the lens.
53
+ await handle.reportOutcome({
54
+ dimensions: [
55
+ {
56
+ dimensionId: 'is_actionable',
57
+ passed: true,
58
+ expected: 'a concrete next step',
59
+ actual: 'offered to open a replacement order',
60
+ },
61
+ ],
62
+ });
63
+ ```
64
+
65
+ That is the whole loop: **`messages.create()` → score → `reportOutcome()`**. The
66
+ lens assembles and stores the evaluation event; over time those events become
67
+ the longitudinal record you query and visualize.
68
+
69
+ ## What it speaks
70
+
71
+ The client talks to a lens over plain HTTP under the `/holonograph/*` path
72
+ space (plus the lens's event and availability endpoints). Requests carry
73
+ `x-holonograph-*` headers for correlation and run mode. You never construct
74
+ these by hand — the client does.
75
+
76
+ Errors from the lens surface as `HolonographHttpError`, which carries the HTTP
77
+ status, an error code, and any details the lens returned.
78
+
79
+ ## API surface
80
+
81
+ - **`HolonographClient`** — construct with an `endpoint` (plus optional `token`
82
+ / `runMode`) and the `lensVersion` + `substrate` to pin into every event.
83
+ - `client.messages.create(request)` — send a message; returns a handle.
84
+ - `handle.reportOutcome(outcome)` — commit the scored outcome.
85
+ - `handle.gradeObserver(...)` — attach grades to a cross-vendor observer call
86
+ before reporting, when the lens returned observer records.
87
+ - `client.contract.register(contract)` — publish a surface contract to the lens.
88
+ - `client.availability.mark(request)` — write availability markers.
89
+ - `client.callDirectly(request)` — escape hatch for the full request shape.
90
+ - **`HttpTransport`** — the underlying transport, exposed for advanced use.
91
+ - **`HolonographHttpError`** and the typed error classes for the grading and
92
+ availability flows.
93
+
94
+ Everything is fully typed; the package ships its own type declarations.
95
+
96
+ ## Requirements
97
+
98
+ This client does nothing on its own — it needs a **running Holonograph lens** to
99
+ connect to. Point `endpoint` at your lens and you are set.
100
+
101
+ ## License
102
+
103
+ MIT