@semiont/sdk 0.5.6 → 0.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/index.d.ts +16 -14
- package/dist/index.js +18 -10
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -87,7 +87,7 @@ const client = new SemiontClient(localTransport, localContentTransport);
|
|
|
87
87
|
- **Collaboration primitives** — fire-and-forget signals on the verb namespaces (`beckon.hover`, `bind.initiate`, `mark.changeShape`, `browse.click`, ...) coordinate attention and intent across participants. Not afterthoughts, not browser-app fluff: they're how a multi-participant session stays coherent.
|
|
88
88
|
- **Session layer** — `SemiontSession` (per-KB authentication, token refresh, lifecycle), `SemiontBrowser` (multi-KB orchestration), and `SessionStorage` adapters (`InMemorySessionStorage`, plus a browser-backed one in `@semiont/react-ui`).
|
|
89
89
|
- **Flow state machines** — RxJS-based factories (`createMarkStateUnit`, `createGatherStateUnit`, `createMatchStateUnit`, `createYieldStateUnit`, `createBeckonStateUnit`) that wrap each long-running flow with `loading$` / `error$` / progress observables. UI-shape-agnostic — any consumer (browser, terminal, mobile, daemon) can subscribe.
|
|
90
|
-
- **`WorkerBus`** — the transport-neutral channel-bus interface that worker-side adapters consume. Domain-specific worker adapters live with their domain — `createJobClaimAdapter`
|
|
90
|
+
- **`WorkerBus`** — the transport-neutral channel-bus interface that worker-side adapters consume. Domain-specific worker adapters live with their domain — `createJobClaimAdapter` in [`@semiont/jobs`](https://github.com/The-AI-Alliance/semiont/tree/main/packages/jobs); `createSmelterActorStateUnit` in [`@semiont/make-meaning`](https://github.com/The-AI-Alliance/semiont/tree/main/packages/make-meaning) — and consume `WorkerBus` from here.
|
|
91
91
|
- **Helpers** — `bus-request` (correlation-ID request/reply), the cache primitive backing live queries, and `createSearchPipeline` (debounced-search RxJS pipeline).
|
|
92
92
|
|
|
93
93
|
Page-shaped state machines (admin tables, compose page, resource viewer page, etc.) live in [`@semiont/react-ui`](https://github.com/The-AI-Alliance/semiont/tree/main/packages/react-ui), alongside the components that render them. Those are framework-neutral but tied to the Semiont web frontend's specific page taxonomy; they don't apply to non-web consumers.
|
|
@@ -104,7 +104,7 @@ Page-shaped state machines (admin tables, compose page, resource viewer page, et
|
|
|
104
104
|
- The transport-neutral `WorkerBus` interface (worker adapters live in their domain packages — `@semiont/jobs`, `@semiont/make-meaning`)
|
|
105
105
|
- Branded ID types, the unified error hierarchy, the `TransportErrorCode` neutral vocabulary
|
|
106
106
|
|
|
107
|
-
Nothing page-shaped, nothing web-shell-shaped. A TUI, mobile reader, daemon, or AI agent installs `@semiont/sdk` alone (plus a transport package — `@semiont/
|
|
107
|
+
Nothing page-shaped, nothing web-shell-shaped. A TUI, mobile reader, daemon, or AI agent installs `@semiont/sdk` alone (plus a transport package — `@semiont/http-transport` for HTTP, `@semiont/make-meaning` for in-process).
|
|
108
108
|
|
|
109
109
|
## Installation
|
|
110
110
|
|
|
@@ -245,7 +245,7 @@ Apache-2.0 — see [LICENSE](https://github.com/The-AI-Alliance/semiont/blob/mai
|
|
|
245
245
|
## Related packages
|
|
246
246
|
|
|
247
247
|
- [`@semiont/core`](https://github.com/The-AI-Alliance/semiont/tree/main/packages/core) — domain types, `ITransport` contract, OpenAPI-derived schemas
|
|
248
|
-
- [`@semiont/
|
|
248
|
+
- [`@semiont/http-transport`](https://github.com/The-AI-Alliance/semiont/tree/main/packages/http-transport) — HTTP transport (`HttpTransport`, `HttpContentTransport`)
|
|
249
249
|
- [`@semiont/make-meaning`](https://github.com/The-AI-Alliance/semiont/tree/main/packages/make-meaning) — in-process transport (`LocalTransport`) and the actor model behind it
|
|
250
250
|
- [`@semiont/observability`](https://github.com/The-AI-Alliance/semiont/tree/main/packages/observability) — OpenTelemetry tracing the SDK propagates across the bus
|
|
251
251
|
- [`@semiont/react-ui`](https://github.com/The-AI-Alliance/semiont/tree/main/packages/react-ui) — React bindings (`useStateUnit`, web `SessionStorage`)
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { firstValueFrom, lastValueFrom } from 'rxjs';
|
|
|
4
4
|
import * as _semiont_core from '@semiont/core';
|
|
5
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
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/
|
|
7
|
+
export { APIError, HttpContentTransport, HttpTransport, HttpTransportConfig, TokenRefresher } from '@semiont/http-transport';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Thenable Observable subclasses.
|
|
@@ -152,6 +152,7 @@ declare class UploadObservable extends Observable<UploadProgress> implements Pro
|
|
|
152
152
|
*/
|
|
153
153
|
|
|
154
154
|
type StoredEventResponse$1 = components['schemas']['StoredEventResponse'];
|
|
155
|
+
type GetResourceResponse$1 = components['schemas']['GetResourceResponse'];
|
|
155
156
|
type GatherProgress = components['schemas']['GatherProgress'];
|
|
156
157
|
type MatchSearchResult = components['schemas']['MatchSearchResult'];
|
|
157
158
|
type JobProgress$2 = components['schemas']['JobProgress'];
|
|
@@ -318,15 +319,12 @@ interface BrowseNamespace$1 {
|
|
|
318
319
|
referencedBy(resourceId: ResourceId): CacheObservable<ReferencedByEntry[]>;
|
|
319
320
|
events(resourceId: ResourceId): CacheObservable<StoredEventResponse$1[]>;
|
|
320
321
|
resourceContent(resourceId: ResourceId): Promise<string>;
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
}): Promise<{
|
|
322
|
+
resourceGraph(resourceId: ResourceId): Promise<GetResourceResponse$1>;
|
|
323
|
+
resourceRepresentation(resourceId: ResourceId): Promise<{
|
|
324
324
|
data: ArrayBuffer;
|
|
325
325
|
contentType: string;
|
|
326
326
|
}>;
|
|
327
|
-
resourceRepresentationStream(resourceId: ResourceId
|
|
328
|
-
accept?: string;
|
|
329
|
-
}): Promise<{
|
|
327
|
+
resourceRepresentationStream(resourceId: ResourceId): Promise<{
|
|
330
328
|
stream: ReadableStream<Uint8Array>;
|
|
331
329
|
contentType: string;
|
|
332
330
|
}>;
|
|
@@ -557,6 +555,7 @@ interface AdminNamespace$1 {
|
|
|
557
555
|
}
|
|
558
556
|
|
|
559
557
|
type StoredEventResponse = components['schemas']['StoredEventResponse'];
|
|
558
|
+
type GetResourceResponse = components['schemas']['GetResourceResponse'];
|
|
560
559
|
type ResourceListFilters = {
|
|
561
560
|
limit?: number;
|
|
562
561
|
archived?: boolean;
|
|
@@ -631,15 +630,18 @@ declare class BrowseNamespace implements BrowseNamespace$1 {
|
|
|
631
630
|
referencedBy(resourceId: ResourceId): CacheObservable<ReferencedByEntry[]>;
|
|
632
631
|
events(resourceId: ResourceId): CacheObservable<StoredEventResponse[]>;
|
|
633
632
|
resourceContent(resourceId: ResourceId): Promise<string>;
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
633
|
+
/**
|
|
634
|
+
* Fetch the resource's JSON-LD metadata graph (descriptor + annotations +
|
|
635
|
+
* inbound entity references). One-shot, uncached, dereferenced via the
|
|
636
|
+
* transport's HTTP `/jsonld` face (bus-free) — the LD view an external
|
|
637
|
+
* linked-data client gets. See `.plans/SIMPLER-JSON-LD.md` §5.
|
|
638
|
+
*/
|
|
639
|
+
resourceGraph(resourceId: ResourceId): Promise<GetResourceResponse>;
|
|
640
|
+
resourceRepresentation(resourceId: ResourceId): Promise<{
|
|
637
641
|
data: ArrayBuffer;
|
|
638
642
|
contentType: string;
|
|
639
643
|
}>;
|
|
640
|
-
resourceRepresentationStream(resourceId: ResourceId
|
|
641
|
-
accept?: string;
|
|
642
|
-
}): Promise<{
|
|
644
|
+
resourceRepresentationStream(resourceId: ResourceId): Promise<{
|
|
643
645
|
stream: ReadableStream<Uint8Array>;
|
|
644
646
|
contentType: string;
|
|
645
647
|
}>;
|
|
@@ -1720,7 +1722,7 @@ declare function createSearchPipeline<T>(fetch: (query: string) => Observable<T[
|
|
|
1720
1722
|
* (e.g. `JobClaimAdapter` in `@semiont/jobs`, `SmelterActorStateUnit` in
|
|
1721
1723
|
* `@semiont/make-meaning`) need.
|
|
1722
1724
|
*
|
|
1723
|
-
* Transport-neutral by design. HTTP `ActorStateUnit` (from `@semiont/
|
|
1725
|
+
* Transport-neutral by design. HTTP `ActorStateUnit` (from `@semiont/http-transport`)
|
|
1724
1726
|
* satisfies it directly; an in-process worker can pass a small shim around
|
|
1725
1727
|
* an `EventBus` with a `() => Promise<void>` `emit` that calls into the
|
|
1726
1728
|
* actor system.
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { SemiontError, annotationId, resourceId, email, googleCredential, refreshToken, EventBus, baseUrl, accessToken, searchQuery } from '@semiont/core';
|
|
1
|
+
import { SemiontError, decodeWithCharset, annotationId, resourceId, email, googleCredential, refreshToken, EventBus, baseUrl, accessToken, searchQuery } from '@semiont/core';
|
|
2
2
|
export { SemiontError, accessToken, annotationId, baseUrl, entityType, refreshToken, resourceId, userId } from '@semiont/core';
|
|
3
3
|
import { Observable, lastValueFrom, firstValueFrom, merge, TimeoutError, throwError, map as map$1, BehaviorSubject, Subject, Subscription, of, distinctUntilChanged as distinctUntilChanged$1 } from 'rxjs';
|
|
4
4
|
export { firstValueFrom, lastValueFrom } from 'rxjs';
|
|
5
5
|
import { filter, map, take, timeout, catchError, takeUntil, startWith, debounceTime, distinctUntilChanged, switchMap } from 'rxjs/operators';
|
|
6
|
-
import { HttpTransport, HttpContentTransport, APIError } from '@semiont/
|
|
7
|
-
export { APIError, HttpContentTransport, HttpTransport } from '@semiont/
|
|
6
|
+
import { HttpTransport, HttpContentTransport, APIError } from '@semiont/http-transport';
|
|
7
|
+
export { APIError, HttpContentTransport, HttpTransport } from '@semiont/http-transport';
|
|
8
8
|
|
|
9
9
|
// src/client.ts
|
|
10
10
|
var StreamObservable = class _StreamObservable extends Observable {
|
|
@@ -421,15 +421,23 @@ var BrowseNamespace = class {
|
|
|
421
421
|
}
|
|
422
422
|
// ── One-shot reads ──────────────────────────────────────────────────────
|
|
423
423
|
async resourceContent(resourceId2) {
|
|
424
|
-
const result = await this.content.getBinary(resourceId2
|
|
425
|
-
|
|
426
|
-
return decoder.decode(result.data);
|
|
424
|
+
const result = await this.content.getBinary(resourceId2);
|
|
425
|
+
return decodeWithCharset(result.data, result.contentType);
|
|
427
426
|
}
|
|
428
|
-
|
|
429
|
-
|
|
427
|
+
/**
|
|
428
|
+
* Fetch the resource's JSON-LD metadata graph (descriptor + annotations +
|
|
429
|
+
* inbound entity references). One-shot, uncached, dereferenced via the
|
|
430
|
+
* transport's HTTP `/jsonld` face (bus-free) — the LD view an external
|
|
431
|
+
* linked-data client gets. See `.plans/SIMPLER-JSON-LD.md` §5.
|
|
432
|
+
*/
|
|
433
|
+
async resourceGraph(resourceId2) {
|
|
434
|
+
return this.content.getResourceGraph(resourceId2);
|
|
435
|
+
}
|
|
436
|
+
async resourceRepresentation(resourceId2) {
|
|
437
|
+
return this.content.getBinary(resourceId2);
|
|
430
438
|
}
|
|
431
|
-
async resourceRepresentationStream(resourceId2
|
|
432
|
-
return this.content.getBinaryStream(resourceId2
|
|
439
|
+
async resourceRepresentationStream(resourceId2) {
|
|
440
|
+
return this.content.getBinaryStream(resourceId2);
|
|
433
441
|
}
|
|
434
442
|
async resourceEvents(resourceId2) {
|
|
435
443
|
const result = await busRequest(
|