@semiont/sdk 0.5.4 → 0.5.5

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 (79) hide show
  1. package/dist/index.d.ts +1750 -52
  2. package/dist/index.js +18 -3
  3. package/dist/index.js.map +1 -1
  4. package/package.json +5 -3
  5. package/dist/awaitable.d.ts +0 -103
  6. package/dist/awaitable.d.ts.map +0 -1
  7. package/dist/bus-request.d.ts +0 -18
  8. package/dist/bus-request.d.ts.map +0 -1
  9. package/dist/cache.d.ts +0 -57
  10. package/dist/cache.d.ts.map +0 -1
  11. package/dist/client.d.ts +0 -138
  12. package/dist/client.d.ts.map +0 -1
  13. package/dist/index.d.ts.map +0 -1
  14. package/dist/namespaces/admin.d.ts +0 -27
  15. package/dist/namespaces/admin.d.ts.map +0 -1
  16. package/dist/namespaces/auth.d.ts +0 -26
  17. package/dist/namespaces/auth.d.ts.map +0 -1
  18. package/dist/namespaces/beckon.d.ts +0 -12
  19. package/dist/namespaces/beckon.d.ts.map +0 -1
  20. package/dist/namespaces/bind.d.ts +0 -11
  21. package/dist/namespaces/bind.d.ts.map +0 -1
  22. package/dist/namespaces/browse.d.ts +0 -111
  23. package/dist/namespaces/browse.d.ts.map +0 -1
  24. package/dist/namespaces/frame.d.ts +0 -29
  25. package/dist/namespaces/frame.d.ts.map +0 -1
  26. package/dist/namespaces/gather.d.ts +0 -16
  27. package/dist/namespaces/gather.d.ts.map +0 -1
  28. package/dist/namespaces/job.d.ts +0 -32
  29. package/dist/namespaces/job.d.ts.map +0 -1
  30. package/dist/namespaces/mark.d.ts +0 -27
  31. package/dist/namespaces/mark.d.ts.map +0 -1
  32. package/dist/namespaces/match.d.ts +0 -15
  33. package/dist/namespaces/match.d.ts.map +0 -1
  34. package/dist/namespaces/types.d.ts +0 -438
  35. package/dist/namespaces/types.d.ts.map +0 -1
  36. package/dist/namespaces/yield.d.ts +0 -23
  37. package/dist/namespaces/yield.d.ts.map +0 -1
  38. package/dist/session/errors.d.ts +0 -18
  39. package/dist/session/errors.d.ts.map +0 -1
  40. package/dist/session/http-session-factory.d.ts +0 -15
  41. package/dist/session/http-session-factory.d.ts.map +0 -1
  42. package/dist/session/knowledge-base.d.ts +0 -95
  43. package/dist/session/knowledge-base.d.ts.map +0 -1
  44. package/dist/session/open-resource.d.ts +0 -22
  45. package/dist/session/open-resource.d.ts.map +0 -1
  46. package/dist/session/registry.d.ts +0 -31
  47. package/dist/session/registry.d.ts.map +0 -1
  48. package/dist/session/semiont-browser.d.ts +0 -141
  49. package/dist/session/semiont-browser.d.ts.map +0 -1
  50. package/dist/session/semiont-session.d.ts +0 -210
  51. package/dist/session/semiont-session.d.ts.map +0 -1
  52. package/dist/session/session-factory.d.ts +0 -31
  53. package/dist/session/session-factory.d.ts.map +0 -1
  54. package/dist/session/session-signals.d.ts +0 -40
  55. package/dist/session/session-signals.d.ts.map +0 -1
  56. package/dist/session/session-storage.d.ts +0 -41
  57. package/dist/session/session-storage.d.ts.map +0 -1
  58. package/dist/session/storage.d.ts +0 -52
  59. package/dist/session/storage.d.ts.map +0 -1
  60. package/dist/session/testing.d.ts +0 -7
  61. package/dist/session/testing.d.ts.map +0 -1
  62. package/dist/state/flows/beckon-state-unit.d.ts +0 -22
  63. package/dist/state/flows/beckon-state-unit.d.ts.map +0 -1
  64. package/dist/state/flows/gather-state-unit.d.ts +0 -12
  65. package/dist/state/flows/gather-state-unit.d.ts.map +0 -1
  66. package/dist/state/flows/mark-state-unit.d.ts +0 -17
  67. package/dist/state/flows/mark-state-unit.d.ts.map +0 -1
  68. package/dist/state/flows/match-state-unit.d.ts +0 -7
  69. package/dist/state/flows/match-state-unit.d.ts.map +0 -1
  70. package/dist/state/flows/yield-state-unit.d.ts +0 -25
  71. package/dist/state/flows/yield-state-unit.d.ts.map +0 -1
  72. package/dist/state/index.d.ts +0 -10
  73. package/dist/state/index.d.ts.map +0 -1
  74. package/dist/state/lib/search-pipeline.d.ts +0 -38
  75. package/dist/state/lib/search-pipeline.d.ts.map +0 -1
  76. package/dist/state/lib/state-unit.d.ts +0 -33
  77. package/dist/state/lib/state-unit.d.ts.map +0 -1
  78. package/dist/state/lib/worker-bus.d.ts +0 -21
  79. package/dist/state/lib/worker-bus.d.ts.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,61 +1,1759 @@
1
+ import * as rxjs from 'rxjs';
2
+ import { Observable, BehaviorSubject, Subject } from 'rxjs';
3
+ export { firstValueFrom, lastValueFrom } from 'rxjs';
4
+ import * as _semiont_core from '@semiont/core';
5
+ import { ResourceId, components, UserDID, paths, BackendDownload, ProgressEvent, AnnotationId, BodyOperation, EventMap, ResourceDescriptor, Annotation, TagSchema, GraphConnection, Motivation, GatheredContext, JobId, ITransport, EventBus, IContentTransport, IBackendOperations, BaseUrl, AccessToken, SemiontError, ConnectionState, Selector } from '@semiont/core';
6
+ export { AccessToken, Annotation, AnnotationId, BaseUrl, BodyItem, BodyOperation, ConnectionState, EntityType, EventMap, GatheredContext, IContentTransport, ITransport, Logger, Motivation, RefreshToken, ResourceDescriptor, ResourceId, SemiontError, TagCategory, TagSchema, UserId, accessToken, annotationId, baseUrl, entityType, refreshToken, resourceId, userId } from '@semiont/core';
7
+ export { APIError, HttpContentTransport, HttpTransport, HttpTransportConfig, TokenRefresher } from '@semiont/api-client';
8
+
1
9
  /**
2
- * @semiont/sdk
10
+ * Thenable Observable subclasses.
3
11
  *
4
- * The Semiont SDK `SemiontClient`, the verb-oriented namespaces, the
5
- * per-tab session layer, the flow state machines and worker adapters,
6
- * and the supporting helpers (`bus-request`, `cache`).
12
+ * Two thin Observable subclasses that also implement `PromiseLike<T>`. Used as
13
+ * the public return type of namespace methods that emit streams (job
14
+ * lifecycle, generation progress) and cache reads (Browse live queries).
7
15
  *
8
- * Transport-agnostic: `SemiontClient` consumes the `ITransport` /
9
- * `IContentTransport` contracts from `@semiont/core`. The HTTP adapters
10
- * (`HttpTransport`, `HttpContentTransport`) are re-exported here for
11
- * convenience so the common case is a single import; non-HTTP transports
12
- * (e.g. `LocalTransport` from `@semiont/make-meaning`) are constructed
13
- * by the caller from their own package.
16
+ * The point: scripts can `await` the call directly without `lastValueFrom` /
17
+ * `firstValueFrom` wrappers; reactive consumers keep using `.subscribe(...)`
18
+ * and `.pipe(...)` exactly as before.
14
19
  *
15
- * Transport-specific error classes (`APIError` from `@semiont/api-client`)
16
- * are NOT re-exported. Catch on `SemiontError` (exported below) and route
17
- * on `err.code`; reach for the transport-specific class only when you're
18
- * already in HTTP-aware code and import it from `@semiont/api-client`
19
- * directly.
20
+ * The asymmetric `.then()` semantics — last-value-on-completion for streams,
21
+ * first-non-undefined-value for caches is encoded by the subclass name. The
22
+ * docstring on the namespace method tells the consumer which one applies.
23
+ *
24
+ * `.pipe(...)` returns a plain `Observable<T>` (RxJS doesn't propagate
25
+ * subclasses through `pipe`). Once you compose, you've explicitly entered
26
+ * RxJS land; `lastValueFrom` from `rxjs` is the right bridge there.
27
+ */
28
+
29
+ /**
30
+ * Bounded Observable stream — emits zero-or-more progress values, then a
31
+ * final value on completion. Used by job-lifecycle methods like
32
+ * `mark.assist`, `gather.annotation`, `match.search`, `yield.fromAnnotation`.
33
+ *
34
+ * Awaiting resolves to the **last** emitted value (via `lastValueFrom`).
35
+ * Subscribing yields every emission, ending in `complete`.
36
+ */
37
+ declare class StreamObservable<T> extends Observable<T> implements PromiseLike<T> {
38
+ then<R1 = T, R2 = never>(onfulfilled?: ((v: T) => R1 | PromiseLike<R1>) | null, onrejected?: ((e: unknown) => R2 | PromiseLike<R2>) | null): PromiseLike<R1 | R2>;
39
+ /** Wrap an existing Observable's subscribe behavior in a StreamObservable. */
40
+ static from<T>(source: Observable<T>): StreamObservable<T>;
41
+ }
42
+ /**
43
+ * Multicast cache observable — emits `undefined` while the underlying value
44
+ * is loading, then the value, then re-emits when bus events invalidate the
45
+ * cache entry. Used by Browse live-query methods (`browse.resource`,
46
+ * `browse.annotations`, etc.).
47
+ *
48
+ * Awaiting resolves to the **first non-undefined** value (waits past the
49
+ * loading state). Subscribing yields the full sequence including the
50
+ * initial `undefined`, so reactive consumers can render a loading state.
51
+ *
52
+ * The class is parameterized as `CacheObservable<T>` even though the
53
+ * stream's element type is `T | undefined` — `T` is what the consumer
54
+ * gets from `await`, and that's the contract we want to advertise. The
55
+ * `Observable<T | undefined>` shape leaks through `.subscribe` and
56
+ * `.pipe` in the natural way.
57
+ */
58
+ declare class CacheObservable<T> extends Observable<T | undefined> implements PromiseLike<T> {
59
+ then<R1 = T, R2 = never>(onfulfilled?: ((v: T) => R1 | PromiseLike<R1>) | null, onrejected?: ((e: unknown) => R2 | PromiseLike<R2>) | null): PromiseLike<R1 | R2>;
60
+ /**
61
+ * Wrap an existing Observable's subscribe behavior in a `CacheObservable`.
62
+ *
63
+ * Memoizes on source identity: passing the same `source` returns the same
64
+ * wrapper instance. The Browse cache primitive already returns a stable
65
+ * Observable per key (its B4 contract), so this preserves that contract
66
+ * through the awaitable wrapping. Without the memo, every public-method
67
+ * call would produce a fresh wrapper and break referential-equality
68
+ * guarantees that hook-style reactive consumers depend on.
69
+ *
70
+ * Backed by a `WeakMap`, so wrappers are GC'd when their source is.
71
+ */
72
+ static from<T>(source: Observable<T | undefined>): CacheObservable<T>;
73
+ }
74
+ /**
75
+ * Discriminated phases of an upload's lifecycle.
76
+ *
77
+ * - `started` — emitted immediately on `yield.resource(...)` invocation, before any bytes flow.
78
+ * - `progress` — emitted as bytes flow over the wire. Wired by `HttpContentTransport`'s XHR path when a caller passes `onProgress` (or, transitively, when `yield.resource` is the caller — it always wires the hook so subscribers see byte counts). `bytesUploaded` and `totalBytes` carry the running counts; `totalBytes` may be 0 when the transport can't determine the total (rare, e.g. chunked encoding) — UI consumers should render an indeterminate state in that case.
79
+ * - `finished` — emitted on backend acknowledgement, carries the assigned `resourceId`.
80
+ *
81
+ * Failures surface as `Observable.error(...)` (typically an `APIError` from the transport's `errors$` Subject), not as a `phase: 'failed'` event — `subscribe`'s error callback handles them. Cancellation is honored: unsubscribing before `finished` aborts the in-flight HTTP request on the XHR path.
82
+ */
83
+ type UploadProgress = {
84
+ phase: 'started';
85
+ totalBytes: number;
86
+ } | {
87
+ phase: 'progress';
88
+ bytesUploaded: number;
89
+ totalBytes: number;
90
+ } | {
91
+ phase: 'finished';
92
+ resourceId: ResourceId;
93
+ };
94
+ /**
95
+ * Specialized `StreamObservable` for `yield.resource`. Subscribers see the
96
+ * full `UploadProgress` event sequence (started → optional progress → finished).
97
+ * Awaiting resolves specifically to `{ resourceId }` extracted from the
98
+ * `'finished'` event — preserving the pre-Phase-18 awaited shape so existing
99
+ * `await client.yield.resource(...)` callers don't need to narrow the union.
100
+ */
101
+ declare class UploadObservable extends Observable<UploadProgress> implements PromiseLike<{
102
+ resourceId: ResourceId;
103
+ }> {
104
+ then<R1 = {
105
+ resourceId: ResourceId;
106
+ }, R2 = never>(onfulfilled?: ((v: {
107
+ resourceId: ResourceId;
108
+ }) => R1 | PromiseLike<R1>) | null, onrejected?: ((e: unknown) => R2 | PromiseLike<R2>) | null): PromiseLike<R1 | R2>;
109
+ }
110
+
111
+ /**
112
+ * Verb Namespace Interfaces
113
+ *
114
+ * These interfaces define the public API of `@semiont/sdk`, organized by
115
+ * the 7 domain flows (Browse, Mark, Bind, Gather, Match, Yield, Beckon)
116
+ * plus infrastructure namespaces (Job, Auth, Admin).
117
+ *
118
+ * Each namespace maps 1:1 to a flow. Each flow maps to a clear actor on
119
+ * the backend. The frontend calls `client.mark.annotation()` and the
120
+ * client handles HTTP, auth, SSE, and caching internally.
121
+ *
122
+ * Return type conventions:
123
+ * - Browse live queries → `CacheObservable<T>` (bus-driven, cached;
124
+ * subscribe yields `T | undefined`, await yields `T` after first load)
125
+ * - Browse one-shot reads → `Promise<T>` (fetch once, no cache)
126
+ * - Commands (mark, bind, yield.resource) → `Promise<T>` (atomic ops)
127
+ * - Long-running ops (gather, match, yield.fromAnnotation, mark.assist)
128
+ * → `StreamObservable<T>` (progress + result; subscribe yields every
129
+ * emit, await yields the last one)
130
+ * - Ephemeral signals (beckon) → `void`
131
+ *
132
+ * `StreamObservable` and `CacheObservable` are `Observable` subclasses
133
+ * that also implement `PromiseLike<T>` — `await client.X.Y(...)` works
134
+ * directly without `lastValueFrom`/`firstValueFrom` wrappers.
135
+ * `.pipe(...)` returns a plain `Observable<T>` (the thenable subclass
136
+ * does not propagate through pipe — by design).
137
+ */
138
+
139
+ type StoredEventResponse$1 = components['schemas']['StoredEventResponse'];
140
+ type GatherProgress = components['schemas']['GatherProgress'];
141
+ type MatchSearchResult = components['schemas']['MatchSearchResult'];
142
+ type JobProgress$2 = components['schemas']['JobProgress'];
143
+ type GatherAnnotationComplete = components['schemas']['GatherAnnotationComplete'];
144
+ type JobStatusResponse$1 = components['schemas']['JobStatusResponse'];
145
+ type AuthResponse$1 = components['schemas']['AuthResponse'];
146
+ type TokenRefreshResponse$1 = components['schemas']['TokenRefreshResponse'];
147
+ type OAuthConfigResponse$1 = components['schemas']['OAuthConfigResponse'];
148
+ type AdminUserStatsResponse$1 = components['schemas']['AdminUserStatsResponse'];
149
+ type ResponseContent<T> = T extends {
150
+ responses: {
151
+ 200: {
152
+ content: {
153
+ 'application/json': infer R;
154
+ };
155
+ };
156
+ };
157
+ } ? R : T extends {
158
+ responses: {
159
+ 201: {
160
+ content: {
161
+ 'application/json': infer R;
162
+ };
163
+ };
164
+ };
165
+ } ? R : T extends {
166
+ responses: {
167
+ 202: {
168
+ content: {
169
+ 'application/json': infer R;
170
+ };
171
+ };
172
+ };
173
+ } ? R : never;
174
+ type RequestContent<T> = T extends {
175
+ requestBody?: {
176
+ content: {
177
+ 'application/json': infer R;
178
+ };
179
+ };
180
+ } ? R : never;
181
+ /** Input for creating an annotation via mark.annotation() */
182
+ type CreateAnnotationInput = components['schemas']['CreateAnnotationRequest'];
183
+ /** Input for creating a resource via yield.resource() */
184
+ interface CreateResourceInput {
185
+ name: string;
186
+ file: File | Buffer;
187
+ format: string;
188
+ entityTypes?: string[];
189
+ language?: string;
190
+ sourceAnnotationId?: string;
191
+ sourceResourceId?: string;
192
+ storageUri: string;
193
+ /** Prompt that drove AI generation (for AI-generated resources). */
194
+ generationPrompt?: string;
195
+ /** Agent(s) that generated the content (for AI-generated resources). */
196
+ generator?: components['schemas']['Agent'] | components['schemas']['Agent'][];
197
+ isDraft?: boolean;
198
+ }
199
+ /** Options for yield.fromAnnotation() */
200
+ interface GenerationOptions {
201
+ title: string;
202
+ storageUri: string;
203
+ context: GatheredContext;
204
+ prompt?: string;
205
+ /** Entity-type tags to stamp on the synthesized resource. Used both as a prompt bias for the generation worker and as the `entityTypes` set on the resulting resource (so `browse.resources({ entityType: ... })` queries can find it). */
206
+ entityTypes?: string[];
207
+ /** Annotation/resource body locale — language the generated resource is written in (typically the user's UI locale). */
208
+ language?: string;
209
+ /** Source-resource locale — language of the resource the annotation lives on, used in the prompt so the LLM understands embedded source-context snippets. BCP-47. */
210
+ sourceLanguage?: string;
211
+ temperature?: number;
212
+ maxTokens?: number;
213
+ }
214
+ /** Options for mark.assist() */
215
+ interface MarkAssistOptions {
216
+ entityTypes?: string[];
217
+ includeDescriptiveReferences?: boolean;
218
+ instructions?: string;
219
+ density?: number;
220
+ tone?: string;
221
+ /** Annotation body locale — language the LLM should write generated body text in (comment text, assessment text, tag/reference body language stamp). BCP-47. */
222
+ language?: string;
223
+ /** Source-resource locale — language of the content being analyzed, used in the prompt so the LLM analyzes non-English source correctly. BCP-47. */
224
+ sourceLanguage?: string;
225
+ schemaId?: string;
226
+ categories?: string[];
227
+ }
228
+ /** Options for yield.createFromToken() */
229
+ type CreateFromTokenOptions = {
230
+ token: string;
231
+ name: string;
232
+ content: string;
233
+ archiveOriginal?: boolean;
234
+ };
235
+ /** Referenced-by entry from browse.referencedBy() */
236
+ type ReferencedByEntry = components['schemas']['GetReferencedByResponse']['referencedBy'][number];
237
+ /** Annotation history from browse.annotationHistory() */
238
+ type AnnotationHistoryResponse = components['schemas']['GetAnnotationHistoryResponse'];
239
+ /** User object from auth/admin responses */
240
+ type User = AuthResponse$1['user'];
241
+ /**
242
+ * Progress emitted by gather.annotation() Observable.
243
+ * Emits GatherProgress during assembly, then GatherAnnotationComplete on finish.
244
+ */
245
+ type GatherAnnotationProgress = GatherProgress | GatherAnnotationComplete;
246
+ /**
247
+ * Progress emitted by match.search() Observable.
248
+ * Emits the final MatchSearchResult (no intermediate progress events currently).
249
+ */
250
+ type MatchSearchProgress = MatchSearchResult;
251
+ /**
252
+ * Progress payload emitted by mark.assist() and yield.fromAnnotation()
253
+ * Observables. Each progress emission carries a JobProgress snapshot
254
+ * (unified job lifecycle).
255
+ */
256
+ type MarkAssistProgress = JobProgress$2;
257
+ /**
258
+ * Discriminated event yielded by the `mark.assist()` Observable. Progress
259
+ * events stream while the worker runs; the final value before the
260
+ * Observable completes is a `complete` event carrying the `JobCompleteCommand`
261
+ * payload (with `result`, `jobId`, `jobType`, etc.). The Observable errors
262
+ * on `job:fail`.
263
+ */
264
+ type MarkAssistEvent = {
265
+ kind: 'progress';
266
+ data: MarkAssistProgress;
267
+ } | {
268
+ kind: 'complete';
269
+ data: components['schemas']['JobCompleteCommand'];
270
+ };
271
+ /**
272
+ * Discriminated event yielded by the `yield.fromAnnotation()` Observable.
273
+ * Same shape and semantics as `MarkAssistEvent`.
274
+ */
275
+ type YieldGenerationEvent = {
276
+ kind: 'progress';
277
+ data: JobProgress$2;
278
+ } | {
279
+ kind: 'complete';
280
+ data: components['schemas']['JobCompleteCommand'];
281
+ };
282
+ /**
283
+ * Browse — reads from materialized views
284
+ *
285
+ * Live queries return Observables that emit initial state and re-emit
286
+ * on bus gateway updates. One-shot reads return Promises.
287
+ *
288
+ * Backend actor: Browser (context classes)
289
+ * Event prefix: browse:*
290
+ */
291
+ interface BrowseNamespace$1 {
292
+ resource(resourceId: ResourceId): CacheObservable<ResourceDescriptor>;
293
+ resources(filters?: {
294
+ limit?: number;
295
+ archived?: boolean;
296
+ search?: string;
297
+ }): CacheObservable<ResourceDescriptor[]>;
298
+ annotations(resourceId: ResourceId): CacheObservable<Annotation[]>;
299
+ annotation(resourceId: ResourceId, annotationId: AnnotationId): CacheObservable<Annotation>;
300
+ entityTypes(): CacheObservable<string[]>;
301
+ tagSchemas(): CacheObservable<TagSchema[]>;
302
+ referencedBy(resourceId: ResourceId): CacheObservable<ReferencedByEntry[]>;
303
+ events(resourceId: ResourceId): CacheObservable<StoredEventResponse$1[]>;
304
+ resourceContent(resourceId: ResourceId): Promise<string>;
305
+ resourceRepresentation(resourceId: ResourceId, options?: {
306
+ accept?: string;
307
+ }): Promise<{
308
+ data: ArrayBuffer;
309
+ contentType: string;
310
+ }>;
311
+ resourceRepresentationStream(resourceId: ResourceId, options?: {
312
+ accept?: string;
313
+ }): Promise<{
314
+ stream: ReadableStream<Uint8Array>;
315
+ contentType: string;
316
+ }>;
317
+ resourceEvents(resourceId: ResourceId): Promise<StoredEventResponse$1[]>;
318
+ annotationHistory(resourceId: ResourceId, annotationId: AnnotationId): Promise<AnnotationHistoryResponse>;
319
+ connections(resourceId: ResourceId): Promise<GraphConnection[]>;
320
+ backlinks(resourceId: ResourceId): Promise<Annotation[]>;
321
+ resourcesByName(query: string, limit?: number): Promise<ResourceDescriptor[]>;
322
+ files(dirPath?: string, sort?: 'name' | 'mtime' | 'annotationCount'): Promise<components['schemas']['BrowseFilesResponse']>;
323
+ click(annotationId: AnnotationId, motivation: Motivation): void;
324
+ navigateReference(resourceId: ResourceId): void;
325
+ }
326
+ /**
327
+ * Frame — schema-layer flow (the eighth flow).
328
+ *
329
+ * Frame operates on the KB's conceptual vocabulary — what *kinds* of
330
+ * things exist (entity types) and, in the future, what taxonomies are
331
+ * recognized (tag schemas), what relations are typed (predicate types),
332
+ * and how schemas are imported (ontology I/O). The other seven flows
333
+ * (yield, mark, match, bind, gather, browse, beckon) operate on
334
+ * content; Frame operates on the schema layer that content is expressed
335
+ * in.
336
+ *
337
+ * MVP scope is small: entity-type vocabulary writes only. Live reads of
338
+ * the entity-type vocabulary stay on Browse (`browse.entityTypes()` is
339
+ * a `CacheObservable<string[]>` consumed by 8+ call sites). Frame owns
340
+ * writes; Browse owns reads — the same asymmetry that already holds for
341
+ * resources and annotations.
342
+ *
343
+ * Backend actor: Stower
344
+ * Event prefix: frame:*
345
+ */
346
+ interface FrameNamespace$1 {
347
+ /** Add a single entity type to the KB's vocabulary. Idempotent — adding an existing type is a no-op. */
348
+ addEntityType(type: string): Promise<void>;
349
+ /** Add multiple entity types in one call. Convenience over a loop of `addEntityType`. */
350
+ addEntityTypes(types: string[]): Promise<void>;
351
+ /**
352
+ * Register a tag schema with the KB's runtime registry.
353
+ *
354
+ * Most-recent registration of a given `schema.id` wins; identical
355
+ * re-registrations are silent, differing content overwrites the
356
+ * existing entry and logs a warning. KBs typically call this at
357
+ * session/skill startup so the schema is available for `mark.assist`
358
+ * with motivation `tagging` and surfaces in `browse.tagSchemas()`.
359
+ */
360
+ addTagSchema(schema: TagSchema): Promise<void>;
361
+ }
362
+ /**
363
+ * Mark — annotation CRUD, AI assist, resource lifecycle
364
+ *
365
+ * Commands return Promises that resolve on HTTP acceptance (202).
366
+ * Results appear on browse Observables via bus gateway.
367
+ * assist() returns an Observable for long-running progress.
368
+ *
369
+ * Backend actor: Stower
370
+ * Event prefix: mark:*
371
+ */
372
+ interface MarkNamespace$1 {
373
+ annotation(input: CreateAnnotationInput): Promise<{
374
+ annotationId: AnnotationId;
375
+ }>;
376
+ delete(resourceId: ResourceId, annotationId: AnnotationId): Promise<void>;
377
+ archive(resourceId: ResourceId): Promise<void>;
378
+ unarchive(resourceId: ResourceId): Promise<void>;
379
+ assist(resourceId: ResourceId, motivation: Motivation, options: MarkAssistOptions): StreamObservable<MarkAssistEvent>;
380
+ request(selector: components['schemas']['MarkRequestedEvent']['selector'], motivation: Motivation): void;
381
+ /** Fire-and-forget variant of `assist` — mark-state-unit orchestrates the call and its progress Observable. */
382
+ requestAssist(motivation: Motivation, options: MarkAssistOptions, correlationId?: string): void;
383
+ /** Submit the currently pending annotation with its selector and optional body. */
384
+ submit(input: components['schemas']['MarkSubmitEvent']): void;
385
+ /** Cancel the currently pending annotation (if any). */
386
+ cancelPending(): void;
387
+ /** Dismiss the in-progress AI-assist widget. */
388
+ dismissProgress(): void;
389
+ changeSelection(motivation: Motivation | null): void;
390
+ changeClick(action: string): void;
391
+ changeShape(shape: string): void;
392
+ toggleMode(): void;
393
+ }
394
+ /**
395
+ * Bind — reference linking
396
+ *
397
+ * The simplest namespace. One method. The result (updated annotation
398
+ * with resolved reference) arrives on browse.annotations() via the
399
+ * enriched mark:body-updated event.
400
+ *
401
+ * Backend actor: Stower (via mark:update-body)
402
+ * Event prefix: mark:body-updated (shares mark event pipeline)
403
+ */
404
+ interface BindNamespace$1 {
405
+ body(resourceId: ResourceId, annotationId: AnnotationId, operations: BodyOperation[]): Promise<void>;
406
+ /** UI signal: a reference-binding flow is requested for an annotation. */
407
+ initiate(input: EventMap['bind:initiate']): void;
408
+ }
409
+ /**
410
+ * Gather — context assembly
411
+ *
412
+ * Long-running (LLM calls + graph traversal). Returns Observables
413
+ * that emit progress then the gathered context.
414
+ *
415
+ * Backend actor: Gatherer
416
+ * Event prefix: gather:*
417
+ */
418
+ interface GatherNamespace$1 {
419
+ annotation(resourceId: ResourceId, annotationId: AnnotationId, options?: {
420
+ contextWindow?: number;
421
+ }): StreamObservable<GatherAnnotationProgress>;
422
+ resource(resourceId: ResourceId, options?: {
423
+ contextWindow?: number;
424
+ }): StreamObservable<GatherAnnotationProgress>;
425
+ }
426
+ /**
427
+ * Match — search and ranking
428
+ *
429
+ * Long-running (semantic search, optional LLM scoring). Returns
430
+ * Observable with progress then results.
431
+ *
432
+ * Backend actor: Matcher
433
+ * Event prefix: match:*
434
+ */
435
+ interface MatchNamespace$1 {
436
+ search(resourceId: ResourceId, referenceId: AnnotationId, context: GatheredContext, options?: {
437
+ limit?: number;
438
+ useSemanticScoring?: boolean;
439
+ }): StreamObservable<MatchSearchProgress>;
440
+ /** Fire-and-forget variant: match-state-unit orchestrates the call and its result Observable. */
441
+ requestSearch(input: components['schemas']['MatchSearchRequest']): void;
442
+ }
443
+ /**
444
+ * Yield — resource creation
445
+ *
446
+ * resource() is synchronous file upload (Promise).
447
+ * fromAnnotation() is long-running LLM generation (Observable).
448
+ *
449
+ * Backend actor: Stower + generation worker
450
+ * Event prefix: yield:*
451
+ */
452
+ interface YieldNamespace$1 {
453
+ resource(data: CreateResourceInput): UploadObservable;
454
+ fromAnnotation(resourceId: ResourceId, annotationId: AnnotationId, options: GenerationOptions): StreamObservable<YieldGenerationEvent>;
455
+ cloneToken(resourceId: ResourceId): Promise<{
456
+ token: string;
457
+ expiresAt: string;
458
+ }>;
459
+ fromToken(token: string): Promise<ResourceDescriptor>;
460
+ createFromToken(options: CreateFromTokenOptions): Promise<{
461
+ resourceId: ResourceId;
462
+ }>;
463
+ /** UI signal: user invoked the clone action from the resource-info panel. */
464
+ clone(): void;
465
+ }
466
+ /**
467
+ * Beckon — attention coordination
468
+ *
469
+ * Fire-and-forget. Ephemeral presence signal delivered via the
470
+ * attention-stream to other participants.
471
+ *
472
+ * Backend actor: (frontend relay via attention-stream)
473
+ * Event prefix: beckon:*
474
+ */
475
+ interface BeckonNamespace$1 {
476
+ attention(resourceId: ResourceId, annotationId: AnnotationId): void;
477
+ hover(annotationId: AnnotationId | null): void;
478
+ sparkle(annotationId: AnnotationId): void;
479
+ }
480
+ /**
481
+ * Job — worker lifecycle
482
+ */
483
+ interface JobNamespace$1 {
484
+ /** Live stream of `job:queued` events from the bus. */
485
+ readonly queued$: Observable<EventMap['job:queued']>;
486
+ /** Live stream of `job:report-progress` events from the bus. */
487
+ readonly progress$: Observable<EventMap['job:report-progress']>;
488
+ /** Live stream of `job:complete` events from the bus. */
489
+ readonly complete$: Observable<EventMap['job:complete']>;
490
+ /** Live stream of `job:fail` events from the bus. */
491
+ readonly fail$: Observable<EventMap['job:fail']>;
492
+ status(jobId: JobId): Promise<JobStatusResponse$1>;
493
+ pollUntilComplete(jobId: JobId, options?: {
494
+ interval?: number;
495
+ timeout?: number;
496
+ onProgress?: (status: JobStatusResponse$1) => void;
497
+ }): Promise<JobStatusResponse$1>;
498
+ cancelByType(jobType: 'annotation' | 'generation'): Promise<void>;
499
+ /** UI signal: cancel all active jobs of a given type (e.g. "annotation"). */
500
+ cancelRequest(jobType: 'annotation' | 'generation'): void;
501
+ }
502
+ /**
503
+ * Auth — authentication
504
+ */
505
+ interface AuthNamespace$1 {
506
+ password(email: string, password: string): Promise<AuthResponse$1>;
507
+ google(credential: string): Promise<AuthResponse$1>;
508
+ refresh(token: string): Promise<TokenRefreshResponse$1>;
509
+ logout(): Promise<void>;
510
+ me(): Promise<User>;
511
+ acceptTerms(): Promise<void>;
512
+ mcpToken(): Promise<{
513
+ token: string;
514
+ }>;
515
+ mediaToken(resourceId: ResourceId): Promise<{
516
+ token: string;
517
+ }>;
518
+ }
519
+ /**
520
+ * Admin — administration
521
+ */
522
+ interface AdminNamespace$1 {
523
+ users(): Promise<User[]>;
524
+ userStats(): Promise<AdminUserStatsResponse$1>;
525
+ updateUser(userId: UserDID, data: RequestContent<paths['/api/admin/users/{id}']['patch']>): Promise<User>;
526
+ oauthConfig(): Promise<OAuthConfigResponse$1>;
527
+ healthCheck(): Promise<ResponseContent<paths['/api/health']['get']>>;
528
+ status(): Promise<ResponseContent<paths['/api/status']['get']>>;
529
+ backup(): Promise<BackendDownload>;
530
+ /**
531
+ * Restore from a backup archive. Returns a `StreamObservable` that
532
+ * emits each `ProgressEvent` as the operation runs (`'started'`,
533
+ * `'parsing'`, `'importing'`, ..., `'complete'`). Subscribers see
534
+ * every step; awaiters get the final event via the PromiseLike sugar.
535
+ */
536
+ restore(file: File): StreamObservable<ProgressEvent>;
537
+ exportKnowledgeBase(params?: {
538
+ includeArchived?: boolean;
539
+ }): Promise<BackendDownload>;
540
+ importKnowledgeBase(file: File): StreamObservable<ProgressEvent>;
541
+ }
542
+
543
+ type StoredEventResponse = components['schemas']['StoredEventResponse'];
544
+ type ResourceListFilters = {
545
+ limit?: number;
546
+ archived?: boolean;
547
+ search?: string;
548
+ };
549
+ declare class BrowseNamespace implements BrowseNamespace$1 {
550
+ private readonly transport;
551
+ private readonly bus;
552
+ private readonly content;
553
+ private readonly resourceCache;
554
+ private readonly resourceListCache;
555
+ private readonly annotationListCache;
556
+ /**
557
+ * Annotation-detail cache keyed by `annotationId` only — the resourceId
558
+ * is a routing hint for the backend fetch, not an identity component.
559
+ * We track the most recent resourceId per annotationId in a side-map
560
+ * so `mark:delete-ok` (which carries only `annotationId`) can reach
561
+ * the right cache entry. Aligns with the pre-refactor semantics.
562
+ */
563
+ private readonly annotationDetailCache;
564
+ private readonly annotationResources;
565
+ private readonly entityTypesCache;
566
+ private readonly tagSchemasCache;
567
+ private readonly referencedByCache;
568
+ private readonly resourceEventsCache;
569
+ /** Filter-blob memory so `invalidateResourceLists` can replay per-key. */
570
+ private readonly resourceListFilters;
571
+ /**
572
+ * Per-key memo for `annotations()` observables. The cache stores the
573
+ * full `AnnotationsListResponse`; the public shape is just the inner
574
+ * `Annotation[]`. Without this memo, every call to `annotations(rId)`
575
+ * would produce a fresh `.pipe(map(...))` observable, violating B4
576
+ * (per-key observable stability). Consumers that compare observable
577
+ * identity — React hooks depending on the observable reference,
578
+ * `distinctUntilChanged` at a higher level — would misbehave.
579
+ */
580
+ private readonly annotationListObs;
581
+ constructor(transport: ITransport, bus: EventBus, content: IContentTransport);
582
+ resource(resourceId: ResourceId): CacheObservable<ResourceDescriptor>;
583
+ resources(filters?: ResourceListFilters): CacheObservable<ResourceDescriptor[]>;
584
+ annotations(resourceId: ResourceId): CacheObservable<Annotation[]>;
585
+ annotation(resourceId: ResourceId, annotationId: AnnotationId): CacheObservable<Annotation>;
586
+ entityTypes(): CacheObservable<string[]>;
587
+ tagSchemas(): CacheObservable<TagSchema[]>;
588
+ referencedBy(resourceId: ResourceId): CacheObservable<ReferencedByEntry[]>;
589
+ events(resourceId: ResourceId): CacheObservable<StoredEventResponse[]>;
590
+ resourceContent(resourceId: ResourceId): Promise<string>;
591
+ resourceRepresentation(resourceId: ResourceId, options?: {
592
+ accept?: string;
593
+ }): Promise<{
594
+ data: ArrayBuffer;
595
+ contentType: string;
596
+ }>;
597
+ resourceRepresentationStream(resourceId: ResourceId, options?: {
598
+ accept?: string;
599
+ }): Promise<{
600
+ stream: ReadableStream<Uint8Array>;
601
+ contentType: string;
602
+ }>;
603
+ resourceEvents(resourceId: ResourceId): Promise<StoredEventResponse[]>;
604
+ annotationHistory(resourceId: ResourceId, annotationId: AnnotationId): Promise<AnnotationHistoryResponse>;
605
+ connections(_resourceId: ResourceId): Promise<GraphConnection[]>;
606
+ backlinks(_resourceId: ResourceId): Promise<Annotation[]>;
607
+ resourcesByName(_query: string, _limit?: number): Promise<ResourceDescriptor[]>;
608
+ files(dirPath?: string, sort?: 'name' | 'mtime' | 'annotationCount'): Promise<components['schemas']['BrowseFilesResponse']>;
609
+ click(annotationId: AnnotationId, motivation: Motivation): void;
610
+ navigateReference(resourceId: ResourceId): void;
611
+ invalidateAnnotationList(resourceId: ResourceId): void;
612
+ removeAnnotationDetail(annotationId: AnnotationId): void;
613
+ invalidateResourceDetail(id: ResourceId): void;
614
+ invalidateResourceLists(): void;
615
+ invalidateEntityTypes(): void;
616
+ invalidateTagSchemas(): void;
617
+ invalidateReferencedBy(resourceId: ResourceId): void;
618
+ invalidateResourceEvents(resourceId: ResourceId): void;
619
+ updateAnnotationInPlace(resourceId: ResourceId, annotation: Annotation): void;
620
+ /**
621
+ * Typed shorthand for `eventBus.get(channel).subscribe(handler)`.
622
+ * Preserves per-channel payload typing so handlers read
623
+ * `EventMap[K]` without any casts.
624
+ */
625
+ private on;
626
+ /**
627
+ * Handler shared by `mark:entity-tag-added` and `mark:entity-tag-removed`.
628
+ * Both events carry the same effect: the annotation list, the
629
+ * resource descriptor, and the event log for that resource all may
630
+ * now reflect different entity tagging, so invalidate all three.
631
+ */
632
+ private onEntityTagChanged;
633
+ /**
634
+ * Handler shared by `mark:archived` and `mark:unarchived`. Both
635
+ * change a resource's archived flag, which is stored on the resource
636
+ * descriptor and affects the resource-list filter.
637
+ */
638
+ private onArchiveToggled;
639
+ /**
640
+ * Handler shared by `yield:create-ok` and `yield:update-ok`. Both
641
+ * report a resource mutation with the resourceId as a string (not
642
+ * yet branded), so we brand and apply the same effect as
643
+ * `onArchiveToggled`.
644
+ */
645
+ private onYieldResourceMutated;
646
+ private subscribeToEvents;
647
+ }
648
+
649
+ declare class MarkNamespace implements MarkNamespace$1 {
650
+ private readonly transport;
651
+ private readonly bus;
652
+ constructor(transport: ITransport, bus: EventBus);
653
+ annotation(input: CreateAnnotationInput): Promise<{
654
+ annotationId: AnnotationId;
655
+ }>;
656
+ delete(resourceId: ResourceId, annotationId: AnnotationId): Promise<void>;
657
+ archive(resourceId: ResourceId): Promise<void>;
658
+ unarchive(resourceId: ResourceId): Promise<void>;
659
+ assist(resourceId: ResourceId, motivation: Motivation, options: MarkAssistOptions): StreamObservable<MarkAssistEvent>;
660
+ request(selector: components['schemas']['MarkRequestedEvent']['selector'], motivation: Motivation): void;
661
+ requestAssist(motivation: Motivation, options: MarkAssistOptions, correlationId?: string): void;
662
+ submit(input: components['schemas']['MarkSubmitEvent']): void;
663
+ cancelPending(): void;
664
+ dismissProgress(): void;
665
+ changeSelection(motivation: Motivation | null): void;
666
+ changeClick(action: string): void;
667
+ changeShape(shape: string): void;
668
+ toggleMode(): void;
669
+ private dispatchAssist;
670
+ }
671
+
672
+ declare class BindNamespace implements BindNamespace$1 {
673
+ private readonly transport;
674
+ private readonly bus;
675
+ constructor(transport: ITransport, bus: EventBus);
676
+ body(resourceId: ResourceId, annotationId: AnnotationId, operations: BodyOperation[]): Promise<void>;
677
+ initiate(input: EventMap['bind:initiate']): void;
678
+ }
679
+
680
+ declare class GatherNamespace implements GatherNamespace$1 {
681
+ private readonly transport;
682
+ private readonly bus;
683
+ constructor(transport: ITransport, bus: EventBus);
684
+ annotation(resourceId: ResourceId, annotationId: AnnotationId, options?: {
685
+ contextWindow?: number;
686
+ }): StreamObservable<GatherAnnotationProgress>;
687
+ resource(_resourceId: ResourceId, _options?: {
688
+ contextWindow?: number;
689
+ }): StreamObservable<GatherAnnotationProgress>;
690
+ }
691
+
692
+ declare class MatchNamespace implements MatchNamespace$1 {
693
+ private readonly transport;
694
+ private readonly bus;
695
+ constructor(transport: ITransport, bus: EventBus);
696
+ requestSearch(input: components['schemas']['MatchSearchRequest']): void;
697
+ search(resourceId: ResourceId, referenceId: AnnotationId, context: GatheredContext, options?: {
698
+ limit?: number;
699
+ useSemanticScoring?: boolean;
700
+ }): StreamObservable<MatchSearchProgress>;
701
+ }
702
+
703
+ declare class YieldNamespace implements YieldNamespace$1 {
704
+ private readonly transport;
705
+ private readonly bus;
706
+ private readonly content;
707
+ constructor(transport: ITransport, bus: EventBus, content: IContentTransport);
708
+ resource(data: CreateResourceInput): UploadObservable;
709
+ fromAnnotation(resourceId: ResourceId, annotationId: AnnotationId, options: GenerationOptions): StreamObservable<YieldGenerationEvent>;
710
+ cloneToken(resourceId: ResourceId): Promise<{
711
+ token: string;
712
+ expiresAt: string;
713
+ }>;
714
+ fromToken(token: string): Promise<ResourceDescriptor>;
715
+ createFromToken(options: CreateFromTokenOptions): Promise<{
716
+ resourceId: ResourceId;
717
+ }>;
718
+ clone(): void;
719
+ }
720
+
721
+ declare class BeckonNamespace implements BeckonNamespace$1 {
722
+ private readonly transport;
723
+ private readonly bus;
724
+ constructor(transport: ITransport, bus: EventBus);
725
+ attention(resourceId: ResourceId, annotationId: AnnotationId): void;
726
+ hover(annotationId: AnnotationId | null): void;
727
+ sparkle(annotationId: AnnotationId): void;
728
+ }
729
+
730
+ /**
731
+ * FrameNamespace — the eighth flow's surface.
732
+ *
733
+ * Frame operates on the KB's **schema layer** — the conceptual vocabulary
734
+ * the other seven flows are expressed in. Where yield/mark/match/bind/
735
+ * gather/browse/beckon act on content (resources, annotations, references,
736
+ * attention), Frame acts on what *kinds* of things exist: entity types,
737
+ * eventually tag schemas, relation/predicate types, ontology imports.
738
+ *
739
+ * The MVP owns a single primitive — entity-type vocabulary writes on the
740
+ * `frame:add-entity-type` channel. See `docs/protocol/flows/FRAME.md`
741
+ * for the per-flow contract.
742
+ *
743
+ * Live reads of the entity-type vocabulary stay on Browse
744
+ * (`browse.entityTypes()` is a `CacheObservable<string[]>`). Frame owns
745
+ * writes; Browse owns reads. The asymmetry is intentional — re-implementing
746
+ * Browse's cache primitives on Frame for a single read would duplicate
747
+ * machinery without benefit.
748
+ */
749
+
750
+ declare class FrameNamespace implements FrameNamespace$1 {
751
+ private readonly transport;
752
+ constructor(transport: ITransport);
753
+ addEntityType(type: string): Promise<void>;
754
+ addEntityTypes(types: string[]): Promise<void>;
755
+ addTagSchema(schema: TagSchema): Promise<void>;
756
+ }
757
+
758
+ type JobStatusResponse = components['schemas']['JobStatusResponse'];
759
+ declare class JobNamespace implements JobNamespace$1 {
760
+ private readonly transport;
761
+ private readonly bus;
762
+ constructor(transport: ITransport, bus: EventBus);
763
+ /**
764
+ * Live stream of `job:queued` events. Surfaces a typed view onto the
765
+ * underlying bus channel for consumers (CLIs, MCP handlers, widgets)
766
+ * that orchestrate jobs and need to react to lifecycle transitions.
767
+ */
768
+ get queued$(): Observable<EventMap['job:queued']>;
769
+ /** Live stream of `job:report-progress` events. */
770
+ get progress$(): Observable<EventMap['job:report-progress']>;
771
+ /** Live stream of `job:complete` events. */
772
+ get complete$(): Observable<EventMap['job:complete']>;
773
+ /** Live stream of `job:fail` events. */
774
+ get fail$(): Observable<EventMap['job:fail']>;
775
+ status(jobId: JobId): Promise<JobStatusResponse>;
776
+ pollUntilComplete(jobId: JobId, options?: {
777
+ interval?: number;
778
+ timeout?: number;
779
+ onProgress?: (status: JobStatusResponse) => void;
780
+ }): Promise<JobStatusResponse>;
781
+ cancelByType(jobType: 'annotation' | 'generation'): Promise<void>;
782
+ cancelRequest(jobType: 'annotation' | 'generation'): void;
783
+ }
784
+
785
+ /**
786
+ * AuthNamespace — authentication. Backend ops only; no bus.
787
+ */
788
+
789
+ type AuthResponse = components['schemas']['AuthResponse'];
790
+ type TokenRefreshResponse = components['schemas']['TokenRefreshResponse'];
791
+ declare class AuthNamespace implements AuthNamespace$1 {
792
+ private readonly backend;
793
+ constructor(backend: IBackendOperations);
794
+ password(emailStr: string, passwordStr: string): Promise<AuthResponse>;
795
+ google(credential: string): Promise<AuthResponse>;
796
+ refresh(token: string): Promise<TokenRefreshResponse>;
797
+ logout(): Promise<void>;
798
+ me(): Promise<User>;
799
+ acceptTerms(): Promise<void>;
800
+ mcpToken(): Promise<{
801
+ token: string;
802
+ }>;
803
+ mediaToken(resourceId: ResourceId): Promise<{
804
+ token: string;
805
+ }>;
806
+ }
807
+
808
+ /**
809
+ * AdminNamespace — administration. Backend ops only; no bus.
810
+ */
811
+
812
+ type AdminUserStatsResponse = components['schemas']['AdminUserStatsResponse'];
813
+ type OAuthConfigResponse = components['schemas']['OAuthConfigResponse'];
814
+ declare class AdminNamespace implements AdminNamespace$1 {
815
+ private readonly backend;
816
+ constructor(backend: IBackendOperations);
817
+ users(): Promise<User[]>;
818
+ userStats(): Promise<AdminUserStatsResponse>;
819
+ updateUser(userId: UserDID, data: RequestContent<paths['/api/admin/users/{id}']['patch']>): Promise<User>;
820
+ oauthConfig(): Promise<OAuthConfigResponse>;
821
+ healthCheck(): Promise<ResponseContent<paths['/api/health']['get']>>;
822
+ status(): Promise<ResponseContent<paths['/api/status']['get']>>;
823
+ backup(): Promise<BackendDownload>;
824
+ restore(file: File): StreamObservable<ProgressEvent>;
825
+ exportKnowledgeBase(params?: {
826
+ includeArchived?: boolean;
827
+ }): Promise<BackendDownload>;
828
+ importKnowledgeBase(file: File): StreamObservable<ProgressEvent>;
829
+ }
830
+
831
+ declare class SemiontClient {
832
+ /**
833
+ * The wire-facing transport. Owns bus actor, HTTP, auth, admin, exchange,
834
+ * system. Exposed for advanced consumers (workers, custom job adapters)
835
+ * that need raw `transport.emit(channel, payload, scope)` access. Ordinary
836
+ * consumers go through typed namespace methods.
837
+ */
838
+ readonly transport: ITransport;
839
+ /** Binary I/O transport. */
840
+ private readonly content;
841
+ /**
842
+ * Per-client local EventBus. Wire events flow in via the transport
843
+ * bridge. Read-only public so `SemiontSession.subscribe(channel, …)`
844
+ * can wire arbitrary-channel subscriptions; everything else uses
845
+ * typed namespace methods.
846
+ */
847
+ readonly bus: EventBus;
848
+ readonly baseUrl: BaseUrl;
849
+ readonly frame: FrameNamespace;
850
+ readonly browse: BrowseNamespace;
851
+ readonly mark: MarkNamespace;
852
+ readonly bind: BindNamespace;
853
+ readonly gather: GatherNamespace;
854
+ readonly match: MatchNamespace;
855
+ readonly yield: YieldNamespace;
856
+ readonly beckon: BeckonNamespace;
857
+ readonly job: JobNamespace;
858
+ readonly auth: AuthNamespace | undefined;
859
+ readonly admin: AdminNamespace | undefined;
860
+ /**
861
+ * The client *owns* its bus. The constructor creates a fresh `EventBus`
862
+ * and hands it to the transport via `transport.bridgeInto(this.bus)`.
863
+ * The reference flows client → transport, never the other way:
864
+ * the transport stores the reference and publishes the events it
865
+ * receives onto that bus. `HttpTransport` does so for every channel
866
+ * delivered on its SSE wire; in-process transports adapt their
867
+ * internal source.
868
+ *
869
+ * Callers do not pass a bus in. If they need to interact with the bus
870
+ * (e.g. for tests or to subscribe to arbitrary channels), they read it
871
+ * back via `client.bus`.
872
+ *
873
+ * `backend` is optional. When provided, the `auth` and `admin`
874
+ * namespaces are constructed against it; when omitted, they're
875
+ * `undefined`. For HTTP setups this is conventionally the same
876
+ * `HttpTransport` instance that's also passed as `transport` (HTTP
877
+ * implements both `ITransport` and `IBackendOperations`).
878
+ */
879
+ constructor(transport: ITransport, content: IContentTransport, backend?: IBackendOperations);
880
+ /** Transport-level connection state. HTTP reflects SSE health; local is always 'connected'. */
881
+ get state$(): rxjs.Observable<_semiont_core.ConnectionState>;
882
+ subscribeToResource(resourceId: ResourceId): () => void;
883
+ dispose(): void;
884
+ /**
885
+ * Convenience factory for the default HTTP setup. Constructs a
886
+ * `BehaviorSubject<AccessToken | null>` internally, plus an
887
+ * `HttpTransport` and `HttpContentTransport`, and returns the wired
888
+ * `SemiontClient`.
889
+ *
890
+ * Use this for one-shot scripts, CLI commands, or any consumer that
891
+ * doesn't need to drive the token from outside (no manual refresh,
892
+ * no cross-tab sync). For long-running scripts that need refresh,
893
+ * use `SemiontSession.fromHttp(...)` (with a token already on hand)
894
+ * or `SemiontSession.signInHttp(...)` (credentials-first) instead —
895
+ * either owns the same transport/client wiring plus the
896
+ * proactive-refresh + storage machinery.
897
+ *
898
+ * Strings are accepted for `baseUrl` and `token`; they are branded
899
+ * via `baseUrl()` / `accessToken()` from `@semiont/core` automatically.
900
+ * Pass the already-branded values if you have them.
901
+ *
902
+ * Omit `token` for unauthenticated usage (public endpoints only).
903
+ */
904
+ static fromHttp(opts: {
905
+ baseUrl: BaseUrl | string;
906
+ token?: AccessToken | string | null;
907
+ }): SemiontClient;
908
+ /**
909
+ * Async factory for the credentials-first script case. Builds a
910
+ * transient HTTP transport, calls `auth.password(email, password)`
911
+ * to acquire an access token, and returns the wired client with
912
+ * the token populated.
913
+ *
914
+ * This is the right entry point for skills, CLI scripts, and any
915
+ * consumer that starts with email + password rather than a JWT
916
+ * already on hand. For consumers that already hold a token (CLI
917
+ * cached-token path, env-var token, embedded auth flow), use
918
+ * `fromHttp({ baseUrl, token })` instead.
919
+ *
920
+ * For long-running scripts that need refresh, use
921
+ * `SemiontSession.signInHttp(...)` — same credentials shape, plus
922
+ * the session machinery for proactive refresh and persistence.
923
+ *
924
+ * Named `signInHttp` because email+password authentication is
925
+ * inherently an HTTP-shaped operation in the current backend; an
926
+ * in-process `LocalTransport` doesn't have a credentials login
927
+ * path. Non-HTTP transports construct the client directly from
928
+ * their package's transport instance.
929
+ *
930
+ * Throws if authentication fails. The transient client is disposed
931
+ * before the throw, so no resources leak on failure.
932
+ */
933
+ static signInHttp(opts: {
934
+ baseUrl: BaseUrl | string;
935
+ email: string;
936
+ password: string;
937
+ }): Promise<SemiontClient>;
938
+ }
939
+
940
+ type BusRequestErrorCode = 'bus.timeout' | 'bus.rejected' | 'bus.bad-payload' | 'bus.unauthorized' | 'bus.forbidden' | 'bus.not-found';
941
+ declare class BusRequestError extends SemiontError {
942
+ code: BusRequestErrorCode;
943
+ constructor(message: string, code: BusRequestErrorCode, details?: Record<string, unknown>);
944
+ }
945
+ /**
946
+ * Subset of ITransport that `busRequest` needs: a way to send a command and
947
+ * a way to observe channels. Generic enough that an in-process transport
948
+ * can satisfy it without round-tripping through HTTP.
949
+ */
950
+ interface BusRequestPrimitive {
951
+ emit<K extends keyof EventMap>(channel: K, payload: EventMap[K]): Promise<void>;
952
+ stream<K extends keyof EventMap>(channel: K): Observable<EventMap[K]>;
953
+ }
954
+ declare function busRequest<TResult>(bus: BusRequestPrimitive, emitChannel: string, payload: Record<string, unknown>, resultChannel: string, failureChannel: string, timeoutMs?: number): Promise<TResult>;
955
+
956
+ /**
957
+ * KnowledgeBase — a connection to a Semiont knowledge system.
958
+ *
959
+ * The KB type itself is uniform. The transport-shape variation lives in
960
+ * the nested `endpoint` field, which is a discriminated union:
961
+ *
962
+ * - `endpoint.kind === 'http'` — a remote backend reached over HTTP+SSE.
963
+ * Carries `host`/`port`/`protocol`.
964
+ * - `endpoint.kind === 'local'` — an in-process knowledge system reached
965
+ * via `LocalTransport` from
966
+ * `@semiont/make-meaning`. Carries an
967
+ * opaque `kbId` identifying the local
968
+ * instance to the host process.
969
+ *
970
+ * Code that doesn't know how to make a transport (`SemiontSession`,
971
+ * `SemiontBrowser`, the frontend KB list UI) treats `KnowledgeBase` as
972
+ * uniform and never inspects `endpoint`. Code that *does* construct
973
+ * transports (the transport-factory passed to `SemiontBrowser`,
974
+ * `kbBackendUrl` for HTTP URL construction) inspects `endpoint.kind`
975
+ * and dispatches.
976
+ *
977
+ * Each KB has its own session, its own credentials (where applicable),
978
+ * and its own JWT (HTTP only). The user is "authenticated against KB X" —
979
+ * never globally authenticated.
980
+ */
981
+ /** Fields shared by every KB regardless of endpoint kind. */
982
+ interface KnowledgeBase {
983
+ id: string;
984
+ label: string;
985
+ email: string;
986
+ gitBranch?: string;
987
+ endpoint: KbEndpoint;
988
+ }
989
+ type KbEndpoint = HttpEndpoint | LocalEndpoint;
990
+ interface HttpEndpoint {
991
+ kind: 'http';
992
+ host: string;
993
+ port: number;
994
+ protocol: 'http' | 'https';
995
+ }
996
+ interface LocalEndpoint {
997
+ kind: 'local';
998
+ /** Opaque identifier for the in-process KB instance the host has loaded. */
999
+ kbId: string;
1000
+ }
1001
+ /**
1002
+ * Input shape for adding a new KB. The id is generated by the provider.
1003
+ */
1004
+ type NewKnowledgeBase = Omit<KnowledgeBase, 'id'>;
1005
+ /**
1006
+ * Status of the locally-stored credential for a KB. Derived from the
1007
+ * presence and validity of the JWT in session storage.
1008
+ */
1009
+ type KbSessionStatus = 'authenticated' | 'expired' | 'signed-out' | 'unreachable';
1010
+ /**
1011
+ * Construct a `KnowledgeBase` for an HTTP-backed Semiont backend without
1012
+ * spelling out the nested `endpoint` literal. Convenience for tests,
1013
+ * worker bootstraps, and one-off scripts.
20
1014
  *
21
1015
  * ```ts
22
- * import { SemiontClient, HttpTransport, HttpContentTransport } from '@semiont/sdk';
23
- * import { baseUrl } from '@semiont/core';
1016
+ * const kb = httpKb({
1017
+ * id: 'my-watcher',
1018
+ * label: 'My Watcher',
1019
+ * email: 'me@example.com',
1020
+ * host: 'localhost',
1021
+ * port: 4000,
1022
+ * protocol: 'http',
1023
+ * });
1024
+ * ```
1025
+ *
1026
+ * Equivalent to:
24
1027
  *
25
- * const transport = new HttpTransport({ baseUrl: baseUrl('https://kb.example/') });
26
- * // HttpTransport implements both ITransport and IBackendOperations;
27
- * // passing it as the third arg wires `client.auth` and `client.admin`.
28
- * const client = new SemiontClient(transport, new HttpContentTransport(transport), transport);
1028
+ * ```ts
1029
+ * const kb: KnowledgeBase = {
1030
+ * id, label, email,
1031
+ * endpoint: { kind: 'http', host, port, protocol },
1032
+ * };
29
1033
  * ```
1034
+ *
1035
+ * UI hosts that have a structured form (host / port / protocol pickers)
1036
+ * already construct the literal directly — they don't need this helper.
1037
+ * Local-endpoint KBs construct the literal directly too; the local
1038
+ * endpoint shape (`{ kind: 'local', kbId }`) is one line and doesn't
1039
+ * earn a helper.
30
1040
  */
31
- export * from './client';
32
- export { StreamObservable, CacheObservable, UploadObservable, type UploadProgress } from './awaitable';
33
- export { busRequest, BusRequestError, type BusRequestErrorCode, type BusRequestPrimitive, } from './bus-request';
34
- export { FrameNamespace } from './namespaces/frame';
35
- export { BrowseNamespace } from './namespaces/browse';
36
- export { MarkNamespace } from './namespaces/mark';
37
- export { BindNamespace } from './namespaces/bind';
38
- export { GatherNamespace } from './namespaces/gather';
39
- export { MatchNamespace } from './namespaces/match';
40
- export { YieldNamespace } from './namespaces/yield';
41
- export { BeckonNamespace } from './namespaces/beckon';
42
- export { JobNamespace } from './namespaces/job';
43
- export { AuthNamespace } from './namespaces/auth';
44
- export { AdminNamespace } from './namespaces/admin';
45
- export type * from './namespaces/types';
46
- export type { Logger, AccessToken, AnnotationId, BaseUrl, RefreshToken, ResourceId, UserId, Annotation, BodyItem, BodyOperation, EntityType, EventMap, GatheredContext, Motivation, ResourceDescriptor, TagCategory, TagSchema, ConnectionState, IContentTransport, ITransport, } from '@semiont/core';
47
- export { accessToken, annotationId, baseUrl, entityType, refreshToken, resourceId, userId, SemiontError, } from '@semiont/core';
48
- export { SemiontSession, type SemiontSessionConfig, type UserInfo } from './session/semiont-session';
49
- export { SemiontBrowser, type SemiontBrowserConfig } from './session/semiont-browser';
50
- export type { SessionFactory, SessionFactoryOptions } from './session/session-factory';
51
- export { createHttpSessionFactory } from './session/http-session-factory';
52
- export { SessionSignals } from './session/session-signals';
53
- export { SemiontSessionError, type SemiontSessionErrorCode } from './session/errors';
54
- export { getBrowser, type GetBrowserOptions } from './session/registry';
55
- export { type SessionStorage, InMemorySessionStorage, } from './session/session-storage';
56
- export { type KnowledgeBase, type KbEndpoint, type HttpEndpoint, type LocalEndpoint, type NewKnowledgeBase, type KbSessionStatus, httpKb, } from './session/knowledge-base';
57
- export { type OpenResource } from './session/open-resource';
58
- export { defaultProtocol, isValidHostname, kbBackendUrl, setStoredSession, type StoredSession, } from './session/storage';
59
- export * from './state';
60
- export { firstValueFrom, lastValueFrom } from 'rxjs';
61
- //# sourceMappingURL=index.d.ts.map
1041
+ declare function httpKb(opts: {
1042
+ id: string;
1043
+ label: string;
1044
+ email: string;
1045
+ host: string;
1046
+ port: number;
1047
+ protocol: 'http' | 'https';
1048
+ gitBranch?: string;
1049
+ }): KnowledgeBase;
1050
+
1051
+ /**
1052
+ * Session-level error surface. Emitted on `SemiontBrowser.error$` for
1053
+ * failures that make the session itself unusable (auth failed, actor
1054
+ * couldn't start, token refresh terminally exhausted). Per-request
1055
+ * errors stay with the caller as normal Promise rejections.
1056
+ *
1057
+ * `SemiontSessionError` extends `SemiontError` (the unified Semiont base)
1058
+ * so consumers can catch with `instanceof SemiontError` for any error
1059
+ * surfaced through the SDK.
1060
+ */
1061
+
1062
+ type SemiontSessionErrorCode = 'session.construct-failed' | 'session.auth-failed' | 'session.refresh-exhausted' | 'browser.sign-in-failed';
1063
+ declare class SemiontSessionError extends SemiontError {
1064
+ code: SemiontSessionErrorCode;
1065
+ readonly kbId: string | null;
1066
+ constructor(code: SemiontSessionErrorCode, message: string, kbId?: string | null);
1067
+ }
1068
+
1069
+ /**
1070
+ * SessionStorage environment-agnostic persistence adapter for the
1071
+ * Semiont session layer. Decouples `SemiontSession` / `SemiontBrowser`
1072
+ * from `localStorage` / `window` so the same classes can run in a
1073
+ * browser, a CLI process, or tests without environment guards.
1074
+ *
1075
+ * Implementations shipped here:
1076
+ * - `InMemorySessionStorage` — map-backed, for tests.
1077
+ *
1078
+ * Browser-backed (`WebBrowserStorage`) lives in `@semiont/react-ui`
1079
+ * because it touches browser-only globals.
1080
+ */
1081
+ /** String key/value store with optional cross-context change subscription. */
1082
+ interface SessionStorage {
1083
+ /** Read a string value; null if absent. */
1084
+ get(key: string): string | null;
1085
+ /** Write a string value. */
1086
+ set(key: string, value: string): void;
1087
+ /** Remove a key. No-op if absent. */
1088
+ delete(key: string): void;
1089
+ /**
1090
+ * Optional: subscribe to external changes (cross-tab, cross-process).
1091
+ * Browser implements via the `storage` event; filesystem would use
1092
+ * fs.watch; in-memory omits this method. Returns an unsubscribe
1093
+ * callback. If omitted, cross-context sync simply isn't available
1094
+ * in that environment — the session still works correctly within a
1095
+ * single process.
1096
+ */
1097
+ subscribe?(handler: (key: string, newValue: string | null) => void): () => void;
1098
+ }
1099
+ /**
1100
+ * Map-backed `SessionStorage`. Cross-context sync is not implemented;
1101
+ * tests that need it can drive it manually.
1102
+ */
1103
+ declare class InMemorySessionStorage implements SessionStorage {
1104
+ private readonly map;
1105
+ get(key: string): string | null;
1106
+ set(key: string, value: string): void;
1107
+ delete(key: string): void;
1108
+ }
1109
+
1110
+ /**
1111
+ * SemiontSession — per-backend session lifetime object. Owns the
1112
+ * SemiontClient, the access token BehaviorSubject, and optionally
1113
+ * an authenticated user. One SemiontSession exists per active backend
1114
+ * connection; lifetime is decoupled from React mount lifetime.
1115
+ *
1116
+ * Headless by design. Runs in browsers, CLIs, workers, and tests.
1117
+ * UI-specific state (session-expired/permission-denied modals) lives
1118
+ * in `SessionSignals`, which wraps a session — the session
1119
+ * itself has no modal observables, no user-facing notifications.
1120
+ *
1121
+ * Auth is parameterized via callbacks passed at construction:
1122
+ *
1123
+ * - `refresh()` — invoked on 401 / proactive re-auth. Returns the
1124
+ * new access token, or null on failure. The frontend passes a
1125
+ * closure that runs the refresh-token flow; the worker passes
1126
+ * one that exchanges the shared secret.
1127
+ *
1128
+ * - `validate(token)` — optional. If provided, the session calls
1129
+ * it once at startup with the stored token to confirm it's
1130
+ * still good and populate `user$`. Frontend passes `getMe`;
1131
+ * worker omits this (service principals have no user record).
1132
+ *
1133
+ * - `onAuthFailed(message)` — optional. Invoked when refresh
1134
+ * terminally fails (expired token, no recovery possible). UI hosts
1135
+ * typically wire this to `SessionSignals.notifySessionExpired` so a
1136
+ * modal surfaces; headless consumers typically just log.
1137
+ *
1138
+ * Persistence goes through a `SessionStorage` adapter provided at
1139
+ * construction — the session never touches `localStorage` or `window`
1140
+ * directly.
1141
+ */
1142
+
1143
+ type UserInfo = components['schemas']['UserResponse'];
1144
+ interface SemiontSessionConfig {
1145
+ kb: KnowledgeBase;
1146
+ /** Persistence adapter. Reads/writes tokens via this. */
1147
+ storage: SessionStorage;
1148
+ /**
1149
+ * Pre-built api client. The session does not construct it — caller
1150
+ * builds the transport stack and passes the client in. This is the
1151
+ * seam where consumers swap one `ITransport` implementation for
1152
+ * another (HTTP, in-process, etc.).
1153
+ */
1154
+ client: SemiontClient;
1155
+ /**
1156
+ * Token observable shared with the transport. Caller must pass the
1157
+ * SAME instance to both the transport (via `HttpTransport` config)
1158
+ * and the session. The session writes refreshed tokens here; the
1159
+ * transport reads from here.
1160
+ */
1161
+ token$: BehaviorSubject<AccessToken | null>;
1162
+ /**
1163
+ * Re-authenticate after expiry / 401. Returns a new access token
1164
+ * (no "Bearer " prefix) on success, or null if recovery is
1165
+ * impossible. Omit for transports where tokens don't apply.
1166
+ */
1167
+ refresh?: () => Promise<string | null>;
1168
+ /**
1169
+ * Validate the stored token at startup and populate `user$`. Omit
1170
+ * for service-principal sessions (worker, CLI tools) where there
1171
+ * is no user record to fetch.
1172
+ */
1173
+ validate?: (token: AccessToken) => Promise<UserInfo | null>;
1174
+ /**
1175
+ * Invoked when refresh terminally fails. Frontend consumers wire
1176
+ * this to a UI signal that surfaces the session-expired modal.
1177
+ */
1178
+ onAuthFailed?: (message: string | null) => void;
1179
+ /** Called for session-level failures (auth, refresh exhaustion). */
1180
+ onError?: (err: SemiontSessionError) => void;
1181
+ }
1182
+ declare class SemiontSession {
1183
+ readonly kb: KnowledgeBase;
1184
+ readonly client: SemiontClient;
1185
+ readonly token$: BehaviorSubject<AccessToken | null>;
1186
+ readonly user$: BehaviorSubject<UserInfo | null>;
1187
+ readonly streamState$: Observable<ConnectionState>;
1188
+ /**
1189
+ * Stream of `SemiontError` instances surfaced by the underlying transport
1190
+ * just before they're thrown to the caller. For `HttpTransport` this is
1191
+ * an `APIError` (status-coded); other transports emit their own subclass.
1192
+ * Surfaced here so a host layer (e.g. `SemiontBrowser`) can route by
1193
+ * `err.code` to global notifications without every call site handling
1194
+ * errors itself. Headless consumers can subscribe for logging.
1195
+ *
1196
+ * Re-published from `client.transport.errors$` per the `ITransport`
1197
+ * contract — the session is purely a passthrough.
1198
+ */
1199
+ readonly errors$: Observable<SemiontError>;
1200
+ /** Resolves after the initial validation round-trip completes (success or failure). */
1201
+ readonly ready: Promise<void>;
1202
+ private readonly storage;
1203
+ private readonly doRefresh?;
1204
+ private readonly doValidate?;
1205
+ private readonly onAuthFailed;
1206
+ private readonly onError;
1207
+ private refreshTimer;
1208
+ private unsubscribeStorage;
1209
+ private disposed;
1210
+ constructor(config: SemiontSessionConfig);
1211
+ /**
1212
+ * Run the initial mount-time validation. If a stored access token is
1213
+ * present and unexpired, call the configured `validate` with it to
1214
+ * confirm it still works and populate `user$`. If expired, try
1215
+ * refresh first. On 401 from validate, try refresh once. Surfaces
1216
+ * auth-failed on terminal failure.
1217
+ *
1218
+ * When no `validate` callback is provided (service principals), this
1219
+ * still runs through the refresh-if-expired step so the stored
1220
+ * token is current — it just skips the user-validation round trip.
1221
+ */
1222
+ private validate;
1223
+ /**
1224
+ * Refresh the access token via the configured `refresh` callback.
1225
+ * On success, pushes the new token into `token$` and schedules the
1226
+ * next proactive refresh. On failure, clears persisted state and
1227
+ * fires `onAuthFailed` — the frontend's wiring of that callback is
1228
+ * what surfaces the session-expired modal.
1229
+ */
1230
+ refresh(): Promise<AccessToken | null>;
1231
+ private scheduleProactiveRefresh;
1232
+ private clearRefreshTimer;
1233
+ /**
1234
+ * Cross-context sync: another tab/process refreshed or signed out this
1235
+ * KB. Mirror the change into our in-memory state.
1236
+ */
1237
+ private handleStorageChange;
1238
+ get expiresAt(): Date | null;
1239
+ /**
1240
+ * Subscribe to a session-bus channel. The single sanctioned escape hatch
1241
+ * for generic-channel subscription (the case `useEventSubscription` needs
1242
+ * — channel name is a hook parameter, not known statically). All other
1243
+ * consumers must call typed namespace methods (e.g. `session.client.mark.archive(...)`).
1244
+ *
1245
+ * @returns disposer that unsubscribes the handler.
1246
+ */
1247
+ subscribe<K extends keyof EventMap>(channel: K, handler: (payload: EventMap[K]) => void): () => void;
1248
+ dispose(): Promise<void>;
1249
+ /**
1250
+ * Convenience factory for the default HTTP setup. Constructs the
1251
+ * shared `BehaviorSubject<AccessToken | null>`, an `HttpTransport`,
1252
+ * an `HttpContentTransport`, and a `SemiontClient`, then wires
1253
+ * the session over them. Removes the load-bearing
1254
+ * "same-token$-instance" invariant from the caller's hands.
1255
+ *
1256
+ * Strings are accepted for `baseUrl` and `token`; they are branded
1257
+ * via `baseUrl()` / `accessToken()` from `@semiont/core` automatically.
1258
+ *
1259
+ * The remaining options (`refresh`, `validate`, `onAuthFailed`,
1260
+ * `onError`) match `SemiontSessionConfig` exactly.
1261
+ */
1262
+ static fromHttp(opts: {
1263
+ kb: KnowledgeBase;
1264
+ storage: SessionStorage;
1265
+ baseUrl: BaseUrl | string;
1266
+ token?: AccessToken | string | null;
1267
+ refresh?: () => Promise<string | null>;
1268
+ validate?: (token: AccessToken) => Promise<UserInfo | null>;
1269
+ onAuthFailed?: (message: string | null) => void;
1270
+ onError?: (err: SemiontSessionError) => void;
1271
+ }): SemiontSession;
1272
+ /**
1273
+ * Async factory for the credentials-first long-running script case.
1274
+ * Builds the HTTP transport stack, calls `auth.password(email,
1275
+ * password)` to acquire access + refresh tokens, persists them via
1276
+ * the storage adapter, wires a default `refresh` callback that
1277
+ * exchanges the refresh token via `auth.refresh(...)`, and returns
1278
+ * the ready session.
1279
+ *
1280
+ * The consumer-supplied `refresh` callback becomes optional — only
1281
+ * needed for non-standard refresh flows (worker-pool shared secret,
1282
+ * OAuth refresh-token grant, interactive re-prompt). The default
1283
+ * uses the refresh token returned by `auth.password`.
1284
+ *
1285
+ * `kb` is required and must be a full `KnowledgeBase`. The `id` field
1286
+ * is the storage key for this session — distinct scripts sharing the
1287
+ * same `SessionStorage` instance must use distinct ids to avoid
1288
+ * trampling each other's tokens. The factory does not synthesize a
1289
+ * default; the consumer makes the choice.
1290
+ *
1291
+ * Named `signInHttp` because email+password authentication is
1292
+ * inherently an HTTP-shaped operation in the current backend; an
1293
+ * in-process `LocalTransport` doesn't have a credentials login
1294
+ * path. Non-HTTP transports construct the session directly from
1295
+ * their package's transport instance.
1296
+ *
1297
+ * Throws on auth failure with no resources leaked. On success, the
1298
+ * returned session's `ready` promise has already resolved.
1299
+ */
1300
+ static signInHttp(opts: {
1301
+ kb: KnowledgeBase;
1302
+ storage: SessionStorage;
1303
+ baseUrl: BaseUrl | string;
1304
+ email: string;
1305
+ password: string;
1306
+ validate?: (token: AccessToken) => Promise<UserInfo | null>;
1307
+ onAuthFailed?: (message: string | null) => void;
1308
+ onError?: (err: SemiontSessionError) => void;
1309
+ }): Promise<SemiontSession>;
1310
+ }
1311
+
1312
+ /**
1313
+ * OpenResource — a single entry in the open-resources list (tabs).
1314
+ *
1315
+ * The list itself lives on `SemiontBrowser.openResources$`. The CRUD
1316
+ * methods (`addOpenResource`, `removeOpenResource`, `updateOpenResourceName`,
1317
+ * `reorderOpenResources`) live on `SemiontBrowser` too.
1318
+ */
1319
+ interface OpenResource {
1320
+ /** Unique identifier for the resource */
1321
+ id: string;
1322
+ /** Display name of the resource */
1323
+ name: string;
1324
+ /** Timestamp when the resource was opened */
1325
+ openedAt: number;
1326
+ /** Order/position for manual sorting (optional for backward compatibility) */
1327
+ order?: number;
1328
+ /** Media type for icon display (e.g., 'application/pdf', 'text/plain') */
1329
+ mediaType?: string;
1330
+ /** Working-tree URI (e.g. "file://docs/overview.md") — used as tooltip in navigation */
1331
+ storageUri?: string;
1332
+ }
1333
+
1334
+ /**
1335
+ * SessionSignals — UI-facing notification state that belongs to the host
1336
+ * surface, not to the session itself.
1337
+ *
1338
+ * `SemiontSession` is a headless per-backend client + token + user
1339
+ * holder. It can run in any process: browser, worker, CLI, test. But
1340
+ * the session-expired / permission-denied *notifications* are inherently
1341
+ * a UI-host concern. Keeping those observables on `SemiontSession` meant
1342
+ * workers and CLIs carried four dead BehaviorSubjects that nothing would
1343
+ * ever fire.
1344
+ *
1345
+ * `SessionSignals` owns the notification state and has no hard reference
1346
+ * to a session. A UI host (e.g. `SemiontBrowser`) constructs one alongside
1347
+ * every active session and wires:
1348
+ *
1349
+ * - `session.onAuthFailed` → `signals.notifySessionExpired` so
1350
+ * proactive-refresh failures surface as a notification
1351
+ *
1352
+ * UI consumers that need to render modal/banner state subscribe here;
1353
+ * consumers that need bus/HTTP access continue to subscribe to the session.
1354
+ *
1355
+ * Session auth-state cleanup (clearing token, clearing storage) is
1356
+ * the session's own responsibility inside `refresh()` — by the time
1357
+ * `notifySessionExpired` runs, the session has already torn down.
1358
+ * Signals only surfaces the notification.
1359
+ */
1360
+
1361
+ declare class SessionSignals {
1362
+ readonly sessionExpiredAt$: BehaviorSubject<number | null>;
1363
+ readonly sessionExpiredMessage$: BehaviorSubject<string | null>;
1364
+ readonly permissionDeniedAt$: BehaviorSubject<number | null>;
1365
+ readonly permissionDeniedMessage$: BehaviorSubject<string | null>;
1366
+ constructor();
1367
+ notifySessionExpired(message: string | null): void;
1368
+ notifyPermissionDenied(message: string | null): void;
1369
+ acknowledgeSessionExpired(): void;
1370
+ acknowledgePermissionDenied(): void;
1371
+ dispose(): void;
1372
+ }
1373
+
1374
+ /**
1375
+ * SessionFactory — the injection point that lets `SemiontBrowser` stay
1376
+ * transport-agnostic.
1377
+ *
1378
+ * The browser knows how to manage the *lifecycle* of an active session
1379
+ * (track it in `activeSession$`, dispose on KB switch, serialize
1380
+ * overlapping activations) but does not know how to *construct* one —
1381
+ * because that's where transport choice lives. The construction step
1382
+ * is parameterized via this factory.
1383
+ *
1384
+ * The HTTP factory is provided by `createHttpSessionFactory`. A
1385
+ * future in-process variant from `@semiont/make-meaning` would expose
1386
+ * its own factory.
1387
+ */
1388
+
1389
+ interface SessionFactoryOptions {
1390
+ /** The KB the session is being constructed for. */
1391
+ kb: KnowledgeBase;
1392
+ /** Persistence adapter — same one the browser uses. */
1393
+ storage: SessionStorage;
1394
+ /** Modal-signal sink for auth-failed / permission-denied notifications. */
1395
+ signals: SessionSignals;
1396
+ /** Receives session-level errors (auth-failed, refresh-exhausted, ...). */
1397
+ onError: (err: SemiontSessionError) => void;
1398
+ }
1399
+ type SessionFactory = (opts: SessionFactoryOptions) => SemiontSession;
1400
+
1401
+ /**
1402
+ * SemiontBrowser — top-level app-facing container for non-KB state.
1403
+ *
1404
+ * Holds the list of configured KBs, the active KB selection, the active
1405
+ * SemiontSession, the identity token, the open-resources list, and a
1406
+ * session-level error stream. Held as a process-wide instance for the
1407
+ * host's lifetime — see `getBrowser()` in `registry.ts` for the canonical
1408
+ * accessor.
1409
+ *
1410
+ * Transport-agnostic: the browser orchestrates session *lifecycle* but
1411
+ * delegates session *construction* to a `SessionFactory` injected at
1412
+ * construction. HTTP-backed apps pass `createHttpSessionFactory()` from
1413
+ * `@semiont/sdk`; in-process apps pass their own factory.
1414
+ *
1415
+ * Persistence goes through a `SessionStorage` adapter provided at
1416
+ * construction — the browser never touches `localStorage` or `window`
1417
+ * directly.
1418
+ */
1419
+
1420
+ interface SemiontBrowserConfig {
1421
+ /** Persistence adapter. The browser reads/writes all persisted state via this. */
1422
+ storage: SessionStorage;
1423
+ /**
1424
+ * Builds a `SemiontSession` for a KB. The browser is transport-
1425
+ * agnostic — every HTTP-vs-local construction concern lives in the
1426
+ * factory. HTTP-backed apps pass `createHttpSessionFactory()` from
1427
+ * `@semiont/sdk`; a future in-process variant from `@semiont/make-meaning`
1428
+ * would expose its own factory.
1429
+ */
1430
+ sessionFactory: SessionFactory;
1431
+ }
1432
+ declare class SemiontBrowser {
1433
+ readonly kbs$: BehaviorSubject<KnowledgeBase[]>;
1434
+ readonly activeKbId$: BehaviorSubject<string | null>;
1435
+ readonly activeSession$: BehaviorSubject<SemiontSession | null>;
1436
+ /**
1437
+ * Modal signals (session-expired / permission-denied) for the
1438
+ * currently-active session. Parallels `activeSession$` — always
1439
+ * non-null when `activeSession$` is non-null, always null when it
1440
+ * is. Extracted from the session itself so headless sessions
1441
+ * (workers, CLIs, tests) don't carry dead modal observables.
1442
+ * See [SessionSignals](./session-signals.ts).
1443
+ */
1444
+ readonly activeSignals$: BehaviorSubject<SessionSignals | null>;
1445
+ /**
1446
+ * True while a session is actively being constructed (setActiveKb /
1447
+ * signIn in flight, awaiting `session.ready`). Distinguishes the
1448
+ * "session about to arrive" intermediate state from "session
1449
+ * intentionally null" (after signOut, or when the active KB has no
1450
+ * stored credentials). UIs that want a loading spinner should gate
1451
+ * on this; otherwise they get stuck spinning after every signOut.
1452
+ */
1453
+ readonly sessionActivating$: BehaviorSubject<boolean>;
1454
+ readonly openResources$: BehaviorSubject<OpenResource[]>;
1455
+ readonly error$: Subject<SemiontSessionError>;
1456
+ readonly identityToken$: BehaviorSubject<string | null>;
1457
+ private readonly storage;
1458
+ private readonly sessionFactory;
1459
+ /**
1460
+ * App-scoped EventBus. Hosts UI-shell events that must work regardless
1461
+ * of whether a KB session is active: panel toggles, sidebar state,
1462
+ * tab reorders, routing, settings, etc. Disjoint from the per-session
1463
+ * bus inside `SemiontClient`, which carries KB-content events
1464
+ * (mark:*, beckon:*, gather:*, match:*, bind:*, yield:*, browse:click).
1465
+ */
1466
+ private readonly eventBus;
1467
+ private unsubscribeStorage;
1468
+ private disposed;
1469
+ private activating;
1470
+ constructor(config: SemiontBrowserConfig);
1471
+ /** Emit an event on the browser's app-scoped bus. */
1472
+ emit<K extends keyof EventMap>(channel: K, payload: EventMap[K]): void;
1473
+ /** Subscribe to an event; returns unsubscribe. */
1474
+ on<K extends keyof EventMap>(channel: K, handler: (payload: EventMap[K]) => void): () => void;
1475
+ /** Read-only observable for an app-scoped channel. */
1476
+ stream<K extends keyof EventMap>(channel: K): Observable<EventMap[K]>;
1477
+ /**
1478
+ * Set the app-level identity token. Sourced from whatever the host
1479
+ * environment uses for OAuth sessions (e.g. NextAuth in a browser app).
1480
+ * Should be called once from the host's startup-and-on-change site;
1481
+ * no other code should write to this slot.
1482
+ */
1483
+ setIdentityToken(token: string | null): void;
1484
+ addKb(input: NewKnowledgeBase, access: string, refresh: string): KnowledgeBase;
1485
+ removeKb(id: string): void;
1486
+ /**
1487
+ * Patch a KB in the list. Restricted to the common, endpoint-agnostic
1488
+ * fields (`label`, `email`, `gitBranch`) — the `endpoint` shape isn't
1489
+ * editable in place; remove and re-add to change the connection
1490
+ * target.
1491
+ */
1492
+ updateKb(id: string, updates: {
1493
+ label?: string;
1494
+ email?: string;
1495
+ gitBranch?: string;
1496
+ }): void;
1497
+ /**
1498
+ * Read the locally-stored credential status for a KB. Pure / synchronous —
1499
+ * does not subscribe to context changes. Used by KB-list UI to color status
1500
+ * dots without requiring re-renders on every tick.
1501
+ */
1502
+ getKbSessionStatus(kbId: string): KbSessionStatus;
1503
+ /**
1504
+ * Switch the active KB. Follows the D2 disposal contract:
1505
+ * 1. Synchronously announce the new id on `activeKbId$` and null out
1506
+ * `activeSession$` so views see a safe empty state first.
1507
+ * 2. Serialize overlapping calls — if an activation is in flight, wait
1508
+ * for it before proceeding.
1509
+ * 3. Dispose whatever session is currently live.
1510
+ * 4. Construct the next session and await `session.ready`.
1511
+ * 5. Before emitting, re-check `activeKbId$` — if a newer call superseded
1512
+ * us while we waited, dispose our session and skip the emit.
1513
+ * 6. Emit the new session.
1514
+ */
1515
+ setActiveKb(id: string | null): Promise<void>;
1516
+ /**
1517
+ * Sign in to an existing KB: store the tokens and (re)activate the
1518
+ * session. If the KB is already active, the current session is disposed
1519
+ * and replaced so the new tokens take effect.
1520
+ */
1521
+ signIn(id: string, access: string, refresh: string): Promise<void>;
1522
+ /**
1523
+ * Sign out of a KB: clear stored tokens. If the KB is active, dispose
1524
+ * its session + signals and emit null for both.
1525
+ */
1526
+ signOut(id: string): Promise<void>;
1527
+ addOpenResource(id: string, name: string, mediaType?: string, storageUri?: string): void;
1528
+ removeOpenResource(id: string): void;
1529
+ updateOpenResourceName(id: string, name: string): void;
1530
+ reorderOpenResources(oldIndex: number, newIndex: number): void;
1531
+ dispose(): Promise<void>;
1532
+ }
1533
+
1534
+ /**
1535
+ * createHttpSessionFactory — the default `SessionFactory` for HTTP-backed
1536
+ * KBs. Owns every HTTP-specific construction concern that used to live in
1537
+ * `SemiontBrowser`: building `HttpTransport`/`HttpContentTransport`,
1538
+ * wiring the `tokenRefresher` callback, deduplicating concurrent 401
1539
+ * refresh round trips, and invoking the auth endpoints for token refresh
1540
+ * and user-validate.
1541
+ *
1542
+ * Returned as a closure so a single `inFlightRefreshes` map is shared
1543
+ * across every session this factory builds — the dedup is meaningful
1544
+ * across concurrent session reactivations for the same KB id.
1545
+ */
1546
+
1547
+ declare function createHttpSessionFactory(): SessionFactory;
1548
+
1549
+ /**
1550
+ * Process-wide accessor for `SemiontBrowser`. Constructed lazily on the
1551
+ * first `getBrowser()` call and held for the host's lifetime — a single
1552
+ * instance owns the KB list, identity token, and active-session state,
1553
+ * so callers throughout the host get the same view of "which KB am I
1554
+ * talking to right now" regardless of where they pick it up.
1555
+ *
1556
+ * The caller provides a `SessionStorage` implementation and a
1557
+ * `SessionFactory` — both are environment-specific (browsers use
1558
+ * `WebBrowserStorage` + `createHttpSessionFactory()`, CLI/embedded
1559
+ * hosts use a filesystem adapter and possibly a local-process
1560
+ * factory, tests use `InMemorySessionStorage` and stubs). The first
1561
+ * call to `getBrowser` wins; subsequent calls return the cached
1562
+ * instance regardless of the options passed.
1563
+ */
1564
+
1565
+ interface GetBrowserOptions {
1566
+ /** Persistence adapter used to construct the singleton on first call. */
1567
+ storage: SessionStorage;
1568
+ /** Session factory used to build a `SemiontSession` per active KB. */
1569
+ sessionFactory: SessionFactory;
1570
+ }
1571
+ declare function getBrowser(options: GetBrowserOptions): SemiontBrowser;
1572
+
1573
+ /**
1574
+ * Pure helpers and storage-adapter-driven loaders for the Semiont
1575
+ * session layer.
1576
+ *
1577
+ * Contains:
1578
+ * - Storage key shape (constants, `sessionKey(kbId)`)
1579
+ * - JWT expiry parsing and "is expired" check
1580
+ * - URL/protocol helpers for KB instances
1581
+ * - Loaders/savers that take a `SessionStorage` and operate over it
1582
+ * (no direct `localStorage` access)
1583
+ *
1584
+ * No React imports, no module-scoped state, no side effects beyond
1585
+ * whatever the passed-in `SessionStorage` does.
1586
+ */
1587
+
1588
+ /** The shape persisted per KB. */
1589
+ interface StoredSession {
1590
+ access: string;
1591
+ refresh: string;
1592
+ }
1593
+ declare function setStoredSession(storage: SessionStorage, kbId: string, session: StoredSession): void;
1594
+ declare function defaultProtocol(host: string): 'http' | 'https';
1595
+ declare function isValidHostname(host: string): boolean;
1596
+ /**
1597
+ * Build the wire URL for an HTTP KB endpoint. HTTP-shaped helper —
1598
+ * lives next to the KB list machinery because the frontend Panel needs
1599
+ * it for the auth round-trip when adding a KB. Code that holds a
1600
+ * uniform `KnowledgeBase` should not call this; it should hand the KB
1601
+ * to a transport factory and let the factory inspect `endpoint.kind`.
1602
+ */
1603
+ declare function kbBackendUrl(endpoint: HttpEndpoint): string;
1604
+
1605
+ /**
1606
+ * Marker for the state-unit pattern: a stateful, lifecycled object with an
1607
+ * RxJS-shaped public surface, constructed by a factory function
1608
+ * (`createFooStateUnit`), with internal state held in a closure.
1609
+ *
1610
+ * The structural contract is `dispose()` — the rest of the pattern
1611
+ * (closure-based identity, Observable public surface, internal Subjects
1612
+ * exposed as `.asObservable()` views, no leaked subscriptions, composition
1613
+ * by parameter rather than ownership) is convention enforced by review,
1614
+ * not the type system.
1615
+ *
1616
+ * See `packages/sdk/docs/STATE-UNITS.md` for the full axioms and rationale.
1617
+ */
1618
+ interface StateUnit {
1619
+ /**
1620
+ * Idempotent, total teardown. Completes every Subject the unit owns,
1621
+ * unsubscribes every internal subscription, releases timers / abort
1622
+ * controllers / network handles. Safe to call multiple times — the
1623
+ * second call is a no-op.
1624
+ */
1625
+ dispose(): void;
1626
+ }
1627
+ /**
1628
+ * Compose multiple disposers into a single `dispose()` call. Accepts either
1629
+ * a `StateUnit` (whose `dispose()` will be invoked) or a plain teardown
1630
+ * function. The returned object is itself disposable; call its `dispose()`
1631
+ * once to tear down everything that was added.
1632
+ */
1633
+ declare function createDisposer(): {
1634
+ add(item: StateUnit | (() => void)): void;
1635
+ dispose(): void;
1636
+ };
1637
+
1638
+ /**
1639
+ * createSearchPipeline
1640
+ *
1641
+ * A debounced-search RxJS pipeline factory. Combines an input Subject with a
1642
+ * downstream fetch function and emits typed `{ results, isSearching }` state.
1643
+ *
1644
+ * Designed to be created once per consumer instance and held for its lifetime
1645
+ * (e.g. by a view layer's lazy initializer), then observed via `state$`. The
1646
+ * pipeline is pure RxJS — unit-testable without any view-layer dependency.
1647
+ *
1648
+ * The fetch function is expected to return `Observable<T[] | undefined>`,
1649
+ * matching the cache-miss-then-data shape of `BrowseNamespace` Observables:
1650
+ * `undefined` means "fetch in flight, no value yet"; an array means "data
1651
+ * available (possibly empty)".
1652
+ */
1653
+
1654
+ interface SearchState<T> {
1655
+ results: T[];
1656
+ isSearching: boolean;
1657
+ }
1658
+ interface SearchPipeline<T> {
1659
+ /** Latest query string. Bind to a controlled input. */
1660
+ query$: Observable<string>;
1661
+ /** Latest search state — results plus a loading flag. */
1662
+ state$: Observable<SearchState<T>>;
1663
+ /** Push a new query value. Triggers the debounced fetch. */
1664
+ setQuery(value: string): void;
1665
+ /** Tear down the input Subject. Call from the consumer's cleanup hook. */
1666
+ dispose(): void;
1667
+ }
1668
+ interface SearchPipelineOptions {
1669
+ /** Milliseconds to wait after the last keystroke before fetching. Default 250. */
1670
+ debounceMs?: number;
1671
+ /** Initial query value. Useful for modals that open with a pre-filled term. */
1672
+ initialQuery?: string;
1673
+ }
1674
+ declare function createSearchPipeline<T>(fetch: (query: string) => Observable<T[] | undefined>, options?: SearchPipelineOptions): SearchPipeline<T>;
1675
+
1676
+ /**
1677
+ * WorkerBus — minimal channel-bus surface that worker-side adapters
1678
+ * (e.g. `JobClaimAdapter` in `@semiont/jobs`, `SmelterActorStateUnit` in
1679
+ * `@semiont/make-meaning`) need.
1680
+ *
1681
+ * Transport-neutral by design. HTTP `ActorStateUnit` (from `@semiont/api-client`)
1682
+ * satisfies it directly; an in-process worker can pass a small shim around
1683
+ * an `EventBus` with a `() => Promise<void>` `emit` that calls into the
1684
+ * actor system.
1685
+ *
1686
+ * `addChannels` is optional because in-process buses receive every emit
1687
+ * implicitly — only HTTP needs to widen its SSE subscription set to
1688
+ * include worker-only channels (`job:queued`, `yield:created`, etc.).
1689
+ */
1690
+
1691
+ interface WorkerBus {
1692
+ on$<T = Record<string, unknown>>(channel: string): Observable<T>;
1693
+ emit(channel: string, payload: Record<string, unknown>): Promise<void>;
1694
+ addChannels?(channels: readonly string[]): void;
1695
+ }
1696
+
1697
+ interface BeckonStateUnit extends StateUnit {
1698
+ hoveredAnnotationId$: Observable<AnnotationId | null>;
1699
+ hover(annotationId: AnnotationId | null): void;
1700
+ focus(annotationId: AnnotationId): void;
1701
+ sparkle(annotationId: AnnotationId): void;
1702
+ }
1703
+ declare function createBeckonStateUnit(client: SemiontClient): BeckonStateUnit;
1704
+ /** Default milliseconds the mouse must dwell before beckon:hover is emitted. */
1705
+ declare const HOVER_DELAY_MS = 150;
1706
+ type EmitHover = (annotationId: AnnotationId | null) => void;
1707
+ interface HoverHandlers {
1708
+ handleMouseEnter: (annotationId: AnnotationId) => void;
1709
+ handleMouseLeave: () => void;
1710
+ cleanup: () => void;
1711
+ }
1712
+ declare function createHoverHandlers(emit: EmitHover, delayMs: number): HoverHandlers;
1713
+
1714
+ interface GatherStateUnit extends StateUnit {
1715
+ context$: Observable<GatheredContext | null>;
1716
+ loading$: Observable<boolean>;
1717
+ error$: Observable<Error | null>;
1718
+ annotationId$: Observable<AnnotationId | null>;
1719
+ }
1720
+ declare function createGatherStateUnit(client: SemiontClient, resourceId: ResourceId): GatherStateUnit;
1721
+
1722
+ interface MatchStateUnit extends StateUnit {
1723
+ }
1724
+ declare function createMatchStateUnit(client: SemiontClient, _resourceId: ResourceId): MatchStateUnit;
1725
+
1726
+ type JobProgress$1 = components['schemas']['JobProgress'];
1727
+ interface GenerateDocumentOptions {
1728
+ title: string;
1729
+ storageUri: string;
1730
+ prompt?: string;
1731
+ /** Body locale — language the generated resource is written in. Falls back to the state unit's UI locale when unset. */
1732
+ language?: string;
1733
+ /** Source-resource locale — language of the resource the annotation lives on. Forwarded to the prompt for context-snippet awareness. BCP-47. */
1734
+ sourceLanguage?: string;
1735
+ temperature?: number;
1736
+ maxTokens?: number;
1737
+ context: GatheredContext;
1738
+ }
1739
+ interface YieldStateUnit extends StateUnit {
1740
+ isGenerating$: Observable<boolean>;
1741
+ progress$: Observable<JobProgress$1 | null>;
1742
+ generate(referenceId: string, options: GenerateDocumentOptions): void;
1743
+ }
1744
+ declare function createYieldStateUnit(client: SemiontClient, resourceId: ResourceId, locale: string): YieldStateUnit;
1745
+
1746
+ type JobProgress = components['schemas']['JobProgress'];
1747
+ interface PendingAnnotation {
1748
+ selector: Selector | Selector[];
1749
+ motivation: Motivation;
1750
+ }
1751
+ interface MarkStateUnit extends StateUnit {
1752
+ pendingAnnotation$: Observable<PendingAnnotation | null>;
1753
+ assistingMotivation$: Observable<Motivation | null>;
1754
+ progress$: Observable<JobProgress | null>;
1755
+ }
1756
+ declare function createMarkStateUnit(client: SemiontClient, resourceId: ResourceId): MarkStateUnit;
1757
+
1758
+ export { AdminNamespace, AuthNamespace, BeckonNamespace, BindNamespace, BrowseNamespace, BusRequestError, CacheObservable, FrameNamespace, GatherNamespace, HOVER_DELAY_MS, InMemorySessionStorage, JobNamespace, MarkNamespace, MatchNamespace, SemiontBrowser, SemiontClient, SemiontSession, SemiontSessionError, SessionSignals, StreamObservable, UploadObservable, YieldNamespace, busRequest, createBeckonStateUnit, createDisposer, createGatherStateUnit, createHoverHandlers, createHttpSessionFactory, createMarkStateUnit, createMatchStateUnit, createSearchPipeline, createYieldStateUnit, defaultProtocol, getBrowser, httpKb, isValidHostname, kbBackendUrl, setStoredSession };
1759
+ export type { AnnotationHistoryResponse, BeckonStateUnit, BusRequestErrorCode, BusRequestPrimitive, CreateAnnotationInput, CreateFromTokenOptions, CreateResourceInput, GatherAnnotationProgress, GatherStateUnit, GenerateDocumentOptions, GenerationOptions, GetBrowserOptions, HoverHandlers, HttpEndpoint, KbEndpoint, KbSessionStatus, KnowledgeBase, LocalEndpoint, MarkAssistEvent, MarkAssistOptions, MarkAssistProgress, MarkStateUnit, MatchSearchProgress, MatchStateUnit, NewKnowledgeBase, OpenResource, PendingAnnotation, ReferencedByEntry, RequestContent, ResponseContent, SearchPipeline, SearchPipelineOptions, SearchState, SemiontBrowserConfig, SemiontSessionConfig, SemiontSessionErrorCode, SessionFactory, SessionFactoryOptions, SessionStorage, StateUnit, StoredSession, UploadProgress, User, UserInfo, WorkerBus, YieldGenerationEvent, YieldStateUnit };