@semiont/core 0.5.9 → 0.5.11

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/index.d.ts CHANGED
@@ -1814,17 +1814,6 @@ interface components {
1814
1814
  };
1815
1815
  resource: components["schemas"]["ResourceDescriptor"];
1816
1816
  };
1817
- AnnotationLLMContextResponse: {
1818
- annotation: components["schemas"]["Annotation"];
1819
- sourceResource: components["schemas"]["ResourceDescriptor"];
1820
- targetResource?: components["schemas"]["ResourceDescriptor"] | null;
1821
- /** @description Gathered context for this annotation */
1822
- context?: components["schemas"]["GatheredContext"];
1823
- targetContext?: {
1824
- content: string;
1825
- summary?: string;
1826
- };
1827
- };
1828
1817
  /** @description W3C Web Annotation target object - source is required, selector is optional */
1829
1818
  AnnotationTarget: {
1830
1819
  /** @description IRI of the resource being annotated */
@@ -1994,22 +1983,7 @@ interface components {
1994
1983
  };
1995
1984
  CreateAnnotationRequest: {
1996
1985
  motivation: components["schemas"]["Motivation"];
1997
- target: {
1998
- source: string;
1999
- selector: components["schemas"]["TextPositionSelector"] | {
2000
- /** @enum {string} */
2001
- type: "TextQuoteSelector";
2002
- exact: string;
2003
- prefix?: string;
2004
- suffix?: string;
2005
- } | components["schemas"]["SvgSelector"] | components["schemas"]["FragmentSelector"] | (components["schemas"]["TextPositionSelector"] | {
2006
- /** @enum {string} */
2007
- type: "TextQuoteSelector";
2008
- exact: string;
2009
- prefix?: string;
2010
- suffix?: string;
2011
- } | components["schemas"]["SvgSelector"] | components["schemas"]["FragmentSelector"])[];
2012
- };
1986
+ target: components["schemas"]["AnnotationTarget"];
2013
1987
  /** @description Optional body. Omit for annotations whose motivation alone is meaningful (highlighting) or whose user-supplied content is empty. Shape matches Annotation.body. */
2014
1988
  body?: components["schemas"]["AnnotationBody"] | components["schemas"]["AnnotationBody"][];
2015
1989
  };
@@ -2022,23 +1996,11 @@ interface components {
2022
1996
  success: boolean;
2023
1997
  message: string;
2024
1998
  };
2025
- /** @description Progress payload emitted on gather:annotation-progress and gather:progress SSE channels during LLM context gathering. */
1999
+ /** @description Progress payload emitted on the gather:annotation-progress SSE channel during LLM context gathering. */
2026
2000
  GatherProgress: {
2027
2001
  message?: string;
2028
2002
  percentage?: number;
2029
2003
  };
2030
- /** @description Completion payload emitted on gather:annotation-finished SSE channel. */
2031
- GatherAnnotationFinished: {
2032
- correlationId: string;
2033
- annotationId: string;
2034
- response: components["schemas"]["AnnotationLLMContextResponse"];
2035
- };
2036
- /** @description Completion payload emitted on gather:finished SSE channel for resource-level context gathering. */
2037
- GatherFinished: {
2038
- correlationId: string;
2039
- resourceId: string;
2040
- response: components["schemas"]["ResourceLLMContextResponse"];
2041
- };
2042
2004
  /** @description Search results payload emitted on match:search-results SSE channel. */
2043
2005
  MatchSearchResult: {
2044
2006
  correlationId: string;
@@ -2333,8 +2295,7 @@ interface components {
2333
2295
  };
2334
2296
  JobStatusResponse: {
2335
2297
  jobId: string;
2336
- /** @enum {string} */
2337
- type: "reference-annotation" | "generation" | "highlight-annotation" | "assessment-annotation" | "comment-annotation" | "tag-annotation";
2298
+ type: components["schemas"]["JobType"];
2338
2299
  /** @enum {string} */
2339
2300
  status: "pending" | "running" | "complete" | "failed" | "cancelled";
2340
2301
  userId: string;
@@ -2345,6 +2306,35 @@ interface components {
2345
2306
  progress?: unknown;
2346
2307
  result?: unknown;
2347
2308
  };
2309
+ /** @description Knowledge graph gathered for an LLM context — a shared backbone in which resources AND annotations are typed nodes, connected by typed (optionally bidirectional) edges. Flattened views the matcher/generation read (connections, citedBy, siblings) are derived from these nodes/edges. */
2310
+ KnowledgeGraph: {
2311
+ nodes: {
2312
+ /** @description Node identifier — a ResourceId or AnnotationId */
2313
+ id: string;
2314
+ /**
2315
+ * @description Whether this node is a resource or an annotation
2316
+ * @enum {string}
2317
+ */
2318
+ type: "resource" | "annotation";
2319
+ label: string;
2320
+ /** @description Entity types on the node (resources) or carried by the annotation */
2321
+ entityTypes?: string[];
2322
+ metadata?: {
2323
+ [key: string]: unknown;
2324
+ };
2325
+ }[];
2326
+ edges: {
2327
+ source: string;
2328
+ target: string;
2329
+ /** @description Edge kind (e.g. citation, annotation-of, sibling) */
2330
+ type: string;
2331
+ /** @description Whether the connection goes both ways */
2332
+ bidirectional?: boolean;
2333
+ metadata?: {
2334
+ [key: string]: unknown;
2335
+ };
2336
+ }[];
2337
+ };
2348
2338
  ListResourcesResponse: {
2349
2339
  resources: components["schemas"]["ResourceDescriptor"][];
2350
2340
  total: number;
@@ -2498,37 +2488,6 @@ interface components {
2498
2488
  /** @description Entity types on the matched passage */
2499
2489
  entityTypes?: string[];
2500
2490
  };
2501
- ResourceLLMContextResponse: {
2502
- mainResource: components["schemas"]["ResourceDescriptor"];
2503
- relatedResources: components["schemas"]["ResourceDescriptor"][];
2504
- annotations: components["schemas"]["Annotation"][];
2505
- graph: {
2506
- nodes: {
2507
- id: string;
2508
- type: string;
2509
- label: string;
2510
- metadata: {
2511
- [key: string]: unknown;
2512
- };
2513
- }[];
2514
- edges: {
2515
- source: string;
2516
- target: string;
2517
- type: string;
2518
- metadata: {
2519
- [key: string]: unknown;
2520
- };
2521
- }[];
2522
- };
2523
- summary?: string;
2524
- suggestedReferences?: string[];
2525
- /** @description The content of the main resource (included if includeContent=true) */
2526
- mainResourceContent?: string;
2527
- /** @description Map of resource IDs to their content (included if includeContent=true) */
2528
- relatedResourcesContent?: {
2529
- [key: string]: string;
2530
- };
2531
- };
2532
2491
  SpecificResource: {
2533
2492
  /** @enum {string} */
2534
2493
  type: "SpecificResource";
@@ -2645,12 +2604,10 @@ interface components {
2645
2604
  BeckonSparkleEvent: {
2646
2605
  annotationId: string;
2647
2606
  };
2648
- /** @description Success result emitted on the bind:body-updated bus channel after bind:update-body has been applied. */
2607
+ /** @description Void success reply emitted on the bind:body-updated channel after bind:update-body has been applied, matched to the originating command by correlationId. */
2649
2608
  BindBodyUpdated: {
2650
- /** @description Correlation ID echoed from the originating bind:update-body command */
2609
+ /** @description Correlation id echoed from the originating bind:update-body command so busRequest can match the reply. */
2651
2610
  correlationId: string;
2652
- /** @description Branded AnnotationId of the annotation whose body was updated */
2653
- annotationId: string;
2654
2611
  };
2655
2612
  /** @description Command payload sent on the bind:initiate bus channel to start a bind flow. */
2656
2613
  BindInitiateCommand: {
@@ -2693,6 +2650,17 @@ interface components {
2693
2650
  * @enum {string}
2694
2651
  */
2695
2652
  BodyPurpose: "assessing" | "bookmarking" | "classifying" | "commenting" | "describing" | "editing" | "highlighting" | "identifying" | "linking" | "moderating" | "questioning" | "replying" | "tagging";
2653
+ /** @description Request to browse the KB's collaborator directory (its declared Agents) */
2654
+ BrowseAgentsRequest: {
2655
+ correlationId: string;
2656
+ };
2657
+ /** @description Result of browsing the collaborator directory */
2658
+ BrowseAgentsResult: {
2659
+ correlationId: string;
2660
+ response: {
2661
+ agents: components["schemas"]["CollaboratorEntry"][];
2662
+ };
2663
+ };
2696
2664
  /** @description Request to browse the history of an annotation */
2697
2665
  BrowseAnnotationHistoryRequest: {
2698
2666
  correlationId: string;
@@ -2861,6 +2829,12 @@ interface components {
2861
2829
  correlationId: string;
2862
2830
  response: components["schemas"]["GetTagSchemasResponse"];
2863
2831
  };
2832
+ /** @description One collaborator in the KB's directory: a W3C Agent plus, for software agents declared in the KB's worker inference config, the job types it serves. Actor-role-only agents (gatherer/matcher) and Persons omit servesJobTypes. */
2833
+ CollaboratorEntry: {
2834
+ agent: components["schemas"]["Agent"];
2835
+ /** @description Job types this agent is declared to serve (from the KB's workers.* config sections). Absent for Persons and for agents declared only under actor roles. */
2836
+ servesJobTypes?: components["schemas"]["JobType"][];
2837
+ };
2864
2838
  /** @description W3C Web Annotation FragmentSelector for media fragment identifiers (RFC 3778 for PDFs) */
2865
2839
  FragmentSelector: {
2866
2840
  /** @enum {string} */
@@ -2882,8 +2856,8 @@ interface components {
2882
2856
  correlationId: string;
2883
2857
  /** @description Branded AnnotationId of the annotation whose context was gathered */
2884
2858
  annotationId: string;
2885
- /** @description The gathered annotation context */
2886
- response: components["schemas"]["AnnotationLLMContextResponse"];
2859
+ /** @description The gathered annotation context (unified GatheredContext, focus.kind:'annotation') */
2860
+ response: components["schemas"]["GatheredContext"];
2887
2861
  };
2888
2862
  /** @description Request payload sent on the gather:requested bus channel to gather context for an annotation. */
2889
2863
  GatherAnnotationRequest: {
@@ -2903,66 +2877,75 @@ interface components {
2903
2877
  contextWindow?: number;
2904
2878
  };
2905
2879
  };
2906
- /** @description Context gathered for an annotation. Includes source document excerpts, metadata, and graph-derived context. Used by both Find (bind) and Generate (yield) flows. */
2880
+ /** @description Context gathered for a gather.* call — consumed by yield.* (generation) and the matcher. A shared base (graph, semanticContext, metadata, inferredRelationshipSummary) plus a discriminated `focus` that names the anchor: an annotation or a whole resource. */
2907
2881
  GatheredContext: {
2908
- /** @description The annotation this context was gathered for */
2909
- annotation: components["schemas"]["Annotation"];
2910
- /** @description The resource containing the annotation */
2911
- sourceResource: components["schemas"]["ResourceDescriptor"];
2912
- /** @description Text context from the source document */
2913
- sourceContext?: {
2914
- /** @description Text appearing before the selected passage */
2915
- before?: string;
2916
- /** @description The selected text passage (the annotation target) */
2917
- selected: string;
2918
- /** @description Text appearing after the selected passage */
2919
- after?: string;
2882
+ /** @description The gather anchor. Discriminated on `kind`. */
2883
+ focus: {
2884
+ /** @enum {string} */
2885
+ kind: "annotation";
2886
+ /** @description The annotation this context was gathered for */
2887
+ annotation: components["schemas"]["Annotation"];
2888
+ /** @description The resource containing the annotation */
2889
+ sourceResource: components["schemas"]["ResourceDescriptor"];
2890
+ /** @description Text context around the annotation target */
2891
+ selected?: {
2892
+ /** @description Text appearing before the selected passage */
2893
+ before?: string;
2894
+ /** @description The selected text passage (the annotation target) */
2895
+ text: string;
2896
+ /** @description Text appearing after the selected passage */
2897
+ after?: string;
2898
+ };
2899
+ /** @description User-provided hint to supplement or replace the selected text for search and generation */
2900
+ userHint?: string;
2901
+ /** @description The resource the annotation links to, if it is a resolved reference. Dormant capability — produced/exposed but not yet consumed (see LINK-TARGET-CONTEXT.md). */
2902
+ targetResource?: components["schemas"]["ResourceDescriptor"];
2903
+ /** @description Context about the annotation's link target. Dormant — see LINK-TARGET-CONTEXT.md. */
2904
+ targetContext?: {
2905
+ content: string;
2906
+ summary?: string;
2907
+ };
2908
+ } | {
2909
+ /** @enum {string} */
2910
+ kind: "resource";
2911
+ /** @description The resource this context was gathered for */
2912
+ resource: components["schemas"]["ResourceDescriptor"];
2913
+ summary?: string;
2914
+ suggestedReferences?: string[];
2915
+ /** @description Resource content (included when requested) */
2916
+ content?: {
2917
+ /** @description Content of the focal resource */
2918
+ main?: string;
2919
+ /** @description Map of related resource IDs to their content */
2920
+ related?: {
2921
+ [key: string]: string;
2922
+ };
2923
+ };
2924
+ };
2925
+ /** @description Knowledge graph backbone — resources AND annotations as typed nodes. The flattened views (connections, citedBy, siblings) are derived from this. */
2926
+ graph: components["schemas"]["KnowledgeGraph"];
2927
+ /** @description Semantically similar passages from across the knowledge base, found via vector search */
2928
+ semanticContext?: {
2929
+ /** @description Passages ranked by cosine similarity to the focal text */
2930
+ similar: components["schemas"]["SemanticMatch"][];
2931
+ /** @description Entity types excluded from this recall — a record of how `similar` was filtered (e.g. ['Question'] so answer-generation never surfaces prior questions). Absent when no exclusion was applied. */
2932
+ excludedEntityTypes?: string[];
2920
2933
  };
2921
- /** @description Context metadata about the annotation and its source */
2922
- metadata?: {
2934
+ /** @description Context metadata about the focal anchor and its source */
2935
+ metadata: {
2923
2936
  /** @description Type of source resource (e.g., 'document', 'image', 'video') */
2924
2937
  resourceType?: string;
2925
2938
  /** @description BCP 47 language tag of source content */
2926
2939
  language?: string;
2927
- /** @description Entity types associated with the annotation */
2940
+ /** @description Entity types associated with the focal anchor */
2928
2941
  entityTypes?: string[];
2929
- };
2930
- /** @description User-provided textual hint to supplement or replace the selected text for search and generation */
2931
- userHint?: string;
2932
- /** @description Graph-derived context from the knowledge base */
2933
- graphContext?: {
2934
- /** @description Resources connected to the source resource via annotations */
2935
- connections?: {
2936
- /** @description ID of the connected resource */
2937
- resourceId: string;
2938
- /** @description Name of the connected resource */
2939
- resourceName: string;
2940
- /** @description Entity types on the connected resource */
2941
- entityTypes?: string[];
2942
- /** @description Whether the connection goes both ways */
2943
- bidirectional: boolean;
2944
- }[];
2945
- /** @description Number of other resources that reference the source resource */
2946
- citedByCount?: number;
2947
- /** @description Resources that reference the source resource */
2948
- citedBy?: {
2949
- resourceId: string;
2950
- resourceName: string;
2951
- }[];
2952
- /** @description Entity types from other annotations on the same resource */
2953
- siblingEntityTypes?: string[];
2954
- /** @description Global frequency counts for entity types (for IDF-like weighting) */
2942
+ /** @description Global frequency counts for entity types (for IDF-like weighting). A KB-wide statistic, not a neighborhood property — kept here rather than on the graph. */
2955
2943
  entityTypeFrequencies?: {
2956
2944
  [key: string]: number;
2957
2945
  };
2958
- /** @description LLM-generated summary of the annotation's relationships in the knowledge graph */
2959
- inferredRelationshipSummary?: string;
2960
- };
2961
- /** @description Semantically similar passages from across the knowledge base, found via vector search */
2962
- semanticContext?: {
2963
- /** @description Passages ranked by cosine similarity to the focal text */
2964
- similar: components["schemas"]["SemanticMatch"][];
2965
2946
  };
2947
+ /** @description LLM-generated summary of the focal anchor's relationships in the knowledge graph */
2948
+ inferredRelationshipSummary?: string;
2966
2949
  };
2967
2950
  /** @description Completion payload emitted on the gather:resource-complete bus channel when resource context gathering finishes. */
2968
2951
  GatherResourceComplete: {
@@ -2970,8 +2953,8 @@ interface components {
2970
2953
  correlationId: string;
2971
2954
  /** @description Branded ResourceId of the resource whose context was gathered */
2972
2955
  resourceId: string;
2973
- /** @description The gathered resource context */
2974
- response: components["schemas"]["ResourceLLMContextResponse"];
2956
+ /** @description The gathered resource context (unified GatheredContext, focus.kind:'resource') */
2957
+ response: components["schemas"]["GatheredContext"];
2975
2958
  };
2976
2959
  /** @description Request payload sent on the gather:resource-requested bus channel to gather context for a resource. */
2977
2960
  GatherResourceRequest: {
@@ -2989,6 +2972,8 @@ interface components {
2989
2972
  includeContent: boolean;
2990
2973
  /** @description Whether to include resource summaries in the gathered result */
2991
2974
  includeSummary: boolean;
2975
+ /** @description Entity types to exclude from the semantic recall built into this context (caller-supplied; e.g. a chat consumer passes ['Question'] so prior questions never ground answer generation). Optional; default none. */
2976
+ excludeEntityTypes?: string[];
2992
2977
  };
2993
2978
  };
2994
2979
  /** @description Request to generate an AI summary of an annotation */
@@ -3004,6 +2989,8 @@ interface components {
3004
2989
  };
3005
2990
  /** @description Request to cancel a job */
3006
2991
  JobCancelRequest: {
2992
+ /** @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. */
2993
+ correlationId?: string;
3007
2994
  /** @enum {string} */
3008
2995
  jobType: "annotation" | "generation";
3009
2996
  };
@@ -3015,8 +3002,9 @@ interface components {
3015
3002
  /** @description Command to create a new job via the event bus */
3016
3003
  JobCreateCommand: {
3017
3004
  correlationId: string;
3018
- /** @enum {string} */
3019
- jobType: "reference-annotation" | "highlight-annotation" | "assessment-annotation" | "comment-annotation" | "tag-annotation" | "generation";
3005
+ /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
3006
+ _userId?: string;
3007
+ jobType: components["schemas"]["JobType"];
3020
3008
  resourceId: string;
3021
3009
  params: {
3022
3010
  [key: string]: unknown;
@@ -3167,18 +3155,24 @@ interface components {
3167
3155
  };
3168
3156
  /** @description Bus command to add a new entity type to the KB's vocabulary. Carried on the `frame:add-entity-type` channel — Frame is the schema-layer flow that owns vocabulary writes. */
3169
3157
  FrameAddEntityTypeCommand: {
3158
+ /** @description Correlation id for request/reply matching, set by the SDK's busRequest so the confirmed-write ack/failure routes back. Absent for in-process (bootstrap/replay/import) emits, which race the frame:entity-type-added domain event instead. */
3159
+ correlationId?: string;
3170
3160
  tag: string;
3171
3161
  /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
3172
3162
  _userId?: string;
3173
3163
  };
3174
3164
  /** @description Bus command to register a tag schema with the KB's runtime registry. Carried on the `frame:add-tag-schema` channel — Frame is the schema-layer flow that owns vocabulary writes. Most-recent registration of a given `schema.id` wins; the projection reflects the latest content. Identical re-registrations are silent; differing content overwrites and logs a warning. */
3175
3165
  FrameAddTagSchemaCommand: {
3166
+ /** @description Correlation id for request/reply matching, set by the SDK's busRequest so the confirmed-write ack/failure routes back. Absent for in-process emits. */
3167
+ correlationId?: string;
3176
3168
  schema: components["schemas"]["TagSchema"];
3177
3169
  /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
3178
3170
  _userId?: string;
3179
3171
  };
3180
3172
  /** @description Bus command to archive a resource and optionally remove its file. */
3181
3173
  MarkArchiveCommand: {
3174
+ /** @description Correlation id for request/reply matching, set by the SDK's busRequest so the confirmed-write ack/failure routes back. */
3175
+ correlationId?: string;
3182
3176
  /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
3183
3177
  _userId?: string;
3184
3178
  resourceId: string;
@@ -3203,10 +3197,6 @@ interface components {
3203
3197
  categories?: string[];
3204
3198
  };
3205
3199
  };
3206
- /** @description Emitted when the mark click action changes */
3207
- MarkClickChangedEvent: {
3208
- action: string;
3209
- };
3210
3200
  /** @description Bus command to create an annotation on a resource. */
3211
3201
  MarkCreateCommand: {
3212
3202
  /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
@@ -3216,9 +3206,14 @@ interface components {
3216
3206
  annotation: components["schemas"]["Annotation"];
3217
3207
  resourceId: string;
3218
3208
  };
3219
- /** @description Success response after creating an annotation. */
3209
+ /** @description Success reply after creating an annotation, matched to the originating command by correlationId. */
3220
3210
  MarkCreateOk: {
3221
- annotationId: string;
3211
+ /** @description Correlation id echoed from the mark:create-request command so busRequest can match the reply. */
3212
+ correlationId?: string;
3213
+ /** @description The created annotation's identity. */
3214
+ response: {
3215
+ annotationId: string;
3216
+ };
3222
3217
  };
3223
3218
  /** @description Raw annotation creation intent — bus handler assembles the W3C annotation */
3224
3219
  MarkCreateRequest: {
@@ -3228,31 +3223,34 @@ interface components {
3228
3223
  };
3229
3224
  /** @description Bus command to delete an annotation. */
3230
3225
  MarkDeleteCommand: {
3226
+ /** @description Correlation id for request/reply matching, set by the SDK's busRequest so the confirmed-write ack/failure routes back. */
3227
+ correlationId?: string;
3231
3228
  /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
3232
3229
  _userId?: string;
3233
3230
  annotationId: string;
3234
3231
  resourceId?: string;
3235
3232
  };
3236
- /** @description Success response after deleting an annotation. */
3233
+ /** @description Success reply after deleting an annotation, matched to the originating command by correlationId. */
3237
3234
  MarkDeleteOk: {
3238
- annotationId: string;
3235
+ /** @description Correlation id echoed from the mark:delete command so busRequest can match the reply. */
3236
+ correlationId?: string;
3237
+ /** @description The deleted annotation's identity. */
3238
+ response: {
3239
+ annotationId: string;
3240
+ };
3239
3241
  };
3240
3242
  /** @description Emitted when the user requests a new mark (annotation) on a resource */
3241
3243
  MarkRequestedEvent: {
3244
+ /** @description The '@id' of the resource the mark belongs to (W3C target.source). Routes the event to the right viewer/state unit when a host mounts many viewers on one session. */
3245
+ source: string;
3242
3246
  /** @description One or more W3C selectors */
3243
3247
  selector: components["schemas"]["TextPositionSelector"] | components["schemas"]["TextQuoteSelector"] | components["schemas"]["SvgSelector"] | components["schemas"]["FragmentSelector"] | (components["schemas"]["TextPositionSelector"] | components["schemas"]["TextQuoteSelector"] | components["schemas"]["SvgSelector"] | components["schemas"]["FragmentSelector"])[];
3244
3248
  motivation: components["schemas"]["Motivation"];
3245
3249
  };
3246
- /** @description Emitted when the active mark selection changes */
3247
- MarkSelectionChangedEvent: {
3248
- motivation: string | null;
3249
- };
3250
- /** @description Emitted when the mark shape changes */
3251
- MarkShapeChangedEvent: {
3252
- shape: string;
3253
- };
3254
3250
  /** @description Emitted when a mark is submitted with its annotation body */
3255
3251
  MarkSubmitEvent: {
3252
+ /** @description The '@id' of the resource the mark belongs to (W3C target.source). Routes the submit to the state unit bound to that resource — without it, N mounted units each create the annotation (N copies on N resources). */
3253
+ source: string;
3256
3254
  motivation: components["schemas"]["Motivation"];
3257
3255
  /** @description One or more W3C selectors */
3258
3256
  selector: components["schemas"]["TextPositionSelector"] | components["schemas"]["TextQuoteSelector"] | components["schemas"]["SvgSelector"] | components["schemas"]["FragmentSelector"] | (components["schemas"]["TextPositionSelector"] | components["schemas"]["TextQuoteSelector"] | components["schemas"]["SvgSelector"] | components["schemas"]["FragmentSelector"])[];
@@ -3261,6 +3259,8 @@ interface components {
3261
3259
  };
3262
3260
  /** @description Bus command to unarchive a previously archived resource. */
3263
3261
  MarkUnarchiveCommand: {
3262
+ /** @description Correlation id for request/reply matching, set by the SDK's busRequest so the confirmed-write ack/failure routes back. */
3263
+ correlationId?: string;
3264
3264
  /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
3265
3265
  _userId?: string;
3266
3266
  resourceId: string;
@@ -3278,6 +3278,8 @@ interface components {
3278
3278
  };
3279
3279
  /** @description Bus command to replace the entity types on a resource. */
3280
3280
  MarkUpdateEntityTypesCommand: {
3281
+ /** @description Correlation id for request/reply matching, set by the SDK's busRequest so the confirmed-write ack/failure routes back. */
3282
+ correlationId?: string;
3281
3283
  resourceId: string;
3282
3284
  /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
3283
3285
  _userId?: string;
@@ -3355,7 +3357,7 @@ interface components {
3355
3357
  YieldCloneCreated: {
3356
3358
  correlationId: string;
3357
3359
  response: {
3358
- resourceId?: string;
3360
+ resourceId: string;
3359
3361
  };
3360
3362
  };
3361
3363
  /** @description Bus command to request cloning a resource using a clone token. */
@@ -3370,6 +3372,8 @@ interface components {
3370
3372
  };
3371
3373
  /** @description Bus command to create a yielded resource in the knowledge base. */
3372
3374
  YieldCreateCommand: {
3375
+ /** @description Correlation id for request/reply matching, set by busRequest so the yield:create-ok / yield:create-failed reply routes back to the awaiting caller. */
3376
+ correlationId?: string;
3373
3377
  /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
3374
3378
  _userId?: string;
3375
3379
  name: string;
@@ -3388,14 +3392,14 @@ interface components {
3388
3392
  generator?: components["schemas"]["Agent"] | components["schemas"]["Agent"][];
3389
3393
  noGit?: boolean;
3390
3394
  };
3391
- /** @description Success response after creating a yielded resource. */
3395
+ /** @description Success reply after creating a yielded resource, matched to the originating command by correlationId. */
3392
3396
  YieldCreateOk: {
3393
- resourceId: string;
3394
- resource: components["schemas"]["ResourceDescriptor"];
3395
- };
3396
- /** @description Success response after moving a yielded resource. */
3397
- YieldMoveOk: {
3398
- resourceId: string;
3397
+ /** @description Correlation id echoed from the yield:create command so busRequest can match the reply. */
3398
+ correlationId?: string;
3399
+ /** @description The created resource's identity. */
3400
+ response: {
3401
+ resourceId: string;
3402
+ };
3399
3403
  };
3400
3404
  /** @description Bus command to move (rename) a yielded resource. */
3401
3405
  YieldMvCommand: {
@@ -3407,6 +3411,8 @@ interface components {
3407
3411
  };
3408
3412
  /** @description Bus command to update a yielded resource's storage content. */
3409
3413
  YieldUpdateCommand: {
3414
+ /** @description Correlation id for request/reply matching, set by busRequest so the yield:update-ok / yield:update-failed reply routes back to the awaiting caller. */
3415
+ correlationId?: string;
3410
3416
  /** @description Authenticated user's DID, injected by the /bus/emit gateway. Clients do not set this. */
3411
3417
  _userId?: string;
3412
3418
  resourceId: string;
@@ -3415,9 +3421,14 @@ interface components {
3415
3421
  byteSize: number;
3416
3422
  noGit?: boolean;
3417
3423
  };
3418
- /** @description Success response after updating a yielded resource. */
3424
+ /** @description Success reply after updating a yielded resource, matched to the originating command by correlationId. */
3419
3425
  YieldUpdateOk: {
3420
- resourceId: string;
3426
+ /** @description Correlation id echoed from the yield:update command so busRequest can match the reply. */
3427
+ correlationId?: string;
3428
+ /** @description The updated resource's identity. */
3429
+ response: {
3430
+ resourceId: string;
3431
+ };
3421
3432
  };
3422
3433
  };
3423
3434
  responses: never;
@@ -3791,8 +3802,7 @@ type EventMap = {
3791
3802
  'yield:create-ok': components['schemas']['YieldCreateOk'];
3792
3803
  'yield:create-failed': components['schemas']['CommandError'];
3793
3804
  'yield:update-ok': components['schemas']['YieldUpdateOk'];
3794
- 'yield:update-failed': components['schemas']['YieldUpdateOk'] & components['schemas']['CommandError'];
3795
- 'yield:move-ok': components['schemas']['YieldMoveOk'];
3805
+ 'yield:update-failed': components['schemas']['CommandError'];
3796
3806
  'yield:move-failed': {
3797
3807
  fromUri: string;
3798
3808
  } & components['schemas']['CommandError'];
@@ -3832,6 +3842,18 @@ type EventMap = {
3832
3842
  'mark:create-failed': components['schemas']['CommandError'];
3833
3843
  'mark:delete-ok': components['schemas']['MarkDeleteOk'];
3834
3844
  'mark:delete-failed': components['schemas']['CommandError'];
3845
+ 'mark:archive-ok': {
3846
+ correlationId?: string;
3847
+ };
3848
+ 'mark:archive-failed': components['schemas']['CommandError'];
3849
+ 'mark:unarchive-ok': {
3850
+ correlationId?: string;
3851
+ };
3852
+ 'mark:unarchive-failed': components['schemas']['CommandError'];
3853
+ 'mark:update-entity-types-ok': {
3854
+ correlationId?: string;
3855
+ };
3856
+ 'mark:update-entity-types-failed': components['schemas']['CommandError'];
3835
3857
  'mark:body-update-failed': components['schemas']['CommandError'];
3836
3858
  'mark:select-comment': components['schemas']['SelectionData'];
3837
3859
  'mark:select-tag': components['schemas']['SelectionData'];
@@ -3843,15 +3865,17 @@ type EventMap = {
3843
3865
  'mark:assist-request': components['schemas']['MarkAssistRequestEvent'];
3844
3866
  'mark:assist-cancelled': void;
3845
3867
  'mark:progress-dismiss': void;
3846
- 'mark:mode-toggled': void;
3847
- 'mark:selection-changed': components['schemas']['MarkSelectionChangedEvent'];
3848
- 'mark:click-changed': components['schemas']['MarkClickChangedEvent'];
3849
- 'mark:shape-changed': components['schemas']['MarkShapeChangedEvent'];
3850
3868
  'frame:entity-type-added': StoredEvent<EventOfType<'frame:entity-type-added'>>;
3851
3869
  'frame:tag-schema-added': StoredEvent<EventOfType<'frame:tag-schema-added'>>;
3852
3870
  'frame:add-entity-type': components['schemas']['FrameAddEntityTypeCommand'];
3853
3871
  'frame:add-tag-schema': components['schemas']['FrameAddTagSchemaCommand'];
3872
+ 'frame:entity-type-add-ok': {
3873
+ correlationId?: string;
3874
+ };
3854
3875
  'frame:entity-type-add-failed': components['schemas']['CommandError'];
3876
+ 'frame:tag-schema-add-ok': {
3877
+ correlationId?: string;
3878
+ };
3855
3879
  'frame:tag-schema-add-failed': components['schemas']['CommandError'];
3856
3880
  'bind:initiate': BindInitiateCommand;
3857
3881
  'bind:update-body': BindUpdateBodyCommand;
@@ -3881,9 +3905,6 @@ type EventMap = {
3881
3905
  correlationId: string;
3882
3906
  } & components['schemas']['CommandError'];
3883
3907
  'gather:annotation-progress': components['schemas']['GatherProgress'];
3884
- 'gather:annotation-finished': components['schemas']['GatherAnnotationFinished'];
3885
- 'gather:progress': components['schemas']['GatherProgress'];
3886
- 'gather:finished': components['schemas']['GatherFinished'];
3887
3908
  'browse:resource-requested': components['schemas']['BrowseResourceRequest'];
3888
3909
  'browse:resource-result': components['schemas']['BrowseResourceResult'];
3889
3910
  'browse:resource-failed': {
@@ -3937,6 +3958,11 @@ type EventMap = {
3937
3958
  'browse:tag-schemas-failed': {
3938
3959
  correlationId: string;
3939
3960
  } & components['schemas']['CommandError'];
3961
+ 'browse:agents-requested': components['schemas']['BrowseAgentsRequest'];
3962
+ 'browse:agents-result': components['schemas']['BrowseAgentsResult'];
3963
+ 'browse:agents-failed': {
3964
+ correlationId: string;
3965
+ } & components['schemas']['CommandError'];
3940
3966
  'browse:directory-requested': components['schemas']['BrowseDirectoryRequest'];
3941
3967
  'browse:directory-result': components['schemas']['BrowseDirectoryResult'];
3942
3968
  'browse:directory-failed': {
@@ -3988,6 +4014,13 @@ type EventMap = {
3988
4014
  'job:claim-failed': {
3989
4015
  correlationId: string;
3990
4016
  } & components['schemas']['CommandError'];
4017
+ 'job:cancel-ok': {
4018
+ correlationId?: string;
4019
+ response: {
4020
+ cancelled: number;
4021
+ };
4022
+ };
4023
+ 'job:cancel-failed': components['schemas']['CommandError'];
3991
4024
  'settings:theme-changed': components['schemas']['SettingsThemeChangedEvent'];
3992
4025
  'settings:line-numbers-toggled': void;
3993
4026
  'settings:locale-changed': components['schemas']['SettingsLocaleChangedEvent'];
@@ -4021,7 +4054,22 @@ type EventMap = {
4021
4054
  reason: string;
4022
4055
  };
4023
4056
  };
4024
- /** Any valid channel name on the EventBus. */
4057
+ /**
4058
+ * Any valid channel name on the EventBus — `keyof EventMap`, the root channel
4059
+ * type. Two subsets matter, and confusing them is a silent-failure trap:
4060
+ *
4061
+ * - `EmittableChannel` (below) — channels with a non-null `CHANNEL_SCHEMAS`
4062
+ * entry; what you EMIT (the `/bus/emit` gateway validates the payload).
4063
+ * - `BridgedChannel` (`bridged-channels.ts`) — the transport fan-in set; the
4064
+ * only channels a client can SUBSCRIBE to over a concrete transport.
4065
+ *
4066
+ * Request/reply (`busRequest`) emits on an `EmittableChannel` and subscribes on
4067
+ * `BridgedChannel` replies. A reply channel that is a valid `EventName` but NOT
4068
+ * in `BRIDGED_CHANNELS` is never delivered → the request times out with no
4069
+ * compile or runtime error (see
4070
+ * `.plans/bugs/gather-resource-complete-not-bridged.md`). `busRequest` now types
4071
+ * its reply params `BridgedChannel` so that omission is a compile error.
4072
+ */
4025
4073
  type EventName = keyof EventMap;
4026
4074
  /**
4027
4075
  * Genuine resource-bound broadcast event types.
@@ -4080,7 +4128,6 @@ declare const CHANNEL_SCHEMAS: {
4080
4128
  readonly 'yield:create-failed': "CommandError";
4081
4129
  readonly 'yield:update-ok': "YieldUpdateOk";
4082
4130
  readonly 'yield:update-failed': null;
4083
- readonly 'yield:move-ok': "YieldMoveOk";
4084
4131
  readonly 'yield:move-failed': null;
4085
4132
  readonly 'yield:clone-token-generated': null;
4086
4133
  readonly 'yield:clone-token-failed': null;
@@ -4110,8 +4157,16 @@ declare const CHANNEL_SCHEMAS: {
4110
4157
  readonly 'mark:create-failed': "CommandError";
4111
4158
  readonly 'mark:delete-ok': "MarkDeleteOk";
4112
4159
  readonly 'mark:delete-failed': "CommandError";
4160
+ readonly 'mark:archive-ok': null;
4161
+ readonly 'mark:archive-failed': "CommandError";
4162
+ readonly 'mark:unarchive-ok': null;
4163
+ readonly 'mark:unarchive-failed': "CommandError";
4164
+ readonly 'mark:update-entity-types-ok': null;
4165
+ readonly 'mark:update-entity-types-failed': "CommandError";
4113
4166
  readonly 'mark:body-update-failed': "CommandError";
4167
+ readonly 'frame:entity-type-add-ok': null;
4114
4168
  readonly 'frame:entity-type-add-failed': "CommandError";
4169
+ readonly 'frame:tag-schema-add-ok': null;
4115
4170
  readonly 'frame:tag-schema-add-failed': "CommandError";
4116
4171
  readonly 'mark:select-comment': "SelectionData";
4117
4172
  readonly 'mark:select-tag': "SelectionData";
@@ -4123,10 +4178,6 @@ declare const CHANNEL_SCHEMAS: {
4123
4178
  readonly 'mark:assist-request': "MarkAssistRequestEvent";
4124
4179
  readonly 'mark:assist-cancelled': null;
4125
4180
  readonly 'mark:progress-dismiss': null;
4126
- readonly 'mark:mode-toggled': null;
4127
- readonly 'mark:selection-changed': "MarkSelectionChangedEvent";
4128
- readonly 'mark:click-changed': "MarkClickChangedEvent";
4129
- readonly 'mark:shape-changed': "MarkShapeChangedEvent";
4130
4181
  readonly 'bind:initiate': "BindInitiateCommand";
4131
4182
  readonly 'bind:update-body': "BindUpdateBodyCommand";
4132
4183
  readonly 'bind:body-updated': "BindBodyUpdated";
@@ -4144,9 +4195,6 @@ declare const CHANNEL_SCHEMAS: {
4144
4195
  readonly 'gather:summary-result': null;
4145
4196
  readonly 'gather:summary-failed': null;
4146
4197
  readonly 'gather:annotation-progress': "GatherProgress";
4147
- readonly 'gather:annotation-finished': "GatherAnnotationFinished";
4148
- readonly 'gather:progress': "GatherProgress";
4149
- readonly 'gather:finished': "GatherFinished";
4150
4198
  readonly 'browse:resource-requested': "BrowseResourceRequest";
4151
4199
  readonly 'browse:resource-result': "BrowseResourceResult";
4152
4200
  readonly 'browse:resource-failed': null;
@@ -4177,6 +4225,9 @@ declare const CHANNEL_SCHEMAS: {
4177
4225
  readonly 'browse:tag-schemas-requested': "BrowseTagSchemasRequest";
4178
4226
  readonly 'browse:tag-schemas-result': "BrowseTagSchemasResult";
4179
4227
  readonly 'browse:tag-schemas-failed': null;
4228
+ readonly 'browse:agents-requested': "BrowseAgentsRequest";
4229
+ readonly 'browse:agents-result': "BrowseAgentsResult";
4230
+ readonly 'browse:agents-failed': null;
4180
4231
  readonly 'browse:directory-requested': "BrowseDirectoryRequest";
4181
4232
  readonly 'browse:directory-result': "BrowseDirectoryResult";
4182
4233
  readonly 'browse:directory-failed': null;
@@ -4214,6 +4265,8 @@ declare const CHANNEL_SCHEMAS: {
4214
4265
  readonly 'job:create-failed': null;
4215
4266
  readonly 'job:claimed': null;
4216
4267
  readonly 'job:claim-failed': null;
4268
+ readonly 'job:cancel-ok': null;
4269
+ readonly 'job:cancel-failed': "CommandError";
4217
4270
  readonly 'settings:theme-changed': "SettingsThemeChangedEvent";
4218
4271
  readonly 'settings:line-numbers-toggled': null;
4219
4272
  readonly 'settings:locale-changed': "SettingsLocaleChangedEvent";
@@ -4242,6 +4295,14 @@ type EmittableChannel = {
4242
4295
  type Selector = components['schemas']['TextPositionSelector'] | components['schemas']['TextQuoteSelector'] | components['schemas']['SvgSelector'] | components['schemas']['FragmentSelector'];
4243
4296
  type GatheredContext = components['schemas']['GatheredContext'];
4244
4297
  type SelectionData = components['schemas']['SelectionData'];
4298
+ type JobType = components['schemas']['JobType'];
4299
+ /**
4300
+ * One entry of the collaborator directory (`browse:agents-result`): a typed
4301
+ * `Agent` plus, for software agents drawn from the KB's worker config, the
4302
+ * job types it serves. Persons and actor-role-only agents omit
4303
+ * `servesJobTypes`. See .plans/COLLABORATOR-DIRECTORY.md.
4304
+ */
4305
+ type CollaboratorEntry = components['schemas']['CollaboratorEntry'];
4245
4306
 
4246
4307
  /**
4247
4308
  * Event Type Guards and Extraction Utilities
@@ -4699,7 +4760,9 @@ declare function validateSvgMarkup(svg: string): string | null;
4699
4760
  * Generates a bare annotation ID (no URL prefix). URIs are constructed
4700
4761
  * at the API boundary when returning responses to clients.
4701
4762
  *
4702
- * Throws on invalid input (missing selector, missing motivation, invalid SVG).
4763
+ * Throws on invalid input (missing motivation, invalid SVG markup). The target
4764
+ * selector is OPTIONAL — a source-only target annotates the whole resource (W3C;
4765
+ * e.g. resource-level edges), per RESOURCE-LEVEL-ANCHOR.
4703
4766
  */
4704
4767
  declare function assembleAnnotation(request: CreateAnnotationRequest, creator: Agent$2): AssembledAnnotation;
4705
4768
  /**
@@ -5320,23 +5383,229 @@ interface IContentTransport {
5320
5383
  dispose(): void;
5321
5384
  }
5322
5385
 
5386
+ declare const BUS_OPERATIONS: {
5387
+ readonly 'bind:update-body': {
5388
+ readonly result: "bind:body-updated";
5389
+ readonly failure: "bind:body-update-failed";
5390
+ };
5391
+ readonly 'browse:resource-requested': {
5392
+ readonly result: "browse:resource-result";
5393
+ readonly failure: "browse:resource-failed";
5394
+ };
5395
+ readonly 'browse:resources-requested': {
5396
+ readonly result: "browse:resources-result";
5397
+ readonly failure: "browse:resources-failed";
5398
+ };
5399
+ readonly 'browse:annotation-requested': {
5400
+ readonly result: "browse:annotation-result";
5401
+ readonly failure: "browse:annotation-failed";
5402
+ };
5403
+ readonly 'browse:annotations-requested': {
5404
+ readonly result: "browse:annotations-result";
5405
+ readonly failure: "browse:annotations-failed";
5406
+ };
5407
+ readonly 'browse:annotation-history-requested': {
5408
+ readonly result: "browse:annotation-history-result";
5409
+ readonly failure: "browse:annotation-history-failed";
5410
+ };
5411
+ readonly 'browse:events-requested': {
5412
+ readonly result: "browse:events-result";
5413
+ readonly failure: "browse:events-failed";
5414
+ };
5415
+ readonly 'browse:referenced-by-requested': {
5416
+ readonly result: "browse:referenced-by-result";
5417
+ readonly failure: "browse:referenced-by-failed";
5418
+ };
5419
+ readonly 'browse:entity-types-requested': {
5420
+ readonly result: "browse:entity-types-result";
5421
+ readonly failure: "browse:entity-types-failed";
5422
+ };
5423
+ readonly 'browse:tag-schemas-requested': {
5424
+ readonly result: "browse:tag-schemas-result";
5425
+ readonly failure: "browse:tag-schemas-failed";
5426
+ };
5427
+ readonly 'browse:agents-requested': {
5428
+ readonly result: "browse:agents-result";
5429
+ readonly failure: "browse:agents-failed";
5430
+ };
5431
+ readonly 'browse:directory-requested': {
5432
+ readonly result: "browse:directory-result";
5433
+ readonly failure: "browse:directory-failed";
5434
+ };
5435
+ readonly 'browse:annotation-context-requested': {
5436
+ readonly result: "browse:annotation-context-result";
5437
+ readonly failure: "browse:annotation-context-failed";
5438
+ };
5439
+ readonly 'frame:add-entity-type': {
5440
+ readonly result: "frame:entity-type-add-ok";
5441
+ readonly failure: "frame:entity-type-add-failed";
5442
+ };
5443
+ readonly 'frame:add-tag-schema': {
5444
+ readonly result: "frame:tag-schema-add-ok";
5445
+ readonly failure: "frame:tag-schema-add-failed";
5446
+ };
5447
+ readonly 'gather:requested': {
5448
+ readonly result: "gather:complete";
5449
+ readonly failure: "gather:failed";
5450
+ readonly progress: "gather:annotation-progress";
5451
+ };
5452
+ readonly 'gather:resource-requested': {
5453
+ readonly result: "gather:resource-complete";
5454
+ readonly failure: "gather:resource-failed";
5455
+ };
5456
+ readonly 'gather:summary-requested': {
5457
+ readonly result: "gather:summary-result";
5458
+ readonly failure: "gather:summary-failed";
5459
+ };
5460
+ readonly 'job:create': {
5461
+ readonly result: "job:created";
5462
+ readonly failure: "job:create-failed";
5463
+ };
5464
+ readonly 'job:status-requested': {
5465
+ readonly result: "job:status-result";
5466
+ readonly failure: "job:status-failed";
5467
+ };
5468
+ readonly 'job:cancel-requested': {
5469
+ readonly result: "job:cancel-ok";
5470
+ readonly failure: "job:cancel-failed";
5471
+ };
5472
+ readonly 'job:claim': {
5473
+ readonly result: "job:claimed";
5474
+ readonly failure: "job:claim-failed";
5475
+ };
5476
+ readonly 'mark:create-request': {
5477
+ readonly result: "mark:create-ok";
5478
+ readonly failure: "mark:create-failed";
5479
+ };
5480
+ readonly 'mark:delete': {
5481
+ readonly result: "mark:delete-ok";
5482
+ readonly failure: "mark:delete-failed";
5483
+ };
5484
+ readonly 'mark:archive': {
5485
+ readonly result: "mark:archive-ok";
5486
+ readonly failure: "mark:archive-failed";
5487
+ };
5488
+ readonly 'mark:unarchive': {
5489
+ readonly result: "mark:unarchive-ok";
5490
+ readonly failure: "mark:unarchive-failed";
5491
+ };
5492
+ readonly 'mark:update-entity-types': {
5493
+ readonly result: "mark:update-entity-types-ok";
5494
+ readonly failure: "mark:update-entity-types-failed";
5495
+ };
5496
+ readonly 'match:search-requested': {
5497
+ readonly result: "match:search-results";
5498
+ readonly failure: "match:search-failed";
5499
+ };
5500
+ readonly 'yield:create': {
5501
+ readonly result: "yield:create-ok";
5502
+ readonly failure: "yield:create-failed";
5503
+ };
5504
+ readonly 'yield:update': {
5505
+ readonly result: "yield:update-ok";
5506
+ readonly failure: "yield:update-failed";
5507
+ };
5508
+ readonly 'yield:clone-create': {
5509
+ readonly result: "yield:clone-created";
5510
+ readonly failure: "yield:clone-create-failed";
5511
+ };
5512
+ readonly 'yield:clone-resource-requested': {
5513
+ readonly result: "yield:clone-resource-result";
5514
+ readonly failure: "yield:clone-resource-failed";
5515
+ };
5516
+ readonly 'yield:clone-token-requested': {
5517
+ readonly result: "yield:clone-token-generated";
5518
+ readonly failure: "yield:clone-token-failed";
5519
+ };
5520
+ };
5521
+ /** The request-channel key of a registered operation — what `busRequest` takes. */
5522
+ type BusOperationKey = keyof typeof BUS_OPERATIONS;
5523
+
5323
5524
  /**
5324
5525
  * BRIDGED_CHANNELS
5325
5526
  *
5326
5527
  * The set of bus channels that any concrete transport bridges into the
5327
5528
  * caller-supplied bus via `bridgeInto`. Transport-neutral: every concrete
5328
- * `ITransport` shares the same set; HTTP delivers them via SSE,
5329
- * in-process transports forward them directly from the local actor bus.
5529
+ * `ITransport` shares the same set; HTTP delivers them via SSE, in-process
5530
+ * transports forward them directly from the local actor bus.
5531
+ *
5532
+ * This is the *fan-in* set — channels for events the transport receives and
5533
+ * pushes onto the client's bus. It is not the same as the channels the client
5534
+ * emits (which is open-ended).
5535
+ *
5536
+ * It is DERIVED, not hand-listed: the request/reply replies come from
5537
+ * `BUS_OPERATIONS` (bus-operations.ts), so no operation's reply can be
5538
+ * forgotten here — that was the recurring unbridged-reply bug class. The only
5539
+ * hand-maintained part is `BRIDGED_BROADCASTS`: the genuine non-request/reply
5540
+ * minority (lifecycle events and UI/infra signals that no single requester
5541
+ * owns). See .plans/BUS-OPERATIONS-REGISTRY.md.
5542
+ *
5543
+ * Resource-scoped channels (joined/left via `subscribeToResource`) are tracked
5544
+ * separately by transports that care about scope (HTTP).
5545
+ */
5546
+ /**
5547
+ * Bridged channels with no owning operation: job-lifecycle events (multi-viewer,
5548
+ * no single requester owns the reply), KB-global frame domain events, UI signals,
5549
+ * and SSE infrastructure. A reply channel must NOT go here — declare its
5550
+ * operation in `BUS_OPERATIONS` instead.
5551
+ */
5552
+ 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"];
5553
+ type OpSpecs = (typeof BUS_OPERATIONS)[keyof typeof BUS_OPERATIONS];
5554
+ type ProgressChannel<O> = O extends {
5555
+ progress: infer P extends EventName;
5556
+ } ? P : never;
5557
+ /** The union of every reply channel declared in the registry. */
5558
+ type RegistryReply = OpSpecs['result'] | OpSpecs['failure'] | ProgressChannel<OpSpecs>;
5559
+ declare const BRIDGED_CHANNELS: readonly BridgedChannel[];
5560
+ /**
5561
+ * The SUBSCRIBE-side subset of `EventName` — the channels a client can receive
5562
+ * over a concrete transport. See the family note on `EventName` in
5563
+ * bus-protocol.ts (emit on an `EmittableChannel`, subscribe on a `BridgedChannel`).
5564
+ */
5565
+ type BridgedChannel = RegistryReply | (typeof BRIDGED_BROADCASTS)[number];
5566
+
5567
+ /**
5568
+ * The value a registered operation resolves to: the `response` field of its
5569
+ * result channel's payload, or `void` for a result channel that carries no
5570
+ * `response` (a confirmed-write ack with no data). Inferred from the registry,
5571
+ * so callers never annotate `busRequest`'s return type. Relies on the reply-shape
5572
+ * standard — see .plans/REPLY-SHAPE-STANDARD.md.
5573
+ */
5574
+ type BusReply<Op extends BusOperationKey> = EventMap[(typeof BUS_OPERATIONS)[Op]['result'] & EventName] extends {
5575
+ response: infer R;
5576
+ } ? R : void;
5577
+ type BusRequestErrorCode = 'bus.timeout' | 'bus.rejected' | 'bus.closed' | 'bus.bad-payload' | 'bus.unauthorized' | 'bus.forbidden' | 'bus.not-found';
5578
+ declare class BusRequestError extends SemiontError {
5579
+ code: BusRequestErrorCode;
5580
+ constructor(message: string, code: BusRequestErrorCode, details?: Record<string, unknown>);
5581
+ }
5582
+ /**
5583
+ * Subset of ITransport that `busRequest` needs: a way to send a command and
5584
+ * a way to observe channels. Generic enough that an in-process transport
5585
+ * can satisfy it without round-tripping through HTTP.
5586
+ */
5587
+ interface BusRequestPrimitive {
5588
+ emit<K extends keyof EventMap>(channel: K, payload: EventMap[K]): Promise<void>;
5589
+ stream<K extends keyof EventMap>(channel: K): Observable<EventMap[K]>;
5590
+ }
5591
+ /**
5592
+ * Request/reply over the bus, keyed by the operation's request channel.
5330
5593
  *
5331
- * Note: this is the *fan-in* set channels for events the transport
5332
- * receives and pushes onto the client's bus. It is not the same as the
5333
- * channels the client emits (which is open-ended).
5594
+ * The `operation` is a `BusOperationKey` (a request channel declared in
5595
+ * `BUS_OPERATIONS`); the matching `result`/`failure` reply channels are looked
5596
+ * up from the registry, so a caller cannot pass a mismatched or unbridged reply
5597
+ * pair — the recurring unbridged-reply bug class is unrepresentable. Every
5598
+ * registry reply derives into `BRIDGED_CHANNELS` (see bridged-channels.ts), so
5599
+ * the transport always subscribes to it (cf.
5600
+ * .plans/bugs/gather-resource-complete-not-bridged.md, where the `gather:resource-*`
5601
+ * pair shipped unbridged with no compile/runtime signal).
5334
5602
  *
5335
- * Resource-scoped channels (joined/left via `subscribeToResource`) are
5336
- * tracked separately by transports that care about scope (HTTP).
5603
+ * The return type is INFERRED from the registry (`BusReply<Op>` = the result
5604
+ * channel's `response` type, or `void`) callers never annotate it. Every reply
5605
+ * is `{ correlationId, response: T }` (data) or `{ correlationId }` (void); see
5606
+ * .plans/REPLY-SHAPE-STANDARD.md. `busRequest` reads `e.response`.
5337
5607
  */
5338
- declare const BRIDGED_CHANNELS: readonly ["browse:resources-result", "browse:resources-failed", "browse:resource-result", "browse:resource-failed", "browse:annotations-result", "browse:annotations-failed", "browse:annotation-result", "browse:annotation-failed", "browse:annotation-history-result", "browse:annotation-history-failed", "browse:events-result", "browse:events-failed", "browse:referenced-by-result", "browse:referenced-by-failed", "browse:entity-types-result", "browse:entity-types-failed", "browse:tag-schemas-result", "browse:tag-schemas-failed", "browse:directory-result", "browse:directory-failed", "browse:annotation-context-result", "browse:annotation-context-failed", "mark:delete-ok", "mark:delete-failed", "mark:create-ok", "mark:create-failed", "match:search-results", "match:search-failed", "gather:complete", "gather:failed", "gather:annotation-progress", "gather:annotation-finished", "gather:summary-result", "gather:summary-failed", "bind:body-updated", "bind:body-update-failed", "job:report-progress", "job:complete", "job:fail", "job:status-result", "job:status-failed", "job:created", "job:create-failed", "job:claimed", "job:claim-failed", "yield:create-ok", "yield:create-failed", "yield:update-ok", "yield:update-failed", "yield:clone-token-generated", "yield:clone-token-failed", "yield:clone-resource-result", "yield:clone-resource-failed", "yield:clone-created", "yield:clone-create-failed", "frame:entity-type-added", "frame:tag-schema-added", "beckon:focus", "beckon:sparkle", "bus:resume-gap"];
5339
- type BridgedChannel = typeof BRIDGED_CHANNELS[number];
5608
+ declare function busRequest<Op extends BusOperationKey>(bus: BusRequestPrimitive, operation: Op, payload: Record<string, unknown>, timeoutMs?: number): Promise<BusReply<Op>>;
5340
5609
 
5341
5610
  /**
5342
5611
  * Fuzzy Anchoring for W3C Web Annotation TextQuoteSelector
@@ -6003,6 +6272,33 @@ interface GoogleAuthRequest {
6003
6272
  */
6004
6273
  declare function generateUuid(): string;
6005
6274
 
6275
+ /**
6276
+ * Marker for the state-unit pattern: a stateful, lifecycled object with an
6277
+ * RxJS-shaped public surface, constructed by a factory function
6278
+ * (`createFooStateUnit`), with internal state held in a closure.
6279
+ *
6280
+ * The structural contract is `dispose()` — the rest of the pattern
6281
+ * (closure-based identity, Observable public surface, internal Subjects
6282
+ * exposed as `.asObservable()` views, no leaked subscriptions, composition
6283
+ * by parameter rather than ownership) is convention, made executable by the
6284
+ * axiom harness in `@semiont/core/testing` (`assertStateUnitAxioms`).
6285
+ *
6286
+ * Lives in `@semiont/core` (not sdk) so every layer can share one definition
6287
+ * without dependency cycles — `http-transport`'s `ActorStateUnit` sits below
6288
+ * sdk and would otherwise have to re-declare it. See
6289
+ * `packages/sdk/docs/STATE-UNITS.md` for the full pattern and rationale, and
6290
+ * `.plans/STATE-UNIT-AXIOMS.md` for the axiom ledger.
6291
+ */
6292
+ interface StateUnit {
6293
+ /**
6294
+ * Idempotent, total teardown. Completes every Subject the unit owns,
6295
+ * unsubscribes every internal subscription, releases timers / abort
6296
+ * controllers / network handles. Safe to call multiple times — the
6297
+ * second call is a no-op.
6298
+ */
6299
+ dispose(): void;
6300
+ }
6301
+
6006
6302
  /**
6007
6303
  * Common type guard utilities
6008
6304
  */
@@ -6805,5 +7101,36 @@ declare function isValidPlatformType(value: string): value is PlatformType;
6805
7101
  */
6806
7102
  declare function getAllPlatformTypes(): PlatformType[];
6807
7103
 
6808
- export { AUTHORABLE_MEDIA_TYPES, BRIDGED_CHANNELS, CHANNEL_SCHEMAS, CONTEXT_FULL_WEIGHT, CONTEXT_PARTIAL_WEIGHT, ConfigurationError, ConflictError, EMBEDDABLE_MEDIA_TYPES, EventBus, JWTTokenSchema, LOCALES, MEDIA_TYPES, NotFoundError, PERSISTED_EVENT_TYPES, POSITION_WEIGHT_MAX, POSITION_WINDOW, RESOURCE_BROADCAST_TYPES, ScopedEventBus, ScriptError, SemiontError, UnauthorizedError, ValidationError, accessToken, agentToDid, anchorAnnotation, annotationId, annotationUri, applyBodyOperations, assembleAnnotation, authCode, baseMediaType, baseUrl, buildContentCache, burstBuffer, busLog, busLogEnabled, capabilitiesOf, cloneToken, createCircleSvg, createFragmentSelector, createPolygonSvg, createRectangleSvg, createTomlConfigLoader, decodeRepresentation, decodeWithCharset, didToAgent, email, entityType, errField, extensionForMediaType, extractBoundingBox, extractCharset, extractContext, findBestTextMatch, findBodyItem, 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, getStorageUri, getSvgSelector, getTargetSelector, getTargetSource, getTextPositionSelector, getTextQuoteSelector, googleCredential, hasTargetSelector, isAnnotationId, isArchived, isArray, isAssessment, isBodyResolved, isBoolean, isComment, isDefined, isDraft, isEventRelatedToAnnotation, isFunction, isHighlight, isNull, isNullish, isNumber, isObject, isReference, isResolvedReference, isResourceId, isStoredEvent, isString, isStubReference, isSupportedMediaType, isTag, isUndefined, isValidEmail, isValidPlatformType, jobId, loadTomlConfig, mcpToken, mediaTypeForExtension, normalizeCoordinates, normalizeText, parseEnvironment, parseFragmentSelector, parseSvgSelector, reconcileSelector, refreshToken, resourceAnnotationUri, resourceId, resourceUri, scaleSvgToNative, searchQuery, serializePerKey, setBusLogTraceIdProvider, softwareToAgent, textExtractionOf, userDID, userId, userToAgent, userToDid, validateData, validateEnvironment, validateSvgMarkup, verifyPosition };
6809
- export type { AccessToken, AnchorConfidence, AnchorMethod, AnchorSelectors, AnchorStrategy, AnchoringModel, Annotation, AnnotationCategory, AnnotationId, AnnotationUri, AnthropicProviderConfig, AppConfig, AssembledAnnotation, AuthCode, BackendDownload, BackendServiceConfig, BaseUrl, BodyItem, BodyItemIdentity, BodyOperation, BoundingBox, Brand, BridgedChannel, BurstBufferOptions, BusOp, CloneToken, ConnectionState, ContentCache, ContentFormat, CreateAnnotationInternal, DatabaseServiceConfig, Email, EmbeddingServiceConfig, EmittableChannel, EntityType, EntityTypeStats, Environment, EnvironmentConfig, EventBase, EventInput, EventMap, EventMetadata, EventName, EventOfType, EventQuery, EventSignature, FragmentSelector, FrontendServiceConfig, GatheredContext, GoogleAuthRequest, GoogleCredential, GraphConnection, GraphDatabaseType, GraphPath, GraphServiceConfig, HealthCheckResponse, IBackendOperations, IContentTransport, ITransport, InferenceProvidersConfig, JobId, ListUsersResponse, LlmSelectorInput, LocaleInfo, Logger, MCPToken, MatchQuality, McpServiceConfig, MediaTypeCapabilities, Motivation, OllamaProviderConfig, PdfCoordinate, PersistedEvent, PersistedEventType, PlatformType, Point, ProgressCallback, ProgressEvent, PutBinaryOptions, PutBinaryProgress, PutBinaryRequest, ReconciledSelector, RefreshToken, RenderMode, RenderedAnchor, ResourceAnnotationUri, ResourceAnnotations, ResourceBroadcastType, ResourceDescriptor, ResourceFilter, ResourceId, ResourceUri, SearchQuery, SelectionData, Selector, SemiontConfig, ServicePlatformConfig, ServicesConfig, SiteConfig, 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 };
7104
+ /**
7105
+ * Knowledge-graph view derivation (CONTEXT-UNIFICATION P3, Q1=A).
7106
+ *
7107
+ * A pure function over the core `KnowledgeGraph` type, so both `@semiont/make-meaning` (the matcher)
7108
+ * and `@semiont/jobs` (the generation prompt builder) can share one derivation. `buildKnowledgeGraph`
7109
+ * — which queries the graph DB — stays in make-meaning; this only transforms an already-built graph.
7110
+ *
7111
+ * Reports the graph as-is (Option A): missing-view citers are kept (the citation edge reflects a real
7112
+ * reference event); the only filter is excluding the focal annotation from siblings (an annotation
7113
+ * isn't its own sibling). Peer connections are edges out of `mainResourceId`; citations and
7114
+ * `annotation-of` edges point INTO it. The graph is a projection of the event log (the system of
7115
+ * record), read here because it is the queryable projection at gather time.
7116
+ */
7117
+
7118
+ type KnowledgeGraph = components['schemas']['KnowledgeGraph'];
7119
+ interface GraphViews {
7120
+ connections: {
7121
+ resourceId: string;
7122
+ resourceName: string;
7123
+ entityTypes: string[];
7124
+ bidirectional: boolean;
7125
+ }[];
7126
+ citedBy: {
7127
+ resourceId: string;
7128
+ resourceName: string;
7129
+ }[];
7130
+ citedByCount: number;
7131
+ siblingEntityTypes: string[];
7132
+ }
7133
+ declare function deriveViews(graph: KnowledgeGraph, mainResourceId: string, focalAnnotationId?: string): GraphViews;
7134
+
7135
+ export { AUTHORABLE_MEDIA_TYPES, BRIDGED_CHANNELS, BusRequestError, CHANNEL_SCHEMAS, CONTEXT_FULL_WEIGHT, CONTEXT_PARTIAL_WEIGHT, ConfigurationError, ConflictError, EMBEDDABLE_MEDIA_TYPES, EventBus, JWTTokenSchema, LOCALES, MEDIA_TYPES, NotFoundError, PERSISTED_EVENT_TYPES, POSITION_WEIGHT_MAX, POSITION_WINDOW, RESOURCE_BROADCAST_TYPES, ScopedEventBus, ScriptError, SemiontError, UnauthorizedError, ValidationError, accessToken, agentToDid, anchorAnnotation, annotationId, annotationUri, applyBodyOperations, assembleAnnotation, authCode, baseMediaType, baseUrl, buildContentCache, burstBuffer, busLog, busLogEnabled, busRequest, capabilitiesOf, cloneToken, createCircleSvg, createFragmentSelector, createPolygonSvg, createRectangleSvg, createTomlConfigLoader, decodeRepresentation, decodeWithCharset, deriveViews, didToAgent, email, entityType, errField, extensionForMediaType, extractBoundingBox, extractCharset, extractContext, findBestTextMatch, findBodyItem, 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, getStorageUri, getSvgSelector, getTargetSelector, getTargetSource, getTextPositionSelector, getTextQuoteSelector, googleCredential, hasTargetSelector, isAnnotationId, isArchived, isArray, isAssessment, isBodyResolved, isBoolean, isComment, isDefined, isDraft, isEventRelatedToAnnotation, isFunction, isHighlight, isNull, isNullish, isNumber, isObject, isReference, isResolvedReference, isResourceId, isStoredEvent, isString, isStubReference, isSupportedMediaType, isTag, isUndefined, isValidEmail, isValidPlatformType, jobId, loadTomlConfig, mcpToken, mediaTypeForExtension, normalizeCoordinates, normalizeText, parseEnvironment, parseFragmentSelector, parseSvgSelector, reconcileSelector, refreshToken, resourceAnnotationUri, resourceId, resourceUri, scaleSvgToNative, searchQuery, serializePerKey, setBusLogTraceIdProvider, softwareToAgent, textExtractionOf, userDID, userId, userToAgent, userToDid, validateData, validateEnvironment, validateSvgMarkup, verifyPosition };
7136
+ export type { AccessToken, AnchorConfidence, AnchorMethod, AnchorSelectors, AnchorStrategy, AnchoringModel, Annotation, AnnotationCategory, AnnotationId, AnnotationUri, AnthropicProviderConfig, AppConfig, AssembledAnnotation, AuthCode, BackendDownload, BackendServiceConfig, BaseUrl, BodyItem, BodyItemIdentity, BodyOperation, BoundingBox, Brand, BridgedChannel, BurstBufferOptions, BusOp, BusRequestErrorCode, BusRequestPrimitive, CloneToken, CollaboratorEntry, ConnectionState, ContentCache, ContentFormat, CreateAnnotationInternal, DatabaseServiceConfig, Email, EmbeddingServiceConfig, EmittableChannel, EntityType, EntityTypeStats, Environment, EnvironmentConfig, EventBase, EventInput, EventMap, EventMetadata, EventName, EventOfType, EventQuery, EventSignature, FragmentSelector, FrontendServiceConfig, GatheredContext, GoogleAuthRequest, GoogleCredential, GraphConnection, GraphDatabaseType, GraphPath, GraphServiceConfig, GraphViews, HealthCheckResponse, IBackendOperations, IContentTransport, ITransport, InferenceProvidersConfig, JobId, JobType, ListUsersResponse, LlmSelectorInput, LocaleInfo, Logger, MCPToken, MatchQuality, McpServiceConfig, MediaTypeCapabilities, Motivation, OllamaProviderConfig, PdfCoordinate, PersistedEvent, PersistedEventType, PlatformType, Point, ProgressCallback, ProgressEvent, PutBinaryOptions, PutBinaryProgress, PutBinaryRequest, ReconciledSelector, RefreshToken, RenderMode, RenderedAnchor, ResourceAnnotationUri, ResourceAnnotations, ResourceBroadcastType, ResourceDescriptor, ResourceFilter, ResourceId, ResourceUri, 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 };