@contractspec/bundle.library 3.8.2 → 3.8.5

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 (121) hide show
  1. package/.turbo/turbo-build.log +130 -116
  2. package/CHANGELOG.md +80 -0
  3. package/dist/application/index.js +806 -131
  4. package/dist/application/mcp/cliMcp.js +21 -2
  5. package/dist/application/mcp/common.js +21 -2
  6. package/dist/application/mcp/common.test.d.ts +1 -0
  7. package/dist/application/mcp/contractsMcp.js +21 -2
  8. package/dist/application/mcp/docsMcp.catalog.d.ts +2 -0
  9. package/dist/application/mcp/docsMcp.catalog.js +382 -0
  10. package/dist/application/mcp/docsMcp.d.ts +5 -1
  11. package/dist/application/mcp/docsMcp.data.d.ts +85 -0
  12. package/dist/application/mcp/docsMcp.data.js +148 -0
  13. package/dist/application/mcp/docsMcp.js +776 -101
  14. package/dist/application/mcp/docsMcp.prompts.d.ts +3 -0
  15. package/dist/application/mcp/docsMcp.prompts.js +522 -0
  16. package/dist/application/mcp/docsMcp.reference.d.ts +24 -0
  17. package/dist/application/mcp/docsMcp.reference.js +236 -0
  18. package/dist/application/mcp/docsMcp.resources.d.ts +3 -0
  19. package/dist/application/mcp/docsMcp.resources.js +520 -0
  20. package/dist/application/mcp/docsMcp.test.d.ts +1 -0
  21. package/dist/application/mcp/docsMcp.tools.d.ts +3 -0
  22. package/dist/application/mcp/docsMcp.tools.js +519 -0
  23. package/dist/application/mcp/index.js +806 -131
  24. package/dist/application/mcp/internalMcp.js +21 -2
  25. package/dist/application/mcp/normalizeMcpRequest.d.ts +1 -0
  26. package/dist/application/mcp/normalizeMcpRequest.js +22 -0
  27. package/dist/application/mcp/providerRankingMcp.js +21 -2
  28. package/dist/components/docs/generated/docs-index.generated.d.ts +6 -6
  29. package/dist/components/docs/index.js +23 -24
  30. package/dist/components/docs/libraries/LibrariesAiAgentPage.js +22 -22
  31. package/dist/components/docs/libraries/LibrariesSupportBotPage.js +1 -2
  32. package/dist/components/docs/libraries/index.js +23 -24
  33. package/dist/components/templates/engine/index.d.ts +1 -1
  34. package/dist/components/templates/engine/index.js +1 -1
  35. package/dist/features/index.js +15 -15
  36. package/dist/index.js +194 -195
  37. package/dist/node/application/index.js +806 -131
  38. package/dist/node/application/mcp/cliMcp.js +21 -2
  39. package/dist/node/application/mcp/common.js +21 -2
  40. package/dist/node/application/mcp/contractsMcp.js +21 -2
  41. package/dist/node/application/mcp/docsMcp.catalog.js +381 -0
  42. package/dist/node/application/mcp/docsMcp.data.js +147 -0
  43. package/dist/node/application/mcp/docsMcp.js +776 -101
  44. package/dist/node/application/mcp/docsMcp.prompts.js +521 -0
  45. package/dist/node/application/mcp/docsMcp.reference.js +235 -0
  46. package/dist/node/application/mcp/docsMcp.resources.js +519 -0
  47. package/dist/node/application/mcp/docsMcp.tools.js +518 -0
  48. package/dist/node/application/mcp/index.js +806 -131
  49. package/dist/node/application/mcp/internalMcp.js +21 -2
  50. package/dist/node/application/mcp/normalizeMcpRequest.js +21 -0
  51. package/dist/node/application/mcp/providerRankingMcp.js +21 -2
  52. package/dist/node/components/docs/index.js +23 -24
  53. package/dist/node/components/docs/libraries/LibrariesAiAgentPage.js +22 -22
  54. package/dist/node/components/docs/libraries/LibrariesSupportBotPage.js +1 -2
  55. package/dist/node/components/docs/libraries/index.js +23 -24
  56. package/dist/node/components/templates/engine/index.js +1 -1
  57. package/dist/node/features/index.js +15 -15
  58. package/dist/node/index.js +194 -195
  59. package/dist/node/presentation/features/hooks/index.js +12 -12
  60. package/dist/node/presentation/features/hooks/useContractsRegistry.js +12 -12
  61. package/dist/node/presentation/features/index.js +12 -12
  62. package/dist/node/presentation/features/organisms/FeatureDataViewsList.js +12 -12
  63. package/dist/node/presentation/features/organisms/FeatureEventsList.js +12 -12
  64. package/dist/node/presentation/features/organisms/FeatureFormsList.js +12 -12
  65. package/dist/node/presentation/features/organisms/FeaturePresentationsList.js +12 -12
  66. package/dist/node/presentation/features/organisms/index.js +12 -12
  67. package/dist/node/presentation/features/templates/FeatureDataViewsTemplate/FeatureDataViewsTemplate.js +12 -12
  68. package/dist/node/presentation/features/templates/FeatureDataViewsTemplate/index.js +12 -12
  69. package/dist/node/presentation/features/templates/FeatureEventsTemplate/FeatureEventsTemplate.js +12 -12
  70. package/dist/node/presentation/features/templates/FeatureEventsTemplate/index.js +12 -12
  71. package/dist/node/presentation/features/templates/FeatureFormsTemplate/FeatureFormsTemplate.js +12 -12
  72. package/dist/node/presentation/features/templates/FeatureFormsTemplate/index.js +12 -12
  73. package/dist/node/presentation/features/templates/FeaturePresentationsTemplate/FeaturePresentationsTemplate.js +12 -12
  74. package/dist/node/presentation/features/templates/FeaturePresentationsTemplate/index.js +12 -12
  75. package/dist/presentation/features/hooks/index.js +12 -12
  76. package/dist/presentation/features/hooks/useContractsRegistry.js +12 -12
  77. package/dist/presentation/features/index.js +12 -12
  78. package/dist/presentation/features/organisms/FeatureDataViewsList.js +12 -12
  79. package/dist/presentation/features/organisms/FeatureEventsList.js +12 -12
  80. package/dist/presentation/features/organisms/FeatureFormsList.js +12 -12
  81. package/dist/presentation/features/organisms/FeaturePresentationsList.js +12 -12
  82. package/dist/presentation/features/organisms/index.js +12 -12
  83. package/dist/presentation/features/templates/FeatureDataViewsTemplate/FeatureDataViewsTemplate.js +12 -12
  84. package/dist/presentation/features/templates/FeatureDataViewsTemplate/index.js +12 -12
  85. package/dist/presentation/features/templates/FeatureEventsTemplate/FeatureEventsTemplate.js +12 -12
  86. package/dist/presentation/features/templates/FeatureEventsTemplate/index.js +12 -12
  87. package/dist/presentation/features/templates/FeatureFormsTemplate/FeatureFormsTemplate.js +12 -12
  88. package/dist/presentation/features/templates/FeatureFormsTemplate/index.js +12 -12
  89. package/dist/presentation/features/templates/FeaturePresentationsTemplate/FeaturePresentationsTemplate.js +12 -12
  90. package/dist/presentation/features/templates/FeaturePresentationsTemplate/index.js +12 -12
  91. package/package.json +108 -23
  92. package/src/application/mcp/common.test.ts +64 -0
  93. package/src/application/mcp/common.ts +5 -2
  94. package/src/application/mcp/docsMcp.catalog.ts +2 -0
  95. package/src/application/mcp/docsMcp.data.ts +196 -0
  96. package/src/application/mcp/docsMcp.prompts.ts +165 -0
  97. package/src/application/mcp/docsMcp.reference.ts +152 -0
  98. package/src/application/mcp/docsMcp.resources.ts +194 -0
  99. package/src/application/mcp/docsMcp.test.ts +148 -0
  100. package/src/application/mcp/docsMcp.tools.ts +183 -0
  101. package/src/application/mcp/docsMcp.ts +13 -177
  102. package/src/application/mcp/normalizeMcpRequest.ts +30 -0
  103. package/src/components/docs/generated/docs-index._common.json +1 -1
  104. package/src/components/docs/generated/docs-index.ai-chat-assistant.json +8 -0
  105. package/src/components/docs/generated/docs-index.artisan-knowledge-product.json +18 -0
  106. package/src/components/docs/generated/docs-index.artisan-payments-stripe.json +34 -0
  107. package/src/components/docs/generated/docs-index.data-grid-showcase.json +18 -0
  108. package/src/components/docs/generated/docs-index.generated.ts +6 -6
  109. package/src/components/docs/generated/docs-index.harness-lab.json +10 -0
  110. package/src/components/docs/generated/docs-index.locale-jurisdiction-gate.json +8 -0
  111. package/src/components/docs/generated/docs-index.manifest.json +50 -5
  112. package/src/components/docs/generated/docs-index.messaging-agent-actions.json +18 -0
  113. package/src/components/docs/generated/docs-index.mobile-demo-tasks.json +34 -0
  114. package/src/components/docs/generated/docs-index.opencode-cli.json +2 -2
  115. package/src/components/docs/generated/docs-index.platform-control-plane.json +250 -0
  116. package/src/components/docs/generated/docs-index.platform-harness.json +178 -0
  117. package/src/components/docs/generated/docs-index.platform-integrations.json +22 -14
  118. package/src/components/docs/generated/docs-index.visualization-showcase.json +18 -0
  119. package/src/components/docs/libraries/LibrariesAiAgentPage.tsx +20 -17
  120. package/src/components/docs/libraries/LibrariesSupportBotPage.tsx +1 -2
  121. package/src/components/templates/engine/index.ts +2 -2
@@ -0,0 +1,236 @@
1
+ // @bun
2
+ // src/features/contracts-registry.ts
3
+ import {
4
+ EventRegistry,
5
+ OperationSpecRegistry
6
+ } from "@contractspec/lib.contracts-spec";
7
+ import {
8
+ DataViewRegistry
9
+ } from "@contractspec/lib.contracts-spec/data-views";
10
+ import {
11
+ ContractReferenceDataView,
12
+ ContractReferenceQuery,
13
+ DocsGenerateCommand,
14
+ DocsGeneratedEvent,
15
+ DocsIndexDataView,
16
+ DocsIndexQuery,
17
+ DocsLayoutPresentation,
18
+ DocsPublishCommand,
19
+ DocsPublishedEvent,
20
+ DocsReferencePagePresentation,
21
+ DocsSearchForm,
22
+ ExampleCatalogDataView
23
+ } from "@contractspec/lib.contracts-spec/docs";
24
+ import { FormRegistry } from "@contractspec/lib.contracts-spec/forms";
25
+ import {
26
+ PresentationRegistry
27
+ } from "@contractspec/lib.contracts-spec/presentations";
28
+ import {
29
+ serializeDataViewSpec,
30
+ serializeEventSpec,
31
+ serializeFormSpec,
32
+ serializeOperationSpec,
33
+ serializePresentationSpec
34
+ } from "@contractspec/lib.contracts-spec/serialization";
35
+ var operationRegistry = null;
36
+ function createContractSpecOperationRegistry() {
37
+ const registry = new OperationSpecRegistry;
38
+ registry.register(DocsIndexQuery).register(ContractReferenceQuery).register(DocsGenerateCommand).register(DocsPublishCommand);
39
+ return registry;
40
+ }
41
+ function getContractSpecOperationRegistry() {
42
+ if (!operationRegistry) {
43
+ operationRegistry = createContractSpecOperationRegistry();
44
+ }
45
+ return operationRegistry;
46
+ }
47
+ function resolveOperationSpec(key, version) {
48
+ return getContractSpecOperationRegistry().get(key, version);
49
+ }
50
+ var eventRegistry = null;
51
+ function createContractSpecEventRegistry() {
52
+ const registry = new EventRegistry;
53
+ registry.register(DocsGeneratedEvent).register(DocsPublishedEvent);
54
+ return registry;
55
+ }
56
+ function getContractSpecEventRegistry() {
57
+ if (!eventRegistry) {
58
+ eventRegistry = createContractSpecEventRegistry();
59
+ }
60
+ return eventRegistry;
61
+ }
62
+ function resolveEventSpec(key, version) {
63
+ return getContractSpecEventRegistry().get(key, version);
64
+ }
65
+ var presentationRegistry = null;
66
+ function createContractSpecPresentationRegistry() {
67
+ const registry = new PresentationRegistry;
68
+ registry.register(DocsLayoutPresentation).register(DocsReferencePagePresentation);
69
+ return registry;
70
+ }
71
+ function getContractSpecPresentationRegistry() {
72
+ if (!presentationRegistry) {
73
+ presentationRegistry = createContractSpecPresentationRegistry();
74
+ }
75
+ return presentationRegistry;
76
+ }
77
+ function resolvePresentationSpec(key, version) {
78
+ return getContractSpecPresentationRegistry().get(key, version);
79
+ }
80
+ var dataViewRegistry = null;
81
+ function createContractSpecDataViewRegistry() {
82
+ const registry = new DataViewRegistry;
83
+ registry.register(DocsIndexDataView).register(ContractReferenceDataView).register(ExampleCatalogDataView);
84
+ return registry;
85
+ }
86
+ function getContractSpecDataViewRegistry() {
87
+ if (!dataViewRegistry) {
88
+ dataViewRegistry = createContractSpecDataViewRegistry();
89
+ }
90
+ return dataViewRegistry;
91
+ }
92
+ function resolveDataViewSpec(key, version) {
93
+ return getContractSpecDataViewRegistry().get(key, version);
94
+ }
95
+ var formRegistry = null;
96
+ function createContractSpecFormRegistry() {
97
+ const registry = new FormRegistry;
98
+ registry.register(DocsSearchForm);
99
+ return registry;
100
+ }
101
+ function getContractSpecFormRegistry() {
102
+ if (!formRegistry) {
103
+ formRegistry = createContractSpecFormRegistry();
104
+ }
105
+ return formRegistry;
106
+ }
107
+ function resolveFormSpec(key, _version) {
108
+ return getContractSpecFormRegistry().get(key);
109
+ }
110
+ function resolveSerializedOperationSpec(key, version) {
111
+ const spec = resolveOperationSpec(key, version);
112
+ return serializeOperationSpec(spec) ?? undefined;
113
+ }
114
+ function resolveSerializedEventSpec(key, version) {
115
+ const spec = resolveEventSpec(key, version);
116
+ return serializeEventSpec(spec) ?? undefined;
117
+ }
118
+ function resolveSerializedPresentationSpec(key, version) {
119
+ const spec = resolvePresentationSpec(key, version);
120
+ return serializePresentationSpec(spec) ?? undefined;
121
+ }
122
+ function resolveSerializedDataViewSpec(key, version) {
123
+ const spec = resolveDataViewSpec(key, version);
124
+ return serializeDataViewSpec(spec) ?? undefined;
125
+ }
126
+ function resolveSerializedFormSpec(key, version) {
127
+ const spec = resolveFormSpec(key, version);
128
+ return serializeFormSpec(spec) ?? undefined;
129
+ }
130
+ function resetContractSpecOperationRegistry() {
131
+ operationRegistry = null;
132
+ }
133
+ function resetContractSpecEventRegistry() {
134
+ eventRegistry = null;
135
+ }
136
+ function resetContractSpecPresentationRegistry() {
137
+ presentationRegistry = null;
138
+ }
139
+ function resetContractSpecDataViewRegistry() {
140
+ dataViewRegistry = null;
141
+ }
142
+ function resetContractSpecFormRegistry() {
143
+ formRegistry = null;
144
+ }
145
+ function resetAllContractSpecRegistries() {
146
+ resetContractSpecOperationRegistry();
147
+ resetContractSpecEventRegistry();
148
+ resetContractSpecPresentationRegistry();
149
+ resetContractSpecDataViewRegistry();
150
+ resetContractSpecFormRegistry();
151
+ }
152
+
153
+ // src/application/mcp/docsMcp.reference.ts
154
+ import { defaultDocRegistry } from "@contractspec/lib.contracts-spec/docs";
155
+ function normalizeText(value) {
156
+ return value?.trim().toLowerCase() ?? "";
157
+ }
158
+ function routeFromDocIds(docIds) {
159
+ for (const docId of docIds ?? []) {
160
+ const doc = defaultDocRegistry.get(docId);
161
+ if (doc)
162
+ return doc.route;
163
+ }
164
+ return;
165
+ }
166
+ function toReference(spec, type, schema, policy) {
167
+ const title = spec.meta.title ?? spec.meta.key;
168
+ const route = routeFromDocIds(spec.meta.docId);
169
+ const description = spec.meta.description;
170
+ return {
171
+ key: spec.meta.key,
172
+ version: spec.meta.version,
173
+ type,
174
+ title,
175
+ description,
176
+ markdown: [
177
+ `# ${title}`,
178
+ `- Key: ${spec.meta.key}`,
179
+ `- Type: ${type}`,
180
+ `- Version: ${spec.meta.version}`,
181
+ route ? `- Docs route: ${route}` : "",
182
+ description ? `
183
+ ${description}` : ""
184
+ ].filter(Boolean).join(`
185
+ `),
186
+ ...route ? { route } : {},
187
+ ...schema ? { schema } : {},
188
+ ...policy ? { policy } : {},
189
+ tags: spec.meta.tags ?? [],
190
+ owners: spec.meta.owners ?? [],
191
+ stability: spec.meta.stability
192
+ };
193
+ }
194
+ function resolveContractReference(args) {
195
+ const includeSchema = args.includeSchema ?? false;
196
+ const requestedType = normalizeText(args.type);
197
+ const operation = resolveOperationSpec(args.key, args.version);
198
+ if (operation && (!requestedType || requestedType === "operation" || requestedType === operation.meta.kind)) {
199
+ return {
200
+ reference: toReference(operation, operation.meta.kind, includeSchema ? resolveSerializedOperationSpec(args.key, args.version) : undefined, operation.policy)
201
+ };
202
+ }
203
+ const resolvers = [
204
+ {
205
+ type: "data-view",
206
+ spec: resolveDataViewSpec(args.key, args.version),
207
+ schema: includeSchema ? resolveSerializedDataViewSpec(args.key, args.version) : undefined
208
+ },
209
+ {
210
+ type: "form",
211
+ spec: resolveFormSpec(args.key, args.version),
212
+ schema: includeSchema ? resolveSerializedFormSpec(args.key, args.version) : undefined
213
+ },
214
+ {
215
+ type: "presentation",
216
+ spec: resolvePresentationSpec(args.key, args.version),
217
+ schema: includeSchema ? resolveSerializedPresentationSpec(args.key, args.version) : undefined
218
+ },
219
+ {
220
+ type: "event",
221
+ spec: resolveEventSpec(args.key, args.version),
222
+ schema: includeSchema ? resolveSerializedEventSpec(args.key, args.version) : undefined
223
+ }
224
+ ];
225
+ for (const candidate of resolvers) {
226
+ if (candidate.spec && (!requestedType || requestedType === candidate.type)) {
227
+ return {
228
+ reference: toReference(candidate.spec, candidate.type, candidate.schema)
229
+ };
230
+ }
231
+ }
232
+ throw new Error(`Contract reference not found: ${args.key}`);
233
+ }
234
+ export {
235
+ resolveContractReference
236
+ };
@@ -0,0 +1,3 @@
1
+ import { ResourceRegistry } from '@contractspec/lib.contracts-spec';
2
+ import type { DocPresentationRoute } from '@contractspec/lib.contracts-spec/docs';
3
+ export declare function buildDocResources(routes: DocPresentationRoute[]): ResourceRegistry;