@contentful/experience-design-system-types 2.42.1-dev-build-f69db6bf.0 → 2.43.0-alpha.0

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.
Files changed (94) hide show
  1. package/README.md +15 -0
  2. package/dist/package.json +1 -1
  3. package/dist/src/agent-process-lifecycle.d.ts +26 -0
  4. package/dist/src/agent-process-lifecycle.js +171 -0
  5. package/dist/src/agent-prompt-artifact.d.ts +8 -0
  6. package/dist/src/agent-prompt-artifact.js +37 -0
  7. package/dist/src/agent-prompt-transport.d.ts +1 -0
  8. package/dist/src/agent-prompt-transport.js +4 -0
  9. package/dist/src/cdf/build.d.ts +9 -2
  10. package/dist/src/cdf/build.js +134 -17
  11. package/dist/src/cdf/finite-values.d.ts +8 -0
  12. package/dist/src/cdf/finite-values.js +21 -0
  13. package/dist/src/cdf/index.d.ts +2 -1
  14. package/dist/src/cdf/index.js +1 -0
  15. package/dist/src/cdf/property-validation.d.ts +16 -0
  16. package/dist/src/cdf/property-validation.js +211 -0
  17. package/dist/src/cdf/representation-validation.d.ts +6 -0
  18. package/dist/src/cdf/representation-validation.js +182 -0
  19. package/dist/src/cdf/schema.d.ts +778 -20
  20. package/dist/src/cdf/schema.js +362 -5
  21. package/dist/src/cdf/types.d.ts +57 -59
  22. package/dist/src/cdf/types.js +72 -15
  23. package/dist/src/cdf/validate.js +31 -1
  24. package/dist/src/cdf/vocabularies.d.ts +1 -1
  25. package/dist/src/cdf/vocabularies.js +9 -1
  26. package/dist/src/config/index.js +6 -3
  27. package/dist/src/exploration/constants.d.ts +10 -0
  28. package/dist/src/exploration/constants.js +18 -0
  29. package/dist/src/exploration/index.d.ts +3 -0
  30. package/dist/src/exploration/index.js +3 -0
  31. package/dist/src/exploration/schemas.d.ts +201 -0
  32. package/dist/src/exploration/schemas.js +126 -0
  33. package/dist/src/exploration/types.d.ts +393 -0
  34. package/dist/src/exploration/types.js +1 -0
  35. package/dist/src/handoff/index.d.ts +1 -1
  36. package/dist/src/index.d.ts +15 -1
  37. package/dist/src/index.js +12 -4
  38. package/dist/src/property-contract/analysis-representation-candidates.d.ts +19 -0
  39. package/dist/src/property-contract/analysis-representation-candidates.js +45 -0
  40. package/dist/src/property-contract/classification.d.ts +38 -0
  41. package/dist/src/property-contract/classification.js +84 -0
  42. package/dist/src/property-contract/compact-model-components.d.ts +16 -0
  43. package/dist/src/property-contract/compact-model-components.js +113 -0
  44. package/dist/src/property-contract/content-digest.d.ts +2 -0
  45. package/dist/src/property-contract/content-digest.js +69 -0
  46. package/dist/src/property-contract/decision-protocol.d.ts +45 -0
  47. package/dist/src/property-contract/decision-protocol.js +251 -0
  48. package/dist/src/property-contract/definition-import-rules.d.ts +10 -0
  49. package/dist/src/property-contract/definition-import-rules.js +105 -0
  50. package/dist/src/property-contract/definition-import.d.ts +13 -0
  51. package/dist/src/property-contract/definition-import.js +52 -0
  52. package/dist/src/property-contract/discriminated-union-source.d.ts +17 -0
  53. package/dist/src/property-contract/discriminated-union-source.js +180 -0
  54. package/dist/src/property-contract/import-prerequisites.d.ts +70 -0
  55. package/dist/src/property-contract/import-prerequisites.js +208 -0
  56. package/dist/src/property-contract/index.d.ts +18 -1
  57. package/dist/src/property-contract/index.js +18 -6
  58. package/dist/src/property-contract/logical-source-graph.d.ts +36 -0
  59. package/dist/src/property-contract/logical-source-graph.js +240 -0
  60. package/dist/src/property-contract/mapper-readiness.d.ts +6 -0
  61. package/dist/src/property-contract/mapper-readiness.js +34 -0
  62. package/dist/src/property-contract/model-exploration.d.ts +42 -0
  63. package/dist/src/property-contract/model-exploration.js +94 -0
  64. package/dist/src/property-contract/native-source-region.d.ts +5 -0
  65. package/dist/src/property-contract/native-source-region.js +125 -0
  66. package/dist/src/property-contract/null-handling.d.ts +10 -0
  67. package/dist/src/property-contract/null-handling.js +45 -0
  68. package/dist/src/property-contract/physical-property-import.d.ts +6 -0
  69. package/dist/src/property-contract/physical-property-import.js +55 -0
  70. package/dist/src/property-contract/property-decision.d.ts +14 -0
  71. package/dist/src/property-contract/property-decision.js +155 -0
  72. package/dist/src/property-contract/property-model.d.ts +197 -0
  73. package/dist/src/property-contract/property-model.js +833 -0
  74. package/dist/src/property-contract/representation-plan.d.ts +133 -0
  75. package/dist/src/property-contract/representation-plan.js +756 -0
  76. package/dist/src/property-contract/representation-proposal.d.ts +65 -0
  77. package/dist/src/property-contract/representation-proposal.js +204 -0
  78. package/dist/src/property-contract/resource-link-schema.d.ts +55 -0
  79. package/dist/src/property-contract/resource-link-schema.js +28 -0
  80. package/dist/src/property-contract/source-representation.d.ts +9 -0
  81. package/dist/src/property-contract/source-representation.js +79 -0
  82. package/dist/src/property-contract/target-definition.d.ts +17 -16
  83. package/dist/src/property-contract/target-definition.js +4 -26
  84. package/dist/src/schema-export.d.ts +30 -0
  85. package/dist/src/schema-export.js +285 -0
  86. package/dist/src/shared-source.d.ts +105 -0
  87. package/dist/src/shared-source.js +1 -0
  88. package/dist/src/source-input-association.d.ts +23 -0
  89. package/dist/src/source-input-association.js +52 -0
  90. package/dist/src/sources-api/preview/index.d.ts +37 -3
  91. package/dist/src/sources-api/preview/index.js +39 -1
  92. package/dist/src/sources-api/preview/schema.d.ts +2 -0
  93. package/dist/src/sources-api/preview/schema.js +74 -0
  94. package/package.json +1 -1
@@ -0,0 +1,393 @@
1
+ import type { EXPLORE_SCOPES } from './constants.js';
2
+ import type { FinitePrimitiveValue } from '../cdf/finite-values.js';
3
+ import type { JsonValue } from '../property-contract/json-value.js';
4
+ export type ExploreScope = (typeof EXPLORE_SCOPES)[number];
5
+ export type DiffScope = 'component' | 'prop' | 'slot';
6
+ export type SourceCompleteness = 'complete-within-declared-bound' | 'partial' | 'unavailable';
7
+ export interface ExplorationIdentity {
8
+ sessionId: string;
9
+ runId: string;
10
+ envelopeId: string;
11
+ digest: string;
12
+ }
13
+ export interface KnownComponent {
14
+ name: string;
15
+ source: string;
16
+ componentId?: string;
17
+ }
18
+ export interface VerifyEvidence {
19
+ source: string;
20
+ line: string;
21
+ quote: string;
22
+ }
23
+ export interface SlotRestriction {
24
+ kind: 'declared' | 'enforced';
25
+ applicable: boolean;
26
+ evidence: VerifyEvidence[];
27
+ supported?: boolean;
28
+ }
29
+ export interface ExploreSlotEvidence {
30
+ sourceInput?: import('../source-input-association.js').SourceInputAssociation;
31
+ name: string;
32
+ isRealSlot: boolean;
33
+ allowedComponents?: string[];
34
+ evidence?: string[];
35
+ required?: boolean;
36
+ reasoning?: string;
37
+ restriction?: SlotRestriction;
38
+ }
39
+ export interface ExplorePropReport {
40
+ name: string;
41
+ /** Recursive union branches form one complete desired definition. */
42
+ definition?: import('../cdf/types.js').CDFPropertyDefinition;
43
+ category?: 'content' | 'design' | 'state' | 'unattached';
44
+ type?: string;
45
+ values?: FinitePrimitiveValue[];
46
+ /** Observed values are evidence and do not establish a finite constraint. */
47
+ observedValues?: JsonValue[];
48
+ tokenKind?: string;
49
+ tokenPaths?: string[];
50
+ required?: boolean;
51
+ default?: unknown;
52
+ description?: string;
53
+ reasoning?: string;
54
+ /** One source-bound draft; mapper readiness remains caller-owned. */
55
+ representationProposal?: import('../property-contract/representation-proposal.js').RepresentationProposalDraft;
56
+ }
57
+ export interface ExploreComponentReport extends KnownComponent {
58
+ included?: boolean;
59
+ inclusionReasoning?: string;
60
+ modelingNotes?: string[];
61
+ props?: ExplorePropReport[];
62
+ slots?: ExploreSlotEvidence[];
63
+ }
64
+ export interface ExploreCompanion {
65
+ agentRole: ExploreScope;
66
+ components: ExploreComponentReport[];
67
+ rawTokenReferences?: Array<{
68
+ tokenPath: string;
69
+ file: string;
70
+ line: number;
71
+ property: string;
72
+ }>;
73
+ }
74
+ export interface AgentCallAttempt {
75
+ attempt: number;
76
+ ok: boolean;
77
+ error?: string;
78
+ stage?: string;
79
+ operationId?: string;
80
+ component?: string;
81
+ source?: string;
82
+ workIds?: readonly string[];
83
+ scope?: ExploreScope;
84
+ identity?: ExplorationIdentity;
85
+ startedAt?: string;
86
+ durationMs?: number;
87
+ }
88
+ export interface ExploreAttempt extends AgentCallAttempt {
89
+ scope: ExploreScope;
90
+ }
91
+ export interface ExploreReportCoverage {
92
+ requested: KnownComponent[];
93
+ answered: KnownComponent[];
94
+ excluded: KnownComponent[];
95
+ complete: true;
96
+ }
97
+ export interface ExploreScopeResult {
98
+ coverage?: ExploreReportCoverage;
99
+ scope: ExploreScope;
100
+ report: string;
101
+ companion: ExploreCompanion;
102
+ attempts: ExploreAttempt[];
103
+ }
104
+ export type ExploreStageResult = {
105
+ ok: true;
106
+ scopes: ExploreScopeResult[];
107
+ } | {
108
+ ok: false;
109
+ scope: ExploreScope;
110
+ attempts: ExploreAttempt[];
111
+ error: string;
112
+ scopes?: ExploreScopeResult[];
113
+ };
114
+ export interface ExploreSourceRef {
115
+ compilerContexts?: import('../shared-source.js').SharedSourceCompilerContext[];
116
+ component: string;
117
+ sourcePath: string;
118
+ content: string | null;
119
+ sourceEvidence?: {
120
+ captureId: string;
121
+ captureDigest: string;
122
+ textHash: string | null;
123
+ coverage: SourceCompleteness;
124
+ extractionByteBinding: 'verified-same' | 'changed' | 'unverified';
125
+ lineRanges: Array<{
126
+ startLine: number;
127
+ endLine: number;
128
+ }>;
129
+ compilerContextId?: string;
130
+ };
131
+ siblingFiles?: Array<{
132
+ path: string;
133
+ content: string;
134
+ sourceEvidence?: ExploreSourceRef['sourceEvidence'];
135
+ }>;
136
+ }
137
+ export interface BoundSourceFile {
138
+ fileId: string;
139
+ compilerContextId?: string;
140
+ path: string;
141
+ textHash: string | null;
142
+ ranges: Array<{
143
+ startLine: number;
144
+ endLine: number;
145
+ text: string;
146
+ }>;
147
+ coverage: SourceCompleteness;
148
+ roles?: string[];
149
+ componentRefs?: import('../shared-source.js').SharedSourceFile['componentRefs'];
150
+ }
151
+ export interface ExplorationSourceInput {
152
+ inventory?: unknown;
153
+ omittedInventory?: number;
154
+ /** Legacy snapshot metadata; ignored and removed from new prompt projections. */
155
+ projectionBounds?: {
156
+ maxBytes: number;
157
+ usedBytes: number;
158
+ };
159
+ components?: import('../shared-source.js').SharedSource['components'];
160
+ compilerContexts?: import('../shared-source.js').SharedSourceCompilerContext[];
161
+ omittedCompilerContexts?: number;
162
+ omittedComponents?: number;
163
+ omittedRanges?: number;
164
+ captureId: string;
165
+ captureDigest: string;
166
+ envelopeId: string;
167
+ envelopeDigest: string;
168
+ coverage: SourceCompleteness;
169
+ promptCoverage: SourceCompleteness;
170
+ extractionByteBinding: 'verified-same' | 'changed' | 'unverified';
171
+ files: BoundSourceFile[];
172
+ omittedFiles: number;
173
+ omittedDiagnostics?: number;
174
+ omittedObservations?: number;
175
+ diagnostics: unknown[];
176
+ observations: NonNullable<import('../shared-source.js').SharedSource['observations']>;
177
+ }
178
+ export interface ExplorationDisagreement {
179
+ id: string;
180
+ component: string;
181
+ source: string;
182
+ scope: DiffScope;
183
+ member?: string;
184
+ field: string;
185
+ path: string;
186
+ valuesByScope: Partial<Record<ExploreScope, unknown>>;
187
+ reasonsByScope: Partial<Record<ExploreScope, string>>;
188
+ existenceDispute?: boolean;
189
+ }
190
+ export interface ExplorationSingleVoter {
191
+ id: string;
192
+ component: string;
193
+ source: string;
194
+ scope: DiffScope;
195
+ member?: string;
196
+ field: string;
197
+ path: string;
198
+ provider: ExploreScope;
199
+ value: unknown;
200
+ reason?: string;
201
+ }
202
+ export interface ExplorationConsensusField {
203
+ path: string;
204
+ value: unknown;
205
+ coverage: number;
206
+ providers: ExploreScope[];
207
+ }
208
+ export interface ExplorationDiff {
209
+ consensus: ExplorationConsensusField[];
210
+ disagreements: ExplorationDisagreement[];
211
+ singleVoters: ExplorationSingleVoter[];
212
+ warnings: string[];
213
+ scopesRead: number;
214
+ componentsSeen: number;
215
+ }
216
+ export interface DerivedSelection {
217
+ componentKey: string;
218
+ componentId?: string;
219
+ name: string;
220
+ source: string;
221
+ decision?: 'accepted' | 'rejected';
222
+ reason: string;
223
+ votes: {
224
+ accepted: number;
225
+ rejected: number;
226
+ };
227
+ dissent: Array<{
228
+ scope: string;
229
+ included: boolean;
230
+ reason: string;
231
+ }>;
232
+ disputed: boolean;
233
+ }
234
+ export type AcceptedSlotState = 'false' | 'unresolved' | 'open' | 'finite';
235
+ export interface DerivedSlot {
236
+ name: string;
237
+ allowedComponents: string[];
238
+ state?: AcceptedSlotState;
239
+ required?: boolean;
240
+ evidence?: VerifyEvidence[];
241
+ }
242
+ export interface DerivedComponentSlots extends KnownComponent {
243
+ slots: DerivedSlot[];
244
+ }
245
+ export interface SlotDecision extends KnownComponent {
246
+ sourceInput?: import('../source-input-association.js').SourceInputAssociation;
247
+ slot: string;
248
+ state: AcceptedSlotState;
249
+ allowedComponents: string[];
250
+ required?: boolean;
251
+ evidence: VerifyEvidence[];
252
+ coverage: number;
253
+ realVotes: number;
254
+ description?: string;
255
+ provenance?: 'source-consensus' | 'human';
256
+ disputes?: SlotDispute[];
257
+ }
258
+ export interface SlotDispute {
259
+ component: string;
260
+ source: string;
261
+ slot: string;
262
+ field: 'isRealSlot' | 'allowedComponents';
263
+ disputeId: string;
264
+ valuesByScope: Record<string, unknown>;
265
+ reasonsByScope: Record<string, string | undefined>;
266
+ }
267
+ export interface DerivedSlots {
268
+ components: DerivedComponentSlots[];
269
+ disputes: SlotDispute[];
270
+ decisions: SlotDecision[];
271
+ }
272
+ export type HypothesisTier = 'factual' | 'interpretive';
273
+ export interface TierHypothesis {
274
+ disagreementIds: string[];
275
+ hypothesis: string;
276
+ tier: HypothesisTier;
277
+ tierReason: string;
278
+ gatedOn?: 'category';
279
+ }
280
+ export type TierStageResult = {
281
+ ok: true;
282
+ hypotheses: TierHypothesis[];
283
+ attempts: AgentCallAttempt[];
284
+ } | {
285
+ ok: false;
286
+ error: string;
287
+ attempts: AgentCallAttempt[];
288
+ };
289
+ export type VerifyOutcome = 'confirmed' | 'resolved' | 'conflicting';
290
+ export type VerifyItemKind = 'factual' | 'single-voter';
291
+ export interface VerifyClaim {
292
+ id: string;
293
+ path: string;
294
+ scope: DiffScope;
295
+ member?: string;
296
+ field: string;
297
+ valuesByScope: Partial<Record<ExploreScope, unknown>>;
298
+ }
299
+ export interface VerifyItem {
300
+ itemId: string;
301
+ kind: VerifyItemKind;
302
+ hypothesis?: string;
303
+ gatedOn?: 'category';
304
+ claims: VerifyClaim[];
305
+ }
306
+ export interface VerifyCallSite {
307
+ sourcePath: string;
308
+ startLine: number;
309
+ endLine: number;
310
+ child: string;
311
+ excerpt: string;
312
+ }
313
+ export interface VerifyComponentWork {
314
+ component: string;
315
+ source: string;
316
+ sourceRef?: ExploreSourceRef;
317
+ callSites: VerifyCallSite[];
318
+ evidenceLimits?: string[];
319
+ items: VerifyItem[];
320
+ }
321
+ export interface VerifyResolution {
322
+ path: string;
323
+ value: unknown;
324
+ }
325
+ export interface VerifiedItem {
326
+ itemId: string;
327
+ component: string;
328
+ source: string;
329
+ outcome: VerifyOutcome;
330
+ resolved?: VerifyResolution[];
331
+ evidence: VerifyEvidence[];
332
+ reason: string;
333
+ downgraded?: boolean;
334
+ }
335
+ export interface VerifyAttempt extends AgentCallAttempt {
336
+ component: string;
337
+ }
338
+ export type VerifyStageResult = {
339
+ ok: true;
340
+ items: VerifiedItem[];
341
+ attempts: VerifyAttempt[];
342
+ } | {
343
+ ok: false;
344
+ component: string;
345
+ error: string;
346
+ attempts: VerifyAttempt[];
347
+ };
348
+ export type CheckVerdict = 'supports' | 'does-not-support' | 'unclear';
349
+ export interface EvidenceCheck {
350
+ checkId: string;
351
+ itemId: string;
352
+ component: string;
353
+ source: string;
354
+ verdict: CheckVerdict;
355
+ reason: string;
356
+ }
357
+ export type CheckStageResult = {
358
+ ok: true;
359
+ items: VerifiedItem[];
360
+ checks: EvidenceCheck[];
361
+ attempts: VerifyAttempt[];
362
+ } | {
363
+ ok: false;
364
+ component: string;
365
+ error: string;
366
+ attempts: VerifyAttempt[];
367
+ };
368
+ export type RendererReferenceInput = {
369
+ kind: 'url';
370
+ url?: string;
371
+ } | {
372
+ kind: 'path';
373
+ path: string;
374
+ } | {
375
+ kind: 'text';
376
+ text: string;
377
+ origin: string;
378
+ };
379
+ export interface RendererReference {
380
+ origin: string;
381
+ digest: string;
382
+ retrievedAt: string;
383
+ bytes: number;
384
+ coverage: 'complete-within-declared-bound';
385
+ text: string;
386
+ }
387
+ export interface ExplorationDetailRecord {
388
+ diff: ExplorationDiff;
389
+ hypotheses: TierHypothesis[];
390
+ verified: VerifiedItem[];
391
+ checks: EvidenceCheck[];
392
+ recordOnly: true;
393
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -24,9 +24,9 @@ declare const ImportHandoffSchema: z.ZodMiniObject<{
24
24
  existingEntitiesPath: z.ZodMiniNullable<z.ZodMiniString<string>>;
25
25
  /** Never 'running': the wizard starts its background cache check only once this has settled. */
26
26
  existingEntitiesStatus: z.ZodMiniEnum<{
27
+ complete: "complete";
27
28
  failed: "failed";
28
29
  idle: "idle";
29
- complete: "complete";
30
30
  }>;
31
31
  /** The only phases the scope gate can start from. */
32
32
  compositionPhase: z.ZodMiniEnum<{
@@ -1,5 +1,19 @@
1
- export { validateCDF, parseCDFComponents, CDF_SCHEMA_URL, cdfJsonSchema, CDF_PROPERTY_TYPES, CDF_PROPERTY_CATEGORIES, CDFComponentSchema, CDFPropertySchema, CDFSlotSchema, CDFTokenSchema, buildCDF, buildFilteredCDF, stripUnsupportedSlotFields, validateSlotReferences, type CDFComponentEntry, type CDFPropertyDefinition, type CDFSlotDefinition, type CDFTokenEntry, type CDFValidationError, type CDFValidationResult, type CDFDocument, } from './cdf/index.js';
1
+ export { shouldUseStdinForPrompt } from './agent-prompt-transport.js';
2
+ export { createAgentPromptArtifact, shouldUsePromptArtifact, type AgentPromptArtifact, } from './agent-prompt-artifact.js';
3
+ export { createAgentCancellationResult, runAgentProcess, type AgentProcessEndDetails, type AgentProcessResult, type RunAgentProcessOptions, } from './agent-process-lifecycle.js';
4
+ export { validateCDF, parseCDFComponents, CDF_SCHEMA_URL, cdfJsonSchema, CDF_PROPERTY_TYPES, CDF_PROPERTY_CATEGORIES, CDFComponentSchema, CDFPropertySchema, CDFSlotSchema, CDFTokenSchema, buildCDF, buildFilteredCDF, stripUnsupportedSlotFields, validateSlotReferences, finiteValuesIssue, isFinitePrimitiveType, isFinitePrimitiveValue, type FinitePrimitiveType, type FinitePrimitiveValue, type CDFComponentEntry, type CDFPropertyDefinition, type CDFFieldDefinition, type CDFSlotDefinition, type CDFTokenEntry, type CDFValidationError, type CDFValidationResult, type CDFDocument, } from './cdf/index.js';
2
5
  export { DESIGN_TOKEN_TYPES, flattenDTCG, validateDTCG, DTCGTokenSchema, type DesignTokenType, type DTCGTokenEntry, type DTCGTokenGroup, type DTCGTokenNode, type DTCGTokenGroupNode, type DTCGValidationError, type DTCGValidationResult, } from './dtcg/index.js';
3
6
  export type { BreakingChange, ChangeClassification, DownstreamImpact, PropertySummary, ComponentTypeSummary, DesignTokenSummary, TaxonomySummary, ChangedEntity, EntityDiffGroup, ServerPreviewResponse, } from './sources-api/preview/index.js';
4
7
  export type { ApplyOperationStatus, ApplyOperationItemError, ApplyOperationItem, ApplyOperationResponse, ApplyGateError, } from './sources-api/apply/index.js';
8
+ export * from './exploration/index.js';
9
+ export type { SharedSource, SharedSourceFile, SharedSourceCompilerContext, SharedSourceReference, SharedSourceRange, SharedSourceCoverage, SharedSourceCallerCoverage, } from './shared-source.js';
5
10
  export * from './property-contract/index.js';
11
+ export { validateCDFProperty, cdfToTarget, targetToCDF, cdfDefinitionChildren, containsCDFDefinitionType, } from './cdf/property-validation.js';
12
+ export * from './source-input-association.js';
13
+ export { PROPERTY_BREAKING_REASONS, SLOT_BREAKING_REASONS, sanitizeBreakingChanges, } from './sources-api/preview/index.js';
14
+ export type { SlotSummary, ProjectionDiagnostic } from './sources-api/preview/index.js';
15
+ export * from './schema-export.js';
16
+ export { previewContractSchemas } from './sources-api/preview/schema.js';
17
+ export { expandCDFModelDependencies } from './cdf/build.js';
18
+ export { toOpenAPISchema } from './schema-export.js';
19
+ export type { ProposedComponentSummary } from './sources-api/preview/index.js';
package/dist/src/index.js CHANGED
@@ -1,9 +1,17 @@
1
1
  // CDF (Component Definition Format) exports — one schema/file for both
2
2
  // components and design tokens, no separate manifest envelope.
3
- export { validateCDF, parseCDFComponents, CDF_SCHEMA_URL, cdfJsonSchema, CDF_PROPERTY_TYPES, CDF_PROPERTY_CATEGORIES, CDFComponentSchema, CDFPropertySchema, CDFSlotSchema, CDFTokenSchema, buildCDF, buildFilteredCDF, stripUnsupportedSlotFields, validateSlotReferences, } from './cdf/index.js';
3
+ export { shouldUseStdinForPrompt } from './agent-prompt-transport.js';
4
+ export { createAgentPromptArtifact, shouldUsePromptArtifact, } from './agent-prompt-artifact.js';
5
+ export { createAgentCancellationResult, runAgentProcess, } from './agent-process-lifecycle.js';
6
+ export { validateCDF, parseCDFComponents, CDF_SCHEMA_URL, cdfJsonSchema, CDF_PROPERTY_TYPES, CDF_PROPERTY_CATEGORIES, CDFComponentSchema, CDFPropertySchema, CDFSlotSchema, CDFTokenSchema, buildCDF, buildFilteredCDF, stripUnsupportedSlotFields, validateSlotReferences, finiteValuesIssue, isFinitePrimitiveType, isFinitePrimitiveValue, } from './cdf/index.js';
4
7
  // DTCG (W3C Design Token Community Group)
5
8
  export { DESIGN_TOKEN_TYPES, flattenDTCG, validateDTCG, DTCGTokenSchema, } from './dtcg/index.js';
6
- // Property contract — pillar #4 foundation (target types + validators).
7
- // Dormant: no current consumer imports these. Available for forthcoming
8
- // evidence-aware extractors and generation. See INTEG-5147 / INTEG-4927.
9
+ export * from './exploration/index.js';
9
10
  export * from './property-contract/index.js';
11
+ export { validateCDFProperty, cdfToTarget, targetToCDF, cdfDefinitionChildren, containsCDFDefinitionType, } from './cdf/property-validation.js';
12
+ export * from './source-input-association.js';
13
+ export { PROPERTY_BREAKING_REASONS, SLOT_BREAKING_REASONS, sanitizeBreakingChanges, } from './sources-api/preview/index.js';
14
+ export * from './schema-export.js';
15
+ export { previewContractSchemas } from './sources-api/preview/schema.js';
16
+ export { expandCDFModelDependencies } from './cdf/build.js';
17
+ export { toOpenAPISchema } from './schema-export.js';
@@ -0,0 +1,19 @@
1
+ import { type JsonValue } from './json-value.js';
2
+ import { type LogicalSourceGraph } from './logical-source-graph.js';
3
+ import { type PropertyModel } from './property-model.js';
4
+ export interface AnalysisRepresentationCandidates {
5
+ identity: PropertyModel['identity'];
6
+ profileDigest: string;
7
+ candidateSetHash: string;
8
+ status: 'prepared' | 'invalid';
9
+ selectedCandidateId: null;
10
+ logicalGraph?: LogicalSourceGraph;
11
+ candidates: Array<{
12
+ id: string;
13
+ strategy: 'native' | 'component-model';
14
+ requires: 'category-and-representation-decision';
15
+ }>;
16
+ diagnostics: string[];
17
+ }
18
+ /** Strategies are source-derived alternatives, without a selected category or target readiness. */
19
+ export declare function prepareAnalysisRepresentationCandidates(model: Pick<PropertyModel, 'identity' | 'source'>, profile?: JsonValue): AnalysisRepresentationCandidates;
@@ -0,0 +1,45 @@
1
+ import { contentDigest } from './content-digest.js';
2
+ import { cloneJson, freezeJson } from './json-value.js';
3
+ import { prepareLogicalSourceGraph } from './logical-source-graph.js';
4
+ import { nativeSourceRegion } from './native-source-region.js';
5
+ import { LOCAL_NATIVE_PROPERTY_PROFILE } from './property-model.js';
6
+ /** Strategies are source-derived alternatives, without a selected category or target readiness. */
7
+ export function prepareAnalysisRepresentationCandidates(model, profile = LOCAL_NATIVE_PROPERTY_PROFILE) {
8
+ const common = {
9
+ identity: cloneJson(model.identity),
10
+ profileDigest: contentDigest(profile),
11
+ selectedCandidateId: null,
12
+ };
13
+ let result;
14
+ try {
15
+ const logicalGraph = prepareLogicalSourceGraph(model);
16
+ const nodes = new Map(logicalGraph.nodes.map((node) => [node.id, node]));
17
+ const strategies = [];
18
+ if (nativeSourceRegion(logicalGraph.rootId, nodes))
19
+ strategies.push('native');
20
+ if (logicalGraph.nodes.some((node) => ['record', 'array', 'tuple', 'intersection'].includes(node.kind)))
21
+ strategies.push('component-model');
22
+ result = {
23
+ ...common,
24
+ status: 'prepared',
25
+ logicalGraph,
26
+ candidates: strategies.map((strategy) => ({
27
+ id: contentDigest({ ...common, source: model.source, strategy }),
28
+ strategy,
29
+ requires: 'category-and-representation-decision',
30
+ })),
31
+ diagnostics: logicalGraph.coverage === 'complete-within-declared-bound'
32
+ ? []
33
+ : ['Source coverage remains bounded or incomplete'],
34
+ };
35
+ }
36
+ catch (error) {
37
+ result = {
38
+ ...common,
39
+ status: 'invalid',
40
+ candidates: [],
41
+ diagnostics: [error instanceof Error ? error.message : 'Source graph unavailable'],
42
+ };
43
+ }
44
+ return freezeJson(cloneJson({ ...result, candidateSetHash: contentDigest(result) }));
45
+ }
@@ -0,0 +1,38 @@
1
+ import type { CDFFieldDefinition, CDFPropertyDefinition } from '../cdf/types.js';
2
+ import { type JsonValue } from './json-value.js';
3
+ import type { DefaultIntent } from './property-model.js';
4
+ import type { RepresentationProposalDraft } from './representation-proposal.js';
5
+ import type { NullHandlingJudgment } from './null-handling.js';
6
+ export interface ClassifiedPropertyCall {
7
+ tool: 'classify_prop';
8
+ prop: string;
9
+ cdf_type?: string;
10
+ cdf_category: 'content' | 'design' | 'state';
11
+ values?: JsonValue[];
12
+ token_kind?: string;
13
+ required?: boolean;
14
+ description?: string;
15
+ default?: JsonValue;
16
+ default_intent?: DefaultIntent;
17
+ items?: CDFFieldDefinition;
18
+ fields?: Record<string, CDFFieldDefinition>;
19
+ source_revision?: string;
20
+ source_node_id?: string;
21
+ reason?: string;
22
+ value?: JsonValue;
23
+ valueType?: CDFFieldDefinition;
24
+ discriminator?: string;
25
+ members?: CDFFieldDefinition[];
26
+ allowedResources?: CDFFieldDefinition['allowedResources'];
27
+ representation_proposal?: RepresentationProposalDraft;
28
+ representation_selection?: {
29
+ strategy: 'component-model';
30
+ candidateId: string;
31
+ };
32
+ null_handling?: NullHandlingJudgment[];
33
+ }
34
+ /** A model selection accounts for the input through a generated slot instead of a native field. */
35
+ export declare function hasPropertyRepresentation(call: ClassifiedPropertyCall): boolean;
36
+ export declare function classificationDefinition(call: ClassifiedPropertyCall): CDFPropertyDefinition;
37
+ export declare function parseClassificationMetadata(rec: Record<string, unknown>, call: ClassifiedPropertyCall): string[];
38
+ export declare function parseClassificationDefaultMetadata(rec: Record<string, unknown>, call: ClassifiedPropertyCall): string[];
@@ -0,0 +1,84 @@
1
+ import { validateCDFProperty, targetToCDF } from '../cdf/property-validation.js';
2
+ import { isSourceBoundRepresentation } from './source-representation.js';
3
+ import { cloneJson, own } from './json-value.js';
4
+ /** A model selection accounts for the input through a generated slot instead of a native field. */
5
+ export function hasPropertyRepresentation(call) {
6
+ return !!call.cdf_type || !!call.representation_selection;
7
+ }
8
+ export function classificationDefinition(call) {
9
+ if (!call.cdf_type)
10
+ throw new Error('Absent representation has no field definition');
11
+ const definition = {
12
+ ...(call.representation_proposal && isSourceBoundRepresentation(call.cdf_type)
13
+ ? targetToCDF(call.representation_proposal.desiredDefinition)
14
+ : {}),
15
+ $type: call.cdf_type,
16
+ $category: call.cdf_category,
17
+ };
18
+ if (typeof call.required === 'boolean')
19
+ definition.$required = call.required;
20
+ if (typeof call.description === 'string')
21
+ definition.$description = call.description;
22
+ if (call.items)
23
+ definition.$items = cloneJson(call.items);
24
+ if (call.fields)
25
+ definition.$fields = cloneJson(call.fields);
26
+ if (own(call, 'value'))
27
+ definition.value = cloneJson(call.value);
28
+ if (call.valueType)
29
+ definition.valueType = cloneJson(call.valueType);
30
+ if (call.discriminator !== undefined)
31
+ definition.discriminator = call.discriminator;
32
+ if (call.members)
33
+ definition.members = cloneJson(call.members);
34
+ if (call.allowedResources)
35
+ definition.allowedResources = cloneJson(call.allowedResources);
36
+ if (call.values?.length && call.cdf_type !== 'token')
37
+ definition.$values = cloneJson(call.values);
38
+ if (call.token_kind && call.cdf_type === 'token')
39
+ definition['$token.kind'] = call.token_kind;
40
+ if (own(call, 'default'))
41
+ definition.$default = cloneJson(call.default);
42
+ if (call.default_intent?.action === 'set')
43
+ definition.$default = cloneJson(call.default_intent.value);
44
+ if (call.default_intent?.action === 'clear')
45
+ delete definition.$default;
46
+ return definition;
47
+ }
48
+ export function parseClassificationMetadata(rec, call) {
49
+ const issues = parseClassificationDefaultMetadata(rec, call);
50
+ if (own(rec, 'items'))
51
+ call.items = cloneJson(rec.items);
52
+ if (own(rec, 'fields'))
53
+ call.fields = cloneJson(rec.fields);
54
+ if (own(rec, 'values')) {
55
+ if (!Array.isArray(rec.values))
56
+ issues.push('values must be an array');
57
+ else
58
+ call.values = cloneJson(rec.values);
59
+ }
60
+ if (typeof rec.source_revision === 'string')
61
+ call.source_revision = rec.source_revision;
62
+ if (typeof rec.source_node_id === 'string')
63
+ call.source_node_id = rec.source_node_id;
64
+ issues.push(...validateCDFProperty(classificationDefinition(call)).issues.map((issue) => `${issue.path}: ${issue.message}`));
65
+ return issues;
66
+ }
67
+ export function parseClassificationDefaultMetadata(rec, call) {
68
+ const issues = [];
69
+ if (own(rec, 'default'))
70
+ call.default = cloneJson(rec.default);
71
+ if (own(rec, 'default_intent')) {
72
+ const intent = rec.default_intent;
73
+ if (!intent ||
74
+ typeof intent !== 'object' ||
75
+ !['absent', 'set', 'clear'].includes(intent.action) ||
76
+ Object.keys(intent).some((key) => !['action', ...(intent.action === 'set' ? ['value'] : [])].includes(key)) ||
77
+ (intent.action === 'set' && !own(intent, 'value')) ||
78
+ own(rec, 'default'))
79
+ issues.push('Invalid or conflicting default intent');
80
+ else
81
+ call.default_intent = cloneJson(intent);
82
+ }
83
+ return issues;
84
+ }
@@ -0,0 +1,16 @@
1
+ import type { CDFComponentEntry, CDFSlotDefinition } from '../cdf/types.js';
2
+ import type { LogicalSourceNode } from './logical-source-graph.js';
3
+ import type { LogicalPhysicalMapping } from './representation-plan.js';
4
+ interface GeneratedModel {
5
+ key: string;
6
+ nodeId: string;
7
+ entry: CDFComponentEntry;
8
+ }
9
+ /** Compact physical authoring scaffolding while retaining every logical source node. */
10
+ export declare function compactModelComponents({ nodes, models, mappings, attachment, }: {
11
+ nodes: ReadonlyMap<string, LogicalSourceNode>;
12
+ models: Map<string, GeneratedModel>;
13
+ mappings: Map<string, LogicalPhysicalMapping>;
14
+ attachment: CDFSlotDefinition;
15
+ }): void;
16
+ export {};