@semiont/core 0.5.27 → 0.5.28

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
@@ -1960,9 +1960,28 @@ interface components {
1960
1960
  updatedAt: string;
1961
1961
  }[];
1962
1962
  };
1963
- /** @description Web Annotation / W3C PROV Agent. Discriminated by @type — Person, Organization, or Software. Each branch carries fields appropriate to its kind. Software peers are first-class participants, not a sub-class of Person. */
1964
- Agent: ({
1965
- /** @constant */
1963
+ /** @description Web Annotation / W3C PROV Agent. Discriminated by @type — Person, Organization, or Software (named member schemas: AgentPerson, AgentOrganization, AgentSoftware). Software peers are first-class participants, not a sub-class of Person. */
1964
+ Agent: components["schemas"]["AgentPerson"] | components["schemas"]["AgentOrganization"] | components["schemas"]["AgentSoftware"];
1965
+ /** @description An organization — the Organization branch of Agent. */
1966
+ AgentOrganization: {
1967
+ /**
1968
+ * @description discriminator enum property added by openapi-typescript
1969
+ * @enum {string}
1970
+ */
1971
+ "@type": "Organization";
1972
+ /** Format: uri */
1973
+ "@id"?: string;
1974
+ name: string;
1975
+ homepage?: string;
1976
+ } & {
1977
+ [key: string]: unknown;
1978
+ };
1979
+ /** @description A human participant — the Person branch of Agent. */
1980
+ AgentPerson: {
1981
+ /**
1982
+ * @description discriminator enum property added by openapi-typescript
1983
+ * @enum {string}
1984
+ */
1966
1985
  "@type": "Person";
1967
1986
  /**
1968
1987
  * Format: uri
@@ -1977,17 +1996,13 @@ interface components {
1977
1996
  homepage?: string;
1978
1997
  } & {
1979
1998
  [key: string]: unknown;
1980
- }) | ({
1981
- /** @constant */
1982
- "@type": "Organization";
1983
- /** Format: uri */
1984
- "@id"?: string;
1985
- name: string;
1986
- homepage?: string;
1987
- } & {
1988
- [key: string]: unknown;
1989
- }) | ({
1990
- /** @constant */
1999
+ };
2000
+ /** @description A software peer (an inference model acting as a first-class participant) — the Software branch of Agent. Carries structured provider + model. */
2001
+ AgentSoftware: {
2002
+ /**
2003
+ * @description discriminator enum property added by openapi-typescript
2004
+ * @enum {string}
2005
+ */
1991
2006
  "@type": "Software";
1992
2007
  /**
1993
2008
  * Format: uri
@@ -2006,7 +2021,7 @@ interface components {
2006
2021
  };
2007
2022
  } & {
2008
2023
  [key: string]: unknown;
2009
- });
2024
+ };
2010
2025
  Annotation: {
2011
2026
  /**
2012
2027
  * @description W3C Web Annotation JSON-LD context
@@ -2041,7 +2056,7 @@ interface components {
2041
2056
  /** @description SHA-256 of resource content at annotation time */
2042
2057
  contentChecksum?: string;
2043
2058
  };
2044
- /** @description Phase 2: Body can be TextualBody (for entity tags, descriptions) or SpecificResource (for links) */
2059
+ /** @description An annotation's body: a TextualBody carries text the annotation states (entity tags, descriptions, comments), a SpecificResource points at what it links to. Tell them apart by `type`, which is required on both and single-valued — a consumer never has to probe for which fields happen to be present. */
2045
2060
  AnnotationBody: components["schemas"]["TextualBody"] | components["schemas"]["SpecificResource"];
2046
2061
  /** @description Payload for mark:body-updated domain event */
2047
2062
  AnnotationBodyUpdatedPayload: {
@@ -2339,7 +2354,7 @@ interface components {
2339
2354
  /** @description A resource's stored extraction outcome — the coordinate map with its provenance, or a named decline — or null when none has been derived. Null is the common case and not an error: a native text layer is read in the browser, and a media type with no extractor never produces one. */
2340
2355
  BrowseAnchoredTextResult: {
2341
2356
  correlationId: string;
2342
- response: components["schemas"]["ExtractionOutcome"] | null;
2357
+ response: Omit<components["schemas"]["ExtractionOutcome"], "kind"> | null;
2343
2358
  };
2344
2359
  /** @description Request to browse a single resource */
2345
2360
  BrowseResourceRequest: {
@@ -2493,7 +2508,7 @@ interface components {
2493
2508
  /** @description Optional body. Omit for annotations whose motivation alone is meaningful (highlighting) or whose user-supplied content is empty. Shape matches Annotation.body. */
2494
2509
  body?: components["schemas"]["AnnotationBody"] | components["schemas"]["AnnotationBody"][];
2495
2510
  };
2496
- /** @description Response body for POST /resources (202 Accepted). Resource creation is asynchronous — the backend writes content to disk, emits yield:create on the bus, and returns the newly-minted resourceId immediately. Consumers watch SSE domain events (yield:created) to observe the fully-persisted state. */
2511
+ /** @description Response body for POST /resources (202 Accepted). The route writes content to disk, emits yield:create, and AWAITS the confirmed-write reply so the returned resourceId is the one Stower minted, and the resource's event is persisted before this response is sent. What remains asynchronous is downstream projection: graph, views and vectors settle after the 202. */
2497
2512
  CreateResourceResponse: {
2498
2513
  /** @description The id of the newly-created resource. Assigned by Stower when it persists yield:create. */
2499
2514
  resourceId: string;
@@ -2503,7 +2518,10 @@ interface components {
2503
2518
  message: string;
2504
2519
  };
2505
2520
  DirEntry: {
2506
- /** @enum {string} */
2521
+ /**
2522
+ * @description discriminator enum property added by openapi-typescript
2523
+ * @enum {string}
2524
+ */
2507
2525
  type: "dir";
2508
2526
  /** @description Entry name (basename) */
2509
2527
  name: string;
@@ -2515,6 +2533,7 @@ interface components {
2515
2533
  */
2516
2534
  mtime: string;
2517
2535
  };
2536
+ /** @description One entry in a directory listing: a file, which may carry the resource it was ingested as, or a subdirectory. Tell them apart by `type`, which is required on both and single-valued. */
2518
2537
  DirectoryEntry: components["schemas"]["FileEntry"] | components["schemas"]["DirEntry"];
2519
2538
  /**
2520
2539
  * DiscoveredKB
@@ -2552,7 +2571,7 @@ interface components {
2552
2571
  /** @description Every KB the launcher currently manages, local and forwarded */
2553
2572
  kbs: components["schemas"]["DiscoveredKB"][];
2554
2573
  };
2555
- /** @description Wire format emitted by GET /resources/:id/events/stream. Extends StoredEventResponse with optional enrichment fields populated from the materialized view at SSE-write time. Subscribers can read the enrichment fields directly to update local caches without an additional fetch. */
2574
+ /** @description Wire format for persisted events delivered over the bus SSE stream (GET /bus/subscribe). Extends StoredEventResponse with optional enrichment fields the EventStore populates from the materialized view at publish time (persistence → view → enrich → notification). Subscribers read the enrichment fields directly to update local caches without an additional fetch. */
2556
2575
  EnrichedResourceEvent: components["schemas"]["StoredEventResponse"] & {
2557
2576
  /** @description Populated for events that mutate an annotation (mark:added, mark:body-updated, mark:removed). Carries the post-materialization annotation as it exists in the view, so subscribers can update local caches in-place without refetching. Absent for events that don't touch annotations. */
2558
2577
  annotation?: components["schemas"]["Annotation"];
@@ -2582,8 +2601,13 @@ interface components {
2582
2601
  data: string;
2583
2602
  id?: string;
2584
2603
  };
2585
- /** @description The full outcome of text extraction for one representation — the record the anchored-text store holds and the wire serves (PERSIST-ANCHORS decision D1). Either a success (the anchored text plus its provenance: how it was extracted, what class of PDF it came from, how confident OCR was, which pages could not be read) or a named decline. A decline is a first-class, cacheable outcome: 'we ran and there was nothing' costs a full recognition pass to discover. ocrConfidence is extraction quality for operators, deliberately not anchor confidence. */
2586
- ExtractionOutcome: (components["schemas"]["AnchoredText"] & {
2604
+ /** @description A successful extraction: the anchored text plus its provenance (WIRE-UNION-DISCRIMINANTS P5c named this member; PERSIST-ANCHORS D1 made it the stored record). */
2605
+ ExtractedText: components["schemas"]["AnchoredText"] & {
2606
+ /**
2607
+ * @description Discriminant — both ExtractionOutcome members carry `kind`, single-valued (D6: category here, detail in `method`).
2608
+ * @enum {string}
2609
+ */
2610
+ kind: "extracted";
2587
2611
  /**
2588
2612
  * @description How the text was extracted.
2589
2613
  * @enum {string}
@@ -2604,15 +2628,33 @@ interface components {
2604
2628
  };
2605
2629
  /** @description 1-indexed pages this extraction could not read — present only for partially covered documents (class C). */
2606
2630
  unreadPages?: number[];
2607
- }) | {
2631
+ } & {
2632
+ /**
2633
+ * @description discriminator enum property added by openapi-typescript
2634
+ * @enum {string}
2635
+ */
2636
+ kind: "extracted";
2637
+ };
2638
+ /** @description A named decline: extraction ran and yielded nothing, by class. A first-class, cacheable outcome — 'we ran and there was nothing' costs a full recognition pass to discover. */
2639
+ ExtractionDeclined: {
2640
+ /**
2641
+ * @description Discriminant — both ExtractionOutcome members carry `kind`, single-valued (D6: category here, detail in `declined`). (enum property replaced by openapi-typescript)
2642
+ * @enum {string}
2643
+ */
2644
+ kind: "declined";
2608
2645
  /**
2609
2646
  * @description Why extraction yielded nothing, by class.
2610
2647
  * @enum {string}
2611
2648
  */
2612
2649
  declined: "no-text-layer" | "encrypted" | "corrupt" | "too-large";
2613
2650
  };
2651
+ /** @description The full outcome of text extraction for one representation — the record the anchored-text store holds and the wire serves (PERSIST-ANCHORS decision D1). Discriminated on `kind` (WIRE-UNION-DISCRIMINANTS P5c/D6): 'extracted' — the anchored text with its provenance; 'declined' — a named decline. ocrConfidence is extraction quality for operators, deliberately not anchor confidence. */
2652
+ ExtractionOutcome: components["schemas"]["ExtractedText"] | components["schemas"]["ExtractionDeclined"];
2614
2653
  FileEntry: {
2615
- /** @enum {string} */
2654
+ /**
2655
+ * @description discriminator enum property added by openapi-typescript
2656
+ * @enum {string}
2657
+ */
2616
2658
  type: "file";
2617
2659
  /** @description Entry name (basename) */
2618
2660
  name: string;
@@ -2811,7 +2853,7 @@ interface components {
2811
2853
  title: string;
2812
2854
  /** @description Storage URI for the generated resource's content. */
2813
2855
  storageUri: string;
2814
- /** @description The gathered context that grounds the generation. Its `focus` names the anchor (the sdk derives the job's resourceId and referenceId, for annotation focus from it); under `cite`, the ids its embedding carries are the only valid citation targets. */
2856
+ /** @description The gathered context that grounds the generation. Its `focus` names the anchor: the DISPATCHER derives the job's resourceId from it (resource focus → focus.resource; annotation focus focus.sourceResource, with the worker auto-binding to focus.annotation) and REJECTS a caller-supplied id — the context is authoritative. Under `cite`, the ids its embedding carries are the only valid citation targets. */
2815
2857
  context: components["schemas"]["GatheredContext"];
2816
2858
  /** @description Refining instruction, composed with `task` (task = what, prompt = how). */
2817
2859
  prompt?: string;
@@ -2910,8 +2952,48 @@ interface components {
2910
2952
  /** @description Maximum output tokens per generation. Equal to contextTokens when the provider has a single shared window. */
2911
2953
  maxOutputTokens: number;
2912
2954
  };
2955
+ /** @description An annotation's graph presence. The node IS the annotation, so the full W3C object is required — selectors and body included, which is what lets a client place context annotations without a second fetch. Citations ride here too: an inbound reference is its linking annotation, anchored by an `annotation-of` edge to the resource it lives on and a `cites` edge to the focal resource. */
2956
+ GraphAnnotationNode: {
2957
+ /** @description The AnnotationId — the same value as annotation.id */
2958
+ id: string;
2959
+ /**
2960
+ * @description discriminator enum property added by openapi-typescript
2961
+ * @enum {string}
2962
+ */
2963
+ type: "annotation";
2964
+ /** @description The annotation's motivation, as a display label */
2965
+ label: string;
2966
+ /** @description Entity types carried by the annotation */
2967
+ entityTypes?: string[];
2968
+ annotation: components["schemas"]["Annotation"];
2969
+ metadata?: {
2970
+ [key: string]: unknown;
2971
+ };
2972
+ };
2973
+ /** @description A resource's presence in the gathered knowledge graph. */
2974
+ GraphResourceNode: {
2975
+ /** @description The resource's ResourceId */
2976
+ id: string;
2977
+ /**
2978
+ * @description discriminator enum property added by openapi-typescript
2979
+ * @enum {string}
2980
+ */
2981
+ type: "resource";
2982
+ /** @description The resource's display name — its raw id when the resource's view was missing at build time */
2983
+ label: string;
2984
+ /** @description Entity types on the resource */
2985
+ entityTypes?: string[];
2986
+ metadata?: {
2987
+ [key: string]: unknown;
2988
+ };
2989
+ };
2913
2990
  /** @description Result of a completed assessment-annotation job. */
2914
2991
  JobAssessmentAnnotationResult: {
2992
+ /**
2993
+ * @description Discriminant — every JobResult member carries `kind`, single-valued, so a consumer holding only the result can tell what it is (WIRE-UNION-DISCRIMINANTS D1). (enum property replaced by openapi-typescript)
2994
+ * @enum {string}
2995
+ */
2996
+ kind: "assessment-annotation";
2915
2997
  assessmentsFound: number;
2916
2998
  assessmentsCreated: number;
2917
2999
  };
@@ -2929,6 +3011,11 @@ interface components {
2929
3011
  };
2930
3012
  /** @description Result of a completed comment-annotation job. */
2931
3013
  JobCommentAnnotationResult: {
3014
+ /**
3015
+ * @description Discriminant — every JobResult member carries `kind`, single-valued, so a consumer holding only the result can tell what it is (WIRE-UNION-DISCRIMINANTS D1). (enum property replaced by openapi-typescript)
3016
+ * @enum {string}
3017
+ */
3018
+ kind: "comment-annotation";
2932
3019
  commentsFound: number;
2933
3020
  commentsCreated: number;
2934
3021
  };
@@ -2993,6 +3080,11 @@ interface components {
2993
3080
  };
2994
3081
  /** @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. */
2995
3082
  JobDeclinedResult: {
3083
+ /**
3084
+ * @description Discriminant — every JobResult member carries `kind`, single-valued, so a consumer holding only the result can tell what it is (WIRE-UNION-DISCRIMINANTS D1). (enum property replaced by openapi-typescript)
3085
+ * @enum {string}
3086
+ */
3087
+ kind: "declined";
2996
3088
  /**
2997
3089
  * @description Discriminant. Always true — a job that did its work reports one of the other result shapes.
2998
3090
  * @enum {boolean}
@@ -3013,15 +3105,27 @@ interface components {
3013
3105
  error: string;
3014
3106
  details?: string;
3015
3107
  };
3016
- /** @description Result of a completed generation job. resourceId is assigned by Stower when yield:create is processed; the worker emits job:complete with only resourceName, and Stower populates resourceId on the persisted payload. */
3108
+ /** @description Result of a completed generation job. The worker creates the resource first (the yield:create round-trip returns the id), then emits job:complete carrying it so resourceId is always present on the wire. */
3017
3109
  JobGenerationResult: {
3018
- /** @description ID of the generated resource (populated by Stower, not by the worker) */
3019
- resourceId?: string;
3110
+ /**
3111
+ * @description Discriminant — every JobResult member carries `kind`, single-valued, so a consumer holding only the result can tell what it is (WIRE-UNION-DISCRIMINANTS D1). (enum property replaced by openapi-typescript)
3112
+ * @enum {string}
3113
+ */
3114
+ kind: "generation";
3115
+ /** @description ID of the generated resource, obtained by the worker from the create round-trip before job:complete is emitted */
3116
+ resourceId: string;
3020
3117
  /** @description Name of the generated resource */
3021
3118
  resourceName: string;
3119
+ /** @description True when the model stopped at the maxTokens ceiling — the artifact is cut off, not complete. Derived at the producer from the provider's stopReason ('max_tokens' → true); required because the worker always knows (GENERATE-FROM-RESOURCE D6/P3a). */
3120
+ truncated: boolean;
3022
3121
  };
3023
3122
  /** @description Result of a completed highlight-annotation job. */
3024
3123
  JobHighlightAnnotationResult: {
3124
+ /**
3125
+ * @description Discriminant — every JobResult member carries `kind`, single-valued, so a consumer holding only the result can tell what it is (WIRE-UNION-DISCRIMINANTS D1). (enum property replaced by openapi-typescript)
3126
+ * @enum {string}
3127
+ */
3128
+ kind: "highlight-annotation";
3025
3129
  highlightsFound: number;
3026
3130
  highlightsCreated: number;
3027
3131
  };
@@ -3069,22 +3173,30 @@ interface components {
3069
3173
  value: string;
3070
3174
  }[];
3071
3175
  };
3072
- /** @description What a running job is doing right now, as a code plus typed params — never a prose sentence. The producer reports what happened; each client renders it in the user's language (react-ui from its translations, the Go launcher from its English map). The vocabulary is the census of every onProgress call site in @semiont/jobs (.plans/ASSIST-PROGRESS-CONSOLIDATION.md P1, 2026-08-12); extending it means adding a variant here and copy in every client, gated by the locale-completeness check. */
3073
- JobProgressMessage: {
3074
- /** @enum {string} */
3075
- code: "loading" | "analyzing" | "analyzing-tags" | "generating-resource" | "creating-resource";
3076
- } | {
3077
- /** @enum {string} */
3078
- code: "detecting-entities";
3079
- /** @description Entity type currently being detected */
3080
- entityType: string;
3081
- } | {
3082
- /** @enum {string} */
3083
- code: "creating-annotations" | "creating-tag-annotations";
3084
- /** @description How many annotations are being created */
3085
- count: number;
3086
- } | {
3087
- /** @enum {string} */
3176
+ /** @description What a running job is doing right now, as a code plus typed params — never a prose sentence. The producer reports what happened; each client renders it in the user's language (react-ui from its translations, the Go launcher from its English map). One named schema per code, discriminated on `code` (WIRE-UNION-DISCRIMINANTS P5b), so generated clients get typed variants and copy-map completeness is statically checkable. The vocabulary is the census of every onProgress call site in @semiont/jobs (.plans/ASSIST-PROGRESS-CONSOLIDATION.md P1); extending it means adding a named variant here and copy in every client, gated by the locale-completeness check. */
3177
+ JobProgressMessage: components["schemas"]["JobProgressLoading"] | components["schemas"]["JobProgressAnalyzing"] | components["schemas"]["JobProgressAnalyzingTags"] | components["schemas"]["JobProgressGeneratingResource"] | components["schemas"]["JobProgressCreatingResource"] | components["schemas"]["JobProgressCompleteGenerated"] | components["schemas"]["JobProgressDetectingEntities"] | components["schemas"]["JobProgressCreatingAnnotations"] | components["schemas"]["JobProgressCreatingTagAnnotations"] | components["schemas"]["JobProgressCompleteCreated"];
3178
+ /** @description Analyzing the content. */
3179
+ JobProgressAnalyzing: {
3180
+ /**
3181
+ * @description discriminator enum property added by openapi-typescript
3182
+ * @enum {string}
3183
+ */
3184
+ code: "analyzing";
3185
+ };
3186
+ /** @description Analyzing the content against the tag schema. */
3187
+ JobProgressAnalyzingTags: {
3188
+ /**
3189
+ * @description discriminator enum property added by openapi-typescript
3190
+ * @enum {string}
3191
+ */
3192
+ code: "analyzing-tags";
3193
+ };
3194
+ /** @description Terminal success summary. */
3195
+ JobProgressCompleteCreated: {
3196
+ /**
3197
+ * @description discriminator enum property added by openapi-typescript
3198
+ * @enum {string}
3199
+ */
3088
3200
  code: "complete-created";
3089
3201
  /** @description How many annotations were created */
3090
3202
  count: number;
@@ -3094,6 +3206,70 @@ interface components {
3094
3206
  */
3095
3207
  kind: "highlight" | "comment" | "assessment" | "reference" | "tag";
3096
3208
  };
3209
+ /** @description Generation's terminal success. Deliberately generic — the client already holds the title it typed, and the outcome (name + resource link) travels on job:complete, not on progress (GENERATE-FROM-RESOURCE D7/D8). `truncated` qualifies the completion (D6): the same bit `JobGenerationResult.truncated` carries, so the two surfaces cannot drift. */
3210
+ JobProgressCompleteGenerated: {
3211
+ /**
3212
+ * @description discriminator enum property added by openapi-typescript
3213
+ * @enum {string}
3214
+ */
3215
+ code: "complete-generated";
3216
+ /** @description True when the model stopped at the maxTokens ceiling — the artifact is cut off, not complete. */
3217
+ truncated: boolean;
3218
+ };
3219
+ /** @description Writing detected annotations back to the resource. */
3220
+ JobProgressCreatingAnnotations: {
3221
+ /**
3222
+ * @description discriminator enum property added by openapi-typescript
3223
+ * @enum {string}
3224
+ */
3225
+ code: "creating-annotations";
3226
+ /** @description How many annotations are being created */
3227
+ count: number;
3228
+ };
3229
+ /** @description Writing the generated resource. */
3230
+ JobProgressCreatingResource: {
3231
+ /**
3232
+ * @description discriminator enum property added by openapi-typescript
3233
+ * @enum {string}
3234
+ */
3235
+ code: "creating-resource";
3236
+ };
3237
+ /** @description Writing detected tag annotations back to the resource. */
3238
+ JobProgressCreatingTagAnnotations: {
3239
+ /**
3240
+ * @description discriminator enum property added by openapi-typescript
3241
+ * @enum {string}
3242
+ */
3243
+ code: "creating-tag-annotations";
3244
+ /** @description How many annotations are being created */
3245
+ count: number;
3246
+ };
3247
+ /** @description Entity detection, one entity type at a time. */
3248
+ JobProgressDetectingEntities: {
3249
+ /**
3250
+ * @description discriminator enum property added by openapi-typescript
3251
+ * @enum {string}
3252
+ */
3253
+ code: "detecting-entities";
3254
+ /** @description Entity type currently being detected */
3255
+ entityType: string;
3256
+ };
3257
+ /** @description The model is generating the resource. */
3258
+ JobProgressGeneratingResource: {
3259
+ /**
3260
+ * @description discriminator enum property added by openapi-typescript
3261
+ * @enum {string}
3262
+ */
3263
+ code: "generating-resource";
3264
+ };
3265
+ /** @description Loading the resource content. */
3266
+ JobProgressLoading: {
3267
+ /**
3268
+ * @description discriminator enum property added by openapi-typescript
3269
+ * @enum {string}
3270
+ */
3271
+ code: "loading";
3272
+ };
3097
3273
  /** @description Event indicating a job has been queued */
3098
3274
  JobQueuedEvent: {
3099
3275
  jobId: string;
@@ -3104,6 +3280,11 @@ interface components {
3104
3280
  };
3105
3281
  /** @description Result of a completed reference-annotation job. */
3106
3282
  JobReferenceAnnotationResult: {
3283
+ /**
3284
+ * @description Discriminant — every JobResult member carries `kind`, single-valued, so a consumer holding only the result can tell what it is (WIRE-UNION-DISCRIMINANTS D1). (enum property replaced by openapi-typescript)
3285
+ * @enum {string}
3286
+ */
3287
+ kind: "reference-annotation";
3107
3288
  /** @description Total entities found */
3108
3289
  totalFound: number;
3109
3290
  /** @description Total annotations emitted */
@@ -3123,7 +3304,7 @@ interface components {
3123
3304
  percentage: number;
3124
3305
  progress?: components["schemas"]["JobProgress"];
3125
3306
  };
3126
- /** @description Discriminated union of all job result types. */
3307
+ /** @description Discriminated union of all job result types — every member carries a single-valued `kind` (WIRE-UNION-DISCRIMINANTS D1/D2). Consumers switch on `kind`; generated clients get typed variants. */
3127
3308
  JobResult: components["schemas"]["JobGenerationResult"] | components["schemas"]["JobReferenceAnnotationResult"] | components["schemas"]["JobHighlightAnnotationResult"] | components["schemas"]["JobAssessmentAnnotationResult"] | components["schemas"]["JobCommentAnnotationResult"] | components["schemas"]["JobTagAnnotationResult"] | components["schemas"]["JobDeclinedResult"];
3128
3309
  /** @description Command to start a job */
3129
3310
  JobStartCommand: {
@@ -3159,7 +3340,7 @@ interface components {
3159
3340
  completedAt?: string;
3160
3341
  error?: string;
3161
3342
  progress?: unknown;
3162
- result?: unknown;
3343
+ result?: components["schemas"]["JobResult"];
3163
3344
  };
3164
3345
  /** @description Result of a job status request */
3165
3346
  JobStatusResult: {
@@ -3168,6 +3349,11 @@ interface components {
3168
3349
  };
3169
3350
  /** @description Result of a completed tag-annotation job. */
3170
3351
  JobTagAnnotationResult: {
3352
+ /**
3353
+ * @description Discriminant — every JobResult member carries `kind`, single-valued, so a consumer holding only the result can tell what it is (WIRE-UNION-DISCRIMINANTS D1). (enum property replaced by openapi-typescript)
3354
+ * @enum {string}
3355
+ */
3356
+ kind: "tag-annotation";
3171
3357
  tagsFound: number;
3172
3358
  tagsCreated: number;
3173
3359
  /** @description Count of tags created per category */
@@ -3182,25 +3368,11 @@ interface components {
3182
3368
  JobType: "reference-annotation" | "generation" | "highlight-annotation" | "assessment-annotation" | "comment-annotation" | "tag-annotation";
3183
3369
  /** @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. */
3184
3370
  KnowledgeGraph: {
3185
- nodes: {
3186
- /** @description Node identifier — a ResourceId or AnnotationId */
3187
- id: string;
3188
- /**
3189
- * @description Whether this node is a resource or an annotation
3190
- * @enum {string}
3191
- */
3192
- type: "resource" | "annotation";
3193
- label: string;
3194
- /** @description Entity types on the node (resources) or carried by the annotation */
3195
- entityTypes?: string[];
3196
- metadata?: {
3197
- [key: string]: unknown;
3198
- };
3199
- }[];
3371
+ nodes: (components["schemas"]["GraphResourceNode"] | components["schemas"]["GraphAnnotationNode"])[];
3200
3372
  edges: {
3201
3373
  source: string;
3202
3374
  target: string;
3203
- /** @description Edge kind (e.g. citation, annotation-of, sibling) */
3375
+ /** @description Edge kind: `annotation-of` (an annotation → the resource it lives on), `cites` (a citing linking annotation → the focal resource), or a peer connection's own relationshipType (free-form; `link` when unnamed) */
3204
3376
  type: string;
3205
3377
  /** @description Whether the connection goes both ways */
3206
3378
  bidirectional?: boolean;
@@ -3596,6 +3768,8 @@ interface components {
3596
3768
  text: string;
3597
3769
  /** @description Source resource ID */
3598
3770
  resourceId: string;
3771
+ /** @description The source resource's display name, resolved from its view at gather time. Required: a match card must name its source, and corpus matches routinely come from outside the graph neighborhood, so there is no node to borrow a name from. A match whose source no longer resolves to a view is dropped by the producer rather than served nameless. */
3772
+ resourceName: string;
3599
3773
  /** @description Source annotation ID, if the match is from an annotation */
3600
3774
  annotationId?: string;
3601
3775
  /** @description Cosine similarity score (0-1) */
@@ -3633,7 +3807,10 @@ interface components {
3633
3807
  theme: "light" | "dark" | "system";
3634
3808
  };
3635
3809
  SpecificResource: {
3636
- /** @enum {string} */
3810
+ /**
3811
+ * @description discriminator enum property added by openapi-typescript
3812
+ * @enum {string}
3813
+ */
3637
3814
  type: "SpecificResource";
3638
3815
  /** @description IRI of the target resource */
3639
3816
  source: string;
@@ -3726,7 +3903,10 @@ interface components {
3726
3903
  suffix?: string;
3727
3904
  };
3728
3905
  TextualBody: {
3729
- /** @enum {string} */
3906
+ /**
3907
+ * @description discriminator enum property added by openapi-typescript
3908
+ * @enum {string}
3909
+ */
3730
3910
  type: "TextualBody";
3731
3911
  /** @description The text content (e.g., entity type name) */
3732
3912
  value: string;
@@ -8142,11 +8322,16 @@ declare function getAllPlatformTypes(): PlatformType[];
8142
8322
  * and `@semiont/jobs` (the generation prompt builder) can share one derivation. `buildKnowledgeGraph`
8143
8323
  * — which queries the graph DB — stays in make-meaning; this only transforms an already-built graph.
8144
8324
  *
8145
- * Reports the graph as-is (Option A): missing-view citers are kept (the citation edge reflects a real
8146
- * reference event); the only filter is excluding the focal annotation from siblings (an annotation
8147
- * isn't its own sibling). Peer connections are edges out of `mainResourceId`; citations and
8148
- * `annotation-of` edges point INTO it. The graph is a projection of the event log (the system of
8149
- * record), read here because it is the queryable projection at gather time.
8325
+ * Reports the graph as-is (Option A): missing-view citers are kept (the citing annotation reflects a
8326
+ * real reference event; its resource label falls back to the raw id). A citation is its linking
8327
+ * ANNOTATION: an annotation node with `annotation-of` the citing resource and `cites` the focal
8328
+ * resource so citedBy resolves through that pair, deduped per citing resource (several citations
8329
+ * from one document are one citer). Siblings are annotations ON the focal resource
8330
+ * (`annotation-of` → main), excluding the focal annotation — an annotation isn't its own sibling,
8331
+ * and a CITING annotation lives on another resource, so it never was one. Peer connections are
8332
+ * edges out of `mainResourceId`; derivation is structural (endpoints), never a match on the
8333
+ * free-form relationshipType. The graph is a projection of the event log (the system of record),
8334
+ * read here because it is the queryable projection at gather time.
8150
8335
  */
8151
8336
 
8152
8337
  type KnowledgeGraph = components['schemas']['KnowledgeGraph'];
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export { createTomlConfigLoader, loadTomlConfig } from './chunk-JWTQJVKM.js';
2
2
  import { BUS_OPERATIONS } from './chunk-CUPZGI7I.js';
3
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-CUPZGI7I.js';
4
+ import './chunk-YLJ4XMA6.js';
4
5
  import { Observable, merge, TimeoutError, throwError, firstValueFrom } from 'rxjs';
5
6
  import { filter, map, take, timeout, catchError, defaultIfEmpty } from 'rxjs/operators';
6
7
 
@@ -2065,13 +2066,20 @@ function getAllPlatformTypes() {
2065
2066
  // src/knowledge-graph-views.ts
2066
2067
  function deriveViews(graph, mainResourceId, focalAnnotationId) {
2067
2068
  const nodeById = new Map(graph.nodes.map((n) => [n.id, n]));
2069
+ const annotationOf = /* @__PURE__ */ new Map();
2070
+ for (const edge of graph.edges) {
2071
+ if (edge.type === "annotation-of") annotationOf.set(edge.source, edge.target);
2072
+ }
2068
2073
  const connections = [];
2069
2074
  const citedBy = [];
2075
+ const citingSeen = /* @__PURE__ */ new Set();
2070
2076
  for (const edge of graph.edges) {
2071
- if (edge.type === "citation") {
2072
- if (edge.target !== mainResourceId) continue;
2073
- const node = nodeById.get(edge.source);
2074
- citedBy.push({ resourceId: edge.source, resourceName: node?.label ?? edge.source });
2077
+ const citingResource = edge.type === "cites" && edge.target === mainResourceId ? annotationOf.get(edge.source) : void 0;
2078
+ if (citingResource !== void 0) {
2079
+ if (citingSeen.has(citingResource)) continue;
2080
+ citingSeen.add(citingResource);
2081
+ const node = nodeById.get(citingResource);
2082
+ citedBy.push({ resourceId: citingResource, resourceName: node?.label ?? citingResource });
2075
2083
  } else if (edge.source === mainResourceId) {
2076
2084
  const node = nodeById.get(edge.target);
2077
2085
  connections.push({
@@ -2084,7 +2092,7 @@ function deriveViews(graph, mainResourceId, focalAnnotationId) {
2084
2092
  }
2085
2093
  const siblingEntityTypes = /* @__PURE__ */ new Set();
2086
2094
  for (const node of graph.nodes) {
2087
- if (node.type === "annotation" && node.id !== focalAnnotationId) {
2095
+ if (node.type === "annotation" && node.id !== focalAnnotationId && annotationOf.get(node.id) === mainResourceId) {
2088
2096
  for (const et of node.entityTypes ?? []) siblingEntityTypes.add(et);
2089
2097
  }
2090
2098
  }