@semiont/core 0.5.29 → 0.5.30
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/dist/{chunk-MM4HBHMM.js → chunk-EWOITHBH.js} +7 -2
- package/dist/chunk-EWOITHBH.js.map +1 -0
- package/dist/{chunk-45YGPHDK.js → chunk-IQGH6UJN.js} +3 -3
- package/dist/{chunk-45YGPHDK.js.map → chunk-IQGH6UJN.js.map} +1 -1
- package/dist/{chunk-VBMXNYPL.js → chunk-UGI6IOOX.js} +5 -4
- package/dist/chunk-UGI6IOOX.js.map +1 -0
- package/dist/config/node-config-loader.js +2 -2
- package/dist/config/node-config-loader.js.map +1 -1
- package/dist/index.d.ts +135 -19
- package/dist/index.js +31 -4
- package/dist/index.js.map +1 -1
- package/dist/openapi.d.ts +12 -0
- package/dist/openapi.js +1585 -653
- package/dist/openapi.js.map +1 -1
- package/dist/testing/axioms.js +2 -2
- package/dist/testing.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-MM4HBHMM.js.map +0 -1
- package/dist/chunk-VBMXNYPL.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1588,7 +1588,7 @@ interface components {
|
|
|
1588
1588
|
domain: string;
|
|
1589
1589
|
isAdmin: boolean;
|
|
1590
1590
|
};
|
|
1591
|
-
/** @description Short-lived access token
|
|
1591
|
+
/** @description Short-lived access token. Use as Authorization: Bearer header on API calls. The TTL is deliberately NOT restated here — docs/system/administration/AUTHENTICATION.md holds the one table of token lifetimes, and a second copy is how this description came to claim an hour for a ten-minute token. A client must refresh from the refresh token rather than assume any particular window. */
|
|
1592
1592
|
token: string;
|
|
1593
1593
|
/** @description Long-lived refresh token (30 days). Exchange via POST /api/tokens/refresh for a fresh access token. */
|
|
1594
1594
|
refreshToken: string;
|
|
@@ -1909,6 +1909,8 @@ interface components {
|
|
|
1909
1909
|
};
|
|
1910
1910
|
/** @description Optional resource scope for broadcast channels (e.g. resourceId). Publishers only — clients must never set this. */
|
|
1911
1911
|
scope?: string;
|
|
1912
|
+
/** @description Routing address for this request's reply (CORRELATED-REPLY-ROUTING D1/D2): the emit doubles as a claim on the correlationId, and delivery matches BOTH this and the emitting principal. Top-level, not inside `payload` — a wire concern like `scope`, so it never enters a channel's domain type. Optional in the schema because a plain broadcast needs no return address; the route requires it when the channel is a registered request channel and the payload carries a correlationId. */
|
|
1913
|
+
clientId?: string;
|
|
1912
1914
|
};
|
|
1913
1915
|
/** @description Subscription matrix for the bus SSE stream (MULTI-RESOURCE-SCOPE). `global` channels are delivered unscoped; each `scoped` entry subscribes the connection to one resource scope's channels, optionally resuming replay from that scope's last-seen persisted event id. At least one global channel or one scoped entry is required. */
|
|
1914
1916
|
BusSubscribeRequest: {
|
|
@@ -1925,6 +1927,8 @@ interface components {
|
|
|
1925
1927
|
/** @description This scope's last-seen persisted event id (`p-<scope>-<seq>`). The server replays this scope's persisted events after it before joining the live tail, and emits a scoped `bus:resume-gap` when it cannot cover the gap (unparseable or mismatched id, retention exceeded, or query error). */
|
|
1926
1928
|
lastEventId?: string;
|
|
1927
1929
|
}[];
|
|
1930
|
+
/** @description Routing address for correlated replies (CORRELATED-REPLY-ROUTING D1): a UUID minted once per bus-client lifetime — per actor, NOT per connection, so it survives a make-before-break reconnect and both overlap connections share it. Required: a subscriber without one could never receive a correlated frame, and that must fail loudly here rather than silently at delivery. Not authentication — the JWT stays that; this is an unguessable routing address, never echoed into any payload or broadcast frame. */
|
|
1931
|
+
clientId: string;
|
|
1928
1932
|
};
|
|
1929
1933
|
CloneResourceWithTokenResponse: {
|
|
1930
1934
|
/** @description Generated clone token */
|
|
@@ -2239,6 +2243,8 @@ interface components {
|
|
|
2239
2243
|
};
|
|
2240
2244
|
/** @description Progress payload emitted on the gather:annotation-progress SSE channel during LLM context gathering. */
|
|
2241
2245
|
GatherProgress: {
|
|
2246
|
+
/** @description The request this progress belongs to (CORRELATED-REPLY-ROUTING D3). Required: `CORRELATED_CHANNELS` derives every operation's progress channel into the delivery filter, so a frame without it cannot be matched to a claim and is silently dropped. */
|
|
2247
|
+
correlationId: string;
|
|
2242
2248
|
message?: string;
|
|
2243
2249
|
percentage?: number;
|
|
2244
2250
|
};
|
|
@@ -2497,12 +2503,29 @@ interface components {
|
|
|
2497
2503
|
assessmentsFound: number;
|
|
2498
2504
|
assessmentsCreated: number;
|
|
2499
2505
|
};
|
|
2500
|
-
/** @description Request to cancel a job */
|
|
2506
|
+
/** @description Request to cancel a job. Target one running or pending job by `jobId` (JOB-RESTART-SAFETY P4), or a whole category of pending jobs by `jobType`. A `jobId`-targeted request that names a RUNNING job is honoured cooperatively by the owning worker, which stops at its next unit boundary and emits JobCancelCommand — the queue is never made to yank a running job out from under a live worker. */
|
|
2501
2507
|
JobCancelRequest: {
|
|
2502
2508
|
/** @description Correlation id for request/reply matching, set by the SDK's busRequest so the confirmed-write ack/failure routes back. Absent for the local cancelRequest UI signal. */
|
|
2503
2509
|
correlationId?: string;
|
|
2504
|
-
/** @
|
|
2505
|
-
|
|
2510
|
+
/** @description Cancel this one job. A pending job is cancelled immediately by the gateway; a running job is cancelled cooperatively by its worker. Takes precedence over jobType. */
|
|
2511
|
+
jobId?: string;
|
|
2512
|
+
/**
|
|
2513
|
+
* @description Cancel all PENDING jobs in this category — the bulk UI signal. Ignored when jobId is present.
|
|
2514
|
+
* @enum {string}
|
|
2515
|
+
*/
|
|
2516
|
+
jobType?: "annotation" | "generation";
|
|
2517
|
+
};
|
|
2518
|
+
/** @description A worker's confirmation that it has cooperatively stopped a running job at a unit boundary (JOB-RESTART-SAFETY P4) — the queue moves the job to cancelled/. Distinct from JobCancelRequest (the client→worker REQUEST to stop): this is the worker announcing it did, so the running job is never yanked to cancelled/ out from under a live worker (the roach-motel race). */
|
|
2519
|
+
JobCancelCommand: {
|
|
2520
|
+
/** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
|
|
2521
|
+
_userId?: string;
|
|
2522
|
+
resourceId: string;
|
|
2523
|
+
jobId: string;
|
|
2524
|
+
jobType: components["schemas"]["JobType"];
|
|
2525
|
+
/** @description Annotation this job is attached to, when applicable. Lets the UI route cancellation feedback to a specific annotation. */
|
|
2526
|
+
annotationId?: string;
|
|
2527
|
+
/** @description Entity-type units whose annotations were fully emitted before cancellation. Recorded on the cancelled job's metadata so the work already done stays visible. */
|
|
2528
|
+
completedUnits?: string[];
|
|
2506
2529
|
};
|
|
2507
2530
|
/** @description Command to claim a pending job (atomic CAS: pending → running) */
|
|
2508
2531
|
JobClaimCommand: {
|
|
@@ -2577,6 +2600,23 @@ interface components {
|
|
|
2577
2600
|
/** @description Annotation this job is attached to, when applicable. Lets the UI route failure feedback (error toast, revert state) to a specific annotation. */
|
|
2578
2601
|
annotationId?: string;
|
|
2579
2602
|
error: string;
|
|
2603
|
+
/** @description Entity-type units whose annotations were fully emitted before this failure (checkpointed resume). The queue records them on the retried job's metadata; a retried claim skips them so completed work is neither redone nor duplicated. */
|
|
2604
|
+
completedUnits?: string[];
|
|
2605
|
+
/**
|
|
2606
|
+
* @description Worker-side classification of the failure, made where the error is still typed. 'deterministic' — the same request cannot succeed on a second attempt — skips the retry budget; absent or 'transient' retries as before. Only KNOWN-deterministic failures carry the class.
|
|
2607
|
+
* @enum {string}
|
|
2608
|
+
*/
|
|
2609
|
+
failureClass?: "transient" | "deterministic";
|
|
2610
|
+
/** @description Whether the queue will re-queue this job for another attempt. Computed by the worker from the SAME predicate the queue applies at failJob (one decision site, `willRetryAfter` in @semiont/jobs) using the retry budget carried on the claimed record. FALSE (or absent) means this failure is TERMINAL: a client's job-watch stream ends here. TRUE means the work continues on a fresh attempt — the failure is an event, not the end, and a stream that terminated on it would report a recovering run as a failed one (JOB-RESTART-SAFETY P5). */
|
|
2611
|
+
willRetry?: boolean;
|
|
2612
|
+
};
|
|
2613
|
+
/** @description Command to persist a running job's completed-unit checkpoint AT unit completion (JOB-RESTART-SAFETY P2). Distinct from JobFailCommand's checkpoint, which lands only on a clean failure: a worker that dies (crash/OOM/kill) never emits job:fail, so this durable, unthrottled write is what lets the janitor's stale-running recovery resume a dead worker's job rather than redo its finished units. */
|
|
2614
|
+
JobCheckpointCommand: {
|
|
2615
|
+
/** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
|
|
2616
|
+
_userId?: string;
|
|
2617
|
+
jobId: string;
|
|
2618
|
+
/** @description Entity-type units whose annotations have been fully emitted so far. Unioned into the running job's metadata checkpoint; a retry after recovery skips them. */
|
|
2619
|
+
completedUnits: string[];
|
|
2580
2620
|
};
|
|
2581
2621
|
/** @description Result of a job that completed without doing its work because the resource could not be read. Distinct from a failure: nothing went wrong, there was simply no text to work with — an encrypted or damaged PDF, a scan whose text could not be recognized, or a document that yielded nothing. The reasons are the extraction vocabulary the Smelter reports on `smelt:settled`, MINUS `no-extractor`: a media type that can never yield text (a zip, an image) is a bad request rather than a decline, so a worker asked to detect over one throws and the job reports `job:fail`. Everything here is a resource-specific outcome — the same media type would have succeeded on a different document. */
|
|
2582
2622
|
JobDeclinedResult: {
|
|
@@ -2661,6 +2701,8 @@ interface components {
|
|
|
2661
2701
|
value: string;
|
|
2662
2702
|
/** @description Annotations found for it. */
|
|
2663
2703
|
foundCount: number;
|
|
2704
|
+
/** @description Annotations actually persisted for it — post-dedupe and post-durability-acknowledgement, so it counts what the event log holds, not what the model proposed. Beside foundCount this is the per-unit yield the sizing work is judged by. Present on flows whose units persist as they complete (reference-annotation); the tagging flow reports the same fact as byCategory on its result, because its annotations are built after the per-category loop. */
|
|
2705
|
+
persistedCount?: number;
|
|
2664
2706
|
}[];
|
|
2665
2707
|
/** @description Echoed job parameters for display in the progress UI. `label` is a CODE, not a sentence — the client owns the wording, same rule as the progress message. `value` is the user's own input (an entity-type list, their instructions) and is deliberately NOT translated: it is their words, not ours. */
|
|
2666
2708
|
requestParams?: {
|
|
@@ -2939,6 +2981,29 @@ interface components {
|
|
|
2939
2981
|
annotationId: string;
|
|
2940
2982
|
};
|
|
2941
2983
|
};
|
|
2984
|
+
/** @description Bus command to persist a detection unit's annotations as one acknowledged batch (JOB-RESTART-SAFETY P6). Unlike mark:create, which is fire-and-forget and resolves when the bus accepts it, this command is answered only after every annotation is in the event log — so a worker can gate unit completion on durability rather than on emission. The batch is the unit: a partial commit is reported as a failure, and the worker retries the whole unit, which is safe because annotation ids are deterministic (P3). */
|
|
2985
|
+
MarkCommitCommand: {
|
|
2986
|
+
/** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
|
|
2987
|
+
_userId?: string;
|
|
2988
|
+
/** @description Correlation id set by busRequest so the mark:commit-ok / mark:commit-failed reply routes back to the awaiting worker. */
|
|
2989
|
+
correlationId: string;
|
|
2990
|
+
/** @description Resource every annotation in this batch targets. */
|
|
2991
|
+
resourceId: string;
|
|
2992
|
+
/** @description The unit's annotations, already built with deterministic ids. Re-committing an identical batch is a no-op rather than a duplicate. */
|
|
2993
|
+
annotations: components["schemas"]["Annotation"][];
|
|
2994
|
+
};
|
|
2995
|
+
/** @description Durability acknowledgement for a mark:commit batch: every annotation named by the command is in the event log at the moment this is emitted. */
|
|
2996
|
+
MarkCommitOk: {
|
|
2997
|
+
/** @description Correlation id echoed from the mark:commit command so busRequest can match the reply. */
|
|
2998
|
+
correlationId: string;
|
|
2999
|
+
/** @description What the commit persisted. */
|
|
3000
|
+
response: {
|
|
3001
|
+
/** @description Annotations this commit appended to the event log. Equals the batch size on success — a retry re-appends what already landed rather than counting it out, because the annotation fold is idempotent by id and the log is append-only. Not a dedupe count. */
|
|
3002
|
+
persisted: number;
|
|
3003
|
+
/** @description Ids the batch covers, whether appended now or already present. */
|
|
3004
|
+
annotationIds: string[];
|
|
3005
|
+
};
|
|
3006
|
+
};
|
|
2942
3007
|
/** @description Raw annotation creation intent — bus handler assembles the W3C annotation */
|
|
2943
3008
|
MarkCreateRequest: {
|
|
2944
3009
|
correlationId: string;
|
|
@@ -4049,6 +4114,16 @@ type EventMap = {
|
|
|
4049
4114
|
'mark:update-entity-types': components['schemas']['MarkUpdateEntityTypesCommand'];
|
|
4050
4115
|
'mark:create-ok': components['schemas']['MarkCreateOk'];
|
|
4051
4116
|
'mark:create-failed': components['schemas']['CommandError'];
|
|
4117
|
+
/**
|
|
4118
|
+
* Persist a detection unit's annotations as ONE acknowledged batch
|
|
4119
|
+
* (JOB-RESTART-SAFETY P6). Answered only after every annotation is in
|
|
4120
|
+
* the event log, so a worker can gate unit completion on durability
|
|
4121
|
+
* instead of on emission — which is what makes an Archivist outage a
|
|
4122
|
+
* delay rather than silent data loss.
|
|
4123
|
+
*/
|
|
4124
|
+
'mark:commit': components['schemas']['MarkCommitCommand'];
|
|
4125
|
+
'mark:commit-ok': components['schemas']['MarkCommitOk'];
|
|
4126
|
+
'mark:commit-failed': components['schemas']['CommandError'];
|
|
4052
4127
|
'mark:delete-ok': components['schemas']['MarkDeleteOk'];
|
|
4053
4128
|
'mark:delete-failed': components['schemas']['CommandError'];
|
|
4054
4129
|
'mark:archive-ok': {
|
|
@@ -4262,8 +4337,10 @@ type EventMap = {
|
|
|
4262
4337
|
'job:report-progress': components['schemas']['JobReportProgressCommand'];
|
|
4263
4338
|
'job:complete': components['schemas']['JobCompleteCommand'];
|
|
4264
4339
|
'job:fail': components['schemas']['JobFailCommand'];
|
|
4340
|
+
'job:checkpoint': components['schemas']['JobCheckpointCommand'];
|
|
4265
4341
|
'job:queued': components['schemas']['JobQueuedEvent'];
|
|
4266
4342
|
'job:cancel-requested': components['schemas']['JobCancelRequest'];
|
|
4343
|
+
'job:cancel': components['schemas']['JobCancelCommand'];
|
|
4267
4344
|
'job:status-requested': components['schemas']['JobStatusRequest'];
|
|
4268
4345
|
'job:create': components['schemas']['JobCreateCommand'];
|
|
4269
4346
|
'job:claim': components['schemas']['JobClaimCommand'];
|
|
@@ -4463,6 +4540,9 @@ declare const CHANNEL_SCHEMAS: {
|
|
|
4463
4540
|
readonly 'frame:add-tag-schema': "FrameAddTagSchemaCommand";
|
|
4464
4541
|
readonly 'mark:create-ok': "MarkCreateOk";
|
|
4465
4542
|
readonly 'mark:create-failed': "CommandError";
|
|
4543
|
+
readonly 'mark:commit': "MarkCommitCommand";
|
|
4544
|
+
readonly 'mark:commit-ok': "MarkCommitOk";
|
|
4545
|
+
readonly 'mark:commit-failed': "CommandError";
|
|
4466
4546
|
readonly 'mark:delete-ok': "MarkDeleteOk";
|
|
4467
4547
|
readonly 'mark:delete-failed': "CommandError";
|
|
4468
4548
|
readonly 'mark:archive-ok': null;
|
|
@@ -4571,8 +4651,10 @@ declare const CHANNEL_SCHEMAS: {
|
|
|
4571
4651
|
readonly 'job:report-progress': "JobReportProgressCommand";
|
|
4572
4652
|
readonly 'job:complete': "JobCompleteCommand";
|
|
4573
4653
|
readonly 'job:fail': "JobFailCommand";
|
|
4654
|
+
readonly 'job:checkpoint': "JobCheckpointCommand";
|
|
4574
4655
|
readonly 'job:queued': "JobQueuedEvent";
|
|
4575
4656
|
readonly 'job:cancel-requested': "JobCancelRequest";
|
|
4657
|
+
readonly 'job:cancel': "JobCancelCommand";
|
|
4576
4658
|
readonly 'job:status-requested': "JobStatusRequest";
|
|
4577
4659
|
readonly 'job:create': "JobCreateCommand";
|
|
4578
4660
|
readonly 'job:claim': "JobClaimCommand";
|
|
@@ -5639,21 +5721,28 @@ declare class ConflictError extends SemiontError {
|
|
|
5639
5721
|
type Agent$1 = components['schemas']['Agent'];
|
|
5640
5722
|
type GetResourceResponse = components['schemas']['GetResourceResponse'];
|
|
5641
5723
|
/**
|
|
5642
|
-
*
|
|
5724
|
+
* Seven-state lifecycle for a transport's connection. Drives UI affordances
|
|
5643
5725
|
* (connecting spinners, reconnecting banners, etc.) and is observed via
|
|
5644
5726
|
* `ITransport.state$`.
|
|
5645
5727
|
*
|
|
5646
|
-
* initial
|
|
5647
|
-
*
|
|
5648
|
-
* connecting
|
|
5649
|
-
* open
|
|
5650
|
-
* reconnecting
|
|
5651
|
-
* degraded
|
|
5652
|
-
*
|
|
5653
|
-
*
|
|
5654
|
-
*
|
|
5655
|
-
|
|
5656
|
-
|
|
5728
|
+
* initial ─ pre-`start()`; never enters subscribers' streams
|
|
5729
|
+
* except as the first replayed value
|
|
5730
|
+
* connecting ─ in-flight initial open
|
|
5731
|
+
* open ─ healthy, delivering events
|
|
5732
|
+
* reconnecting ─ open → dropped, retrying; may be transient
|
|
5733
|
+
* degraded ─ has been reconnecting for > DEGRADED_THRESHOLD_MS;
|
|
5734
|
+
* UI banner threshold; distinguishes brief mount-
|
|
5735
|
+
* churn cycles from sustained disconnection
|
|
5736
|
+
* unauthenticated ─ not attempting: the credential is absent, or was
|
|
5737
|
+
* refused (401) and only a DIFFERENT one is worth
|
|
5738
|
+
* trying. No network activity; recovers on its own
|
|
5739
|
+
* when a usable credential appears (a re-login, a
|
|
5740
|
+
* session refresh). The refusal itself surfaces on
|
|
5741
|
+
* the transport's error stream (SSE-AUTH-RESILIENCE
|
|
5742
|
+
* D3/D6a — one state for both answers)
|
|
5743
|
+
* closed ─ stop()/dispose() called; terminal
|
|
5744
|
+
*/
|
|
5745
|
+
type ConnectionState = 'initial' | 'connecting' | 'open' | 'reconnecting' | 'degraded' | 'unauthenticated' | 'closed';
|
|
5657
5746
|
type AuthResponse = components['schemas']['AuthResponse'];
|
|
5658
5747
|
type TokenRefreshResponse = components['schemas']['TokenRefreshResponse'];
|
|
5659
5748
|
type AdminUserStatsResponse = components['schemas']['AdminUserStatsResponse'];
|
|
@@ -6016,6 +6105,10 @@ declare const BUS_OPERATIONS: {
|
|
|
6016
6105
|
readonly result: "mark:create-ok";
|
|
6017
6106
|
readonly failure: "mark:create-failed";
|
|
6018
6107
|
};
|
|
6108
|
+
readonly 'mark:commit': {
|
|
6109
|
+
readonly result: "mark:commit-ok";
|
|
6110
|
+
readonly failure: "mark:commit-failed";
|
|
6111
|
+
};
|
|
6019
6112
|
readonly 'mark:delete': {
|
|
6020
6113
|
readonly result: "mark:delete-ok";
|
|
6021
6114
|
readonly failure: "mark:delete-failed";
|
|
@@ -6100,7 +6193,7 @@ type BusOperationKey = keyof typeof BUS_OPERATIONS;
|
|
|
6100
6193
|
* and SSE infrastructure. A reply channel must NOT go here — declare its
|
|
6101
6194
|
* operation in `BUS_OPERATIONS` instead.
|
|
6102
6195
|
*/
|
|
6103
|
-
declare const BRIDGED_BROADCASTS: readonly ["job:report-progress", "job:complete", "job:fail", "frame:entity-type-added", "frame:tag-schema-added", "beckon:focus", "beckon:sparkle", "bus:resume-gap", "browse:resource-open", "browse:resource-viewed", "session:joined", "session:left", "browse:click"];
|
|
6196
|
+
declare const BRIDGED_BROADCASTS: readonly ["job:report-progress", "job:complete", "job:fail", "frame:entity-type-added", "frame:tag-schema-added", "yield:created", "yield:updated", "yield:cloned", "yield:moved", "beckon:focus", "beckon:sparkle", "bus:resume-gap", "browse:resource-open", "browse:resource-viewed", "session:joined", "session:left", "browse:click"];
|
|
6104
6197
|
type OpSpecs = (typeof BUS_OPERATIONS)[keyof typeof BUS_OPERATIONS];
|
|
6105
6198
|
type ProgressChannel<O> = O extends {
|
|
6106
6199
|
progress: infer P extends EventName;
|
|
@@ -6125,11 +6218,24 @@ type BridgedChannel = RegistryReply | (typeof BRIDGED_BROADCASTS)[number];
|
|
|
6125
6218
|
type BusReply<Op extends BusOperationKey> = EventMap[(typeof BUS_OPERATIONS)[Op]['result'] & EventName] extends {
|
|
6126
6219
|
response: infer R;
|
|
6127
6220
|
} ? R : void;
|
|
6128
|
-
type BusRequestErrorCode = 'bus.timeout' | 'bus.rejected' | 'bus.closed' | 'bus.bad-payload' | 'bus.unauthorized' | 'bus.forbidden' | 'bus.not-found';
|
|
6221
|
+
type BusRequestErrorCode = 'bus.timeout' | 'bus.rejected' | 'bus.closed' | 'bus.bad-payload' | 'bus.unauthorized' | 'bus.forbidden' | 'bus.not-found' | 'bus.unsubscribed';
|
|
6129
6222
|
declare class BusRequestError extends SemiontError {
|
|
6130
6223
|
code: BusRequestErrorCode;
|
|
6131
6224
|
constructor(message: string, code: BusRequestErrorCode, details?: Record<string, unknown>);
|
|
6132
6225
|
}
|
|
6226
|
+
/**
|
|
6227
|
+
* The reply channels — result, failure, and (for streaming operations)
|
|
6228
|
+
* progress — of every operation in `channels`, deduplicated. Entries that
|
|
6229
|
+
* are not operation request channels (broadcast signals, domain events)
|
|
6230
|
+
* contribute nothing.
|
|
6231
|
+
*
|
|
6232
|
+
* This is THE derivation for a narrowed-subscription transport profile
|
|
6233
|
+
* (`HttpTransportConfig.channels`: subscribe exactly the reply channels of
|
|
6234
|
+
* the operations a process awaits) and for a service's outbound reply pump
|
|
6235
|
+
* (forward exactly the replies of the operations it answers). Restating a
|
|
6236
|
+
* reply channel by hand was the recurring unbridged-reply bug class.
|
|
6237
|
+
*/
|
|
6238
|
+
declare function replyChannelsFor(channels: readonly string[]): EventName[];
|
|
6133
6239
|
/**
|
|
6134
6240
|
* Subset of ITransport that `busRequest` needs: a way to send a command and
|
|
6135
6241
|
* a way to observe channels. Generic enough that an in-process transport
|
|
@@ -6163,6 +6269,16 @@ interface BusRequestPrimitive {
|
|
|
6163
6269
|
* lose replies omits the surface and `busRequest` behaves as before.
|
|
6164
6270
|
*/
|
|
6165
6271
|
trackReply?(correlationId: string): () => void;
|
|
6272
|
+
/**
|
|
6273
|
+
* Whether this transport's receive path delivers `channel` — i.e. a reply
|
|
6274
|
+
* published there can actually reach this process. Wire transports whose
|
|
6275
|
+
* subscription set is configurable (a worker subscribing only the reply
|
|
6276
|
+
* channels it awaits) implement this so `busRequest` on a channel outside
|
|
6277
|
+
* the set fails fast with `bus.unsubscribed` instead of burning its
|
|
6278
|
+
* timeout on a reply that could never arrive. OPTIONAL: an in-process
|
|
6279
|
+
* transport delivers every channel and omits it.
|
|
6280
|
+
*/
|
|
6281
|
+
isSubscribed?(channel: string): boolean;
|
|
6166
6282
|
}
|
|
6167
6283
|
/**
|
|
6168
6284
|
* Request/reply over the bus, keyed by the operation's request channel.
|
|
@@ -7994,5 +8110,5 @@ declare function getShardPath(key: string, numBuckets?: number): [string, string
|
|
|
7994
8110
|
*/
|
|
7995
8111
|
declare const DISCOVERY_URL_PATH = "/discovery/kbs.json";
|
|
7996
8112
|
|
|
7997
|
-
export { AUTHORABLE_MEDIA_TYPES, BRIDGED_CHANNELS, BUS_OPERATIONS, BusRequestError, CHANNEL_SCHEMAS, CONTEXT_FULL_WEIGHT, CONTEXT_PARTIAL_WEIGHT, ConfigurationError, ConflictError, DEFAULT_CHUNKING_CONFIG, DISCOVERY_URL_PATH, EMBEDDABLE_MEDIA_TYPES, EventBus, GENERATABLE_MEDIA_TYPES, JWTTokenSchema, LOCALES, MEDIA_TYPES, NotFoundError, PERSISTED_EVENT_TYPES, POSITION_WEIGHT_MAX, POSITION_WINDOW, RESOURCE_BROADCAST_TYPES, STARTUP_FETCH_RETRY, ScopedEventBus, ScriptError, SemiontError, UnauthorizedError, ValidationError, accessToken, agentToDid, anchorAnnotation, anchorRuns, annotationId, annotationUri, applyBodyOperations, assembleAnnotation, authCode, baseMediaType, baseUrl, buildContentCache, burstBuffer, busLog, busLogEnabled, busRequest, capabilitiesOf, chunkText, cloneFormat, cloneToken, createCircleSvg, createFragmentSelector, createPolygonSvg, createRectangleSvg, createTomlConfigLoader, decodeRepresentation, decodeWithCharset, deriveStorageUri, deriveViews, didToAgent, email, entityType, errField, estimateTokens, extensionForMediaType, extractBoundingBox, extractCharset, extractContext, findBestTextMatch, findBodyItem, findClaimSpan, folderOf, formatLocaleDisplay, generateUuid, getAllLocaleCodes, getAllPlatformTypes, getAnnotationExactText, getAnnotationUriFromEvent, getBodySource, getBodyType, getChecksum, getCommentText, getCreator, getDerivedFrom, getExactText, getFragmentSelector, getLanguage, getLocaleEnglishName, getLocaleInfo, getLocaleNativeName, getNodeEncoding, getPageFromFragment, getPrimaryMediaType, getPrimaryRepresentation, getPrimarySelector, getResourceEntityTypes, getResourceId, getShardPath, getStorageUri, getSvgSelector, getTargetSelector, getTargetSource, getTextPositionSelector, getTextQuoteSelector, googleCredential, hasTargetSelector, isAnnotatable, isAnnotationId, isArchived, isArray, isAssessment, isBodyResolved, isBoolean, isComment, isDefined, isDraft, isEventRelatedToAnnotation, isFunction, isGatheredContext, isGenerationJobParams, isHighlight, isNull, isNullish, isNumber, isObject, isReference, isResolvedReference, isResourceId, isStoredEvent, isString, isStubReference, isSupportedMediaType, isTag, isTextRun, isTransientFetchError, isUndefined, isValidEmail, isValidPlatformType, jobId, jumpConsistentHash, kbDid, loadTomlConfig, locate, mcpToken, mediaTypeForExtension, normalizeCoordinates, normalizeText, parseEnvironment, parseFragmentSelector, parseSvgSelector, proposeStoragePath, reconcileSelector, refreshToken, resourceAnnotationUri, resourceId, resourceUri, retryWithBackoff, scaleSvgToNative, searchQuery, serializePerKey, setBusLogTraceIdProvider, softwareToAgent, storageFileName, textExtractionOf, textUnder, userDID, userId, userToAgent, userToDid, uuidV4, validateData, validateEnvironment, validateSvgMarkup, verifyPosition };
|
|
8113
|
+
export { AUTHORABLE_MEDIA_TYPES, BRIDGED_CHANNELS, BUS_OPERATIONS, BusRequestError, CHANNEL_SCHEMAS, CONTEXT_FULL_WEIGHT, CONTEXT_PARTIAL_WEIGHT, ConfigurationError, ConflictError, DEFAULT_CHUNKING_CONFIG, DISCOVERY_URL_PATH, EMBEDDABLE_MEDIA_TYPES, EventBus, GENERATABLE_MEDIA_TYPES, JWTTokenSchema, LOCALES, MEDIA_TYPES, NotFoundError, PERSISTED_EVENT_TYPES, POSITION_WEIGHT_MAX, POSITION_WINDOW, RESOURCE_BROADCAST_TYPES, STARTUP_FETCH_RETRY, ScopedEventBus, ScriptError, SemiontError, UnauthorizedError, ValidationError, accessToken, agentToDid, anchorAnnotation, anchorRuns, annotationId, annotationUri, applyBodyOperations, assembleAnnotation, authCode, baseMediaType, baseUrl, buildContentCache, burstBuffer, busLog, busLogEnabled, busRequest, capabilitiesOf, chunkText, cloneFormat, cloneToken, createCircleSvg, createFragmentSelector, createPolygonSvg, createRectangleSvg, createTomlConfigLoader, decodeRepresentation, decodeWithCharset, deriveStorageUri, deriveViews, didToAgent, email, entityType, errField, estimateTokens, extensionForMediaType, extractBoundingBox, extractCharset, extractContext, findBestTextMatch, findBodyItem, findClaimSpan, folderOf, formatLocaleDisplay, generateUuid, getAllLocaleCodes, getAllPlatformTypes, getAnnotationExactText, getAnnotationUriFromEvent, getBodySource, getBodyType, getChecksum, getCommentText, getCreator, getDerivedFrom, getExactText, getFragmentSelector, getLanguage, getLocaleEnglishName, getLocaleInfo, getLocaleNativeName, getNodeEncoding, getPageFromFragment, getPrimaryMediaType, getPrimaryRepresentation, getPrimarySelector, getResourceEntityTypes, getResourceId, getShardPath, getStorageUri, getSvgSelector, getTargetSelector, getTargetSource, getTextPositionSelector, getTextQuoteSelector, googleCredential, hasTargetSelector, isAnnotatable, isAnnotationId, isArchived, isArray, isAssessment, isBodyResolved, isBoolean, isComment, isDefined, isDraft, isEventRelatedToAnnotation, isFunction, isGatheredContext, isGenerationJobParams, isHighlight, isNull, isNullish, isNumber, isObject, isReference, isResolvedReference, isResourceId, isStoredEvent, isString, isStubReference, isSupportedMediaType, isTag, isTextRun, isTransientFetchError, isUndefined, isValidEmail, isValidPlatformType, jobId, jumpConsistentHash, kbDid, loadTomlConfig, locate, mcpToken, mediaTypeForExtension, normalizeCoordinates, normalizeText, parseEnvironment, parseFragmentSelector, parseSvgSelector, proposeStoragePath, reconcileSelector, refreshToken, replyChannelsFor, resourceAnnotationUri, resourceId, resourceUri, retryWithBackoff, scaleSvgToNative, searchQuery, serializePerKey, setBusLogTraceIdProvider, softwareToAgent, storageFileName, textExtractionOf, textUnder, userDID, userId, userToAgent, userToDid, uuidV4, validateData, validateEnvironment, validateSvgMarkup, verifyPosition };
|
|
7998
8114
|
export type { AccessToken, AnchorConfidence, AnchorMethod, AnchorRect, AnchorSelectors, AnchorStrategy, AnchoredText, AnchoringModel, Annotation, AnnotationCategory, AnnotationId, AnnotationUri, AnthropicProviderConfig, AppConfig, ArchivistServiceConfig, AssembledAnnotation, AuthCode, BaseUrl, BodyItem, BodyItemIdentity, BodyOperation, BoundingBox, Brand, BridgedChannel, BurstBufferOptions, BusOp, BusOperationKey, BusOperationSpec, BusRequestErrorCode, BusRequestPrimitive, ChunkingConfig, CloneToken, CollaboratorEntry, ConnectionState, ContentCache, ContentFormat, CreateAnnotationInternal, DatabaseServiceConfig, DiscoveredKB, DiscoveryDocument, Email, EmbeddingServiceConfig, EmittableChannel, EntityType, EntityTypeStats, Environment, EnvironmentConfig, EventBase, EventInput, EventMap, EventMetadata, EventName, EventOfType, EventQuery, EventSignature, ExtractionOutcome, FragmentSelector, GatewayServiceConfig, GatheredContext, GenerationJobParams, GoogleAuthRequest, GoogleCredential, GraphConnection, GraphDatabaseType, GraphPath, GraphServiceConfig, GraphViews, HealthCheckResponse, IContentTransport, IGatewayOperations, ITransport, InferenceProvidersConfig, JobId, JobType, ListUsersResponse, LlmSelectorInput, LocaleInfo, Logger, MCPToken, MatchQuality, McpServiceConfig, MediaTypeCapabilities, Motivation, OllamaProviderConfig, PdfCoordinate, PdfTextItem, PdfTextRun, PersistedEvent, PersistedEventType, PlatformType, Point, PutBinaryOptions, PutBinaryProgress, PutBinaryRequest, ReconciledSelector, RefreshToken, RenderMode, RenderedAnchor, ResourceAnnotationUri, ResourceAnnotations, ResourceBroadcastType, ResourceDescriptor, ResourceFilter, ResourceId, ResourceUri, RetryAttemptInfo, RetryPolicy, SearchQuery, SelectionData, Selector, SemiontConfig, ServicePlatformConfig, ServicesConfig, SiteConfig, StateUnit, StatusResponse, StoredEvent, StoredEventLike, SupportedMediaType, SvgSelector, TagCategory, TagSchema, TextExtraction, TextPosition, TextPositionSelector, TextQuoteSelector, ActorInferenceConfig as TomlActorInferenceConfig, TomlFileReader, InferenceConfig as TomlInferenceConfig, WorkerInferenceConfig as TomlWorkerInferenceConfig, TransportErrorCode, UpdateResourceInput, UpdateUserRequest, UpdateUserResponse, UserDID, UserId, UserResponse, ValidationFailure, ValidationResult, ValidationSuccess, VectorsServiceConfig, components, operations, paths };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { createTomlConfigLoader, loadTomlConfig } from './chunk-
|
|
2
|
-
import { BUS_OPERATIONS } from './chunk-
|
|
3
|
-
export { BRIDGED_CHANNELS, BUS_OPERATIONS, EventBus, ScopedEventBus, accessToken, annotationUri, authCode, baseUrl, busLog, busLogEnabled, cloneToken, email, entityType, googleCredential, jobId, mcpToken, refreshToken, resourceAnnotationUri, resourceUri, searchQuery, setBusLogTraceIdProvider, userDID } from './chunk-
|
|
1
|
+
export { createTomlConfigLoader, loadTomlConfig } from './chunk-UGI6IOOX.js';
|
|
2
|
+
import { BUS_OPERATIONS } from './chunk-EWOITHBH.js';
|
|
3
|
+
export { BRIDGED_CHANNELS, BUS_OPERATIONS, EventBus, ScopedEventBus, accessToken, annotationUri, authCode, baseUrl, busLog, busLogEnabled, cloneToken, email, entityType, googleCredential, jobId, mcpToken, refreshToken, resourceAnnotationUri, resourceUri, searchQuery, setBusLogTraceIdProvider, userDID } from './chunk-EWOITHBH.js';
|
|
4
4
|
import './chunk-YLJ4XMA6.js';
|
|
5
5
|
import { Observable, merge, TimeoutError, throwError, firstValueFrom } from 'rxjs';
|
|
6
6
|
import { filter, map, take, timeout, catchError, defaultIfEmpty } from 'rxjs/operators';
|
|
@@ -122,6 +122,9 @@ var CHANNEL_SCHEMAS = {
|
|
|
122
122
|
"frame:add-tag-schema": "FrameAddTagSchemaCommand",
|
|
123
123
|
"mark:create-ok": "MarkCreateOk",
|
|
124
124
|
"mark:create-failed": "CommandError",
|
|
125
|
+
"mark:commit": "MarkCommitCommand",
|
|
126
|
+
"mark:commit-ok": "MarkCommitOk",
|
|
127
|
+
"mark:commit-failed": "CommandError",
|
|
125
128
|
"mark:delete-ok": "MarkDeleteOk",
|
|
126
129
|
"mark:delete-failed": "CommandError",
|
|
127
130
|
"mark:archive-ok": null,
|
|
@@ -258,8 +261,10 @@ var CHANNEL_SCHEMAS = {
|
|
|
258
261
|
"job:report-progress": "JobReportProgressCommand",
|
|
259
262
|
"job:complete": "JobCompleteCommand",
|
|
260
263
|
"job:fail": "JobFailCommand",
|
|
264
|
+
"job:checkpoint": "JobCheckpointCommand",
|
|
261
265
|
"job:queued": "JobQueuedEvent",
|
|
262
266
|
"job:cancel-requested": "JobCancelRequest",
|
|
267
|
+
"job:cancel": "JobCancelCommand",
|
|
263
268
|
"job:status-requested": "JobStatusRequest",
|
|
264
269
|
"job:create": "JobCreateCommand",
|
|
265
270
|
"job:claim": "JobClaimCommand",
|
|
@@ -1008,10 +1013,32 @@ var BusRequestError = class extends SemiontError {
|
|
|
1008
1013
|
this.name = "BusRequestError";
|
|
1009
1014
|
}
|
|
1010
1015
|
};
|
|
1016
|
+
function replyChannelsFor(channels) {
|
|
1017
|
+
const out = /* @__PURE__ */ new Set();
|
|
1018
|
+
for (const ch of channels) {
|
|
1019
|
+
const op = BUS_OPERATIONS[ch];
|
|
1020
|
+
if (!op) continue;
|
|
1021
|
+
out.add(op.result);
|
|
1022
|
+
out.add(op.failure);
|
|
1023
|
+
if ("progress" in op && op.progress) out.add(op.progress);
|
|
1024
|
+
}
|
|
1025
|
+
return [...out];
|
|
1026
|
+
}
|
|
1011
1027
|
async function busRequest(bus, operation, payload, timeoutMs = 3e4) {
|
|
1012
1028
|
const correlationId = uuidV4();
|
|
1013
1029
|
const fullPayload = { ...payload, correlationId };
|
|
1014
1030
|
const { result: resultChannel, failure: failureChannel } = BUS_OPERATIONS[operation];
|
|
1031
|
+
if (bus.isSubscribed) {
|
|
1032
|
+
for (const replyChannel of [resultChannel, failureChannel]) {
|
|
1033
|
+
if (!bus.isSubscribed(replyChannel)) {
|
|
1034
|
+
throw new BusRequestError(
|
|
1035
|
+
`Transport is not subscribed to reply channel ${replyChannel} \u2014 a reply to ${operation} can never arrive. Add this operation's reply channels to the transport's channel set.`,
|
|
1036
|
+
"bus.unsubscribed",
|
|
1037
|
+
{ channel: operation, resultChannel, failureChannel }
|
|
1038
|
+
);
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1015
1042
|
const result$ = merge(
|
|
1016
1043
|
bus.stream(resultChannel).pipe(
|
|
1017
1044
|
filter((e) => e.correlationId === correlationId),
|
|
@@ -2195,6 +2222,6 @@ function getShardPath(key, numBuckets = 65536) {
|
|
|
2195
2222
|
// src/discovery.ts
|
|
2196
2223
|
var DISCOVERY_URL_PATH = "/discovery/kbs.json";
|
|
2197
2224
|
|
|
2198
|
-
export { AUTHORABLE_MEDIA_TYPES, BusRequestError, CHANNEL_SCHEMAS, CONTEXT_FULL_WEIGHT, CONTEXT_PARTIAL_WEIGHT, ConfigurationError, ConflictError, DEFAULT_CHUNKING_CONFIG, DISCOVERY_URL_PATH, EMBEDDABLE_MEDIA_TYPES, GENERATABLE_MEDIA_TYPES, JWTTokenSchema, LOCALES, MEDIA_TYPES, NotFoundError, PERSISTED_EVENT_TYPES, POSITION_WEIGHT_MAX, POSITION_WINDOW, RESOURCE_BROADCAST_TYPES, STARTUP_FETCH_RETRY, ScriptError, SemiontError, UnauthorizedError, ValidationError, agentToDid, anchorAnnotation, anchorRuns, annotationId, applyBodyOperations, assembleAnnotation, baseMediaType, buildContentCache, burstBuffer, busRequest, capabilitiesOf, chunkText, cloneFormat, createCircleSvg, createFragmentSelector, createPolygonSvg, createRectangleSvg, decodeRepresentation, decodeWithCharset, deriveStorageUri, deriveViews, didToAgent, errField, estimateTokens, extensionForMediaType, extractBoundingBox, extractCharset, extractContext, findBestTextMatch, findBodyItem, findClaimSpan, folderOf, formatLocaleDisplay, generateUuid, getAllLocaleCodes, getAllPlatformTypes, getAnnotationExactText, getAnnotationUriFromEvent, getBodySource, getBodyType, getChecksum, getCommentText, getCreator, getDerivedFrom, getExactText, getFragmentSelector, getLanguage, getLocaleEnglishName, getLocaleInfo, getLocaleNativeName, getNodeEncoding, getPageFromFragment, getPrimaryMediaType, getPrimaryRepresentation, getPrimarySelector, getResourceEntityTypes, getResourceId, getShardPath, getStorageUri, getSvgSelector, getTargetSelector, getTargetSource, getTextPositionSelector, getTextQuoteSelector, hasTargetSelector, isAnnotatable, isAnnotationId, isArchived, isArray, isAssessment, isBodyResolved, isBoolean, isComment, isDefined, isDraft, isEventRelatedToAnnotation, isFunction, isGatheredContext, isGenerationJobParams, isHighlight, isNull, isNullish, isNumber, isObject, isReference, isResolvedReference, isResourceId, isStoredEvent, isString, isStubReference, isSupportedMediaType, isTag, isTextRun, isTransientFetchError, isUndefined, isValidEmail, isValidPlatformType, jumpConsistentHash, kbDid, locate, mediaTypeForExtension, normalizeCoordinates, normalizeText, parseEnvironment, parseFragmentSelector, parseSvgSelector, proposeStoragePath, reconcileSelector, resourceId, retryWithBackoff, scaleSvgToNative, serializePerKey, softwareToAgent, storageFileName, textExtractionOf, textUnder, userId, userToAgent, userToDid, uuidV4, validateData, validateEnvironment, validateSvgMarkup, verifyPosition };
|
|
2225
|
+
export { AUTHORABLE_MEDIA_TYPES, BusRequestError, CHANNEL_SCHEMAS, CONTEXT_FULL_WEIGHT, CONTEXT_PARTIAL_WEIGHT, ConfigurationError, ConflictError, DEFAULT_CHUNKING_CONFIG, DISCOVERY_URL_PATH, EMBEDDABLE_MEDIA_TYPES, GENERATABLE_MEDIA_TYPES, JWTTokenSchema, LOCALES, MEDIA_TYPES, NotFoundError, PERSISTED_EVENT_TYPES, POSITION_WEIGHT_MAX, POSITION_WINDOW, RESOURCE_BROADCAST_TYPES, STARTUP_FETCH_RETRY, ScriptError, SemiontError, UnauthorizedError, ValidationError, agentToDid, anchorAnnotation, anchorRuns, annotationId, applyBodyOperations, assembleAnnotation, baseMediaType, buildContentCache, burstBuffer, busRequest, capabilitiesOf, chunkText, cloneFormat, createCircleSvg, createFragmentSelector, createPolygonSvg, createRectangleSvg, decodeRepresentation, decodeWithCharset, deriveStorageUri, deriveViews, didToAgent, errField, estimateTokens, extensionForMediaType, extractBoundingBox, extractCharset, extractContext, findBestTextMatch, findBodyItem, findClaimSpan, folderOf, formatLocaleDisplay, generateUuid, getAllLocaleCodes, getAllPlatformTypes, getAnnotationExactText, getAnnotationUriFromEvent, getBodySource, getBodyType, getChecksum, getCommentText, getCreator, getDerivedFrom, getExactText, getFragmentSelector, getLanguage, getLocaleEnglishName, getLocaleInfo, getLocaleNativeName, getNodeEncoding, getPageFromFragment, getPrimaryMediaType, getPrimaryRepresentation, getPrimarySelector, getResourceEntityTypes, getResourceId, getShardPath, getStorageUri, getSvgSelector, getTargetSelector, getTargetSource, getTextPositionSelector, getTextQuoteSelector, hasTargetSelector, isAnnotatable, isAnnotationId, isArchived, isArray, isAssessment, isBodyResolved, isBoolean, isComment, isDefined, isDraft, isEventRelatedToAnnotation, isFunction, isGatheredContext, isGenerationJobParams, isHighlight, isNull, isNullish, isNumber, isObject, isReference, isResolvedReference, isResourceId, isStoredEvent, isString, isStubReference, isSupportedMediaType, isTag, isTextRun, isTransientFetchError, isUndefined, isValidEmail, isValidPlatformType, jumpConsistentHash, kbDid, locate, mediaTypeForExtension, normalizeCoordinates, normalizeText, parseEnvironment, parseFragmentSelector, parseSvgSelector, proposeStoragePath, reconcileSelector, replyChannelsFor, resourceId, retryWithBackoff, scaleSvgToNative, serializePerKey, softwareToAgent, storageFileName, textExtractionOf, textUnder, userId, userToAgent, userToDid, uuidV4, validateData, validateEnvironment, validateSvgMarkup, verifyPosition };
|
|
2199
2226
|
//# sourceMappingURL=index.js.map
|
|
2200
2227
|
//# sourceMappingURL=index.js.map
|