@deepseek-ai/dsh-typert-generator 0.0.1-rc.1

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.
@@ -0,0 +1,148 @@
1
+ /**
2
+ * Cordis catalog-specific projection over the compiler-independent Typert
3
+ * model. This module owns Cordis validation and text projection mechanics;
4
+ * callers supply repository-specific type classifications and inherited data.
5
+ * @module @deepseek-ai/dsh-typert-generator
6
+ */
7
+ import type { FaceModel, SourceDeclarationModel } from './model.ts';
8
+ type Mode = 'emit' | 'waterfall' | 'parallel' | 'serial';
9
+ /** One harness event, extracted from an `interface Events` block. */
10
+ export interface EventEntry {
11
+ /** Scoped name, e.g. `agent/request`. */
12
+ name: string;
13
+ /** The scope prefix, e.g. `agent` (everything before the first `/`). */
14
+ scope: string;
15
+ /** Full signature text (the method-signature member, JSDoc stripped). */
16
+ signature: string;
17
+ /** Original declaration JSDoc, dedented from its containing interface. */
18
+ jsDoc: string;
19
+ /** Dispatch mode from the `@mode` tag. */
20
+ mode: Mode;
21
+ /** Description prose (JSDoc minus the `@mode` tag), one line per paragraph. */
22
+ doc: string;
23
+ /** Source pointer `packages/…/file.ts:line` of the declaration. */
24
+ source: string;
25
+ }
26
+ /** One public service method and the source contract attached to it. */
27
+ export interface ServiceMethodEntry {
28
+ /** Public method signature (body stripped). */
29
+ signature: string;
30
+ /** Original method JSDoc, dedented from its containing class. */
31
+ jsDoc: string;
32
+ }
33
+ /** One harness service, extracted from an `interface Context` block. */
34
+ export interface ServiceEntry {
35
+ /** The `ctx.<key>` name, e.g. `llm`. */
36
+ key: string;
37
+ /** The service class/interface name, e.g. `LlmService`. */
38
+ type: string;
39
+ /** Whether the service class is abstract (a seam interface). */
40
+ abstract: boolean;
41
+ /** Class-level JSDoc prose, one line per paragraph. */
42
+ doc: string;
43
+ /** Public methods (bodies stripped), in source order. */
44
+ methods: ServiceMethodEntry[];
45
+ /** Source pointer of the class declaration. */
46
+ source: string;
47
+ }
48
+ /** A terse inherited-tier entry supplied by the catalog policy. */
49
+ export interface InheritedEntry {
50
+ /** Display name of the inherited event or context member group. */
51
+ name: string;
52
+ /** One-line description rendered into the catalog. */
53
+ summary: string;
54
+ /** Source pointer such as `vendor/…:line`. */
55
+ source: string;
56
+ }
57
+ /** Repository policy consumed by the Cordis catalog parsing and rendering logic. */
58
+ export interface CordisCatalogPolicy {
59
+ /** Type names linked from signatures to their documentation pages. */
60
+ readonly linkedTypePages: Readonly<Record<string, string>>;
61
+ /** TypeScript or framework types that need no repository documentation link. */
62
+ readonly foundationTypeNames: ReadonlySet<string>;
63
+ /** Repository types deliberately documented outside the linked data catalog. */
64
+ readonly typeLinkExemptions: Readonly<Record<string, string>>;
65
+ /** Manually curated framework events inherited by every plugin. */
66
+ readonly inheritedEvents: readonly InheritedEntry[];
67
+ /** Manually curated framework context members inherited by every plugin. */
68
+ readonly inheritedServices: readonly InheritedEntry[];
69
+ }
70
+ /** Complete model-level Cordis projection used by every text renderer. */
71
+ export interface CordisCatalogModel {
72
+ readonly events: readonly EventEntry[];
73
+ readonly services: readonly ServiceEntry[];
74
+ }
75
+ /** Repository-specific Cordis validation and projection over one Typert face. */
76
+ export declare class CordisCatalogProjector {
77
+ private readonly face;
78
+ private readonly sourceDeclarations;
79
+ private readonly policy;
80
+ private readonly renderer;
81
+ /**
82
+ * @param face - analyzed host face containing package business semantics.
83
+ * @param sourceDeclarations - exported declarations available to the runtime type closure.
84
+ * @param policy - caller-owned type classifications and inherited Cordis data.
85
+ */
86
+ constructor(face: FaceModel, sourceDeclarations: readonly SourceDeclarationModel[], policy: CordisCatalogPolicy);
87
+ /**
88
+ * Validate and project the host model's Cordis surface.
89
+ * @returns every validated service and event projected from the host model.
90
+ */
91
+ project(): CordisCatalogModel;
92
+ /**
93
+ * Render the model-facing static API consumed by `tool-cordis`.
94
+ * @param model - validated Cordis catalog projection from this projector.
95
+ * @returns the model-facing TypeScript catalog source.
96
+ */
97
+ renderRuntimeApi(model: CordisCatalogModel): string;
98
+ private collectEvents;
99
+ private collectServices;
100
+ private runtimeTypes;
101
+ }
102
+ /**
103
+ * Analyze the host project once and return both the model and its projection.
104
+ * @param scanRoot - workspace root containing `tsconfig.host.json`.
105
+ * @param policy - caller-owned type classifications and inherited Cordis data.
106
+ * @returns the configured projector and its validated catalog model.
107
+ */
108
+ export declare function projectCordisCatalog(scanRoot: string, policy: CordisCatalogPolicy): {
109
+ readonly projector: CordisCatalogProjector;
110
+ readonly model: CordisCatalogModel;
111
+ };
112
+ /**
113
+ * Collect all modeled events for relationship-document consumers.
114
+ * @param scanRoot - workspace root containing `tsconfig.host.json`.
115
+ * @param policy - caller-owned Cordis catalog policy.
116
+ * @returns all validated event entries.
117
+ */
118
+ export declare function collectEvents(scanRoot: string, policy: CordisCatalogPolicy): EventEntry[];
119
+ /**
120
+ * Collect all modeled services for relationship-document consumers.
121
+ * @param scanRoot - workspace root containing `tsconfig.host.json`.
122
+ * @param policy - caller-owned Cordis catalog policy.
123
+ * @returns all validated service entries.
124
+ */
125
+ export declare function collectServices(scanRoot: string, policy: CordisCatalogPolicy): ServiceEntry[];
126
+ /** Opening region delimiter; injected content lives between the pair and the page owns everything outside. */
127
+ export declare const REGION_BEGIN = "<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) \u2014 do not edit between markers -->";
128
+ /** Closing region delimiter matching {@link REGION_BEGIN}. */
129
+ export declare const REGION_END = "<!-- END GENERATED cordis-surface -->";
130
+ /**
131
+ * Render one page's generated `cordis-surface` region: the services mapped to
132
+ * the page, then the event scopes mapped to it, markers included. Pure and
133
+ * deterministic given sorted inputs; identical bytes land in both pair sides.
134
+ * @param page - the owning `docs/subsystems/` page basename, e.g. `core.md`.
135
+ * @param services - validated services mapped to this page.
136
+ * @param events - validated events whose scopes map to this page.
137
+ * @param policy - type links supplied by the caller.
138
+ * @returns the complete marker-delimited region text.
139
+ */
140
+ export declare function renderPageRegion(page: string, services: ServiceEntry[], events: EventEntry[], policy: CordisCatalogPolicy): string;
141
+ /**
142
+ * Render the inherited (pinned vendor) tier as its own generated page.
143
+ * @param policy - inherited events and services supplied by the caller.
144
+ * @returns the complete generated Markdown document.
145
+ */
146
+ export declare function renderInheritedPage(policy: CordisCatalogPolicy): string;
147
+ export {};
148
+ //# sourceMappingURL=cordis-catalog.d.ts.map