@dp-bohrium/widget-sdk 0.5.0 → 0.7.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.
- package/AGENTS.md +13 -4
- package/CHANGELOG.md +39 -1
- package/README.md +33 -20
- package/assets/licenses/ajv@8.20.0/LICENSE +22 -0
- package/assets/licenses/fast-deep-equal@3.1.3/LICENSE +21 -0
- package/assets/licenses/fast-uri@3.1.6/LICENSE +30 -0
- package/assets/licenses/json-schema-traverse@1.0.0/LICENSE +21 -0
- package/assets/licenses/require-from-string@2.0.2/license +21 -0
- package/assets/licenses/widget-contracts.LICENSE +21 -0
- package/assets/licenses/widget-sdk.LICENSE +21 -0
- package/assets/schemas/host-runtime-config.schema.json +305 -0
- package/assets/schemas/widget-manifest.schema.json +361 -0
- package/assets/schemas/widget-plugin-manifest.schema.json +162 -0
- package/assets/schemas/widget-runtime-contracts.schema.json +2874 -0
- package/assets/toolchain.json +28 -0
- package/conformance/bridge/capability-request.json +23 -0
- package/conformance/bridge/files-download-request.json +23 -0
- package/conformance/bridge/files-read-versioned-request.json +25 -0
- package/conformance/bridge/files-write-request.json +25 -0
- package/conformance/bridge/files-write-success.json +25 -0
- package/conformance/bridge/network-fetch-denied.json +16 -0
- package/conformance/bridge/network-fetch-request.json +19 -0
- package/conformance/bridge/network-fetch-success.json +22 -0
- package/conformance/bridge/presentation-change-surface-request.json +14 -0
- package/conformance/bridge/presentation-close-request.json +14 -0
- package/conformance/bridge/presentation-close-success.json +11 -0
- package/conformance/bridge/presentation-downgrade-success.json +14 -0
- package/conformance/bridge/presentation-focus-backward-request.json +14 -0
- package/conformance/bridge/presentation-focus-boundary-success.json +14 -0
- package/conformance/bridge/presentation-focus-forward-request.json +14 -0
- package/conformance/bridge/presentation-init.json +70 -0
- package/conformance/bridge/presentation-policy-denied.json +16 -0
- package/conformance/bridge/presentation-present-request.json +14 -0
- package/conformance/bridge/presentation-user-denied.json +16 -0
- package/conformance/bridge/ready.json +11 -0
- package/conformance/bridge/region-acquire-request.json +14 -0
- package/conformance/bridge/tasks-list-request.json +17 -0
- package/conformance/bridge/tasks-watch-request.json +18 -0
- package/conformance/bridge/ui-state-write-request.json +18 -0
- package/conformance/bundles/minimal-file-preview/entry.js +1 -0
- package/conformance/bundles/minimal-file-preview/manifest.json +12 -0
- package/conformance/bundles/minimal-file-preview/samples/file-preview.json +1 -0
- package/conformance/bundles/minimal-panel/entry.js +1 -0
- package/conformance/bundles/minimal-panel/manifest.json +11 -0
- package/conformance/bundles/minimal-panel/samples/panel.json +1 -0
- package/conformance/bundles/minimal-tool-result/entry.js +1 -0
- package/conformance/bundles/minimal-tool-result/manifest.json +11 -0
- package/conformance/bundles/minimal-tool-result/samples/tool-result.json +1 -0
- package/conformance/file-grants/write.json +8 -0
- package/conformance/file-responses/list.json +1 -0
- package/conformance/file-responses/metadata.json +11 -0
- package/conformance/file-responses/mutation-conflict.json +6 -0
- package/conformance/file-responses/permission-denied.json +6 -0
- package/conformance/file-responses/read-revision-only.json +8 -0
- package/conformance/file-responses/read-unversioned-range.json +12 -0
- package/conformance/file-responses/read-versioned.json +12 -0
- package/conformance/file-responses/resource-limit.json +1 -0
- package/conformance/file-responses/revision-conflict.json +6 -0
- package/conformance/file-responses/text-content.json +7 -0
- package/conformance/file-responses/write-outcome-unknown.json +6 -0
- package/conformance/file-responses/write-success.json +15 -0
- package/conformance/host-runtime-config/invalid-host-service-expiry.json +85 -0
- package/conformance/host-runtime-config/invalid-host-service-identity.json +85 -0
- package/conformance/host-runtime-config/invalid-host-service-permission.json +85 -0
- package/conformance/host-runtime-config/invalid-host-service-status.json +65 -0
- package/conformance/host-runtime-config/invalid-missing-manifest-fields.json +55 -0
- package/conformance/host-runtime-config/invalid-static-origins.json +60 -0
- package/conformance/host-runtime-config/valid-host-service-authorization-required.json +65 -0
- package/conformance/host-runtime-config/valid-host-service-authorization.json +85 -0
- package/conformance/host-runtime-config/valid-no-requested-permissions.json +52 -0
- package/conformance/host-runtime-config/valid.json +85 -0
- package/conformance/invalid-bridge-messages/network-fetch-mixed-case-forbidden-header.json +21 -0
- package/conformance/invalid-file-grants/extra-file-scope.json +9 -0
- package/conformance/invalid-file-grants/missing-write-limits.json +4 -0
- package/conformance/invalid-file-requests/arbitrary-path.json +16 -0
- package/conformance/invalid-file-requests/missing-expected-revision.json +14 -0
- package/conformance/invalid-file-requests/missing-mutation-id.json +14 -0
- package/conformance/invalid-file-requests/path-in-reference.json +16 -0
- package/conformance/invalid-file-results/read-empty-revision.json +5 -0
- package/conformance/invalid-file-results/read-null-revision.json +5 -0
- package/conformance/invalid-file-results/write-missing-mutation-id.json +11 -0
- package/conformance/invalid-manifests/missing-target.json +11 -0
- package/conformance/invalid-manifests/presentation-duplicate-surfaces.json +16 -0
- package/conformance/invalid-manifests/presentation-empty-surfaces.json +14 -0
- package/conformance/invalid-manifests/presentation-unknown-surface.json +16 -0
- package/conformance/invalid-manifests/unknown-field.json +12 -0
- package/conformance/invalid-network-requests/mixed-case-forbidden-header.json +11 -0
- package/conformance/invalid-presentation-grants/duplicate-surfaces.json +5 -0
- package/conformance/invalid-presentation-grants/empty-surfaces.json +5 -0
- package/conformance/invalid-presentation-grants/false-confirmation.json +5 -0
- package/conformance/invalid-presentation-grants/missing-confirmation.json +4 -0
- package/conformance/invalid-presentation-grants/unknown-surface.json +5 -0
- package/conformance/invalid-presentation-requests/change-surface-missing-surface.json +4 -0
- package/conformance/invalid-presentation-requests/close-with-surface.json +4 -0
- package/conformance/invalid-presentation-requests/focus-boundary-missing-direction.json +4 -0
- package/conformance/invalid-presentation-requests/focus-boundary-unknown-direction.json +4 -0
- package/conformance/invalid-presentation-requests/focus-boundary-with-coordinates.json +9 -0
- package/conformance/invalid-presentation-requests/focus-boundary-with-event-provenance.json +8 -0
- package/conformance/invalid-presentation-requests/focus-boundary-with-generation.json +8 -0
- package/conformance/invalid-presentation-requests/focus-boundary-with-identity.json +12 -0
- package/conformance/invalid-presentation-requests/focus-boundary-with-key.json +8 -0
- package/conformance/invalid-presentation-requests/focus-boundary-with-modifiers.json +11 -0
- package/conformance/invalid-presentation-requests/focus-boundary-with-selector.json +8 -0
- package/conformance/invalid-presentation-requests/focus-boundary-with-surface.json +8 -0
- package/conformance/invalid-presentation-requests/focus-boundary-with-target.json +8 -0
- package/conformance/invalid-presentation-requests/focus-boundary-with-timestamp.json +8 -0
- package/conformance/invalid-presentation-requests/focus-boundary-with-z-index.json +8 -0
- package/conformance/invalid-presentation-requests/present-missing-surface.json +4 -0
- package/conformance/invalid-presentation-requests/unknown-surface.json +4 -0
- package/conformance/invalid-presentation-requests/widget-controls-coordinates.json +9 -0
- package/conformance/invalid-presentation-requests/widget-controls-geometry.json +8 -0
- package/conformance/invalid-presentation-requests/widget-controls-instance-id.json +8 -0
- package/conformance/invalid-presentation-requests/widget-controls-principal.json +8 -0
- package/conformance/invalid-presentation-requests/widget-controls-run-id.json +4 -0
- package/conformance/invalid-presentation-requests/widget-controls-widget-id.json +8 -0
- package/conformance/invalid-presentation-requests/widget-controls-widget-version-id.json +8 -0
- package/conformance/invalid-presentation-requests/widget-controls-z-index.json +4 -0
- package/conformance/invalid-render-inputs/malformed.json +17 -0
- package/conformance/manifests/valid-file-preview.json +12 -0
- package/conformance/manifests/valid-file-write-preview.json +30 -0
- package/conformance/manifests/valid-network.json +15 -0
- package/conformance/manifests/valid-panel.json +11 -0
- package/conformance/manifests/valid-presentation-panel.json +21 -0
- package/conformance/manifests/valid-region-panel.json +18 -0
- package/conformance/manifests/valid-tool-result.json +14 -0
- package/conformance/render-inputs/compatibility/literature-search-paper-results.json +75 -0
- package/conformance/render-inputs/compatibility/scientific-bibliography-bibtex.json +10 -0
- package/conformance/render-inputs/compatibility/scientific-dataset-csv.json +10 -0
- package/conformance/render-inputs/compatibility/scientific-manuscript-latex.json +10 -0
- package/conformance/render-inputs/compatibility/scientific-manuscript-markdown.json +10 -0
- package/conformance/render-inputs/compatibility/scientific-molecule-mol.json +10 -0
- package/conformance/render-inputs/compatibility/scientific-molecule-mol2.json +10 -0
- package/conformance/render-inputs/compatibility/scientific-notebook-ipynb.json +10 -0
- package/conformance/render-inputs/compatibility/scientific-paper-pdf.json +10 -0
- package/conformance/render-inputs/compatibility/scientific-protein-pdb.json +10 -0
- package/conformance/render-inputs/compatibility/scientific-source-python.json +10 -0
- package/conformance/render-inputs/compatibility/scientific-structure-cif.json +47 -0
- package/conformance/render-inputs/compatibility/scientific-structure-poscar.json +10 -0
- package/conformance/render-inputs/compatibility/scientific-structure-stru.json +10 -0
- package/conformance/render-inputs/compatibility/scientific-trajectory-xyz.json +10 -0
- package/conformance/render-inputs/compatibility/thinking-process-paper-search.json +25 -0
- package/conformance/render-inputs/compatibility/thinking-process-scholar-search.json +25 -0
- package/conformance/render-inputs/compatibility/thinking-process-web-search.json +25 -0
- package/conformance/render-inputs/compatibility/workspace-file-search.json +24 -0
- package/conformance/render-inputs/compatibility/workspace-file-tree.json +24 -0
- package/conformance/render-inputs/empty.json +10 -0
- package/conformance/render-inputs/file-preview.json +10 -0
- package/conformance/render-inputs/incremental-update.json +10 -0
- package/conformance/render-inputs/large.json +10 -0
- package/conformance/render-inputs/malformed.json +1 -0
- package/conformance/render-inputs/panel.json +10 -0
- package/conformance/render-inputs/partial-state-full-snapshot.json +40 -0
- package/conformance/render-inputs/tool-result.json +10 -0
- package/conformance/resource-budgets/corpus.json +431 -0
- package/dist/cli.mjs +15618 -0
- package/dist/contracts.d.ts +2 -0
- package/dist/contracts.js +2 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +17 -11
- package/dist/manifest.d.ts +1 -1
- package/dist/protocol/generated-host-runtime-config.d.ts +551 -0
- package/dist/protocol/generated-manifest.d.ts +192 -0
- package/dist/protocol/generated-plugin-manifest.d.ts +176 -0
- package/dist/protocol/generated-runtime-contracts.d.ts +1224 -0
- package/dist/protocol/index.d.ts +43 -0
- package/dist/protocol/plugin-manifest.d.ts +30 -0
- package/dist/protocol/widget-events.d.ts +13 -0
- package/dist/runtime/bootstrap.d.ts +1 -1
- package/dist/runtime/client.d.ts +1 -1
- package/dist/runtime/event-validation.d.ts +1 -1
- package/dist/runtime/events.d.ts +1 -1
- package/dist/runtime/files.d.ts +1 -1
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +1 -1
- package/dist/runtime/mock-host.d.ts +1 -1
- package/dist/runtime/network.d.ts +1 -1
- package/dist/runtime/protocol-endpoint.d.ts +1 -1
- package/dist/runtime/service.d.ts +2 -2
- package/dist/runtime/transport.d.ts +1 -1
- package/dist/{runtime-DVFTv55x.js → runtime-DZA7Gqzl.js} +1 -1
- package/dist/widget-events-BT0QxR-H.js +65 -0
- package/dist/widget.d.ts +2 -2
- package/llms.txt +8 -1
- package/package.json +18 -6
- package/schemas/host-runtime-config.schema.json +305 -0
- package/schemas/widget-manifest.schema.json +361 -0
- package/schemas/widget-plugin-manifest.schema.json +162 -0
- package/schemas/widget-runtime-contracts.schema.json +2874 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type { FileMutationId, FileReadInput, FileReadResult, FileRevision, FileWriteInput, FileWriteResult, WidgetActivationEvent, WidgetActivationEvents, WidgetContribution, WidgetEventName, WidgetFilePreviewContribution, WidgetPanelContribution, WidgetPluginContributions, WidgetPluginManifest, WidgetToolPhase, } from "
|
|
2
|
-
export { isWidgetActivationEvent, isWidgetEventName, WIDGET_ACTIVATION_EVENTS, WIDGET_EVENT_NAMES, } from "
|
|
1
|
+
export type { CapabilityRequest, CapabilityResult, FileDownloadResult, FileMutationId, FilePreviewContent, FilePreviewRenderRequest, FileReadInput, FileReadResult, FileReference, FileRevision, FileWriteInput, FileWriteResult, GrantedCapability, JsonValue, PanelContent, PanelRenderRequest, RenderRequest, RenderState, TaskObservationBatch, TaskObservationEvent, TaskObservationSnapshot, Theme, ThemeMode, WidgetActivationEvent, WidgetActivationEvents, WidgetContribution, WidgetError, WidgetErrorCode, WidgetEventName, WidgetFilePreviewContribution, WidgetLiveEvent, WidgetNetworkFetchInput, WidgetNetworkFetchOutput, WidgetPanelContribution, WidgetPluginContributions, WidgetPluginManifest, WidgetToolPhase, } from "./protocol/index.js";
|
|
2
|
+
export { isWidgetActivationEvent, isWidgetEventName, WIDGET_ACTIVATION_EVENTS, WIDGET_EVENT_NAMES, } from "./protocol/index.js";
|
|
3
3
|
export type { CompileWidgetPluginManifestOptions } from "./manifest.js";
|
|
4
4
|
export { compileWidgetPluginManifest } from "./manifest.js";
|
|
5
5
|
export type { HostUserEmail, HostUserEmailResult, HostUserProfile, HostUserProfileResult, WidgetHostUserClient, } from "./runtime/service.js";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as
|
|
2
|
-
import {
|
|
3
|
-
//#region src/manifest.
|
|
1
|
+
import { i as isWidgetActivationEvent, n as isWidgetEventName, r as WIDGET_ACTIVATION_EVENTS, t as WIDGET_EVENT_NAMES } from "./widget-events-BT0QxR-H.js";
|
|
2
|
+
import { i as createWidgetClient, l as WIDGET_SDK_VERSION } from "./runtime-DZA7Gqzl.js";
|
|
3
|
+
//#region ../widget-project/src/manifest-compiler.mjs
|
|
4
4
|
function compiledContribution(contribution) {
|
|
5
5
|
switch (contribution.type) {
|
|
6
6
|
case "panel": return {
|
|
@@ -14,13 +14,8 @@ function compiledContribution(contribution) {
|
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
*
|
|
20
|
-
* 这是构建工具的边界函数,不是类型提示入口:作者直接编辑带 `$schema` 的 JSON,
|
|
21
|
-
* SDK 版本从当前安装包读取,宿主入口默认落到 dist/widget.js,内部 contribution 标识只在这里生成。
|
|
22
|
-
*/
|
|
23
|
-
function compileWidgetPluginManifest(manifest, options = {}) {
|
|
17
|
+
/** 只编译协议数据;SDK 版本由可信调用方绑定,不读取安装或执行环境。 */
|
|
18
|
+
function compileWidgetPluginManifest$1(manifest, sdkVersion, options = {}) {
|
|
24
19
|
const samples = options.samples ?? manifest.samples;
|
|
25
20
|
if (!samples || samples.length === 0) throw new Error("Widget Plugin Manifest must provide at least one sample before packaging");
|
|
26
21
|
const contribution = manifest.contributes.widget;
|
|
@@ -32,7 +27,7 @@ function compileWidgetPluginManifest(manifest, options = {}) {
|
|
|
32
27
|
widgetConfig: {
|
|
33
28
|
schemaVersion: 1,
|
|
34
29
|
hostApiVersion: 1,
|
|
35
|
-
widgetSdkVersion:
|
|
30
|
+
widgetSdkVersion: sdkVersion,
|
|
36
31
|
entry: options.hostEntry ?? "dist/widget.js",
|
|
37
32
|
contribution: compiledContribution(manifest.contributes.widget),
|
|
38
33
|
...activationEvents === void 0 ? {} : { activationEvents },
|
|
@@ -43,6 +38,17 @@ function compileWidgetPluginManifest(manifest, options = {}) {
|
|
|
43
38
|
};
|
|
44
39
|
}
|
|
45
40
|
//#endregion
|
|
41
|
+
//#region src/manifest.ts
|
|
42
|
+
/**
|
|
43
|
+
* 将开发者维护的插件清单编译为宿主可加载的宿主清单。
|
|
44
|
+
*
|
|
45
|
+
* 这是构建工具的边界函数,不是类型提示入口:作者直接编辑带 `$schema` 的 JSON,
|
|
46
|
+
* SDK 版本从当前安装包读取,宿主入口默认落到 dist/widget.js,内部 contribution 标识只在这里生成。
|
|
47
|
+
*/
|
|
48
|
+
function compileWidgetPluginManifest(manifest, options = {}) {
|
|
49
|
+
return compileWidgetPluginManifest$1(manifest, WIDGET_SDK_VERSION, options);
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
46
52
|
//#region src/lifetime.ts
|
|
47
53
|
function createWidgetLifetime(onError) {
|
|
48
54
|
const controller = new AbortController();
|
package/dist/manifest.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WidgetManifest, WidgetPluginManifest } from "
|
|
1
|
+
import type { WidgetManifest, WidgetPluginManifest } from "./protocol/index.js";
|
|
2
2
|
export interface CompileWidgetPluginManifestOptions {
|
|
3
3
|
readonly samples?: NonNullable<WidgetPluginManifest["samples"]>;
|
|
4
4
|
/** Host bundle entry. CLI supplies this after the project is built. */
|