@semiont/sdk 0.5.3 → 0.5.4

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/awaitable.d.ts +103 -0
  2. package/dist/awaitable.d.ts.map +1 -0
  3. package/dist/bus-request.d.ts +18 -0
  4. package/dist/bus-request.d.ts.map +1 -0
  5. package/dist/cache.d.ts +57 -0
  6. package/dist/cache.d.ts.map +1 -0
  7. package/dist/client.d.ts +138 -0
  8. package/dist/client.d.ts.map +1 -0
  9. package/dist/index.d.ts +52 -1750
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +0 -1
  12. package/dist/index.js.map +1 -1
  13. package/dist/namespaces/admin.d.ts +27 -0
  14. package/dist/namespaces/admin.d.ts.map +1 -0
  15. package/dist/namespaces/auth.d.ts +26 -0
  16. package/dist/namespaces/auth.d.ts.map +1 -0
  17. package/dist/namespaces/beckon.d.ts +12 -0
  18. package/dist/namespaces/beckon.d.ts.map +1 -0
  19. package/dist/namespaces/bind.d.ts +11 -0
  20. package/dist/namespaces/bind.d.ts.map +1 -0
  21. package/dist/namespaces/browse.d.ts +111 -0
  22. package/dist/namespaces/browse.d.ts.map +1 -0
  23. package/dist/namespaces/frame.d.ts +29 -0
  24. package/dist/namespaces/frame.d.ts.map +1 -0
  25. package/dist/namespaces/gather.d.ts +16 -0
  26. package/dist/namespaces/gather.d.ts.map +1 -0
  27. package/dist/namespaces/job.d.ts +32 -0
  28. package/dist/namespaces/job.d.ts.map +1 -0
  29. package/dist/namespaces/mark.d.ts +27 -0
  30. package/dist/namespaces/mark.d.ts.map +1 -0
  31. package/dist/namespaces/match.d.ts +15 -0
  32. package/dist/namespaces/match.d.ts.map +1 -0
  33. package/dist/namespaces/types.d.ts +438 -0
  34. package/dist/namespaces/types.d.ts.map +1 -0
  35. package/dist/namespaces/yield.d.ts +23 -0
  36. package/dist/namespaces/yield.d.ts.map +1 -0
  37. package/dist/session/errors.d.ts +18 -0
  38. package/dist/session/errors.d.ts.map +1 -0
  39. package/dist/session/http-session-factory.d.ts +15 -0
  40. package/dist/session/http-session-factory.d.ts.map +1 -0
  41. package/dist/session/knowledge-base.d.ts +95 -0
  42. package/dist/session/knowledge-base.d.ts.map +1 -0
  43. package/dist/session/open-resource.d.ts +22 -0
  44. package/dist/session/open-resource.d.ts.map +1 -0
  45. package/dist/session/registry.d.ts +31 -0
  46. package/dist/session/registry.d.ts.map +1 -0
  47. package/dist/session/semiont-browser.d.ts +141 -0
  48. package/dist/session/semiont-browser.d.ts.map +1 -0
  49. package/dist/session/semiont-session.d.ts +210 -0
  50. package/dist/session/semiont-session.d.ts.map +1 -0
  51. package/dist/session/session-factory.d.ts +31 -0
  52. package/dist/session/session-factory.d.ts.map +1 -0
  53. package/dist/session/session-signals.d.ts +40 -0
  54. package/dist/session/session-signals.d.ts.map +1 -0
  55. package/dist/session/session-storage.d.ts +41 -0
  56. package/dist/session/session-storage.d.ts.map +1 -0
  57. package/dist/session/storage.d.ts +52 -0
  58. package/dist/session/storage.d.ts.map +1 -0
  59. package/dist/session/testing.d.ts +7 -0
  60. package/dist/session/testing.d.ts.map +1 -0
  61. package/dist/state/flows/beckon-state-unit.d.ts +22 -0
  62. package/dist/state/flows/beckon-state-unit.d.ts.map +1 -0
  63. package/dist/state/flows/gather-state-unit.d.ts +12 -0
  64. package/dist/state/flows/gather-state-unit.d.ts.map +1 -0
  65. package/dist/state/flows/mark-state-unit.d.ts +17 -0
  66. package/dist/state/flows/mark-state-unit.d.ts.map +1 -0
  67. package/dist/state/flows/match-state-unit.d.ts +7 -0
  68. package/dist/state/flows/match-state-unit.d.ts.map +1 -0
  69. package/dist/state/flows/yield-state-unit.d.ts +25 -0
  70. package/dist/state/flows/yield-state-unit.d.ts.map +1 -0
  71. package/dist/state/index.d.ts +10 -0
  72. package/dist/state/index.d.ts.map +1 -0
  73. package/dist/state/lib/search-pipeline.d.ts +38 -0
  74. package/dist/state/lib/search-pipeline.d.ts.map +1 -0
  75. package/dist/state/lib/state-unit.d.ts +33 -0
  76. package/dist/state/lib/state-unit.d.ts.map +1 -0
  77. package/dist/state/lib/worker-bus.d.ts +21 -0
  78. package/dist/state/lib/worker-bus.d.ts.map +1 -0
  79. package/package.json +3 -3
@@ -0,0 +1,438 @@
1
+ /**
2
+ * Verb Namespace Interfaces
3
+ *
4
+ * These interfaces define the public API of `@semiont/sdk`, organized by
5
+ * the 7 domain flows (Browse, Mark, Bind, Gather, Match, Yield, Beckon)
6
+ * plus infrastructure namespaces (Job, Auth, Admin).
7
+ *
8
+ * Each namespace maps 1:1 to a flow. Each flow maps to a clear actor on
9
+ * the backend. The frontend calls `client.mark.annotation()` and the
10
+ * client handles HTTP, auth, SSE, and caching internally.
11
+ *
12
+ * Return type conventions:
13
+ * - Browse live queries → `CacheObservable<T>` (bus-driven, cached;
14
+ * subscribe yields `T | undefined`, await yields `T` after first load)
15
+ * - Browse one-shot reads → `Promise<T>` (fetch once, no cache)
16
+ * - Commands (mark, bind, yield.resource) → `Promise<T>` (atomic ops)
17
+ * - Long-running ops (gather, match, yield.fromAnnotation, mark.assist)
18
+ * → `StreamObservable<T>` (progress + result; subscribe yields every
19
+ * emit, await yields the last one)
20
+ * - Ephemeral signals (beckon) → `void`
21
+ *
22
+ * `StreamObservable` and `CacheObservable` are `Observable` subclasses
23
+ * that also implement `PromiseLike<T>` — `await client.X.Y(...)` works
24
+ * directly without `lastValueFrom`/`firstValueFrom` wrappers.
25
+ * `.pipe(...)` returns a plain `Observable<T>` (the thenable subclass
26
+ * does not propagate through pipe — by design).
27
+ */
28
+ import type { Observable } from 'rxjs';
29
+ import type { StreamObservable, CacheObservable, UploadObservable } from '../awaitable';
30
+ import type { components, EventMap, paths } from '@semiont/core';
31
+ import type { ResourceId, AnnotationId, BackendDownload, BodyOperation, GraphConnection, JobId, Motivation, GatheredContext, ProgressEvent, TagSchema, UserDID } from '@semiont/core';
32
+ import type { Annotation } from '@semiont/core';
33
+ import type { ResourceDescriptor } from '@semiont/core';
34
+ type StoredEventResponse = components['schemas']['StoredEventResponse'];
35
+ type GatherProgress = components['schemas']['GatherProgress'];
36
+ type MatchSearchResult = components['schemas']['MatchSearchResult'];
37
+ type JobProgress = components['schemas']['JobProgress'];
38
+ type GatherAnnotationComplete = components['schemas']['GatherAnnotationComplete'];
39
+ type JobStatusResponse = components['schemas']['JobStatusResponse'];
40
+ type AuthResponse = components['schemas']['AuthResponse'];
41
+ type TokenRefreshResponse = components['schemas']['TokenRefreshResponse'];
42
+ type OAuthConfigResponse = components['schemas']['OAuthConfigResponse'];
43
+ type AdminUserStatsResponse = components['schemas']['AdminUserStatsResponse'];
44
+ export type ResponseContent<T> = T extends {
45
+ responses: {
46
+ 200: {
47
+ content: {
48
+ 'application/json': infer R;
49
+ };
50
+ };
51
+ };
52
+ } ? R : T extends {
53
+ responses: {
54
+ 201: {
55
+ content: {
56
+ 'application/json': infer R;
57
+ };
58
+ };
59
+ };
60
+ } ? R : T extends {
61
+ responses: {
62
+ 202: {
63
+ content: {
64
+ 'application/json': infer R;
65
+ };
66
+ };
67
+ };
68
+ } ? R : never;
69
+ export type RequestContent<T> = T extends {
70
+ requestBody?: {
71
+ content: {
72
+ 'application/json': infer R;
73
+ };
74
+ };
75
+ } ? R : never;
76
+ /** Input for creating an annotation via mark.annotation() */
77
+ export type CreateAnnotationInput = components['schemas']['CreateAnnotationRequest'];
78
+ /** Input for creating a resource via yield.resource() */
79
+ export interface CreateResourceInput {
80
+ name: string;
81
+ file: File | Buffer;
82
+ format: string;
83
+ entityTypes?: string[];
84
+ language?: string;
85
+ sourceAnnotationId?: string;
86
+ sourceResourceId?: string;
87
+ storageUri: string;
88
+ /** Prompt that drove AI generation (for AI-generated resources). */
89
+ generationPrompt?: string;
90
+ /** Agent(s) that generated the content (for AI-generated resources). */
91
+ generator?: components['schemas']['Agent'] | components['schemas']['Agent'][];
92
+ isDraft?: boolean;
93
+ }
94
+ /** Options for yield.fromAnnotation() */
95
+ export interface GenerationOptions {
96
+ title: string;
97
+ storageUri: string;
98
+ context: GatheredContext;
99
+ prompt?: string;
100
+ /** 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). */
101
+ entityTypes?: string[];
102
+ /** Annotation/resource body locale — language the generated resource is written in (typically the user's UI locale). */
103
+ language?: string;
104
+ /** 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. */
105
+ sourceLanguage?: string;
106
+ temperature?: number;
107
+ maxTokens?: number;
108
+ }
109
+ /** Options for mark.assist() */
110
+ export interface MarkAssistOptions {
111
+ entityTypes?: string[];
112
+ includeDescriptiveReferences?: boolean;
113
+ instructions?: string;
114
+ density?: number;
115
+ tone?: string;
116
+ /** Annotation body locale — language the LLM should write generated body text in (comment text, assessment text, tag/reference body language stamp). BCP-47. */
117
+ language?: string;
118
+ /** Source-resource locale — language of the content being analyzed, used in the prompt so the LLM analyzes non-English source correctly. BCP-47. */
119
+ sourceLanguage?: string;
120
+ schemaId?: string;
121
+ categories?: string[];
122
+ }
123
+ /** Options for yield.createFromToken() */
124
+ export type CreateFromTokenOptions = {
125
+ token: string;
126
+ name: string;
127
+ content: string;
128
+ archiveOriginal?: boolean;
129
+ };
130
+ /** Referenced-by entry from browse.referencedBy() */
131
+ export type ReferencedByEntry = components['schemas']['GetReferencedByResponse']['referencedBy'][number];
132
+ /** Annotation history from browse.annotationHistory() */
133
+ export type AnnotationHistoryResponse = components['schemas']['GetAnnotationHistoryResponse'];
134
+ /** User object from auth/admin responses */
135
+ export type User = AuthResponse['user'];
136
+ /**
137
+ * Progress emitted by gather.annotation() Observable.
138
+ * Emits GatherProgress during assembly, then GatherAnnotationComplete on finish.
139
+ */
140
+ export type GatherAnnotationProgress = GatherProgress | GatherAnnotationComplete;
141
+ /**
142
+ * Progress emitted by match.search() Observable.
143
+ * Emits the final MatchSearchResult (no intermediate progress events currently).
144
+ */
145
+ export type MatchSearchProgress = MatchSearchResult;
146
+ /**
147
+ * Progress payload emitted by mark.assist() and yield.fromAnnotation()
148
+ * Observables. Each progress emission carries a JobProgress snapshot
149
+ * (unified job lifecycle).
150
+ */
151
+ export type MarkAssistProgress = JobProgress;
152
+ /**
153
+ * Discriminated event yielded by the `mark.assist()` Observable. Progress
154
+ * events stream while the worker runs; the final value before the
155
+ * Observable completes is a `complete` event carrying the `JobCompleteCommand`
156
+ * payload (with `result`, `jobId`, `jobType`, etc.). The Observable errors
157
+ * on `job:fail`.
158
+ */
159
+ export type MarkAssistEvent = {
160
+ kind: 'progress';
161
+ data: MarkAssistProgress;
162
+ } | {
163
+ kind: 'complete';
164
+ data: components['schemas']['JobCompleteCommand'];
165
+ };
166
+ /**
167
+ * Discriminated event yielded by the `yield.fromAnnotation()` Observable.
168
+ * Same shape and semantics as `MarkAssistEvent`.
169
+ */
170
+ export type YieldGenerationEvent = {
171
+ kind: 'progress';
172
+ data: JobProgress;
173
+ } | {
174
+ kind: 'complete';
175
+ data: components['schemas']['JobCompleteCommand'];
176
+ };
177
+ /**
178
+ * Browse — reads from materialized views
179
+ *
180
+ * Live queries return Observables that emit initial state and re-emit
181
+ * on bus gateway updates. One-shot reads return Promises.
182
+ *
183
+ * Backend actor: Browser (context classes)
184
+ * Event prefix: browse:*
185
+ */
186
+ export interface BrowseNamespace {
187
+ resource(resourceId: ResourceId): CacheObservable<ResourceDescriptor>;
188
+ resources(filters?: {
189
+ limit?: number;
190
+ archived?: boolean;
191
+ search?: string;
192
+ }): CacheObservable<ResourceDescriptor[]>;
193
+ annotations(resourceId: ResourceId): CacheObservable<Annotation[]>;
194
+ annotation(resourceId: ResourceId, annotationId: AnnotationId): CacheObservable<Annotation>;
195
+ entityTypes(): CacheObservable<string[]>;
196
+ tagSchemas(): CacheObservable<TagSchema[]>;
197
+ referencedBy(resourceId: ResourceId): CacheObservable<ReferencedByEntry[]>;
198
+ events(resourceId: ResourceId): CacheObservable<StoredEventResponse[]>;
199
+ resourceContent(resourceId: ResourceId): Promise<string>;
200
+ resourceRepresentation(resourceId: ResourceId, options?: {
201
+ accept?: string;
202
+ }): Promise<{
203
+ data: ArrayBuffer;
204
+ contentType: string;
205
+ }>;
206
+ resourceRepresentationStream(resourceId: ResourceId, options?: {
207
+ accept?: string;
208
+ }): Promise<{
209
+ stream: ReadableStream<Uint8Array>;
210
+ contentType: string;
211
+ }>;
212
+ resourceEvents(resourceId: ResourceId): Promise<StoredEventResponse[]>;
213
+ annotationHistory(resourceId: ResourceId, annotationId: AnnotationId): Promise<AnnotationHistoryResponse>;
214
+ connections(resourceId: ResourceId): Promise<GraphConnection[]>;
215
+ backlinks(resourceId: ResourceId): Promise<Annotation[]>;
216
+ resourcesByName(query: string, limit?: number): Promise<ResourceDescriptor[]>;
217
+ files(dirPath?: string, sort?: 'name' | 'mtime' | 'annotationCount'): Promise<components['schemas']['BrowseFilesResponse']>;
218
+ click(annotationId: AnnotationId, motivation: Motivation): void;
219
+ navigateReference(resourceId: ResourceId): void;
220
+ }
221
+ /**
222
+ * Frame — schema-layer flow (the eighth flow).
223
+ *
224
+ * Frame operates on the KB's conceptual vocabulary — what *kinds* of
225
+ * things exist (entity types) and, in the future, what taxonomies are
226
+ * recognized (tag schemas), what relations are typed (predicate types),
227
+ * and how schemas are imported (ontology I/O). The other seven flows
228
+ * (yield, mark, match, bind, gather, browse, beckon) operate on
229
+ * content; Frame operates on the schema layer that content is expressed
230
+ * in.
231
+ *
232
+ * MVP scope is small: entity-type vocabulary writes only. Live reads of
233
+ * the entity-type vocabulary stay on Browse (`browse.entityTypes()` is
234
+ * a `CacheObservable<string[]>` consumed by 8+ call sites). Frame owns
235
+ * writes; Browse owns reads — the same asymmetry that already holds for
236
+ * resources and annotations.
237
+ *
238
+ * Backend actor: Stower
239
+ * Event prefix: frame:*
240
+ */
241
+ export interface FrameNamespace {
242
+ /** Add a single entity type to the KB's vocabulary. Idempotent — adding an existing type is a no-op. */
243
+ addEntityType(type: string): Promise<void>;
244
+ /** Add multiple entity types in one call. Convenience over a loop of `addEntityType`. */
245
+ addEntityTypes(types: string[]): Promise<void>;
246
+ /**
247
+ * Register a tag schema with the KB's runtime registry.
248
+ *
249
+ * Most-recent registration of a given `schema.id` wins; identical
250
+ * re-registrations are silent, differing content overwrites the
251
+ * existing entry and logs a warning. KBs typically call this at
252
+ * session/skill startup so the schema is available for `mark.assist`
253
+ * with motivation `tagging` and surfaces in `browse.tagSchemas()`.
254
+ */
255
+ addTagSchema(schema: TagSchema): Promise<void>;
256
+ }
257
+ /**
258
+ * Mark — annotation CRUD, AI assist, resource lifecycle
259
+ *
260
+ * Commands return Promises that resolve on HTTP acceptance (202).
261
+ * Results appear on browse Observables via bus gateway.
262
+ * assist() returns an Observable for long-running progress.
263
+ *
264
+ * Backend actor: Stower
265
+ * Event prefix: mark:*
266
+ */
267
+ export interface MarkNamespace {
268
+ annotation(input: CreateAnnotationInput): Promise<{
269
+ annotationId: AnnotationId;
270
+ }>;
271
+ delete(resourceId: ResourceId, annotationId: AnnotationId): Promise<void>;
272
+ archive(resourceId: ResourceId): Promise<void>;
273
+ unarchive(resourceId: ResourceId): Promise<void>;
274
+ assist(resourceId: ResourceId, motivation: Motivation, options: MarkAssistOptions): StreamObservable<MarkAssistEvent>;
275
+ request(selector: components['schemas']['MarkRequestedEvent']['selector'], motivation: Motivation): void;
276
+ /** Fire-and-forget variant of `assist` — mark-state-unit orchestrates the call and its progress Observable. */
277
+ requestAssist(motivation: Motivation, options: MarkAssistOptions, correlationId?: string): void;
278
+ /** Submit the currently pending annotation with its selector and optional body. */
279
+ submit(input: components['schemas']['MarkSubmitEvent']): void;
280
+ /** Cancel the currently pending annotation (if any). */
281
+ cancelPending(): void;
282
+ /** Dismiss the in-progress AI-assist widget. */
283
+ dismissProgress(): void;
284
+ changeSelection(motivation: Motivation | null): void;
285
+ changeClick(action: string): void;
286
+ changeShape(shape: string): void;
287
+ toggleMode(): void;
288
+ }
289
+ /**
290
+ * Bind — reference linking
291
+ *
292
+ * The simplest namespace. One method. The result (updated annotation
293
+ * with resolved reference) arrives on browse.annotations() via the
294
+ * enriched mark:body-updated event.
295
+ *
296
+ * Backend actor: Stower (via mark:update-body)
297
+ * Event prefix: mark:body-updated (shares mark event pipeline)
298
+ */
299
+ export interface BindNamespace {
300
+ body(resourceId: ResourceId, annotationId: AnnotationId, operations: BodyOperation[]): Promise<void>;
301
+ /** UI signal: a reference-binding flow is requested for an annotation. */
302
+ initiate(input: EventMap['bind:initiate']): void;
303
+ }
304
+ /**
305
+ * Gather — context assembly
306
+ *
307
+ * Long-running (LLM calls + graph traversal). Returns Observables
308
+ * that emit progress then the gathered context.
309
+ *
310
+ * Backend actor: Gatherer
311
+ * Event prefix: gather:*
312
+ */
313
+ export interface GatherNamespace {
314
+ annotation(resourceId: ResourceId, annotationId: AnnotationId, options?: {
315
+ contextWindow?: number;
316
+ }): StreamObservable<GatherAnnotationProgress>;
317
+ resource(resourceId: ResourceId, options?: {
318
+ contextWindow?: number;
319
+ }): StreamObservable<GatherAnnotationProgress>;
320
+ }
321
+ /**
322
+ * Match — search and ranking
323
+ *
324
+ * Long-running (semantic search, optional LLM scoring). Returns
325
+ * Observable with progress then results.
326
+ *
327
+ * Backend actor: Matcher
328
+ * Event prefix: match:*
329
+ */
330
+ export interface MatchNamespace {
331
+ search(resourceId: ResourceId, referenceId: AnnotationId, context: GatheredContext, options?: {
332
+ limit?: number;
333
+ useSemanticScoring?: boolean;
334
+ }): StreamObservable<MatchSearchProgress>;
335
+ /** Fire-and-forget variant: match-state-unit orchestrates the call and its result Observable. */
336
+ requestSearch(input: components['schemas']['MatchSearchRequest']): void;
337
+ }
338
+ /**
339
+ * Yield — resource creation
340
+ *
341
+ * resource() is synchronous file upload (Promise).
342
+ * fromAnnotation() is long-running LLM generation (Observable).
343
+ *
344
+ * Backend actor: Stower + generation worker
345
+ * Event prefix: yield:*
346
+ */
347
+ export interface YieldNamespace {
348
+ resource(data: CreateResourceInput): UploadObservable;
349
+ fromAnnotation(resourceId: ResourceId, annotationId: AnnotationId, options: GenerationOptions): StreamObservable<YieldGenerationEvent>;
350
+ cloneToken(resourceId: ResourceId): Promise<{
351
+ token: string;
352
+ expiresAt: string;
353
+ }>;
354
+ fromToken(token: string): Promise<ResourceDescriptor>;
355
+ createFromToken(options: CreateFromTokenOptions): Promise<{
356
+ resourceId: ResourceId;
357
+ }>;
358
+ /** UI signal: user invoked the clone action from the resource-info panel. */
359
+ clone(): void;
360
+ }
361
+ /**
362
+ * Beckon — attention coordination
363
+ *
364
+ * Fire-and-forget. Ephemeral presence signal delivered via the
365
+ * attention-stream to other participants.
366
+ *
367
+ * Backend actor: (frontend relay via attention-stream)
368
+ * Event prefix: beckon:*
369
+ */
370
+ export interface BeckonNamespace {
371
+ attention(resourceId: ResourceId, annotationId: AnnotationId): void;
372
+ hover(annotationId: AnnotationId | null): void;
373
+ sparkle(annotationId: AnnotationId): void;
374
+ }
375
+ /**
376
+ * Job — worker lifecycle
377
+ */
378
+ export interface JobNamespace {
379
+ /** Live stream of `job:queued` events from the bus. */
380
+ readonly queued$: Observable<EventMap['job:queued']>;
381
+ /** Live stream of `job:report-progress` events from the bus. */
382
+ readonly progress$: Observable<EventMap['job:report-progress']>;
383
+ /** Live stream of `job:complete` events from the bus. */
384
+ readonly complete$: Observable<EventMap['job:complete']>;
385
+ /** Live stream of `job:fail` events from the bus. */
386
+ readonly fail$: Observable<EventMap['job:fail']>;
387
+ status(jobId: JobId): Promise<JobStatusResponse>;
388
+ pollUntilComplete(jobId: JobId, options?: {
389
+ interval?: number;
390
+ timeout?: number;
391
+ onProgress?: (status: JobStatusResponse) => void;
392
+ }): Promise<JobStatusResponse>;
393
+ cancelByType(jobType: 'annotation' | 'generation'): Promise<void>;
394
+ /** UI signal: cancel all active jobs of a given type (e.g. "annotation"). */
395
+ cancelRequest(jobType: 'annotation' | 'generation'): void;
396
+ }
397
+ /**
398
+ * Auth — authentication
399
+ */
400
+ export interface AuthNamespace {
401
+ password(email: string, password: string): Promise<AuthResponse>;
402
+ google(credential: string): Promise<AuthResponse>;
403
+ refresh(token: string): Promise<TokenRefreshResponse>;
404
+ logout(): Promise<void>;
405
+ me(): Promise<User>;
406
+ acceptTerms(): Promise<void>;
407
+ mcpToken(): Promise<{
408
+ token: string;
409
+ }>;
410
+ mediaToken(resourceId: ResourceId): Promise<{
411
+ token: string;
412
+ }>;
413
+ }
414
+ /**
415
+ * Admin — administration
416
+ */
417
+ export interface AdminNamespace {
418
+ users(): Promise<User[]>;
419
+ userStats(): Promise<AdminUserStatsResponse>;
420
+ updateUser(userId: UserDID, data: RequestContent<paths['/api/admin/users/{id}']['patch']>): Promise<User>;
421
+ oauthConfig(): Promise<OAuthConfigResponse>;
422
+ healthCheck(): Promise<ResponseContent<paths['/api/health']['get']>>;
423
+ status(): Promise<ResponseContent<paths['/api/status']['get']>>;
424
+ backup(): Promise<BackendDownload>;
425
+ /**
426
+ * Restore from a backup archive. Returns a `StreamObservable` that
427
+ * emits each `ProgressEvent` as the operation runs (`'started'`,
428
+ * `'parsing'`, `'importing'`, ..., `'complete'`). Subscribers see
429
+ * every step; awaiters get the final event via the PromiseLike sugar.
430
+ */
431
+ restore(file: File): StreamObservable<ProgressEvent>;
432
+ exportKnowledgeBase(params?: {
433
+ includeArchived?: boolean;
434
+ }): Promise<BackendDownload>;
435
+ importKnowledgeBase(file: File): StreamObservable<ProgressEvent>;
436
+ }
437
+ export {};
438
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/namespaces/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACxF,OAAO,KAAK,EAAE,UAAU,EAAE,Q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+1,23 @@
1
+ import type { ResourceId, AnnotationId, EventBus } from '@semiont/core';
2
+ import type { ITransport, IContentTransport } from '@semiont/core';
3
+ import { StreamObservable, UploadObservable } from '../awaitable';
4
+ import type { YieldNamespace as IYieldNamespace, CreateResourceInput, GenerationOptions, CreateFromTokenOptions, YieldGenerationEvent } from './types';
5
+ import type { ResourceDescriptor } from '@semiont/core';
6
+ export declare class YieldNamespace implements IYieldNamespace {
7
+ private readonly transport;
8
+ private readonly bus;
9
+ private readonly content;
10
+ constructor(transport: ITransport, bus: EventBus, content: IContentTransport);
11
+ resource(data: CreateResourceInput): UploadObservable;
12
+ fromAnnotation(resourceId: ResourceId, annotationId: AnnotationId, options: GenerationOptions): StreamObservable<YieldGenerationEvent>;
13
+ cloneToken(resourceId: ResourceId): Promise<{
14
+ token: string;
15
+ expiresAt: string;
16
+ }>;
17
+ fromToken(token: string): Promise<ResourceDescriptor>;
18
+ createFromToken(options: CreateFromTokenOptions): Promise<{
19
+ resourceId: ResourceId;
20
+ }>;
21
+ clone(): void;
22
+ }
23
+ //# sourceMappingURL=yield.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"yield.d.ts","sourceRoot":"","sources":["../../src/namespaces/yield.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EACZ,QAAQ,EAET,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEnE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,KAAK,EACV,cAAc,IAAI,eAAe,EACjC,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGxD,qBAAa,cAAe,YAAW,eAAe;IAElD,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAFP,SAAS,EAAE,UAAU,EACrB,GAAG,EAAE,QAAQ,EACb,OAAO,EAAE,iBAAiB;IAG7C,QAAQ,CAAC,IAAI,EAAE,mBAAmB,GAAG,gBAAgB;IAgErD,cAAc,CACZ,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,iBAAiB,GACzB,gBAAgB,CAAC,oBAAoB,CAAC;IAkInC,UAAU,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAUjF,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAWrD,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,UAAU,CAAA;KAAE,CAAC;IAW3F,KAAK,IAAI,IAAI;CAGd"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Session-level error surface. Emitted on `SemiontBrowser.error$` for
3
+ * failures that make the session itself unusable (auth failed, actor
4
+ * couldn't start, token refresh terminally exhausted). Per-request
5
+ * errors stay with the caller as normal Promise rejections.
6
+ *
7
+ * `SemiontSessionError` extends `SemiontError` (the unified Semiont base)
8
+ * so consumers can catch with `instanceof SemiontError` for any error
9
+ * surfaced through the SDK.
10
+ */
11
+ import { SemiontError } from '@semiont/core';
12
+ export type SemiontSessionErrorCode = 'session.construct-failed' | 'session.auth-failed' | 'session.refresh-exhausted' | 'browser.sign-in-failed';
13
+ export declare class SemiontSessionError extends SemiontError {
14
+ code: SemiontSessionErrorCode;
15
+ readonly kbId: string | null;
16
+ constructor(code: SemiontSessionErrorCode, message: string, kbId?: string | null);
17
+ }
18
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/session/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,MAAM,MAAM,uBAAuB,GAC/B,0BAA0B,GAC1B,qBAAqB,GACrB,2BAA2B,GAC3B,wBAAwB,CAAC;AAE7B,qBAAa,mBAAoB,SAAQ,YAAY;IAC3C,IAAI,EAAE,uBAAuB,CAAC;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;gBAEjB,IAAI,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,GAAG,IAAW;CAKvF"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * createHttpSessionFactory — the default `SessionFactory` for HTTP-backed
3
+ * KBs. Owns every HTTP-specific construction concern that used to live in
4
+ * `SemiontBrowser`: building `HttpTransport`/`HttpContentTransport`,
5
+ * wiring the `tokenRefresher` callback, deduplicating concurrent 401
6
+ * refresh round trips, and invoking the auth endpoints for token refresh
7
+ * and user-validate.
8
+ *
9
+ * Returned as a closure so a single `inFlightRefreshes` map is shared
10
+ * across every session this factory builds — the dedup is meaningful
11
+ * across concurrent session reactivations for the same KB id.
12
+ */
13
+ import type { SessionFactory } from './session-factory';
14
+ export declare function createHttpSessionFactory(): SessionFactory;
15
+ //# sourceMappingURL=http-session-factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-session-factory.d.ts","sourceRoot":"","sources":["../../src/session/http-session-factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AASH,OAAO,KAAK,EAAE,cAAc,EAAyB,MAAM,mBAAmB,CAAC;AAE/E,wBAAgB,wBAAwB,IAAI,cAAc,CAoGzD"}
@@ -0,0 +1,95 @@
1
+ /**
2
+ * KnowledgeBase — a connection to a Semiont knowledge system.
3
+ *
4
+ * The KB type itself is uniform. The transport-shape variation lives in
5
+ * the nested `endpoint` field, which is a discriminated union:
6
+ *
7
+ * - `endpoint.kind === 'http'` — a remote backend reached over HTTP+SSE.
8
+ * Carries `host`/`port`/`protocol`.
9
+ * - `endpoint.kind === 'local'` — an in-process knowledge system reached
10
+ * via `LocalTransport` from
11
+ * `@semiont/make-meaning`. Carries an
12
+ * opaque `kbId` identifying the local
13
+ * instance to the host process.
14
+ *
15
+ * Code that doesn't know how to make a transport (`SemiontSession`,
16
+ * `SemiontBrowser`, the frontend KB list UI) treats `KnowledgeBase` as
17
+ * uniform and never inspects `endpoint`. Code that *does* construct
18
+ * transports (the transport-factory passed to `SemiontBrowser`,
19
+ * `kbBackendUrl` for HTTP URL construction) inspects `endpoint.kind`
20
+ * and dispatches.
21
+ *
22
+ * Each KB has its own session, its own credentials (where applicable),
23
+ * and its own JWT (HTTP only). The user is "authenticated against KB X" —
24
+ * never globally authenticated.
25
+ */
26
+ /** Fields shared by every KB regardless of endpoint kind. */
27
+ export interface KnowledgeBase {
28
+ id: string;
29
+ label: string;
30
+ email: string;
31
+ gitBranch?: string;
32
+ endpoint: KbEndpoint;
33
+ }
34
+ export type KbEndpoint = HttpEndpoint | LocalEndpoint;
35
+ export interface HttpEndpoint {
36
+ kind: 'http';
37
+ host: string;
38
+ port: number;
39
+ protocol: 'http' | 'https';
40
+ }
41
+ export interface LocalEndpoint {
42
+ kind: 'local';
43
+ /** Opaque identifier for the in-process KB instance the host has loaded. */
44
+ kbId: string;
45
+ }
46
+ /**
47
+ * Input shape for adding a new KB. The id is generated by the provider.
48
+ */
49
+ export type NewKnowledgeBase = Omit<KnowledgeBase, 'id'>;
50
+ /**
51
+ * Status of the locally-stored credential for a KB. Derived from the
52
+ * presence and validity of the JWT in session storage.
53
+ */
54
+ export type KbSessionStatus = 'authenticated' | 'expired' | 'signed-out' | 'unreachable';
55
+ /**
56
+ * Construct a `KnowledgeBase` for an HTTP-backed Semiont backend without
57
+ * spelling out the nested `endpoint` literal. Convenience for tests,
58
+ * worker bootstraps, and one-off scripts.
59
+ *
60
+ * ```ts
61
+ * const kb = httpKb({
62
+ * id: 'my-watcher',
63
+ * label: 'My Watcher',
64
+ * email: 'me@example.com',
65
+ * host: 'localhost',
66
+ * port: 4000,
67
+ * protocol: 'http',
68
+ * });
69
+ * ```
70
+ *
71
+ * Equivalent to:
72
+ *
73
+ * ```ts
74
+ * const kb: KnowledgeBase = {
75
+ * id, label, email,
76
+ * endpoint: { kind: 'http', host, port, protocol },
77
+ * };
78
+ * ```
79
+ *
80
+ * UI hosts that have a structured form (host / port / protocol pickers)
81
+ * already construct the literal directly — they don't need this helper.
82
+ * Local-endpoint KBs construct the literal directly too; the local
83
+ * endpoint shape (`{ kind: 'local', kbId }`) is one line and doesn't
84
+ * earn a helper.
85
+ */
86
+ export declare function httpKb(opts: {
87
+ id: string;
88
+ label: string;
89
+ email: string;
90
+ host: string;
91
+ port: number;
92
+ protocol: 'http' | 'https';
93
+ gitBranch?: string;
94
+ }): KnowledgeBase;
95
+ //# sourceMappingURL=knowledge-base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knowledge-base.d.ts","sourceRoot":"","sources":["../../src/session/knowledge-base.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,6DAA6D;AAC7D,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,UAAU,CAAC;CACtB;AAED,MAAM,MAAM,UAAU,GAAG,YAAY,GAAG,aAAa,CAAC;AAEtD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,OAAO,CAAC;IACd,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;AAEzD;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG,SAAS,GAAG,YAAY,GAAG,aAAa,CAAC;AAEzF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,aAAa,CAShB"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * OpenResource — a single entry in the open-resources list (tabs).
3
+ *
4
+ * The list itself lives on `SemiontBrowser.openResources$`. The CRUD
5
+ * methods (`addOpenResource`, `removeOpenResource`, `updateOpenResourceName`,
6
+ * `reorderOpenResources`) live on `SemiontBrowser` too.
7
+ */
8
+ export interface OpenResource {
9
+ /** Unique identifier for the resource */
10
+ id: string;
11
+ /** Display name of the resource */
12
+ name: string;
13
+ /** Timestamp when the resource was opened */
14
+ openedAt: number;
15
+ /** Order/position for manual sorting (optional for backward compatibility) */
16
+ order?: number;
17
+ /** Media type for icon display (e.g., 'application/pdf', 'text/plain') */
18
+ mediaType?: string;
19
+ /** Working-tree URI (e.g. "file://docs/overview.md") — used as tooltip in navigation */
20
+ storageUri?: string;
21
+ }
22
+ //# sourceMappingURL=open-resource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open-resource.d.ts","sourceRoot":"","sources":["../../src/session/open-resource.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,YAAY;IAC3B,yCAAyC;IACzC,EAAE,EAAE,MAAM,CAAC;IAEX,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IAEb,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,CAAC;IAEjB,8EAA8E;IAC9E,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,0EAA0E;IAC1E,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,wFAAwF;IACxF,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}