hci-atrium 0.1.0 → 0.3.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/README.md +266 -8
- package/dist/asset-meta.d.ts +31 -0
- package/dist/asset-meta.d.ts.map +1 -0
- package/dist/asset-meta.js +25 -0
- package/dist/asset-meta.js.map +1 -0
- package/dist/atrium.d.ts +220 -7
- package/dist/atrium.d.ts.map +1 -1
- package/dist/atrium.js +410 -39
- package/dist/atrium.js.map +1 -1
- package/dist/dash.d.ts +206 -0
- package/dist/dash.d.ts.map +1 -0
- package/dist/dash.js +302 -0
- package/dist/dash.js.map +1 -0
- package/dist/direct.d.ts +86 -0
- package/dist/direct.d.ts.map +1 -0
- package/dist/direct.js +121 -0
- package/dist/direct.js.map +1 -0
- package/dist/index.d.ts +8 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/models.d.ts +70 -0
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +56 -0
- package/dist/models.js.map +1 -1
- package/dist/player/audio-layers.d.ts +306 -0
- package/dist/player/audio-layers.d.ts.map +1 -0
- package/dist/player/audio-layers.js +1245 -0
- package/dist/player/audio-layers.js.map +1 -0
- package/dist/player/index.d.ts +13 -0
- package/dist/player/index.d.ts.map +1 -0
- package/dist/player/index.js +13 -0
- package/dist/player/index.js.map +1 -0
- package/dist/player/layer-signals.d.ts +80 -0
- package/dist/player/layer-signals.d.ts.map +1 -0
- package/dist/player/layer-signals.js +174 -0
- package/dist/player/layer-signals.js.map +1 -0
- package/dist/player/play-command.d.ts +55 -0
- package/dist/player/play-command.d.ts.map +1 -0
- package/dist/player/play-command.js +36 -0
- package/dist/player/play-command.js.map +1 -0
- package/dist/player/play-intent.d.ts +18 -0
- package/dist/player/play-intent.d.ts.map +1 -0
- package/dist/player/play-intent.js +26 -0
- package/dist/player/play-intent.js.map +1 -0
- package/dist/player/runtime.d.ts +105 -0
- package/dist/player/runtime.d.ts.map +1 -0
- package/dist/player/runtime.js +402 -0
- package/dist/player/runtime.js.map +1 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +1 -0
- package/dist/react/index.js.map +1 -1
- package/dist/react/use-room-connection.d.ts +40 -0
- package/dist/react/use-room-connection.d.ts.map +1 -0
- package/dist/react/use-room-connection.js +85 -0
- package/dist/react/use-room-connection.js.map +1 -0
- package/dist/rooms/recorder.d.ts +4 -0
- package/dist/rooms/recorder.d.ts.map +1 -1
- package/dist/rooms/recorder.js +7 -0
- package/dist/rooms/recorder.js.map +1 -1
- package/dist/rooms/room.d.ts +78 -0
- package/dist/rooms/room.d.ts.map +1 -1
- package/dist/rooms/room.js +208 -3
- package/dist/rooms/room.js.map +1 -1
- package/dist/rooms/standing-source.d.ts +3 -0
- package/dist/rooms/standing-source.d.ts.map +1 -1
- package/dist/rooms/standing-source.js +6 -0
- package/dist/rooms/standing-source.js.map +1 -1
- package/dist/rooms/transcriber.d.ts +4 -0
- package/dist/rooms/transcriber.d.ts.map +1 -1
- package/dist/rooms/transcriber.js +1 -0
- package/dist/rooms/transcriber.js.map +1 -1
- package/dist/shaping/index.d.ts +1 -0
- package/dist/shaping/index.d.ts.map +1 -1
- package/dist/shaping/index.js +1 -0
- package/dist/shaping/index.js.map +1 -1
- package/dist/shaping/request.d.ts +1 -1
- package/dist/shaping/request.d.ts.map +1 -1
- package/dist/shaping/surveys.d.ts +69 -0
- package/dist/shaping/surveys.d.ts.map +1 -0
- package/dist/shaping/surveys.js +129 -0
- package/dist/shaping/surveys.js.map +1 -0
- package/dist/tools.d.ts +84 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +105 -0
- package/dist/tools.js.map +1 -0
- package/dist/trace.d.ts +96 -0
- package/dist/trace.d.ts.map +1 -0
- package/dist/trace.js +251 -0
- package/dist/trace.js.map +1 -0
- package/dist/transcribe.d.ts +5 -0
- package/dist/transcribe.d.ts.map +1 -1
- package/dist/transcribe.js +1 -1
- package/dist/transcribe.js.map +1 -1
- package/package.json +5 -1
package/dist/dash.js
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Observation-dashboard state — the host-side helper (the TypeScript port of Python's ``dash.py``,
|
|
3
|
+
* on the **v2 tile wire**).
|
|
4
|
+
*
|
|
5
|
+
* An app drives a live dashboard by holding its state here as a grid of **tiles**. The helper answers
|
|
6
|
+
* each dashboard's ``presence.join`` with a full snapshot (host-answers-join) and broadcasts a delta
|
|
7
|
+
* on every change, over the room's ephemeral ``dash.*`` signals. The dialect is normative in
|
|
8
|
+
* ``docs/reference/dash-dialect.md``; the hosted renderer is ``/tools/dashboard``.
|
|
9
|
+
*
|
|
10
|
+
* One source of truth (the app), two channels. The **live dashboard** is what a researcher watches
|
|
11
|
+
* *now*: tiles for state, and {@link Dashboard.error} for a prominent, persistent error strip — both
|
|
12
|
+
* ephemeral, so the room stores nothing and a late joiner sees only the current snapshot (never a past
|
|
13
|
+
* error). The **session** is the durable record: log notable events *and* errors there yourself (a
|
|
14
|
+
* ``session.event``) so they survive the room. Notable failures usually want both.
|
|
15
|
+
*
|
|
16
|
+
* Tiles (``kind``): ``status`` (a labelled value) · ``text`` (fit-to-box prose) · ``image`` /
|
|
17
|
+
* ``sound`` (link an asset by ``assetId``) · ``decision`` (candidates considered / picked / why).
|
|
18
|
+
* Every tile takes an optional ``title``, a ``colSpan`` / ``rowSpan`` (1..3) and a ``group`` (a titled
|
|
19
|
+
* row break in the grid). Structure lives in the grid — the room's event log (the dashboard's
|
|
20
|
+
* sidebar) is a strict chronological feed the app does not lay out.
|
|
21
|
+
*
|
|
22
|
+
* Controls: {@link Dashboard.button} (fires an action back to the app) and {@link Dashboard.textInput}
|
|
23
|
+
* (a labelled send). A dashboard fires a control as a ``dash.action`` request and toasts the handler's
|
|
24
|
+
* return; a researcher note arrives as a fire-and-forget ``dash.note``.
|
|
25
|
+
*
|
|
26
|
+
* ```ts
|
|
27
|
+
* await using room = await atrium.rooms.open({ name: "study" })
|
|
28
|
+
* await room.connect() // the app is the snapshot's `host`
|
|
29
|
+
* const dash = room.dashboard({ title: "Reactive Soundscape" })
|
|
30
|
+
* await dash.status("phase", "Phase", "Calibration")
|
|
31
|
+
* await dash.text("brief", "Welcome — settle in.", { colSpan: 2 })
|
|
32
|
+
* dash.button("advance", "Start next phase", async () => {
|
|
33
|
+
* await dash.status("phase", "Phase", "Running", { style: "good" }) // broadcasts a delta
|
|
34
|
+
* return { message: "Phase advanced" }
|
|
35
|
+
* })
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
import { InvalidArgumentError } from "./errors.js";
|
|
39
|
+
function span(name, value) {
|
|
40
|
+
if (value === undefined)
|
|
41
|
+
return undefined;
|
|
42
|
+
if (!Number.isInteger(value) || value < 1 || value > 3) {
|
|
43
|
+
throw new InvalidArgumentError(`${name} must be an integer between 1 and 3 (got ${value})`);
|
|
44
|
+
}
|
|
45
|
+
return value;
|
|
46
|
+
}
|
|
47
|
+
function normalizeCandidate(c) {
|
|
48
|
+
if (typeof c === "string")
|
|
49
|
+
return { label: c };
|
|
50
|
+
const out = { label: c.label };
|
|
51
|
+
if (c.detail !== undefined)
|
|
52
|
+
out.detail = c.detail;
|
|
53
|
+
if (c.score !== undefined)
|
|
54
|
+
out.score = c.score;
|
|
55
|
+
return out;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Live observation-dashboard state for one connected room.
|
|
59
|
+
*
|
|
60
|
+
* Build it on a room (ideally after ``connect()``, so ``host`` resolves) — usually via
|
|
61
|
+
* ``room.dashboard({ title })``. It registers a ``presence.join`` handler that answers each joining
|
|
62
|
+
* dashboard with the current snapshot. Mutating methods update the snapshot **and** broadcast a delta
|
|
63
|
+
* once connected. All ``dash.*`` traffic is ephemeral — nothing is stored; keep the durable record in
|
|
64
|
+
* the session.
|
|
65
|
+
*/
|
|
66
|
+
export class Dashboard {
|
|
67
|
+
room;
|
|
68
|
+
title;
|
|
69
|
+
hostOverride;
|
|
70
|
+
publish;
|
|
71
|
+
tiles = [];
|
|
72
|
+
pos = new Map();
|
|
73
|
+
controls = [];
|
|
74
|
+
controlPos = new Map();
|
|
75
|
+
// control id → [handler, wantsValue] (a text control's handler takes the submitted value)
|
|
76
|
+
handlers = new Map();
|
|
77
|
+
noteHandler = null;
|
|
78
|
+
constructor(room, opts = {}) {
|
|
79
|
+
this.room = room;
|
|
80
|
+
this.title = opts.title;
|
|
81
|
+
this.hostOverride = opts.host;
|
|
82
|
+
this.publish =
|
|
83
|
+
opts.publish ?? ((type, payload, o) => room.send(type, payload, o));
|
|
84
|
+
room.on("presence.join", (e) => this.handleJoin(e));
|
|
85
|
+
room.on("dash.action", (e) => this.handleAction(e));
|
|
86
|
+
room.on("dash.note", (e) => this.handleNote(e));
|
|
87
|
+
}
|
|
88
|
+
// --- snapshot / transport ------------------------------------------------
|
|
89
|
+
/** The full current state a joining dashboard receives (``components`` is THE tile carrier). */
|
|
90
|
+
snapshot() {
|
|
91
|
+
const snap = { components: this.tiles.map((t) => ({ ...t })) };
|
|
92
|
+
if (this.title !== undefined)
|
|
93
|
+
snap.title = this.title;
|
|
94
|
+
const host = this.hostOverride ?? this.room.identity ?? undefined;
|
|
95
|
+
if (host != null)
|
|
96
|
+
snap.host = host;
|
|
97
|
+
if (this.controls.length > 0)
|
|
98
|
+
snap.controls = this.controls.map((c) => ({ ...c }));
|
|
99
|
+
return snap;
|
|
100
|
+
}
|
|
101
|
+
// A dashboard connected — retell the full state to just that connection (ephemeral, so recorders
|
|
102
|
+
// don't store repeated snapshots).
|
|
103
|
+
async handleJoin(event) {
|
|
104
|
+
const to = event.payload.connection_id ?? event.payload.identity;
|
|
105
|
+
if (typeof to === "string" && to) {
|
|
106
|
+
await this.publish("dash.snapshot", this.snapshot(), { to, ephemeral: true });
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
// Broadcast a patch to every connected dashboard (once we have a connection to send from).
|
|
110
|
+
async delta(delta) {
|
|
111
|
+
if (this.room.connectionId === null)
|
|
112
|
+
return;
|
|
113
|
+
await this.publish("dash.delta", delta, { ephemeral: true });
|
|
114
|
+
}
|
|
115
|
+
// A dashboard fired a control (a request); the returned value is what the room dispatcher replies
|
|
116
|
+
// with. Buttons pass no value; a text control passes its submitted `value`.
|
|
117
|
+
async handleAction(event) {
|
|
118
|
+
const id = event.payload.id;
|
|
119
|
+
const entry = typeof id === "string" ? this.handlers.get(id) : undefined;
|
|
120
|
+
if (!entry)
|
|
121
|
+
return { ok: false, message: `unknown control: ${String(id)}` };
|
|
122
|
+
const [handler, wantsValue] = entry;
|
|
123
|
+
try {
|
|
124
|
+
const result = await (wantsValue
|
|
125
|
+
? handler(String(event.payload.value ?? ""))
|
|
126
|
+
: handler());
|
|
127
|
+
return result && typeof result === "object" ? result : { ok: true };
|
|
128
|
+
}
|
|
129
|
+
catch (err) {
|
|
130
|
+
// A failing handler becomes an error toast, not a dead request.
|
|
131
|
+
return { ok: false, message: err.message || String(err) };
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
// A researcher note (fire-and-forget). The helper doesn't own a session, so recording it is the
|
|
135
|
+
// app's job — we just hand off the text.
|
|
136
|
+
async handleNote(event) {
|
|
137
|
+
if (!this.noteHandler)
|
|
138
|
+
return;
|
|
139
|
+
const text = event.payload.text;
|
|
140
|
+
if (typeof text !== "string")
|
|
141
|
+
return;
|
|
142
|
+
await this.noteHandler(text);
|
|
143
|
+
}
|
|
144
|
+
baseTile(id, kind, opts) {
|
|
145
|
+
const tile = { id, kind };
|
|
146
|
+
if (opts.title !== undefined)
|
|
147
|
+
tile.title = opts.title;
|
|
148
|
+
const col = span("colSpan", opts.colSpan);
|
|
149
|
+
if (col !== undefined)
|
|
150
|
+
tile.col_span = col;
|
|
151
|
+
const row = span("rowSpan", opts.rowSpan);
|
|
152
|
+
if (row !== undefined)
|
|
153
|
+
tile.row_span = row;
|
|
154
|
+
if (opts.group !== undefined)
|
|
155
|
+
tile.group = opts.group;
|
|
156
|
+
return tile;
|
|
157
|
+
}
|
|
158
|
+
async upsert(tile) {
|
|
159
|
+
const id = tile.id;
|
|
160
|
+
const at = this.pos.get(id);
|
|
161
|
+
if (at !== undefined)
|
|
162
|
+
this.tiles[at] = tile;
|
|
163
|
+
else {
|
|
164
|
+
this.pos.set(id, this.tiles.length);
|
|
165
|
+
this.tiles.push(tile);
|
|
166
|
+
}
|
|
167
|
+
await this.delta({ upsert: [tile] });
|
|
168
|
+
}
|
|
169
|
+
// --- tiles ---------------------------------------------------------------
|
|
170
|
+
/** Add or update a labelled status tile (``style``: good/warn/bad). */
|
|
171
|
+
async status(id, label, value, opts = {}) {
|
|
172
|
+
const tile = this.baseTile(id, "status", opts);
|
|
173
|
+
tile.label = label;
|
|
174
|
+
tile.value = value;
|
|
175
|
+
if (opts.style !== undefined)
|
|
176
|
+
tile.style = opts.style;
|
|
177
|
+
await this.upsert(tile);
|
|
178
|
+
}
|
|
179
|
+
/** Add or update a text tile — prose that fills the box: the tool shrinks the font through measured
|
|
180
|
+
* tiers until the whole text fits, scrolling inward only if even the floor can't hold it. */
|
|
181
|
+
async text(id, text, opts = {}) {
|
|
182
|
+
const tile = this.baseTile(id, "text", opts);
|
|
183
|
+
tile.text = text;
|
|
184
|
+
await this.upsert(tile);
|
|
185
|
+
}
|
|
186
|
+
/** Add or update an image tile — link a library asset by ``assetId`` (public thumbnail,
|
|
187
|
+
* click-through to the platform) or a raw ``url``. */
|
|
188
|
+
async image(id, opts = {}) {
|
|
189
|
+
const tile = this.baseTile(id, "image", opts);
|
|
190
|
+
if (opts.assetId !== undefined)
|
|
191
|
+
tile.asset_id = opts.assetId;
|
|
192
|
+
if (opts.url !== undefined)
|
|
193
|
+
tile.url = opts.url;
|
|
194
|
+
if (opts.caption !== undefined)
|
|
195
|
+
tile.caption = opts.caption;
|
|
196
|
+
await this.upsert(tile);
|
|
197
|
+
}
|
|
198
|
+
/** Add or update a sound tile — link a library asset by ``assetId`` (inline player); ``playing``
|
|
199
|
+
* reflects whether it's currently sounding. */
|
|
200
|
+
async sound(id, opts = {}) {
|
|
201
|
+
const tile = this.baseTile(id, "sound", opts);
|
|
202
|
+
if (opts.assetId !== undefined)
|
|
203
|
+
tile.asset_id = opts.assetId;
|
|
204
|
+
if (opts.playing !== undefined)
|
|
205
|
+
tile.playing = opts.playing;
|
|
206
|
+
await this.upsert(tile);
|
|
207
|
+
}
|
|
208
|
+
/** Add or update a decision tile — the agentic debug shape: what was **considered** (each candidate
|
|
209
|
+
* an optional ``detail`` / ``score``), which was **picked** (a candidate label), and the
|
|
210
|
+
* **reasoning**. The picked candidate renders prominent, the rest dimmed. The tool renders a
|
|
211
|
+
* decision tile **two rows tall by default** (its content wants the room); pass ``rowSpan`` to
|
|
212
|
+
* override. */
|
|
213
|
+
async decision(id, candidates, opts = {}) {
|
|
214
|
+
const tile = this.baseTile(id, "decision", opts);
|
|
215
|
+
tile.candidates = candidates.map(normalizeCandidate);
|
|
216
|
+
if (opts.picked !== undefined)
|
|
217
|
+
tile.picked = opts.picked;
|
|
218
|
+
if (opts.reasoning !== undefined)
|
|
219
|
+
tile.reasoning = opts.reasoning;
|
|
220
|
+
await this.upsert(tile);
|
|
221
|
+
}
|
|
222
|
+
/** Remove a tile. */
|
|
223
|
+
async remove(id) {
|
|
224
|
+
const at = this.pos.get(id);
|
|
225
|
+
if (at === undefined)
|
|
226
|
+
return;
|
|
227
|
+
this.pos.delete(id);
|
|
228
|
+
this.tiles.splice(at, 1);
|
|
229
|
+
for (const [tileId, p] of this.pos)
|
|
230
|
+
if (p > at)
|
|
231
|
+
this.pos.set(tileId, p - 1);
|
|
232
|
+
await this.delta({ remove: [id] });
|
|
233
|
+
}
|
|
234
|
+
// --- errors --------------------------------------------------------------
|
|
235
|
+
/**
|
|
236
|
+
* Surface an error prominently on the live dashboard — a sticky, dismissable strip, **not** a tile.
|
|
237
|
+
* Broadcasts a ``dash.error`` signal ``{ message, detail?, at }`` (``at`` = epoch-ms) to every
|
|
238
|
+
* connected dashboard; the tool pins it above the grid until the researcher dismisses it.
|
|
239
|
+
*
|
|
240
|
+
* This is the **live prominent surface** — what makes a failure impossible to miss *while the study
|
|
241
|
+
* runs*. It is not durable: like all ``dash.*`` traffic it's ephemeral, a late joiner won't see a
|
|
242
|
+
* past error, and the room stores nothing. To keep the error in the permanent record, also record
|
|
243
|
+
* it to the **session** yourself (a ``session.event``).
|
|
244
|
+
*/
|
|
245
|
+
async error(message, detail) {
|
|
246
|
+
if (this.room.connectionId === null)
|
|
247
|
+
return;
|
|
248
|
+
const payload = { message, at: Date.now() };
|
|
249
|
+
if (detail !== undefined)
|
|
250
|
+
payload.detail = detail;
|
|
251
|
+
await this.publish("dash.error", payload, { ephemeral: true });
|
|
252
|
+
}
|
|
253
|
+
// --- controls ------------------------------------------------------------
|
|
254
|
+
// Controls ride the snapshot (not deltas): declare them at setup, before dashboards join. A
|
|
255
|
+
// dashboard that joins later re-receives the whole snapshot, so it always sees the full set.
|
|
256
|
+
addControl(control) {
|
|
257
|
+
const id = control.id;
|
|
258
|
+
const at = this.controlPos.get(id);
|
|
259
|
+
if (at !== undefined)
|
|
260
|
+
this.controls[at] = control;
|
|
261
|
+
else {
|
|
262
|
+
this.controlPos.set(id, this.controls.length);
|
|
263
|
+
this.controls.push(control);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
/** Declare a button and bind its handler. The handler (sync or async, no args) may return
|
|
267
|
+
* ``{ ok?, message? }`` — toasted on the dashboard — or nothing (a success toast). Chainable. */
|
|
268
|
+
button(id, label, handler, opts = {}) {
|
|
269
|
+
const control = { id, type: "button", label };
|
|
270
|
+
if (opts.variant !== undefined)
|
|
271
|
+
control.variant = opts.variant;
|
|
272
|
+
if (opts.confirm)
|
|
273
|
+
control.confirm = true;
|
|
274
|
+
if (opts.disabled)
|
|
275
|
+
control.disabled = true;
|
|
276
|
+
this.addControl(control);
|
|
277
|
+
this.handlers.set(id, [handler, false]);
|
|
278
|
+
return this;
|
|
279
|
+
}
|
|
280
|
+
/** Declare a text-send control and bind its handler. The handler (sync or async) receives the
|
|
281
|
+
* submitted value and may return ``{ ok?, message? }`` — toasted on the dashboard — or nothing.
|
|
282
|
+
* (Named ``textInput`` to leave the ``text`` tile the natural name.) Chainable. */
|
|
283
|
+
textInput(id, handler, opts = {}) {
|
|
284
|
+
const control = { id, type: "text" };
|
|
285
|
+
if (opts.label !== undefined)
|
|
286
|
+
control.label = opts.label;
|
|
287
|
+
if (opts.placeholder !== undefined)
|
|
288
|
+
control.placeholder = opts.placeholder;
|
|
289
|
+
if (opts.disabled)
|
|
290
|
+
control.disabled = true;
|
|
291
|
+
this.addControl(control);
|
|
292
|
+
this.handlers.set(id, [handler, true]);
|
|
293
|
+
return this;
|
|
294
|
+
}
|
|
295
|
+
/** Register the handler for researcher notes. It receives the note text; record it to your session
|
|
296
|
+
* — the dashboard is live-only and stores nothing. Chainable. */
|
|
297
|
+
onNote(handler) {
|
|
298
|
+
this.noteHandler = handler;
|
|
299
|
+
return this;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
//# sourceMappingURL=dash.js.map
|
package/dist/dash.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dash.js","sourceRoot":"","sources":["../src/dash.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAoHlD,SAAS,IAAI,CAAC,IAAY,EAAE,KAAyB;IACnD,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAA;IACzC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QACvD,MAAM,IAAI,oBAAoB,CAAC,GAAG,IAAI,4CAA4C,KAAK,GAAG,CAAC,CAAA;IAC7F,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,IAAI,CAAC,KAAK,CAAA;QACxD,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS;YAAE,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAA;QAC1E,IAAI,IAAI,CAAC,QAAQ;YAAE,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAA;QAC1C,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;QACxB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAA;QACtC,OAAO,IAAI,CAAA;IACb,CAAC;IAED;qEACiE;IACjE,MAAM,CAAC,OAAwB;QAC7B,IAAI,CAAC,WAAW,GAAG,OAAO,CAAA;QAC1B,OAAO,IAAI,CAAA;IACb,CAAC;CACF"}
|
package/dist/direct.d.ts
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client-side direct-model overlay — route a chat call to an OpenAI-compatible endpoint.
|
|
3
|
+
*
|
|
4
|
+
* The SDK holds a small **direct registry**: a map of model *name* → {@link DirectEndpoint}. A
|
|
5
|
+
* chat/agent call naming a registered model is POSTed **directly** to that endpoint (a local Ollama
|
|
6
|
+
* / LM Studio, or a remote OpenAI-compatible server), bypassing Atrium; every other name goes to
|
|
7
|
+
* Atrium as usual. This is the client-side twin of the server-side per-user providers (BYOM-A).
|
|
8
|
+
*
|
|
9
|
+
* Only **chat** is routed here. Embeddings are never — a stored vector's model is a data contract
|
|
10
|
+
* with the library's vector space, so ``atrium.embed`` never consults this registry even on a name
|
|
11
|
+
* collision. Library search / sessions / rooms have no LLM hop, so there is nothing to intercept.
|
|
12
|
+
*
|
|
13
|
+
* The Atrium bearer token **never** reaches these endpoints: this module owns the request, builds
|
|
14
|
+
* the headers from the endpoint's own key (or none), and the client's direct branch calls the global
|
|
15
|
+
* ``fetch`` rather than the authenticated transport.
|
|
16
|
+
*
|
|
17
|
+
* Python's ``DirectTransports`` (a cached ``httpx.Client`` per endpoint) has no counterpart here —
|
|
18
|
+
* ``fetch`` is stateless, so there is nothing to pool or close; the per-endpoint ``timeout`` becomes
|
|
19
|
+
* an ``AbortSignal.timeout`` on each call.
|
|
20
|
+
*/
|
|
21
|
+
/** Default per-request timeout for a direct endpoint, in **milliseconds** (Python's 30 seconds). */
|
|
22
|
+
export declare const DEFAULT_DIRECT_TIMEOUT_MS = 30000;
|
|
23
|
+
/** The construction form of a {@link DirectEndpoint} (what ``addDirectModel`` takes). */
|
|
24
|
+
export interface DirectEndpointInit {
|
|
25
|
+
/** The endpoint root, including the OpenAI path prefix (e.g. ``http://localhost:11434/v1``). */
|
|
26
|
+
baseUrl: string;
|
|
27
|
+
/** Bearer key for the endpoint, or omitted for keyless local servers. */
|
|
28
|
+
apiKey?: string;
|
|
29
|
+
/** Per-request timeout in **milliseconds** (default {@link DEFAULT_DIRECT_TIMEOUT_MS}) — raise it
|
|
30
|
+
* for slow local models. */
|
|
31
|
+
timeout?: number;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* An OpenAI-compatible endpoint that one or more direct models live at.
|
|
35
|
+
*
|
|
36
|
+
* ``apiKey`` rides the endpoint (shared by every model name registered on it, matching how one
|
|
37
|
+
* server hosts many names); many local servers need none. Chat is POSTed to
|
|
38
|
+
* ``{baseUrl}/chat/completions`` and ``atrium.discoverModels`` reads ``{baseUrl}/models``.
|
|
39
|
+
*/
|
|
40
|
+
export declare class DirectEndpoint {
|
|
41
|
+
readonly baseUrl: string;
|
|
42
|
+
readonly apiKey: string | undefined;
|
|
43
|
+
readonly timeout: number;
|
|
44
|
+
constructor(init: DirectEndpointInit);
|
|
45
|
+
/** The chat-completions URL (absolute — no base_url join ambiguity on the transport). */
|
|
46
|
+
get chatUrl(): string;
|
|
47
|
+
/** The model-listing URL for ``atrium.discoverModels``. */
|
|
48
|
+
get modelsUrl(): string;
|
|
49
|
+
/**
|
|
50
|
+
* Auth headers for this endpoint (empty when it needs no key). The Atrium bearer token is
|
|
51
|
+
* deliberately absent — a direct call must never leak it to a third-party or local endpoint.
|
|
52
|
+
*/
|
|
53
|
+
headers(): Record<string, string>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Accept a {@link DirectEndpoint} or its plain-object construction form; coerce to one. A plain
|
|
57
|
+
* object without its own ``timeout`` inherits ``defaultTimeout``; an instance is taken as-is.
|
|
58
|
+
*/
|
|
59
|
+
export declare function toDirectEndpoint(value: DirectEndpoint | DirectEndpointInit, defaultTimeout?: number): DirectEndpoint;
|
|
60
|
+
/**
|
|
61
|
+
* A map of model name → {@link DirectEndpoint}. Explicit per-name registration only.
|
|
62
|
+
*
|
|
63
|
+
* A registered name **shadows** an Atrium model of the same name — intentional, and the reason
|
|
64
|
+
* registration is never auto-enumerated from an endpoint's catalogue.
|
|
65
|
+
*/
|
|
66
|
+
export declare class DirectRegistry {
|
|
67
|
+
private readonly byName;
|
|
68
|
+
constructor(models?: Record<string, DirectEndpoint | DirectEndpointInit>, defaultTimeout?: number);
|
|
69
|
+
/** Register (or overwrite) one name → endpoint mapping. */
|
|
70
|
+
register(name: string, endpoint: DirectEndpoint): void;
|
|
71
|
+
/** Remove a name mapping (idempotent — unknown names are ignored). */
|
|
72
|
+
remove(name: string): void;
|
|
73
|
+
/** The endpoint a name routes to, or ``undefined`` when it should go to Atrium. */
|
|
74
|
+
resolve(name: string | undefined): DirectEndpoint | undefined;
|
|
75
|
+
/** A snapshot of the current name → endpoint mappings. */
|
|
76
|
+
list(): Record<string, DirectEndpoint>;
|
|
77
|
+
}
|
|
78
|
+
/** Extract model ids from an OpenAI ``GET /models`` response (``{"data": [{"id": …}, …]}``). */
|
|
79
|
+
export declare function parseModelNames(data: unknown): string[];
|
|
80
|
+
/**
|
|
81
|
+
* POST a chat body to a direct endpoint over the raw global ``fetch`` — never the client's
|
|
82
|
+
* authenticated transport, so no Atrium credential can ride along. Non-2xx raises {@link APIError},
|
|
83
|
+
* exactly like the Atrium path. ``signal`` is already linked with the endpoint's timeout.
|
|
84
|
+
*/
|
|
85
|
+
export declare function directFetch(endpoint: DirectEndpoint, url: string, init: RequestInit): Promise<Response>;
|
|
86
|
+
//# sourceMappingURL=direct.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"direct.d.ts","sourceRoot":"","sources":["../src/direct.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAKH,oGAAoG;AACpG,eAAO,MAAM,yBAAyB,QAAS,CAAA;AAE/C,yFAAyF;AACzF,MAAM,WAAW,kBAAkB;IACjC,gGAAgG;IAChG,OAAO,EAAE,MAAM,CAAA;IACf,yEAAyE;IACzE,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;gCAC4B;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;;;;;GAMG;AACH,qBAAa,cAAc;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;gBAEZ,IAAI,EAAE,kBAAkB;IAMpC,yFAAyF;IACzF,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,2DAA2D;IAC3D,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED;;;OAGG;IACH,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAGlC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,cAAc,GAAG,kBAAkB,EAC1C,cAAc,CAAC,EAAE,MAAM,GACtB,cAAc,CAKhB;AAED;;;;;GAKG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoC;gBAGzD,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,GAAG,kBAAkB,CAAC,EAC5D,cAAc,CAAC,EAAE,MAAM;IAOzB,2DAA2D;IAC3D,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,GAAG,IAAI;IAItD,sEAAsE;IACtE,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI1B,mFAAmF;IACnF,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,cAAc,GAAG,SAAS;IAI7D,0DAA0D;IAC1D,IAAI,IAAI,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC;CAGvC;AAED,gGAAgG;AAChG,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,EAAE,CAMvD;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,cAAc,EACxB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,WAAW,GAChB,OAAO,CAAC,QAAQ,CAAC,CASnB"}
|
package/dist/direct.js
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client-side direct-model overlay — route a chat call to an OpenAI-compatible endpoint.
|
|
3
|
+
*
|
|
4
|
+
* The SDK holds a small **direct registry**: a map of model *name* → {@link DirectEndpoint}. A
|
|
5
|
+
* chat/agent call naming a registered model is POSTed **directly** to that endpoint (a local Ollama
|
|
6
|
+
* / LM Studio, or a remote OpenAI-compatible server), bypassing Atrium; every other name goes to
|
|
7
|
+
* Atrium as usual. This is the client-side twin of the server-side per-user providers (BYOM-A).
|
|
8
|
+
*
|
|
9
|
+
* Only **chat** is routed here. Embeddings are never — a stored vector's model is a data contract
|
|
10
|
+
* with the library's vector space, so ``atrium.embed`` never consults this registry even on a name
|
|
11
|
+
* collision. Library search / sessions / rooms have no LLM hop, so there is nothing to intercept.
|
|
12
|
+
*
|
|
13
|
+
* The Atrium bearer token **never** reaches these endpoints: this module owns the request, builds
|
|
14
|
+
* the headers from the endpoint's own key (or none), and the client's direct branch calls the global
|
|
15
|
+
* ``fetch`` rather than the authenticated transport.
|
|
16
|
+
*
|
|
17
|
+
* Python's ``DirectTransports`` (a cached ``httpx.Client`` per endpoint) has no counterpart here —
|
|
18
|
+
* ``fetch`` is stateless, so there is nothing to pool or close; the per-endpoint ``timeout`` becomes
|
|
19
|
+
* an ``AbortSignal.timeout`` on each call.
|
|
20
|
+
*/
|
|
21
|
+
import { APIError } from "./errors.js";
|
|
22
|
+
import { httpFetch } from "./http.js";
|
|
23
|
+
/** Default per-request timeout for a direct endpoint, in **milliseconds** (Python's 30 seconds). */
|
|
24
|
+
export const DEFAULT_DIRECT_TIMEOUT_MS = 30_000;
|
|
25
|
+
/**
|
|
26
|
+
* An OpenAI-compatible endpoint that one or more direct models live at.
|
|
27
|
+
*
|
|
28
|
+
* ``apiKey`` rides the endpoint (shared by every model name registered on it, matching how one
|
|
29
|
+
* server hosts many names); many local servers need none. Chat is POSTed to
|
|
30
|
+
* ``{baseUrl}/chat/completions`` and ``atrium.discoverModels`` reads ``{baseUrl}/models``.
|
|
31
|
+
*/
|
|
32
|
+
export class DirectEndpoint {
|
|
33
|
+
baseUrl;
|
|
34
|
+
apiKey;
|
|
35
|
+
timeout;
|
|
36
|
+
constructor(init) {
|
|
37
|
+
this.baseUrl = init.baseUrl.replace(/\/+$/, "");
|
|
38
|
+
this.apiKey = init.apiKey;
|
|
39
|
+
this.timeout = init.timeout ?? DEFAULT_DIRECT_TIMEOUT_MS;
|
|
40
|
+
}
|
|
41
|
+
/** The chat-completions URL (absolute — no base_url join ambiguity on the transport). */
|
|
42
|
+
get chatUrl() {
|
|
43
|
+
return `${this.baseUrl}/chat/completions`;
|
|
44
|
+
}
|
|
45
|
+
/** The model-listing URL for ``atrium.discoverModels``. */
|
|
46
|
+
get modelsUrl() {
|
|
47
|
+
return `${this.baseUrl}/models`;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Auth headers for this endpoint (empty when it needs no key). The Atrium bearer token is
|
|
51
|
+
* deliberately absent — a direct call must never leak it to a third-party or local endpoint.
|
|
52
|
+
*/
|
|
53
|
+
headers() {
|
|
54
|
+
return this.apiKey ? { Authorization: `Bearer ${this.apiKey}` } : {};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Accept a {@link DirectEndpoint} or its plain-object construction form; coerce to one. A plain
|
|
59
|
+
* object without its own ``timeout`` inherits ``defaultTimeout``; an instance is taken as-is.
|
|
60
|
+
*/
|
|
61
|
+
export function toDirectEndpoint(value, defaultTimeout) {
|
|
62
|
+
if (value instanceof DirectEndpoint) {
|
|
63
|
+
return value;
|
|
64
|
+
}
|
|
65
|
+
return new DirectEndpoint({ ...value, timeout: value.timeout ?? defaultTimeout });
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* A map of model name → {@link DirectEndpoint}. Explicit per-name registration only.
|
|
69
|
+
*
|
|
70
|
+
* A registered name **shadows** an Atrium model of the same name — intentional, and the reason
|
|
71
|
+
* registration is never auto-enumerated from an endpoint's catalogue.
|
|
72
|
+
*/
|
|
73
|
+
export class DirectRegistry {
|
|
74
|
+
byName = new Map();
|
|
75
|
+
constructor(models, defaultTimeout) {
|
|
76
|
+
for (const [name, endpoint] of Object.entries(models ?? {})) {
|
|
77
|
+
this.register(name, toDirectEndpoint(endpoint, defaultTimeout));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/** Register (or overwrite) one name → endpoint mapping. */
|
|
81
|
+
register(name, endpoint) {
|
|
82
|
+
this.byName.set(name, endpoint);
|
|
83
|
+
}
|
|
84
|
+
/** Remove a name mapping (idempotent — unknown names are ignored). */
|
|
85
|
+
remove(name) {
|
|
86
|
+
this.byName.delete(name);
|
|
87
|
+
}
|
|
88
|
+
/** The endpoint a name routes to, or ``undefined`` when it should go to Atrium. */
|
|
89
|
+
resolve(name) {
|
|
90
|
+
return name === undefined ? undefined : this.byName.get(name);
|
|
91
|
+
}
|
|
92
|
+
/** A snapshot of the current name → endpoint mappings. */
|
|
93
|
+
list() {
|
|
94
|
+
return Object.fromEntries(this.byName);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/** Extract model ids from an OpenAI ``GET /models`` response (``{"data": [{"id": …}, …]}``). */
|
|
98
|
+
export function parseModelNames(data) {
|
|
99
|
+
const items = data?.data;
|
|
100
|
+
if (!Array.isArray(items))
|
|
101
|
+
return [];
|
|
102
|
+
return items
|
|
103
|
+
.filter((item) => item && typeof item === "object" && "id" in item)
|
|
104
|
+
.map((item) => String(item.id));
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* POST a chat body to a direct endpoint over the raw global ``fetch`` — never the client's
|
|
108
|
+
* authenticated transport, so no Atrium credential can ride along. Non-2xx raises {@link APIError},
|
|
109
|
+
* exactly like the Atrium path. ``signal`` is already linked with the endpoint's timeout.
|
|
110
|
+
*/
|
|
111
|
+
export async function directFetch(endpoint, url, init) {
|
|
112
|
+
const res = await httpFetch(url, {
|
|
113
|
+
...init,
|
|
114
|
+
headers: { ...endpoint.headers(), ...init.headers },
|
|
115
|
+
});
|
|
116
|
+
if (!res.ok) {
|
|
117
|
+
throw new APIError(res.status, await res.text().catch(() => ""));
|
|
118
|
+
}
|
|
119
|
+
return res;
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=direct.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"direct.js","sourceRoot":"","sources":["../src/direct.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,oGAAoG;AACpG,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAA;AAa/C;;;;;;GAMG;AACH,MAAM,OAAO,cAAc;IAChB,OAAO,CAAQ;IACf,MAAM,CAAoB;IAC1B,OAAO,CAAQ;IAExB,YAAY,IAAwB;QAClC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,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M,EAAE,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;IAClE,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,14 +4,20 @@
|
|
|
4
4
|
* The default entry exposes the framework-agnostic core. React bindings live at the
|
|
5
5
|
* ``hci-atrium/react`` subpath so importing this entry never pulls in React.
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export type { AssetMeta } from "./asset-meta.js";
|
|
8
|
+
export { fetchAssetMeta } from "./asset-meta.js";
|
|
9
|
+
export { type AgentOptions, type AssetListOptions, Assets, Atrium, type AtriumOptions, type ChatOptions, type CompareOptions, DEFAULT_BASE_URL, type EmbedOptions, type EnrichOptions, Library, type LibraryVectorsOptions, type LiveRoomOptions, type RoomOpenOptions, Rooms, type SearchByExamplesOptions, type SearchOptions, type SessionEventOptions, type SessionEventsOptions, type SessionExportFormat, type SessionListOptions, type SessionStartOptions, Sessions, type SourceImportOptions, Sources, type SourcesSearchOptions, type SurveyResponsesOptions, type SurveyStartOptions, Surveys, type SurveyTemplateOptions, type SurveyUploadOptions, type TagOptions, type TranscribeLiveOptions, type TranscribeOptions, type UploadOptions, } from "./atrium.js";
|
|
8
10
|
export type { ChangeListener, ErrorListener, SignInOptions } from "./auth.js";
|
|
9
11
|
export { Auth } from "./auth.js";
|
|
10
12
|
export { type AnchorLike, type AssetOperand, by, type ConceptOperand, type FileOperand, type Operand, type OperandLike, type TextOperand, toAnchorMembers, type VectorOperand, } from "./by.js";
|
|
13
|
+
export { type ButtonOptions, type CandidateLike, type DashButtonHandler, Dashboard, type DashboardOptions, type DashboardRoom, type DashControlResult, type DashNoteHandler, type DashTextHandler, type DecisionCandidate, type DecisionTileOptions, type ImageTileOptions, type SoundTileOptions, type StatusTileOptions, type TextInputOptions, type TileOptions, } from "./dash.js";
|
|
11
14
|
export { Decider } from "./decider.js";
|
|
15
|
+
export { DEFAULT_DIRECT_TIMEOUT_MS, DirectEndpoint, type DirectEndpointInit, DirectRegistry, } from "./direct.js";
|
|
12
16
|
export { APIError, AtriumError, AuthError, InvalidArgumentError, StructuredOutputError, TransientAuthError, } from "./errors.js";
|
|
13
17
|
export type { FileSource } from "./files.js";
|
|
14
|
-
export { Asset, type AssetBinder, type AssetPage, type AssetRef, type AssetVector, type AssetVectorsOptions, assetCapabilities, assetPlayback, type Candidate, type ChatReply, type CompareFeature, type CompareResult, type Event, type Filters, type IndexEntry, type OperandInfo, type RoomInfo, type SearchByExamplesHit, type SearchHit, type SegmentRef, type Session, type SessionEvent, type SessionInfo, type SourceInfo, type SourceSearchResult, type SourceSkip, type Space, type TagDefinition, type TagSnapshot, type TagSnapshotFeature, type Transcript, type User, } from "./models.js";
|
|
18
|
+
export { Asset, type AssetBinder, type AssetPage, type AssetRef, type AssetVector, type AssetVectorsOptions, assetCapabilities, assetPlayback, type Candidate, type ChatReply, type CompareFeature, type CompareResult, type Event, type Filters, type IndexEntry, type OperandInfo, type ProjectFile, type RoomInfo, type SearchByExamplesHit, type SearchHit, type SegmentRef, type Session, type SessionEvent, type SessionInfo, type SourceInfo, type SourceSearchResult, type SourceSkip, type Space, type Survey, type SurveyResponse, type SurveyTemplate, type TagDefinition, type TagSnapshot, type TagSnapshotFeature, type Transcript, type User, } from "./models.js";
|
|
15
19
|
export { type ActiveSource, ArmedSet, AUDIO_ROLE, AUDIO_SIGNAL, AUDIO_SNIPPET_CONSUMER_ROLE, AUDIO_SNIPPET_MAGIC, AUDIO_SNIPPET_SOURCE_ROLE, AUDIO_SNIPPET_VERSION, AUDIO_SNIPPET_VERSION_2, type AudioAnnounce, type AudioBeatEvent, type AudioClip, type AudioFrame, type AudioInputKind, type AudioSignal, type AudioSnippetFrame, type AudioTrack, type AudioVector, BrokerError, CAPTURE_OFFER_ROLE, CAPTURE_SOURCE_ROLE, type CaptureOfferDeps, type CaptureRecorder, CHAT_BROKER_ROLE, DEFAULT_CHAT_MAX_TOKENS, DEFAULT_MAX_ANCHORS, decodeAudioFrame, decodeAudioSnippetFrame, EMBED_BROKER_ROLE, encodeAudioFrame, type FetchImpl, type Handler, isAudioFrame, isAudioSnippetFrame, type JoinRoomOptions, joinRoom, OFFER_MAX_SOURCES, type OfferDeps, OfferedCapture, OfferedTranscription, type Participant, type ParticipantPredicate, Recorder, type RecorderStopReason, Room, type RoomAudioClient, type RoomDeps, type RoomEndReason, type RoomEvent, RoomEventStream, type RoomSignal, type RoomTransport, type RoomTransportMode, type RosterEntry, type ScoredAudio, StandingSource, TRANSCRIBER_SOURCE, TRANSCRIPTION_OFFER_ROLE, Transcriber, type TranscriberDeps, type TranscriptionOfferDeps, validateChatMessages, type WebSocketCtor, type WebSocketLike, } from "./rooms/index.js";
|
|
20
|
+
export { isStandardSchema, type StandardSchemaV1, type ToolDescriptor, type ToolJsonSchema, type ToolParameters, toolSchema, } from "./tools.js";
|
|
21
|
+
export { isTraceEphemeral, RoomTrace, TRACE_STATE, type TraceSink, traceCallType, traceEnvelope, traceStateType, } from "./trace.js";
|
|
16
22
|
export type { AudioChunk } from "./transcribe.js";
|
|
17
23
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,KAAK,gBAAgB,EACrB,MAAM,EACN,MAAM,EACN,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,gBAAgB,EAChB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,OAAO,EACP,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,EACL,KAAK,uBAAuB,EAC5B,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,K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ACb,cAAc,GACf,MAAM,YAAY,CAAA;AACnB,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -4,11 +4,16 @@
|
|
|
4
4
|
* The default entry exposes the framework-agnostic core. React bindings live at the
|
|
5
5
|
* ``hci-atrium/react`` subpath so importing this entry never pulls in React.
|
|
6
6
|
*/
|
|
7
|
-
export {
|
|
7
|
+
export { fetchAssetMeta } from "./asset-meta.js";
|
|
8
|
+
export { Assets, Atrium, DEFAULT_BASE_URL, Library, Rooms, Sessions, Sources, Surveys, } from "./atrium.js";
|
|
8
9
|
export { Auth } from "./auth.js";
|
|
9
10
|
export { by, toAnchorMembers, } from "./by.js";
|
|
11
|
+
export { Dashboard, } from "./dash.js";
|
|
10
12
|
export { Decider } from "./decider.js";
|
|
13
|
+
export { DEFAULT_DIRECT_TIMEOUT_MS, DirectEndpoint, DirectRegistry, } from "./direct.js";
|
|
11
14
|
export { APIError, AtriumError, AuthError, InvalidArgumentError, StructuredOutputError, TransientAuthError, } from "./errors.js";
|
|
12
15
|
export { Asset, assetCapabilities, assetPlayback, } from "./models.js";
|
|
13
16
|
export { ArmedSet, AUDIO_ROLE, AUDIO_SIGNAL, AUDIO_SNIPPET_CONSUMER_ROLE, AUDIO_SNIPPET_MAGIC, AUDIO_SNIPPET_SOURCE_ROLE, AUDIO_SNIPPET_VERSION, AUDIO_SNIPPET_VERSION_2, BrokerError, CAPTURE_OFFER_ROLE, CAPTURE_SOURCE_ROLE, CHAT_BROKER_ROLE, DEFAULT_CHAT_MAX_TOKENS, DEFAULT_MAX_ANCHORS, decodeAudioFrame, decodeAudioSnippetFrame, EMBED_BROKER_ROLE, encodeAudioFrame, isAudioFrame, isAudioSnippetFrame, joinRoom, OFFER_MAX_SOURCES, OfferedCapture, OfferedTranscription, Recorder, Room, RoomEventStream, StandingSource, TRANSCRIBER_SOURCE, TRANSCRIPTION_OFFER_ROLE, Transcriber, validateChatMessages, } from "./rooms/index.js";
|
|
17
|
+
export { isStandardSchema, toolSchema, } from "./tools.js";
|
|
18
|
+
export { isTraceEphemeral, RoomTrace, TRACE_STATE, traceCallType, traceEnvelope, traceStateType, } from "./trace.js";
|
|
14
19
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAGL,MAAM,EACN,MAAM,EAIN,gBAAgB,EAGhB,OAAO,EAIP,KAAK,EAQL,QAAQ,EAER,OAAO,EAIP,OAAO,GAOR,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAGL,EAAE,EAMF,eAAe,GAEhB,MAAM,SAAS,CAAA;AAChB,OAAO,EAIL,SAAS,GAaV,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EACL,yBAAyB,EACzB,cAAc,EAEd,cAAc,GACf,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,QAAQ,EACR,WAAW,EACX,SAAS,EACT,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,KAAK,EAML,iBAAiB,EACjB,aAAa,GA6Bd,MAAM,aAAa,CAAA;AACpB,OAAO,EAEL,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,2BAA2B,EAC3B,mBAAmB,EACnB,yBAAyB,EACzB,qBAAqB,EACrB,uBAAuB,EAUvB,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EAGnB,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB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