@dp-bohrium/widget-contracts 0.0.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.
Files changed (118) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +190 -0
  3. package/conformance/bridge/capability-request.json +23 -0
  4. package/conformance/bridge/network-fetch-denied.json +16 -0
  5. package/conformance/bridge/network-fetch-request.json +19 -0
  6. package/conformance/bridge/network-fetch-success.json +22 -0
  7. package/conformance/bridge/presentation-change-surface-request.json +14 -0
  8. package/conformance/bridge/presentation-close-request.json +14 -0
  9. package/conformance/bridge/presentation-close-success.json +11 -0
  10. package/conformance/bridge/presentation-downgrade-success.json +14 -0
  11. package/conformance/bridge/presentation-focus-backward-request.json +14 -0
  12. package/conformance/bridge/presentation-focus-boundary-success.json +14 -0
  13. package/conformance/bridge/presentation-focus-forward-request.json +14 -0
  14. package/conformance/bridge/presentation-init.json +70 -0
  15. package/conformance/bridge/presentation-policy-denied.json +16 -0
  16. package/conformance/bridge/presentation-present-request.json +14 -0
  17. package/conformance/bridge/presentation-user-denied.json +16 -0
  18. package/conformance/bridge/ready.json +11 -0
  19. package/conformance/bundles/minimal-file-preview/entry.js +1 -0
  20. package/conformance/bundles/minimal-file-preview/manifest.json +12 -0
  21. package/conformance/bundles/minimal-file-preview/samples/file-preview.json +1 -0
  22. package/conformance/bundles/minimal-panel/entry.js +1 -0
  23. package/conformance/bundles/minimal-panel/manifest.json +11 -0
  24. package/conformance/bundles/minimal-panel/samples/panel.json +1 -0
  25. package/conformance/bundles/minimal-tool-result/entry.js +1 -0
  26. package/conformance/bundles/minimal-tool-result/manifest.json +11 -0
  27. package/conformance/bundles/minimal-tool-result/samples/tool-result.json +1 -0
  28. package/conformance/file-responses/list.json +1 -0
  29. package/conformance/file-responses/metadata.json +11 -0
  30. package/conformance/file-responses/permission-denied.json +6 -0
  31. package/conformance/file-responses/resource-limit.json +1 -0
  32. package/conformance/file-responses/text-content.json +1 -0
  33. package/conformance/host-runtime-config/invalid-missing-manifest-fields.json +55 -0
  34. package/conformance/host-runtime-config/invalid-static-origins.json +60 -0
  35. package/conformance/host-runtime-config/valid.json +85 -0
  36. package/conformance/invalid-bridge-messages/network-fetch-mixed-case-forbidden-header.json +21 -0
  37. package/conformance/invalid-manifests/missing-target.json +11 -0
  38. package/conformance/invalid-manifests/presentation-duplicate-surfaces.json +16 -0
  39. package/conformance/invalid-manifests/presentation-empty-surfaces.json +14 -0
  40. package/conformance/invalid-manifests/presentation-unknown-surface.json +16 -0
  41. package/conformance/invalid-manifests/unknown-field.json +12 -0
  42. package/conformance/invalid-network-requests/mixed-case-forbidden-header.json +11 -0
  43. package/conformance/invalid-presentation-grants/duplicate-surfaces.json +5 -0
  44. package/conformance/invalid-presentation-grants/empty-surfaces.json +5 -0
  45. package/conformance/invalid-presentation-grants/false-confirmation.json +5 -0
  46. package/conformance/invalid-presentation-grants/missing-confirmation.json +4 -0
  47. package/conformance/invalid-presentation-grants/unknown-surface.json +5 -0
  48. package/conformance/invalid-presentation-requests/change-surface-missing-surface.json +4 -0
  49. package/conformance/invalid-presentation-requests/close-with-surface.json +4 -0
  50. package/conformance/invalid-presentation-requests/focus-boundary-missing-direction.json +4 -0
  51. package/conformance/invalid-presentation-requests/focus-boundary-unknown-direction.json +4 -0
  52. package/conformance/invalid-presentation-requests/focus-boundary-with-coordinates.json +9 -0
  53. package/conformance/invalid-presentation-requests/focus-boundary-with-event-provenance.json +8 -0
  54. package/conformance/invalid-presentation-requests/focus-boundary-with-generation.json +8 -0
  55. package/conformance/invalid-presentation-requests/focus-boundary-with-identity.json +12 -0
  56. package/conformance/invalid-presentation-requests/focus-boundary-with-key.json +8 -0
  57. package/conformance/invalid-presentation-requests/focus-boundary-with-modifiers.json +11 -0
  58. package/conformance/invalid-presentation-requests/focus-boundary-with-selector.json +8 -0
  59. package/conformance/invalid-presentation-requests/focus-boundary-with-surface.json +8 -0
  60. package/conformance/invalid-presentation-requests/focus-boundary-with-target.json +8 -0
  61. package/conformance/invalid-presentation-requests/focus-boundary-with-timestamp.json +8 -0
  62. package/conformance/invalid-presentation-requests/focus-boundary-with-z-index.json +8 -0
  63. package/conformance/invalid-presentation-requests/present-missing-surface.json +4 -0
  64. package/conformance/invalid-presentation-requests/unknown-surface.json +4 -0
  65. package/conformance/invalid-presentation-requests/widget-controls-coordinates.json +9 -0
  66. package/conformance/invalid-presentation-requests/widget-controls-geometry.json +8 -0
  67. package/conformance/invalid-presentation-requests/widget-controls-instance-id.json +8 -0
  68. package/conformance/invalid-presentation-requests/widget-controls-principal.json +8 -0
  69. package/conformance/invalid-presentation-requests/widget-controls-run-id.json +4 -0
  70. package/conformance/invalid-presentation-requests/widget-controls-widget-id.json +8 -0
  71. package/conformance/invalid-presentation-requests/widget-controls-widget-version-id.json +8 -0
  72. package/conformance/invalid-presentation-requests/widget-controls-z-index.json +4 -0
  73. package/conformance/invalid-render-inputs/malformed.json +17 -0
  74. package/conformance/manifests/valid-file-preview.json +12 -0
  75. package/conformance/manifests/valid-network.json +15 -0
  76. package/conformance/manifests/valid-panel.json +11 -0
  77. package/conformance/manifests/valid-presentation-panel.json +21 -0
  78. package/conformance/manifests/valid-tool-result.json +14 -0
  79. package/conformance/render-inputs/compatibility/literature-search-paper-results.json +75 -0
  80. package/conformance/render-inputs/compatibility/scientific-bibliography-bibtex.json +10 -0
  81. package/conformance/render-inputs/compatibility/scientific-dataset-csv.json +10 -0
  82. package/conformance/render-inputs/compatibility/scientific-manuscript-latex.json +10 -0
  83. package/conformance/render-inputs/compatibility/scientific-manuscript-markdown.json +10 -0
  84. package/conformance/render-inputs/compatibility/scientific-molecule-mol.json +10 -0
  85. package/conformance/render-inputs/compatibility/scientific-molecule-mol2.json +10 -0
  86. package/conformance/render-inputs/compatibility/scientific-notebook-ipynb.json +10 -0
  87. package/conformance/render-inputs/compatibility/scientific-paper-pdf.json +10 -0
  88. package/conformance/render-inputs/compatibility/scientific-protein-pdb.json +10 -0
  89. package/conformance/render-inputs/compatibility/scientific-source-python.json +10 -0
  90. package/conformance/render-inputs/compatibility/scientific-structure-cif.json +47 -0
  91. package/conformance/render-inputs/compatibility/scientific-structure-poscar.json +10 -0
  92. package/conformance/render-inputs/compatibility/scientific-structure-stru.json +10 -0
  93. package/conformance/render-inputs/compatibility/scientific-trajectory-xyz.json +10 -0
  94. package/conformance/render-inputs/compatibility/thinking-process-paper-search.json +25 -0
  95. package/conformance/render-inputs/compatibility/thinking-process-scholar-search.json +25 -0
  96. package/conformance/render-inputs/compatibility/thinking-process-web-search.json +25 -0
  97. package/conformance/render-inputs/compatibility/workspace-file-search.json +24 -0
  98. package/conformance/render-inputs/compatibility/workspace-file-tree.json +24 -0
  99. package/conformance/render-inputs/empty.json +10 -0
  100. package/conformance/render-inputs/file-preview.json +10 -0
  101. package/conformance/render-inputs/incremental-update.json +10 -0
  102. package/conformance/render-inputs/large.json +10 -0
  103. package/conformance/render-inputs/malformed.json +1 -0
  104. package/conformance/render-inputs/panel.json +10 -0
  105. package/conformance/render-inputs/partial-state-full-snapshot.json +40 -0
  106. package/conformance/render-inputs/tool-result.json +10 -0
  107. package/dist/generated-host-runtime-config.d.ts +246 -0
  108. package/dist/generated-host-runtime-config.js +3 -0
  109. package/dist/generated-manifest.d.ts +86 -0
  110. package/dist/generated-manifest.js +3 -0
  111. package/dist/generated-runtime-contracts.d.ts +401 -0
  112. package/dist/generated-runtime-contracts.js +3 -0
  113. package/dist/index.d.ts +22 -0
  114. package/dist/index.js +2 -0
  115. package/package.json +55 -0
  116. package/schemas/host-runtime-config.schema.json +185 -0
  117. package/schemas/widget-manifest.schema.json +227 -0
  118. package/schemas/widget-runtime-contracts.schema.json +1478 -0
@@ -0,0 +1,246 @@
1
+ /** GENERATED FILE. Do not edit directly. */
2
+ export type Identifier = string;
3
+ export type Mode = ("preview" | "published");
4
+ export type Timestamp = string;
5
+ export type RuntimeOrigin = string;
6
+ export type PositiveInteger = number;
7
+ export type Digest = string;
8
+ export type WidgetSdkVersion = string;
9
+ export type EntryPath = string;
10
+ export type WidgetSlotConfig = ({
11
+ type: "tool-result";
12
+ toolName: string;
13
+ } | {
14
+ type: "file-preview";
15
+ /**
16
+ * @minItems 1
17
+ */
18
+ extensions: [string, ...(string)[]];
19
+ } | {
20
+ type: "panel";
21
+ panelType: string;
22
+ });
23
+ /**
24
+ * @minItems 1
25
+ */
26
+ export type Samples = [
27
+ {
28
+ id: string;
29
+ title: string;
30
+ request: string;
31
+ },
32
+ ...({
33
+ id: string;
34
+ title: string;
35
+ request: string;
36
+ })[]
37
+ ];
38
+ export type GrantedCapability = ({
39
+ name: "files.list";
40
+ limits: {
41
+ pageSize: number;
42
+ callsPerMinute: number;
43
+ };
44
+ } | {
45
+ name: "files.metadata";
46
+ limits: {
47
+ callsPerMinute: number;
48
+ };
49
+ } | {
50
+ name: "files.read";
51
+ limits: {
52
+ bytesPerRequest: number;
53
+ bytesPerRun: number;
54
+ callsPerMinute: number;
55
+ };
56
+ } | {
57
+ name: "events.read";
58
+ /**
59
+ * @minItems 1
60
+ * @maxItems 32
61
+ */
62
+ topics: [string, ...(string)[]];
63
+ limits: {
64
+ callsPerMinute: number;
65
+ pageSize: number;
66
+ minPollMs: number;
67
+ };
68
+ } | {
69
+ name: "actions.invoke";
70
+ /**
71
+ * @minItems 1
72
+ * @maxItems 32
73
+ */
74
+ actions: [string, ...(string)[]];
75
+ limits: {
76
+ callsPerMinute: number;
77
+ };
78
+ } | {
79
+ name: "network.fetch";
80
+ limits: WidgetNetworkLimits;
81
+ } | GrantedPresentationCapability);
82
+ export type GrantedCapabilities = GrantedCapability[];
83
+ export type FallbackReason = ("not-authorized" | "not-approved" | "delisted-for-new-use" | "revoked" | "host-api-unsupported" | "preview-not-allowed");
84
+ export interface WidgetHostRuntimeConfig {
85
+ schemaVersion: 1;
86
+ hostApiVersion: 1;
87
+ configId: Identifier;
88
+ runId: Identifier;
89
+ mode: Mode;
90
+ issuedAt: Timestamp;
91
+ expiresAt: Timestamp;
92
+ recheckAt: Timestamp;
93
+ securityProfile: "runtime-security-profile-v1";
94
+ resourceBudget: ResourceBudget;
95
+ runtime: RuntimeAuthority;
96
+ network: NetworkAuthority;
97
+ bindings: (LoadableBinding | FallbackBinding)[];
98
+ }
99
+ export interface ResourceBudget {
100
+ version: 1;
101
+ bundle: {
102
+ compressedBytes: number;
103
+ expandedBytes: number;
104
+ fileCount: number;
105
+ singleFileBytes: number;
106
+ };
107
+ bridge: {
108
+ messageBytes: number;
109
+ messagesPerSecond: number;
110
+ pendingRequests: number;
111
+ };
112
+ files: {
113
+ readBytesPerRequest: number;
114
+ readBytesPerRun: number;
115
+ callsPerMinute: number;
116
+ listPageSize: number;
117
+ };
118
+ timeouts: {
119
+ bundleLoadMs: number;
120
+ handshakeMs: number;
121
+ firstRenderMs: number;
122
+ updateMs: number;
123
+ capabilityMs: number;
124
+ disposeGraceMs: number;
125
+ };
126
+ concurrency: {
127
+ activeIframesPerPage: number;
128
+ activeIframesPerRun: number;
129
+ hiddenRecycleMs: number;
130
+ };
131
+ retry: {
132
+ maxAttempts: number;
133
+ initialDelayMs: number;
134
+ maxDelayMs: number;
135
+ totalMs: number;
136
+ };
137
+ failure: {
138
+ consecutiveFailures: number;
139
+ windowMs: number;
140
+ };
141
+ }
142
+ export interface RuntimeAuthority {
143
+ origin: RuntimeOrigin;
144
+ catalogRevision: string;
145
+ }
146
+ export interface NetworkAuthority {
147
+ mode: ("runtime-consent" | "unavailable");
148
+ policyVersion: string;
149
+ limits: WidgetNetworkLimits;
150
+ }
151
+ export interface WidgetNetworkLimits {
152
+ timeoutMs: PositiveInteger;
153
+ maxRedirects: PositiveInteger;
154
+ maxConcurrentRequests: PositiveInteger;
155
+ callsPerMinute: PositiveInteger;
156
+ requestHeaderBytes: PositiveInteger;
157
+ responseHeaderBytes: PositiveInteger;
158
+ requestBodyBytes: PositiveInteger;
159
+ responseBodyBytes: PositiveInteger;
160
+ }
161
+ export interface LoadableBinding {
162
+ status: "loadable";
163
+ bindingId: Identifier;
164
+ widgetId: Identifier;
165
+ widgetVersionId: Identifier;
166
+ digest: Digest;
167
+ manifest: WidgetManifest;
168
+ launch: Launch;
169
+ grantedCapabilities: GrantedCapabilities;
170
+ }
171
+ export interface WidgetManifest {
172
+ name: string;
173
+ description?: string;
174
+ widgetConfig: WidgetConfig;
175
+ }
176
+ export interface WidgetConfig {
177
+ schemaVersion: 1;
178
+ hostApiVersion: 1;
179
+ widgetSdkVersion: WidgetSdkVersion;
180
+ entry: EntryPath;
181
+ slot: WidgetSlotConfig;
182
+ requestedCapabilities?: RequestedCapabilities;
183
+ runtime?: RuntimeOptions;
184
+ samples: Samples;
185
+ }
186
+ export interface RequestedCapabilities {
187
+ files?: FilesCapabilityRequest;
188
+ events?: EventsCapabilityRequest;
189
+ actions?: ActionsCapabilityRequest;
190
+ network?: NetworkCapabilityRequest;
191
+ presentation?: RequestedPresentationCapability;
192
+ }
193
+ export interface FilesCapabilityRequest {
194
+ list?: boolean;
195
+ metadata?: boolean;
196
+ read?: boolean;
197
+ }
198
+ export interface EventsCapabilityRequest {
199
+ /**
200
+ * @minItems 1
201
+ * @maxItems 32
202
+ */
203
+ topics: [string, ...(string)[]];
204
+ }
205
+ export interface ActionsCapabilityRequest {
206
+ /**
207
+ * @minItems 1
208
+ * @maxItems 32
209
+ */
210
+ names: [string, ...(string)[]];
211
+ }
212
+ export interface NetworkCapabilityRequest {
213
+ fetch: true;
214
+ }
215
+ export interface RequestedPresentationCapability {
216
+ /**
217
+ * @minItems 1
218
+ * @maxItems 2
219
+ */
220
+ surfaces: [("floating" | "overlay")] | [("floating" | "overlay"), ("floating" | "overlay")];
221
+ }
222
+ export interface RuntimeOptions {
223
+ worker?: boolean;
224
+ webAssembly?: boolean;
225
+ }
226
+ export interface Launch {
227
+ url: string;
228
+ expiresAt: Timestamp;
229
+ }
230
+ export interface GrantedPresentationCapability {
231
+ name: "ui.presentation";
232
+ /**
233
+ * @minItems 1
234
+ * @maxItems 2
235
+ */
236
+ surfaces: [("floating" | "overlay")] | [("floating" | "overlay"), ("floating" | "overlay")];
237
+ requiresHostConfirmation: true;
238
+ }
239
+ export interface FallbackBinding {
240
+ status: "fallback";
241
+ bindingId: Identifier;
242
+ widgetId: Identifier;
243
+ widgetVersionId: Identifier;
244
+ slot: WidgetSlotConfig;
245
+ reason: FallbackReason;
246
+ }
@@ -0,0 +1,3 @@
1
+ /* eslint-disable */
2
+ /** GENERATED FILE. Do not edit directly. */
3
+ export {};
@@ -0,0 +1,86 @@
1
+ /** GENERATED FILE. Do not edit directly. */
2
+ export type WidgetSdkVersion = string;
3
+ export type EntryPath = string;
4
+ export type WidgetSlotConfig = ({
5
+ type: "tool-result";
6
+ toolName: string;
7
+ } | {
8
+ type: "file-preview";
9
+ /**
10
+ * @minItems 1
11
+ */
12
+ extensions: [string, ...(string)[]];
13
+ } | {
14
+ type: "panel";
15
+ panelType: string;
16
+ });
17
+ /**
18
+ * @minItems 1
19
+ */
20
+ export type Samples = [
21
+ {
22
+ id: string;
23
+ title: string;
24
+ request: string;
25
+ },
26
+ ...({
27
+ id: string;
28
+ title: string;
29
+ request: string;
30
+ })[]
31
+ ];
32
+ export interface WidgetManifest {
33
+ name: string;
34
+ description?: string;
35
+ widgetConfig: WidgetConfig;
36
+ }
37
+ export interface WidgetConfig {
38
+ schemaVersion: 1;
39
+ hostApiVersion: 1;
40
+ widgetSdkVersion: WidgetSdkVersion;
41
+ entry: EntryPath;
42
+ slot: WidgetSlotConfig;
43
+ requestedCapabilities?: RequestedCapabilities;
44
+ runtime?: RuntimeOptions;
45
+ samples: Samples;
46
+ }
47
+ export interface RequestedCapabilities {
48
+ files?: FilesCapabilityRequest;
49
+ events?: EventsCapabilityRequest;
50
+ actions?: ActionsCapabilityRequest;
51
+ network?: NetworkCapabilityRequest;
52
+ presentation?: RequestedPresentationCapability;
53
+ }
54
+ export interface FilesCapabilityRequest {
55
+ list?: boolean;
56
+ metadata?: boolean;
57
+ read?: boolean;
58
+ }
59
+ export interface EventsCapabilityRequest {
60
+ /**
61
+ * @minItems 1
62
+ * @maxItems 32
63
+ */
64
+ topics: [string, ...(string)[]];
65
+ }
66
+ export interface ActionsCapabilityRequest {
67
+ /**
68
+ * @minItems 1
69
+ * @maxItems 32
70
+ */
71
+ names: [string, ...(string)[]];
72
+ }
73
+ export interface NetworkCapabilityRequest {
74
+ fetch: true;
75
+ }
76
+ export interface RequestedPresentationCapability {
77
+ /**
78
+ * @minItems 1
79
+ * @maxItems 2
80
+ */
81
+ surfaces: [("floating" | "overlay")] | [("floating" | "overlay"), ("floating" | "overlay")];
82
+ }
83
+ export interface RuntimeOptions {
84
+ worker?: boolean;
85
+ webAssembly?: boolean;
86
+ }
@@ -0,0 +1,3 @@
1
+ /* eslint-disable */
2
+ /** GENERATED FILE. Do not edit directly. */
3
+ export {};