@world-engines/view-sdk 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,46 @@
1
+ WorldEngine 官方作者工具许可证
2
+
3
+ 版权所有 (c) 2026 Nixdorfer。保留所有权利。
4
+
5
+ 本仓库的源代码、构建材料及附带资源(统称“本作品”)不是开源软件,
6
+ 不适用任何 OSI 认证的开源许可证。
7
+
8
+ 一、官方作者工具分发许可
9
+
10
+ 版权所有者可以通过其官方网站、npm registry、签名安装包或其他官方渠道,
11
+ 复制并分发由本作品构建的 WorldEngine 作者工具及其必要运行资源
12
+ (统称“官方作者工具”)。仅版权所有者或其书面指定的发布者享有此分发权。
13
+
14
+ 二、作者用户许可
15
+
16
+ 从官方渠道取得官方作者工具的作者用户,可以:
17
+
18
+ 1. 安装和运行官方作者工具;
19
+ 2. 使用官方作者工具创作、编辑、预览、导入、导出和提交其有权处理的内容;
20
+ 3. 为上述使用目的制作合理必要的本地备份副本。
21
+
22
+ 三、未授予的权利
23
+
24
+ 除第二条明确允许的行为外,本许可证不授予作者用户或其他第三方以下权利:
25
+
26
+ 1. 修改、改编、反编译、反汇编或制作官方作者工具的派生作品;
27
+ 2. 复制、镜像、转发、再上传、出售、出租、再分发或再许可官方作者工具;
28
+ 3. 使用本作品的源代码、构建材料或任何部分开发、提供或训练其他产品或服务;
29
+ 4. 删除或规避版权、许可、签名、访问控制或其他权利管理信息。
30
+
31
+ 法律强制允许且合同不得排除的权利不受上述限制影响。
32
+
33
+ 四、源代码查看
34
+
35
+ 第三方可以在已获合法访问权限的范围内查看本作品,用于审查、安全研究或学习参考;
36
+ 查看不授予运行、复制、修改、分发、再许可或用于其他产品与服务的权利。
37
+
38
+ 五、无担保与责任限制
39
+
40
+ 本作品与官方作者工具均按“现状”提供,不附带任何明示或暗示的担保。
41
+ 在适用法律允许的最大范围内,版权所有者不对因访问或使用本作品或官方作者工具
42
+ 造成的任何损失承担责任。
43
+
44
+ 六、终止
45
+
46
+ 违反本许可证将立即终止相应的访问与使用权;终止不影响版权所有者已经产生的权利和救济。
@@ -0,0 +1,33 @@
1
+ export type { ChatPlayApi, TmwInteractionResult } from "@world-engines/chatplay-vite-plugin/runtime/chatplay-sdk.d.ts";
2
+ export { CHATPLAY_DEBUG_CAPABILITIES, CHATPLAY_RUNTIME_COMPATIBILITY, chatPlay, } from "@world-engines/chatplay-vite-plugin";
3
+ export type { ChatPlayDangerousLanOptions, ChatPlayDebugCapability, ChatPlayDebugCapabilityMatrix, ChatPlayDebugClient, ChatPlayDebugCurrency, ChatPlayPluginOptions, ChatPlayRuntimeCompatibility, } from "@world-engines/chatplay-vite-plugin";
4
+ import { CHATPLAY_RUNTIME_COMPATIBILITY as chatPlayRuntimeCompatibility, type ChatPlayPluginOptions } from "@world-engines/chatplay-vite-plugin";
5
+ import type { Plugin } from "vite";
6
+ /** 可重复注入到本地 Preview 的最小 ChatPlay 调试语境;它不模拟远端 runtime。 */
7
+ export interface ChatPlayFixture {
8
+ readonly schema_version: 1;
9
+ readonly fixture_id: string;
10
+ readonly scenario_id: string;
11
+ readonly initial_messages: readonly ChatPlayFixtureMessage[];
12
+ readonly runtime: typeof chatPlayRuntimeCompatibility;
13
+ }
14
+ export interface ChatPlayFixtureMessage {
15
+ readonly role: "system" | "assistant" | "user";
16
+ readonly content: string;
17
+ }
18
+ export interface ChatPlayViteIntegration {
19
+ readonly fixture: ChatPlayFixture;
20
+ readonly plugin: Plugin;
21
+ /** 供 View 的 Vite config 合并到 define;不注入凭据或远端响应。 */
22
+ readonly define: Readonly<Record<"__CHATPLAY_FIXTURE__", string>>;
23
+ }
24
+ export declare function createChatPlayFixture(input: {
25
+ readonly fixture_id: string;
26
+ readonly scenario_id: string;
27
+ readonly initial_messages?: readonly ChatPlayFixtureMessage[];
28
+ }): ChatPlayFixture;
29
+ /**
30
+ * 返回真实 ChatPlay Vite plugin 与可序列化 fixture define。
31
+ * fixture 只负责可重复的 Preview 输入;请求仍由 plugin 的显式 apiBase/apiKeyEnv/model 配置处理。
32
+ */
33
+ export declare function integrateChatPlayVite(options: ChatPlayPluginOptions, fixture: ChatPlayFixture): ChatPlayViteIntegration;
package/dist/index.js ADDED
@@ -0,0 +1,30 @@
1
+ export { CHATPLAY_DEBUG_CAPABILITIES, CHATPLAY_RUNTIME_COMPATIBILITY, chatPlay, } from "@world-engines/chatplay-vite-plugin";
2
+ import { CHATPLAY_RUNTIME_COMPATIBILITY as chatPlayRuntimeCompatibility, chatPlay as createChatPlayPlugin, } from "@world-engines/chatplay-vite-plugin";
3
+ export function createChatPlayFixture(input) {
4
+ if (input.fixture_id.trim() === "" || input.scenario_id.trim() === "") {
5
+ throw new TypeError("ChatPlay fixture 必须包含 fixture_id 与 scenario_id");
6
+ }
7
+ for (const message of input.initial_messages ?? []) {
8
+ if (message.content.trim() === "") {
9
+ throw new TypeError("ChatPlay fixture message 不得为空");
10
+ }
11
+ }
12
+ return Object.freeze({
13
+ schema_version: 1,
14
+ fixture_id: input.fixture_id,
15
+ scenario_id: input.scenario_id,
16
+ initial_messages: Object.freeze([...(input.initial_messages ?? [])]),
17
+ runtime: chatPlayRuntimeCompatibility,
18
+ });
19
+ }
20
+ /**
21
+ * 返回真实 ChatPlay Vite plugin 与可序列化 fixture define。
22
+ * fixture 只负责可重复的 Preview 输入;请求仍由 plugin 的显式 apiBase/apiKeyEnv/model 配置处理。
23
+ */
24
+ export function integrateChatPlayVite(options, fixture) {
25
+ return Object.freeze({
26
+ fixture,
27
+ plugin: createChatPlayPlugin(options),
28
+ define: Object.freeze({ __CHATPLAY_FIXTURE__: JSON.stringify(fixture) }),
29
+ });
30
+ }
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "@world-engines/view-sdk",
3
+ "version": "0.1.0-alpha.0",
4
+ "license": "SEE LICENSE IN LICENSE",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "import": "./dist/index.js"
10
+ }
11
+ },
12
+ "files": [
13
+ "dist"
14
+ ],
15
+ "dependencies": {
16
+ "@world-engines/chatplay-vite-plugin": "0.1.2"
17
+ },
18
+ "peerDependencies": {
19
+ "vite": ">=5.4.0 <8"
20
+ },
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "worldengine_source_sha256": "07fef124af40a871e999b380b35baae432cdc87dac84456e1bb570ac26090b69",
25
+ "worldengine_release_metadata_provenance": {
26
+ "schema": "worldengine-release-metadata-v1",
27
+ "base_archive_sha256": "991e4d5674eb86e808ab4d81fc2cec3c215eb3a5120814924dee7f6715ff3390",
28
+ "change": "dependency:@world-engines/chatplay-vite-plugin@0.1.2",
29
+ "source_recompiled": false,
30
+ "source_sha256_retained": "ac0bad0149bf60902b3d07ffdf4307fbf7454bb8a8c1fd0aa8343aa92f006c68"
31
+ },
32
+ "worldengine_source_identity_provenance": {
33
+ "schema": "worldengine-public-namespace-projection/v1",
34
+ "kind": "composite-source-identity; namespace projection; not-full-source-recompile",
35
+ "original_name": "@worldengine/view-sdk",
36
+ "original_archive_sha256": "30abde8692d34f774a2a825522a435586117dd0972373890d379802a986332df",
37
+ "original_source_sha256": "ac0bad0149bf60902b3d07ffdf4307fbf7454bb8a8c1fd0aa8343aa92f006c68",
38
+ "projected_name": "@world-engines/view-sdk",
39
+ "package_name_mapping": {
40
+ "@chat/blocks-editor": "@world-engines/blocks-editor",
41
+ "@chat/ladybug-bridge": "@world-engines/ladybug-bridge",
42
+ "@chat/monaco-host": "@world-engines/monaco-host",
43
+ "@chat/protocol-ts": "@world-engines/protocol-ts",
44
+ "@chat/scenario-author-source": "@world-engines/scenario-author-source",
45
+ "@chat/scenario-review-snapshot": "@world-engines/scenario-review-snapshot",
46
+ "@chat/tmw": "@world-engines/tmw",
47
+ "@chat/view-exposure": "@world-engines/view-exposure",
48
+ "@world-engines/chatplay-vite-plugin": "@world-engines/chatplay-vite-plugin",
49
+ "@worldengine/agent-kit": "@world-engines/agent-kit",
50
+ "@worldengine/authoring-bridge": "@world-engines/authoring-bridge",
51
+ "@worldengine/authoring-ui": "@world-engines/authoring-ui",
52
+ "@worldengine/create-project": "@world-engines/create-project",
53
+ "@worldengine/project-format": "@world-engines/project-format",
54
+ "@worldengine/project-host": "@world-engines/project-host",
55
+ "@worldengine/project-setup": "@world-engines/project-setup",
56
+ "@worldengine/spatial-authoring": "@world-engines/spatial-authoring",
57
+ "@worldengine/view-sdk": "@world-engines/view-sdk"
58
+ }
59
+ }
60
+ }