dsh-pico-lab 0.1.0 → 0.2.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/README.md +8 -0
- package/lib/cli.mjs +3 -3
- package/lib/client.js +1041 -0
- package/lib/core-CqdMbmvD.mjs +1 -0
- package/lib/{core-CCJIvdg3.mjs → core-RKJbGowf.mjs} +45 -6
- package/lib/index.mjs +110 -5
- package/lib/{tools-DRr4n9Ax.mjs → tools-DIoSAX2i.mjs} +1 -1
- package/package.json +18 -2
- package/lib/core-ntjet8c1.mjs +0 -1
package/README.md
CHANGED
|
@@ -14,6 +14,14 @@ DSH 里 **插件 → 安装第三方插件**,填 `dsh-pico-lab`(还没发布
|
|
|
14
14
|
|
|
15
15
|
Agent 会:查依赖、缺什么引导装什么 → 从模板生成 Unity 工程 → 在 Unity 里打开 → 写章节和台词 → 自动试玩、看截图、改 → 配音(先问你,花积分)→ 装进头显。
|
|
16
16
|
|
|
17
|
+
也可以不用对话:侧栏点 **PICO Lab** 打开图形界面——
|
|
18
|
+
|
|
19
|
+
- **准备环境**:每个依赖一行,缺的点“安装”;要你自己做的(Homebrew、git 命令行工具)给出命令,一键复制。
|
|
20
|
+
- **新建世界**:填课名、英文名、给谁上、一句话,选起步课或完整示例。
|
|
21
|
+
- **世界页**:编辑器、PICO XR SDK、旁白录音、台词表、头显的状态一眼看到;按钮“在 Unity 里打开 / 自动试玩 / 打包 APK / 装进头显”,进度和日志实时显示;“试玩”里是每句旁白一张的截图墙(点开大图、左右翻);“台词”里按章列出每句、能试听;“写课和配音”给出交给 Agent 的写课指令和每章 Seed Audio 提示词,一键复制。
|
|
22
|
+
|
|
23
|
+
写课本身(章节代码和台词)还是交给对话里的 Agent。
|
|
24
|
+
|
|
17
25
|
需要 DSH 0.2.2 以上、macOS(Apple 芯片),一台 PICO 头显(开发者模式,USB 连电脑)。
|
|
18
26
|
|
|
19
27
|
## 依赖(插件会逐项检查,能装的问过你再装)
|
package/lib/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { m as defaults } from "./core-
|
|
2
|
-
import { n as createTools, t as GUIDE } from "./tools-
|
|
1
|
+
import { m as defaults } from "./core-RKJbGowf.mjs";
|
|
2
|
+
import { n as createTools, t as GUIDE } from "./tools-DIoSAX2i.mjs";
|
|
3
3
|
// src/cli.ts
|
|
4
4
|
/** 命令行:node bin/cli.mjs <工具名或简称> '<JSON 参数>',给 Claude Code / Codex 用。 */
|
|
5
5
|
const [cmd, raw] = process.argv.slice(2);
|
|
@@ -22,7 +22,7 @@ const args = raw ? JSON.parse(raw) : {};
|
|
|
22
22
|
try {
|
|
23
23
|
const r = await t.execute(args);
|
|
24
24
|
if (r?.job) {
|
|
25
|
-
const core = await import("./core-
|
|
25
|
+
const core = await import("./core-CqdMbmvD.mjs");
|
|
26
26
|
let shown = 0;
|
|
27
27
|
for (;;) {
|
|
28
28
|
const [j] = await core.waitJobs([r.job], 5, 1e5);
|
package/lib/client.js
ADDED
|
@@ -0,0 +1,1041 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({ id: "dsh-pico-lab", factory: (require) => {
|
|
2
|
+
var module = { exports: {} }; var exports = module.exports;
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
let react = require("react");
|
|
5
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
+
|
|
7
|
+
// src/client/styles.ts
|
|
8
|
+
const CSS = `
|
|
9
|
+
.plb,.plb-over{--bg:var(--dsw-alias-bg-base,#fff);--pop:var(--dsw-alias-bg-layer-2,#fff);--ink:var(--dsw-alias-label-primary,#0f1115);--mut:var(--dsw-alias-label-secondary,#61666b);--dim:var(--dsw-alias-label-tertiary,#81858c);--line:var(--dsw-alias-border-l2,#0000001a);--hair:var(--dsw-alias-border-l1,#0000000a);--hov:var(--dsw-alias-interactive-bg-hover,#2631480f);--fill:color-mix(in srgb,var(--ink) 5%,transparent);--solid:var(--dsw-alias-button-primary-fill,#0f1115);--on:var(--dsw-alias-label-primary-foreground,#fff);--bad:var(--dsw-alias-state-error-primary,#ec1313);--good:var(--dsw-alias-state-success-primary,#1a9a4b);--warn:var(--dsw-alias-state-warning-primary,#c27700);background:var(--bg);color:var(--ink)}
|
|
10
|
+
.plb{height:100%;min-height:0;display:flex;overflow:hidden;font-size:14px;line-height:1.55;container-type:inline-size}
|
|
11
|
+
.plb *{box-sizing:border-box}.plb :is(p,h1,h2,h3,h4,ul){margin:0}.plb :is(h1,h2,h3,h4){font:inherit}.plb ul{padding:0;list-style:none}
|
|
12
|
+
.plb :is(button,input){font:inherit;color:inherit}.plb button{border:0;background:none;padding:0;cursor:pointer;text-align:inherit}.plb button:disabled{cursor:default;opacity:.35}
|
|
13
|
+
.plb :is(button,input,a):focus-visible{outline:2px solid var(--ink);outline-offset:2px}
|
|
14
|
+
.plb svg{flex:none}.plb .grow{flex:1;min-width:0}.plb .row{display:flex;align-items:center;gap:10px}.plb .mut{color:var(--mut)}.plb .small{font-size:12.500px}.plb .tiny{font-size:11.500px;color:var(--dim);margin-top:auto;padding:12px 10px 4px;word-break:break-all}.plb .center{text-align:center}
|
|
15
|
+
.plb .err{color:var(--bad);font-size:13px;margin-top:8px}
|
|
16
|
+
.plb .text{display:inline-flex;align-items:center;gap:6px;color:var(--mut);padding:5px 8px;border-radius:8px;white-space:nowrap;font-size:13px}.plb .text:hover{color:var(--ink);background:var(--hov)}
|
|
17
|
+
.plb .solid{display:inline-flex;align-items:center;justify-content:center;gap:6px;background:var(--solid);color:var(--on);border-radius:999px;padding:0 16px;height:34px;white-space:nowrap}.plb .solid:hover:not(:disabled){opacity:.86}
|
|
18
|
+
.plb .line{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--line);border-radius:999px;padding:0 14px;height:34px;white-space:nowrap}.plb .line:hover:not(:disabled){background:var(--hov)}.plb .line.small{height:28px;padding:0 12px;font-size:13px}
|
|
19
|
+
.plb .icon{width:30px;height:30px;border-radius:50%;display:inline-grid;place-items:center;color:var(--mut);flex:none}.plb button.icon:hover{background:var(--hov);color:var(--ink)}.plb .icon.small{width:24px;height:24px}
|
|
20
|
+
.plb .seg{display:flex;flex-wrap:wrap;gap:2px;padding:3px;border-radius:10px;background:var(--fill)}.plb .seg button{flex:1;text-align:center;border-radius:8px;padding:6px 10px;color:var(--mut);white-space:nowrap}.plb .seg .on{background:var(--pop);color:var(--ink);box-shadow:0 1px 3px #0000001f}
|
|
21
|
+
.plb .spin{display:inline-block;vertical-align:-2px;width:13px;height:13px;border-radius:50%;border:2px solid currentColor;border-right-color:transparent;animation:plb-r .8s linear infinite;margin-right:4px}@keyframes plb-r{to{transform:rotate(1turn)}}
|
|
22
|
+
.plb [data-tip]{position:relative}.plb [data-tip]:hover::after{content:attr(data-tip);position:absolute;left:50%;bottom:calc(100% + 6px);transform:translateX(-50%);width:max-content;max-width:280px;white-space:normal;background:var(--solid);color:var(--on);font-size:12px;line-height:1.45;padding:6px 9px;border-radius:8px;z-index:20;pointer-events:none;text-align:left}
|
|
23
|
+
|
|
24
|
+
.plb-side{flex:none;width:232px;display:flex;flex-direction:column;gap:2px;padding:14px 10px;padding-top:max(14px,var(--dsh-frame-chrome-top,0px));border-right:1px solid var(--hair);overflow:auto}
|
|
25
|
+
.plb-side .brand{display:flex;align-items:center;gap:8px;padding:6px 10px 14px;font-size:16px}
|
|
26
|
+
.plb-side h4{font-size:12px;color:var(--dim);padding:14px 10px 4px}
|
|
27
|
+
.plb-side .nav{display:flex;align-items:center;gap:8px;padding:8px 10px;border-radius:10px;color:var(--mut)}.plb-side .nav:hover{background:var(--hov);color:var(--ink)}.plb-side .nav.on{background:var(--fill);color:var(--ink)}
|
|
28
|
+
.plb-side .nav em{font-style:normal;font-size:12px;color:var(--good);display:inline-flex}.plb-side .nav em.warn{color:var(--warn)}
|
|
29
|
+
.plb-side .world b{display:block;font-weight:500;color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.plb-side .world small{display:block;font-size:12px;color:var(--dim)}
|
|
30
|
+
.plb-main{flex:1;min-width:0;overflow:auto;padding:22px 28px 40px;padding-top:max(22px,var(--dsh-frame-chrome-top,0px));padding-right:max(28px,var(--dsh-frame-trailing-clearance,0px));display:flex;flex-direction:column;gap:14px}
|
|
31
|
+
.plb-main>*{width:100%;max-width:920px;margin-left:auto;margin-right:auto}
|
|
32
|
+
.plb-main.solo{justify-content:center;padding-bottom:10vh}.plb-main.solo>*{max-width:640px}
|
|
33
|
+
.plb .narrow-only{display:none}
|
|
34
|
+
@container (max-width:720px){.plb-side{display:none}.plb:not(.picked) .plb-side{display:flex;width:100%}.plb:not(.picked) .plb-main{display:none}.plb .narrow-only{display:inline-grid}}
|
|
35
|
+
html[data-platform='darwin'] .plb-side .brand{-webkit-app-region:drag}
|
|
36
|
+
|
|
37
|
+
.plb .card{background:var(--pop);border:1px solid var(--line);border-radius:18px;padding:18px 20px;display:flex;flex-direction:column;gap:10px}
|
|
38
|
+
.plb .card h2{font-size:15px;font-weight:600}.plb .card h2:not(:first-child){margin-top:8px}.plb h1.title{font-size:22px;font-weight:600;letter-spacing:-.01em}
|
|
39
|
+
.plb .hero{display:flex;flex-direction:column;gap:12px}.plb .hero h1{font-size:26px;font-weight:600;text-align:center;letter-spacing:-.01em}
|
|
40
|
+
.plb .hero .form{margin-top:14px}
|
|
41
|
+
.plb .acts{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-top:4px}
|
|
42
|
+
.plb .sure{display:inline-flex;align-items:center;gap:8px;padding:4px 4px 4px 12px;border-radius:999px;background:var(--fill);font-size:13px}
|
|
43
|
+
.plb .form{display:grid;grid-template-columns:1fr 1fr;gap:12px 16px}.plb .form label,.plb .form .lab{display:flex;flex-direction:column;gap:5px}.plb .form .lab{grid-column:1/-1}
|
|
44
|
+
.plb .form span{font-size:12.500px;color:var(--mut)}.plb .form small{font-size:11.500px;color:var(--dim)}
|
|
45
|
+
.plb .form input{height:38px;border:1px solid var(--line);border-radius:10px;background:var(--bg);padding:0 12px;outline:0}.plb .form input:focus{border-color:color-mix(in srgb,var(--ink) 40%,transparent)}
|
|
46
|
+
@container (max-width:560px){.plb .form{grid-template-columns:1fr}}
|
|
47
|
+
|
|
48
|
+
.plb .deps li{display:flex;align-items:flex-start;gap:12px;padding:10px 0;border-top:1px solid var(--hair)}.plb .deps li:first-child{border-top:0}
|
|
49
|
+
.plb .deps b{display:block;font-weight:500}.plb .deps small{display:block;color:var(--dim);font-size:12.500px;word-break:break-all}
|
|
50
|
+
.plb .deps .dot{width:20px;height:20px;border-radius:50%;flex:none;display:grid;place-items:center;margin-top:1px;border:1.5px solid var(--line)}
|
|
51
|
+
.plb .deps .ok .dot{background:var(--good);border-color:var(--good);color:#fff}.plb .deps .miss .dot{border-color:var(--warn)}
|
|
52
|
+
.plb .manual{display:flex;align-items:flex-start;gap:8px;margin-top:6px;padding:8px 10px;border-radius:10px;background:var(--fill);font-size:12.500px;color:var(--mut);word-break:break-all}.plb .manual span{flex:1}
|
|
53
|
+
|
|
54
|
+
.plb .chips{display:flex;flex-wrap:wrap;gap:6px}.plb .chip{display:inline-flex;align-items:center;gap:5px;font-size:12.500px;padding:3px 10px;border-radius:999px;background:var(--fill);color:var(--mut)}
|
|
55
|
+
.plb .chip.good{color:var(--good);background:color-mix(in srgb,var(--good) 10%,transparent)}.plb .chip.warn{color:var(--warn);background:color-mix(in srgb,var(--warn) 12%,transparent)}
|
|
56
|
+
.plb .tabs{display:flex;gap:18px;padding:4px 4px 0}.plb .tabs button{font-size:15px;color:var(--dim);padding:4px 0}.plb .tabs button:hover{color:var(--ink)}.plb .tabs .on{color:var(--ink);font-weight:600}
|
|
57
|
+
|
|
58
|
+
.plb .job{border-radius:12px;background:var(--fill);padding:10px 12px;display:flex;flex-direction:column;gap:6px;margin-top:4px}.plb .job .state{font-size:12.500px;color:var(--mut)}.plb .job.failed .state{color:var(--bad)}.plb .job.done .state{color:var(--good)}
|
|
59
|
+
.plb .job pre{margin:0;max-height:220px;overflow:auto;font:11.500px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace;color:var(--mut);white-space:pre-wrap;word-break:break-all}
|
|
60
|
+
|
|
61
|
+
.plb .shots{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:10px}
|
|
62
|
+
.plb .shots button{display:flex;flex-direction:column;gap:4px;border-radius:10px;overflow:hidden}.plb .shots img{width:100%;aspect-ratio:2/1;object-fit:cover;border-radius:10px;background:#05070d;display:block;filter:brightness(1.9) saturate(1.1)}.plb .shots button:hover img{outline:2px solid var(--ink);outline-offset:-2px}
|
|
63
|
+
.plb .shots span{font-size:12px;color:var(--mut);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
64
|
+
.plb .lightbox{position:fixed;inset:0;z-index:50;background:#000000f5;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:40px}
|
|
65
|
+
.plb .lightbox img{max-width:100%;max-height:calc(100% - 60px);object-fit:contain;border-radius:8px}
|
|
66
|
+
.plb .lb-bar{display:flex;align-items:center;gap:10px;color:#fff;font-size:13px}.plb .lb-bar .icon{color:#fff}.plb .lb-bar .icon:hover{background:#ffffff22}
|
|
67
|
+
|
|
68
|
+
.plb .lines>div{display:flex;flex-direction:column;gap:2px;margin-bottom:12px}.plb .lines h3{font-size:13px;font-weight:600;color:var(--mut);padding:4px 0}
|
|
69
|
+
.plb .line-row{display:flex;align-items:center;gap:8px;padding:4px 2px;border-radius:8px}.plb .line-row:hover{background:var(--hov)}.plb .line-row.mute{color:var(--mut)}
|
|
70
|
+
.plb .line-row code{font:11.500px ui-monospace,Menlo,monospace;color:var(--dim)}
|
|
71
|
+
.plb .kind{font-size:11.500px;padding:1px 7px;border-radius:999px;background:var(--fill);color:var(--mut);flex:none}.plb .kind.k-示{color:var(--warn);background:color-mix(in srgb,var(--warn) 12%,transparent)}
|
|
72
|
+
.plb .problems li{color:var(--bad);font-size:12.500px;white-space:pre-wrap;padding:3px 0}
|
|
73
|
+
.plb .quote{position:relative;padding:12px 14px;border-radius:12px;background:var(--fill);display:flex;flex-direction:column;gap:6px}.plb .quote>button{align-self:flex-end}
|
|
74
|
+
.plb .quote pre{margin:0;white-space:pre-wrap;font:12.500px/1.6 inherit;color:var(--mut);max-height:180px;overflow:auto}
|
|
75
|
+
|
|
76
|
+
.plb-over{position:absolute;inset:0;top:var(--dsh-frame-chrome-top,0px);z-index:1}
|
|
77
|
+
.plb-side-btn{display:flex;align-items:center;gap:8px;border:0;background:none;cursor:pointer;color:var(--dsw-alias-label-primary,#0f1115);font:inherit;font-size:14px}.plb-side-btn.wide{width:calc(100% - 4px);height:34px;margin:4px 2px 0;padding:6px;border-radius:12px}.plb-side-btn.wide svg{margin:0 2px}.plb-side-btn.rail{justify-content:center;width:36px;height:36px;margin:8px 0 0;padding:0;border-radius:12px}.plb-side-btn:hover,.plb-side-btn.here{background:var(--dsw-alias-interactive-bg-hover,#2631480f)}.plb-side-btn svg{flex:none}
|
|
78
|
+
`;
|
|
79
|
+
|
|
80
|
+
// src/client/index.tsx
|
|
81
|
+
const inject = ["slots"];
|
|
82
|
+
const ID = "pico-lab";
|
|
83
|
+
const NAME = "PICO Lab";
|
|
84
|
+
let panel;
|
|
85
|
+
let here = false;
|
|
86
|
+
const subs = /* @__PURE__ */ new Set();
|
|
87
|
+
const setHere = (v) => {
|
|
88
|
+
here = v;
|
|
89
|
+
for (const f of subs) f();
|
|
90
|
+
};
|
|
91
|
+
const useHere = () => (0, react.useSyncExternalStore)((f) => {
|
|
92
|
+
subs.add(f);
|
|
93
|
+
return () => subs.delete(f);
|
|
94
|
+
}, () => here);
|
|
95
|
+
async function get(route) {
|
|
96
|
+
const r = await fetch(`/pico-lab/api/${route}`, { cache: "no-store" }), j = await r.json().catch(() => ({}));
|
|
97
|
+
if (!r.ok || j.error) throw new Error(j.error ?? "出错了");
|
|
98
|
+
return j;
|
|
99
|
+
}
|
|
100
|
+
async function post(route, body) {
|
|
101
|
+
const r = await fetch(`/pico-lab/api/${route}`, {
|
|
102
|
+
method: "POST",
|
|
103
|
+
headers: {
|
|
104
|
+
"content-type": "application/json",
|
|
105
|
+
"x-pico-lab": "1"
|
|
106
|
+
},
|
|
107
|
+
body: JSON.stringify(body)
|
|
108
|
+
}), j = await r.json().catch(() => ({}));
|
|
109
|
+
if (!r.ok || j.error) throw new Error(j.error ?? "出错了");
|
|
110
|
+
return j;
|
|
111
|
+
}
|
|
112
|
+
const file = (slug, k, v) => `/pico-lab/file?slug=${encodeURIComponent(slug)}&${k}=${encodeURIComponent(v)}`;
|
|
113
|
+
const I = ({ d, s = 16 }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
114
|
+
viewBox: "0 0 16 16",
|
|
115
|
+
width: s,
|
|
116
|
+
height: s,
|
|
117
|
+
fill: "none",
|
|
118
|
+
stroke: "currentColor",
|
|
119
|
+
strokeWidth: "1.4",
|
|
120
|
+
strokeLinecap: "round",
|
|
121
|
+
strokeLinejoin: "round",
|
|
122
|
+
"aria-hidden": "true",
|
|
123
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d })
|
|
124
|
+
});
|
|
125
|
+
const D = {
|
|
126
|
+
plus: "M8 3v10M3 8h10",
|
|
127
|
+
check: "m3.500 8.500 3 3 6-7",
|
|
128
|
+
x: "m4 4 8 8M12 4l-8 8",
|
|
129
|
+
play: "M5 3.500v9l7-4.500z",
|
|
130
|
+
stop: "M4.500 4.500h7v7h-7z",
|
|
131
|
+
copy: "M5.500 5.500h7v7h-7zM3.500 10.500v-7h7",
|
|
132
|
+
open: "M2.500 5v7.500h11V6.500H8L6.500 5zM2.500 5V3.500h4L8 5",
|
|
133
|
+
box: "M8 2l5.500 3v6L8 14l-5.500-3V5zM2.500 5 8 8l5.500-3M8 8v6",
|
|
134
|
+
send: "M8 13V3.500M3.800 7.500 8 3.300l4.200 4.200",
|
|
135
|
+
wrench: "M10 2.500a3 3 0 0 0-2.700 4.300L2.800 11.300l1.900 1.900 4.500-4.500A3 3 0 0 0 13.500 6l-1.800 1.800-1.700-.3-.3-1.700L11.500 4A3 3 0 0 0 10 2.500z",
|
|
136
|
+
left: "M10 3 5 8l5 5",
|
|
137
|
+
right: "m6 3 5 5-5 5",
|
|
138
|
+
refresh: "M13 8a5 5 0 1 1-1.500-3.500M13 2.500V5h-2.500",
|
|
139
|
+
folder: "M2.500 4.500h4l1.500 1.500h5.500v6.500h-11z",
|
|
140
|
+
mic: "M8 2.500a2 2 0 0 1 2 2V8a2 2 0 0 1-4 0V4.500a2 2 0 0 1 2-2zM4.500 7.500a3.500 3.500 0 0 0 7 0M8 11v2.500"
|
|
141
|
+
};
|
|
142
|
+
const Mark = () => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
143
|
+
viewBox: "0 0 20 20",
|
|
144
|
+
width: "20",
|
|
145
|
+
height: "20",
|
|
146
|
+
fill: "none",
|
|
147
|
+
stroke: "currentColor",
|
|
148
|
+
strokeWidth: "1.5",
|
|
149
|
+
strokeLinejoin: "round",
|
|
150
|
+
"aria-hidden": "true",
|
|
151
|
+
children: [
|
|
152
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
|
|
153
|
+
x: "2.500",
|
|
154
|
+
y: "6",
|
|
155
|
+
width: "15",
|
|
156
|
+
height: "8",
|
|
157
|
+
rx: "4"
|
|
158
|
+
}),
|
|
159
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
160
|
+
cx: "7",
|
|
161
|
+
cy: "10",
|
|
162
|
+
r: "1.300"
|
|
163
|
+
}),
|
|
164
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
165
|
+
cx: "13",
|
|
166
|
+
cy: "10",
|
|
167
|
+
r: "1.300"
|
|
168
|
+
})
|
|
169
|
+
]
|
|
170
|
+
});
|
|
171
|
+
const when = (iso) => iso ? new Date(iso).toLocaleString("zh-CN", {
|
|
172
|
+
month: "numeric",
|
|
173
|
+
day: "numeric",
|
|
174
|
+
hour: "2-digit",
|
|
175
|
+
minute: "2-digit"
|
|
176
|
+
}) : "";
|
|
177
|
+
const shotName = (p) => {
|
|
178
|
+
const n = p.split("/").pop().replace(/^\d+_/, "").replace(/\.png$/, "");
|
|
179
|
+
const t = /^title(\d+)$/.exec(n);
|
|
180
|
+
return t ? `第 ${Number(t[1]) + 1} 章标题` : n.replace(/_near$/, " · 手靠近").replace(/_ghost$/, " · 虚影手").replace(/_(\d+)$/, " · 第 $1 句后");
|
|
181
|
+
};
|
|
182
|
+
function useEscape(close, live = true) {
|
|
183
|
+
const f = (0, react.useRef)(close);
|
|
184
|
+
f.current = close;
|
|
185
|
+
(0, react.useEffect)(() => {
|
|
186
|
+
if (!live) return;
|
|
187
|
+
const k = (e) => {
|
|
188
|
+
if (e.key === "Escape") {
|
|
189
|
+
e.stopPropagation();
|
|
190
|
+
f.current();
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
addEventListener("keydown", k, true);
|
|
194
|
+
return () => removeEventListener("keydown", k, true);
|
|
195
|
+
}, [live]);
|
|
196
|
+
}
|
|
197
|
+
function Copy({ text, label = "复制" }) {
|
|
198
|
+
const [ok, setOk] = (0, react.useState)(false);
|
|
199
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
200
|
+
className: "text",
|
|
201
|
+
onClick: () => {
|
|
202
|
+
navigator.clipboard.writeText(text).then(() => {
|
|
203
|
+
setOk(true);
|
|
204
|
+
setTimeout(() => setOk(false), 1500);
|
|
205
|
+
});
|
|
206
|
+
},
|
|
207
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(I, {
|
|
208
|
+
d: ok ? D.check : D.copy,
|
|
209
|
+
s: 14
|
|
210
|
+
}), ok ? "已复制" : label]
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
/** A button that asks once more in place before doing something big. */
|
|
214
|
+
function Sure({ children, ask, run, cls = "line", disabled, tip }) {
|
|
215
|
+
const [armed, setArmed] = (0, react.useState)(false);
|
|
216
|
+
if (armed && ask) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
217
|
+
className: "sure",
|
|
218
|
+
children: [
|
|
219
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: ask }),
|
|
220
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
221
|
+
className: "text",
|
|
222
|
+
onClick: () => setArmed(false),
|
|
223
|
+
children: "算了"
|
|
224
|
+
}),
|
|
225
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
226
|
+
className: "solid",
|
|
227
|
+
autoFocus: true,
|
|
228
|
+
onClick: () => {
|
|
229
|
+
setArmed(false);
|
|
230
|
+
run();
|
|
231
|
+
},
|
|
232
|
+
children: "确定"
|
|
233
|
+
})
|
|
234
|
+
]
|
|
235
|
+
});
|
|
236
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
237
|
+
className: cls,
|
|
238
|
+
disabled,
|
|
239
|
+
"data-tip": tip,
|
|
240
|
+
onClick: () => ask ? setArmed(true) : run(),
|
|
241
|
+
children
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
function JobLog({ ids, onDone }) {
|
|
245
|
+
const [jobs, setJobs] = (0, react.useState)([]), pre = (0, react.useRef)(null), done = (0, react.useRef)(false);
|
|
246
|
+
(0, react.useEffect)(() => {
|
|
247
|
+
done.current = false;
|
|
248
|
+
let live = true;
|
|
249
|
+
const tick = async () => {
|
|
250
|
+
try {
|
|
251
|
+
const r = await get(`jobs?ids=${ids.join(",")}&lines=80`);
|
|
252
|
+
if (!live) return;
|
|
253
|
+
setJobs(r.jobs);
|
|
254
|
+
if (r.jobs.every((j) => j.state !== "running") && !done.current) {
|
|
255
|
+
done.current = true;
|
|
256
|
+
onDone();
|
|
257
|
+
}
|
|
258
|
+
} catch {}
|
|
259
|
+
};
|
|
260
|
+
tick();
|
|
261
|
+
const t = setInterval(() => void tick(), 1500);
|
|
262
|
+
return () => {
|
|
263
|
+
live = false;
|
|
264
|
+
clearInterval(t);
|
|
265
|
+
};
|
|
266
|
+
}, [ids.join()]);
|
|
267
|
+
(0, react.useEffect)(() => {
|
|
268
|
+
const p = pre.current;
|
|
269
|
+
if (p) p.scrollTop = p.scrollHeight;
|
|
270
|
+
}, [jobs]);
|
|
271
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: jobs.map((j) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
272
|
+
className: `job ${j.state}`,
|
|
273
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
274
|
+
className: "row",
|
|
275
|
+
children: [
|
|
276
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: j.title }),
|
|
277
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "grow" }),
|
|
278
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
279
|
+
className: "state",
|
|
280
|
+
children: j.state === "running" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("i", { className: "spin" }), "进行中"] }) : j.state === "done" ? "完成" : `没成功(${j.code})`
|
|
281
|
+
})
|
|
282
|
+
]
|
|
283
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
|
|
284
|
+
ref: pre,
|
|
285
|
+
children: j.output.split("\n").filter((l) => !l.startsWith("$ ")).join("\n")
|
|
286
|
+
})]
|
|
287
|
+
}, j.id)) });
|
|
288
|
+
}
|
|
289
|
+
function Env({ s, reload }) {
|
|
290
|
+
const [jobs, setJobs] = (0, react.useState)([]), [err, setErr] = (0, react.useState)("");
|
|
291
|
+
const install = (dep) => post("install", { dep }).then((r) => setJobs((x) => [...x, r.job]), (e) => setErr(e.message));
|
|
292
|
+
const big = {
|
|
293
|
+
"unity-editor": "会下载约 8 GB,装 Unity 编辑器和 Android 模块,要一阵子。确定?",
|
|
294
|
+
"unity-cli": "会从 unity.com 下载安装 Unity 命令行。确定?",
|
|
295
|
+
"whisper-model": "会下载约 550 MB 的模型。确定?"
|
|
296
|
+
};
|
|
297
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
298
|
+
className: "card",
|
|
299
|
+
children: [
|
|
300
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
301
|
+
className: "row",
|
|
302
|
+
children: [
|
|
303
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", { children: "准备环境" }),
|
|
304
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "grow" }),
|
|
305
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
306
|
+
className: "text",
|
|
307
|
+
onClick: () => void reload(true),
|
|
308
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(I, {
|
|
309
|
+
d: D.refresh,
|
|
310
|
+
s: 14
|
|
311
|
+
}), "重新检查"]
|
|
312
|
+
})
|
|
313
|
+
]
|
|
314
|
+
}),
|
|
315
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
316
|
+
className: "mut",
|
|
317
|
+
children: s.deps.ok ? "这台电脑能搭世界了。" : "缺的东西按顺序装上就行。能代装的点“安装”;标着“要你自己做”的,照着说明在终端里做。"
|
|
318
|
+
}),
|
|
319
|
+
err && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
320
|
+
className: "err",
|
|
321
|
+
role: "alert",
|
|
322
|
+
children: err
|
|
323
|
+
}),
|
|
324
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
325
|
+
className: "deps",
|
|
326
|
+
children: s.deps.deps.map((d) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
|
|
327
|
+
className: d.ok ? "ok" : d.required ? "miss" : "opt",
|
|
328
|
+
children: [
|
|
329
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
330
|
+
className: "dot",
|
|
331
|
+
children: d.ok ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(I, {
|
|
332
|
+
d: D.check,
|
|
333
|
+
s: 13
|
|
334
|
+
}) : null
|
|
335
|
+
}),
|
|
336
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
337
|
+
className: "grow",
|
|
338
|
+
children: [
|
|
339
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: d.name }),
|
|
340
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("small", { children: [d.ok ? d.found : d.why, !d.ok && d.note ? `。${d.note}` : ""] }),
|
|
341
|
+
!d.ok && !d.install && d.manual && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
342
|
+
className: "manual",
|
|
343
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: ["要你自己做:", d.manual] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Copy, {
|
|
344
|
+
text: d.manual.replace(/^.*?:/, ""),
|
|
345
|
+
label: "复制命令"
|
|
346
|
+
})]
|
|
347
|
+
})
|
|
348
|
+
]
|
|
349
|
+
}),
|
|
350
|
+
!d.ok && d.install && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Sure, {
|
|
351
|
+
cls: "line small",
|
|
352
|
+
ask: big[d.id],
|
|
353
|
+
run: () => void install(d.id),
|
|
354
|
+
children: "安装"
|
|
355
|
+
}),
|
|
356
|
+
!d.ok && !d.required && !d.install && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
357
|
+
className: "mut small",
|
|
358
|
+
children: "可选"
|
|
359
|
+
})
|
|
360
|
+
]
|
|
361
|
+
}, d.id))
|
|
362
|
+
}),
|
|
363
|
+
jobs.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(JobLog, {
|
|
364
|
+
ids: jobs,
|
|
365
|
+
onDone: () => void reload(true)
|
|
366
|
+
})
|
|
367
|
+
]
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
function Create({ created, first }) {
|
|
371
|
+
const [f, setF] = (0, react.useState)({
|
|
372
|
+
title: "",
|
|
373
|
+
slug: "",
|
|
374
|
+
audience: "",
|
|
375
|
+
pitch: "",
|
|
376
|
+
from: "starter"
|
|
377
|
+
}), [err, setErr] = (0, react.useState)(""), [busy, setBusy] = (0, react.useState)(false);
|
|
378
|
+
const set = (k) => (e) => setF({
|
|
379
|
+
...f,
|
|
380
|
+
[k]: e.target.value
|
|
381
|
+
});
|
|
382
|
+
const ok = f.title.trim() && /^[a-z][a-z0-9-]{1,39}$/.test(f.slug);
|
|
383
|
+
const go = async () => {
|
|
384
|
+
setBusy(true);
|
|
385
|
+
setErr("");
|
|
386
|
+
try {
|
|
387
|
+
created((await post("create", {
|
|
388
|
+
...f,
|
|
389
|
+
audience: f.audience || void 0,
|
|
390
|
+
pitch: f.pitch || void 0
|
|
391
|
+
})).slug);
|
|
392
|
+
} catch (e) {
|
|
393
|
+
setErr(e.message);
|
|
394
|
+
} finally {
|
|
395
|
+
setBusy(false);
|
|
396
|
+
}
|
|
397
|
+
};
|
|
398
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
399
|
+
className: first ? "hero" : "card",
|
|
400
|
+
children: [
|
|
401
|
+
first ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", { children: "搭一个能走进去的世界" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
402
|
+
className: "mut center",
|
|
403
|
+
children: "在 PICO 头显里上的一堂十分钟互动课:旁白引导,每一步都由你的手完成。"
|
|
404
|
+
})] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", { children: "新建世界" }),
|
|
405
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
406
|
+
className: "form",
|
|
407
|
+
children: [
|
|
408
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "课名" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
409
|
+
value: f.title,
|
|
410
|
+
onChange: set("title"),
|
|
411
|
+
placeholder: "光合作用",
|
|
412
|
+
autoFocus: true
|
|
413
|
+
})] }),
|
|
414
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [
|
|
415
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "英文名" }),
|
|
416
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
417
|
+
value: f.slug,
|
|
418
|
+
onChange: (e) => setF({
|
|
419
|
+
...f,
|
|
420
|
+
slug: e.target.value.toLowerCase().replace(/[^a-z0-9-]/g, "")
|
|
421
|
+
}),
|
|
422
|
+
placeholder: "photosynthesis"
|
|
423
|
+
}),
|
|
424
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", { children: "当目录名和包名,小写字母、数字、连字符" })
|
|
425
|
+
] }),
|
|
426
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "给谁上" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
427
|
+
value: f.audience,
|
|
428
|
+
onChange: set("audience"),
|
|
429
|
+
placeholder: "初中生"
|
|
430
|
+
})] }),
|
|
431
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "一句话" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
432
|
+
value: f.pitch,
|
|
433
|
+
onChange: set("pitch"),
|
|
434
|
+
placeholder: "植物怎样把光变成糖"
|
|
435
|
+
})] }),
|
|
436
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
437
|
+
className: "lab",
|
|
438
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "从哪开始" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
439
|
+
className: "seg",
|
|
440
|
+
children: [["starter", "起步课(两章:碰、搬)"], ["llm-lesson", "完整示例《走进大模型》"]].map(([k, v]) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
441
|
+
className: f.from === k ? "on" : "",
|
|
442
|
+
"aria-pressed": f.from === k,
|
|
443
|
+
onClick: () => setF({
|
|
444
|
+
...f,
|
|
445
|
+
from: k
|
|
446
|
+
}),
|
|
447
|
+
children: v
|
|
448
|
+
}, k))
|
|
449
|
+
})]
|
|
450
|
+
})
|
|
451
|
+
]
|
|
452
|
+
}),
|
|
453
|
+
err && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
454
|
+
className: "err",
|
|
455
|
+
role: "alert",
|
|
456
|
+
children: err
|
|
457
|
+
}),
|
|
458
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
459
|
+
className: "acts",
|
|
460
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
461
|
+
className: "solid",
|
|
462
|
+
disabled: !ok || busy,
|
|
463
|
+
onClick: () => void go(),
|
|
464
|
+
children: [busy ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("i", { className: "spin" }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(I, { d: D.plus }), "生成世界"]
|
|
465
|
+
})
|
|
466
|
+
})
|
|
467
|
+
]
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
function Shots({ slug, shots }) {
|
|
471
|
+
const [at, setAt] = (0, react.useState)();
|
|
472
|
+
useEscape(() => setAt(void 0), at !== void 0);
|
|
473
|
+
(0, react.useEffect)(() => {
|
|
474
|
+
if (at === void 0) return;
|
|
475
|
+
const k = (e) => {
|
|
476
|
+
if (e.key === "ArrowRight") setAt((a) => Math.min(shots.length - 1, (a ?? 0) + 1));
|
|
477
|
+
if (e.key === "ArrowLeft") setAt((a) => Math.max(0, (a ?? 0) - 1));
|
|
478
|
+
};
|
|
479
|
+
addEventListener("keydown", k);
|
|
480
|
+
return () => removeEventListener("keydown", k);
|
|
481
|
+
}, [at, shots.length]);
|
|
482
|
+
const name = (p) => p.split("/").pop();
|
|
483
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
484
|
+
className: "shots",
|
|
485
|
+
children: shots.map((p, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
486
|
+
onClick: () => setAt(i),
|
|
487
|
+
"aria-label": shotName(p),
|
|
488
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
489
|
+
src: file(slug, "shot", name(p)),
|
|
490
|
+
alt: "",
|
|
491
|
+
loading: "lazy"
|
|
492
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: shotName(p) })]
|
|
493
|
+
}, p))
|
|
494
|
+
}), at !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
495
|
+
className: "lightbox",
|
|
496
|
+
role: "dialog",
|
|
497
|
+
"aria-modal": "true",
|
|
498
|
+
"aria-label": "试玩截图",
|
|
499
|
+
onClick: (e) => e.target === e.currentTarget && setAt(void 0),
|
|
500
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
501
|
+
src: file(slug, "shot", name(shots[at])),
|
|
502
|
+
alt: shotName(shots[at])
|
|
503
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
504
|
+
className: "lb-bar",
|
|
505
|
+
children: [
|
|
506
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
507
|
+
className: "icon",
|
|
508
|
+
"aria-label": "上一张",
|
|
509
|
+
disabled: at === 0,
|
|
510
|
+
onClick: () => setAt(at - 1),
|
|
511
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(I, { d: D.left })
|
|
512
|
+
}),
|
|
513
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
|
|
514
|
+
shotName(shots[at]),
|
|
515
|
+
" ",
|
|
516
|
+
at + 1,
|
|
517
|
+
" / ",
|
|
518
|
+
shots.length
|
|
519
|
+
] }),
|
|
520
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
521
|
+
className: "icon",
|
|
522
|
+
"aria-label": "下一张",
|
|
523
|
+
disabled: at === shots.length - 1,
|
|
524
|
+
onClick: () => setAt(at + 1),
|
|
525
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(I, { d: D.right })
|
|
526
|
+
}),
|
|
527
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
528
|
+
className: "icon",
|
|
529
|
+
"aria-label": "关闭",
|
|
530
|
+
onClick: () => setAt(void 0),
|
|
531
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(I, { d: D.x })
|
|
532
|
+
})
|
|
533
|
+
]
|
|
534
|
+
})]
|
|
535
|
+
})] });
|
|
536
|
+
}
|
|
537
|
+
function Lines({ slug, script, missing }) {
|
|
538
|
+
const [playing, setPlaying] = (0, react.useState)(), audio = (0, react.useRef)(null);
|
|
539
|
+
const play = (key) => {
|
|
540
|
+
audio.current?.pause();
|
|
541
|
+
if (playing === key) {
|
|
542
|
+
setPlaying(void 0);
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
545
|
+
const a = new Audio(file(slug, "line", key));
|
|
546
|
+
a.onended = () => setPlaying(void 0);
|
|
547
|
+
a.play();
|
|
548
|
+
audio.current = a;
|
|
549
|
+
setPlaying(key);
|
|
550
|
+
};
|
|
551
|
+
(0, react.useEffect)(() => () => audio.current?.pause(), []);
|
|
552
|
+
const KIND = {
|
|
553
|
+
讲: "讲",
|
|
554
|
+
示: "提示",
|
|
555
|
+
续: "接续"
|
|
556
|
+
};
|
|
557
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
558
|
+
className: "lines",
|
|
559
|
+
children: [(script?.chapters ?? []).map((c) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("h3", { children: [
|
|
560
|
+
c.chapter === "intro" ? "开场" : `第 ${c.chapter + 1} 章`,
|
|
561
|
+
" ",
|
|
562
|
+
c.title
|
|
563
|
+
] }), c.lines.map((l) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
564
|
+
className: `line-row ${l.audio ? "" : "mute"}`,
|
|
565
|
+
children: [
|
|
566
|
+
l.audio ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
567
|
+
className: "icon small",
|
|
568
|
+
"aria-label": `播放 ${l.key}`,
|
|
569
|
+
onClick: () => play(l.key),
|
|
570
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(I, {
|
|
571
|
+
d: playing === l.key ? D.stop : D.play,
|
|
572
|
+
s: 13
|
|
573
|
+
})
|
|
574
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
575
|
+
className: "icon small",
|
|
576
|
+
"data-tip": "还没有录音",
|
|
577
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(I, {
|
|
578
|
+
d: D.mic,
|
|
579
|
+
s: 13
|
|
580
|
+
})
|
|
581
|
+
}),
|
|
582
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
583
|
+
className: `kind k-${l.kind}`,
|
|
584
|
+
children: KIND[l.kind] ?? l.kind
|
|
585
|
+
}),
|
|
586
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
587
|
+
className: "grow",
|
|
588
|
+
children: l.subtitle
|
|
589
|
+
}),
|
|
590
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: l.key })
|
|
591
|
+
]
|
|
592
|
+
}, l.key))] }, String(c.chapter))), missing.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
593
|
+
className: "mut small",
|
|
594
|
+
children: [missing.length, " 句还没有录音:没录音时字幕按字数停留,课照样能跑。"]
|
|
595
|
+
})]
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
function World({ slug, s, back }) {
|
|
599
|
+
const [v, setV] = (0, react.useState)(), [err, setErr] = (0, react.useState)(""), [jobs, setJobs] = (0, react.useState)([]), [tab, setTab] = (0, react.useState)("play"), [prompts, setPrompts] = (0, react.useState)();
|
|
600
|
+
const load = (0, react.useCallback)(async () => {
|
|
601
|
+
try {
|
|
602
|
+
setV(await get(`world?slug=${encodeURIComponent(slug)}`));
|
|
603
|
+
setErr("");
|
|
604
|
+
} catch (e) {
|
|
605
|
+
setErr(e.message);
|
|
606
|
+
}
|
|
607
|
+
}, [slug]);
|
|
608
|
+
(0, react.useEffect)(() => {
|
|
609
|
+
setV(void 0);
|
|
610
|
+
setJobs([]);
|
|
611
|
+
setPrompts(void 0);
|
|
612
|
+
load();
|
|
613
|
+
const t = setInterval(() => {
|
|
614
|
+
if (!document.hidden) load();
|
|
615
|
+
}, 5e3);
|
|
616
|
+
return () => clearInterval(t);
|
|
617
|
+
}, [load]);
|
|
618
|
+
(0, react.useEffect)(() => {
|
|
619
|
+
if (v?.running?.length) setJobs((x) => [.../* @__PURE__ */ new Set([...x, ...v.running.map((r) => r.id)])]);
|
|
620
|
+
}, [v?.running?.map((r) => r.id).join()]);
|
|
621
|
+
const act = (route, body = {}) => post(route, {
|
|
622
|
+
slug,
|
|
623
|
+
...body
|
|
624
|
+
}).then((r) => {
|
|
625
|
+
if (r.job) setJobs((x) => [...x, r.job]);
|
|
626
|
+
load();
|
|
627
|
+
}, (e) => setErr(e.message));
|
|
628
|
+
if (!v) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
|
|
629
|
+
className: "card",
|
|
630
|
+
children: err ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
631
|
+
className: "err",
|
|
632
|
+
children: err
|
|
633
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
634
|
+
className: "mut",
|
|
635
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("i", { className: "spin" }), " 读取中…"]
|
|
636
|
+
})
|
|
637
|
+
});
|
|
638
|
+
const w = v.world, open = !!v.editor, busy = v.running.length > 0, lines = (v.script?.chapters ?? []).flatMap((c) => c.lines), voiced = lines.filter((l) => l.audio).length;
|
|
639
|
+
const heads = (s.headsets ?? []).filter((d) => d.state === "device"), ap = v.autoplay, problems = v.check?.problems ?? [];
|
|
640
|
+
const missingDeps = !s.deps.ok;
|
|
641
|
+
const writePrompt = `用 PICO 世界工坊继续写世界「${w.title}」(${w.slug})。先读世界目录 ${w.dir} 里的 AUTHORING.md 和 ART.md,再按 WORLD.md 的课纲改写 SCRIPT.md 和 Assets/PicoWorld/Scripts/Course/ 里的章节,改完用 pico_world_check 核对、pico_world_autoplay 自动试玩,看截图把问题改掉。`;
|
|
642
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
643
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
644
|
+
className: "card",
|
|
645
|
+
children: [
|
|
646
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
647
|
+
className: "row",
|
|
648
|
+
children: [
|
|
649
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
650
|
+
className: "icon narrow-only",
|
|
651
|
+
"aria-label": "返回",
|
|
652
|
+
onClick: back,
|
|
653
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(I, { d: D.left })
|
|
654
|
+
}),
|
|
655
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
|
|
656
|
+
className: "title",
|
|
657
|
+
children: w.title
|
|
658
|
+
}),
|
|
659
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "grow" }),
|
|
660
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
661
|
+
className: "text",
|
|
662
|
+
onClick: () => void post("reveal", { slug }),
|
|
663
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(I, {
|
|
664
|
+
d: D.folder,
|
|
665
|
+
s: 14
|
|
666
|
+
}), "在访达中显示"]
|
|
667
|
+
})
|
|
668
|
+
]
|
|
669
|
+
}),
|
|
670
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
671
|
+
className: "mut small",
|
|
672
|
+
children: [
|
|
673
|
+
w.audience ? `给${w.audience} · ` : "",
|
|
674
|
+
w.packageId,
|
|
675
|
+
" · ",
|
|
676
|
+
w.from === "llm-lesson" ? "来自示例《走进大模型》" : "来自起步课"
|
|
677
|
+
]
|
|
678
|
+
}),
|
|
679
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
680
|
+
className: "chips",
|
|
681
|
+
children: [
|
|
682
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
683
|
+
className: `chip ${open ? "good" : ""}`,
|
|
684
|
+
children: open ? "Unity 编辑器开着" : "Unity 编辑器没开"
|
|
685
|
+
}),
|
|
686
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
687
|
+
className: `chip ${v.sdk.ok ? "good" : ""}`,
|
|
688
|
+
"data-tip": v.sdk.note,
|
|
689
|
+
children: v.sdk.ok ? "PICO XR SDK 已取到" : "PICO XR SDK 待取(第一次打开时自动下载)"
|
|
690
|
+
}),
|
|
691
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
692
|
+
className: `chip ${voiced === lines.length && lines.length ? "good" : ""}`,
|
|
693
|
+
children: [
|
|
694
|
+
"旁白 ",
|
|
695
|
+
voiced,
|
|
696
|
+
" / ",
|
|
697
|
+
lines.length,
|
|
698
|
+
" 有录音"
|
|
699
|
+
]
|
|
700
|
+
}),
|
|
701
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
702
|
+
className: `chip ${problems.length ? "warn" : "good"}`,
|
|
703
|
+
children: problems.length ? `台词表有 ${problems.length} 处对不上` : "台词表和代码一致"
|
|
704
|
+
}),
|
|
705
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
706
|
+
className: `chip ${heads.length ? "good" : ""}`,
|
|
707
|
+
children: heads.length ? `连着 ${heads.length} 台头显` : "没连头显"
|
|
708
|
+
}),
|
|
709
|
+
v.apk && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
710
|
+
className: "chip",
|
|
711
|
+
children: ["APK ", when(v.apk.at)]
|
|
712
|
+
})
|
|
713
|
+
]
|
|
714
|
+
}),
|
|
715
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
716
|
+
className: "acts",
|
|
717
|
+
children: [
|
|
718
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Sure, {
|
|
719
|
+
cls: "solid",
|
|
720
|
+
disabled: open || busy || missingDeps,
|
|
721
|
+
tip: missingDeps ? "先把环境准备好" : open ? "已经开着" : void 0,
|
|
722
|
+
ask: v.sdk.ok ? void 0 : "第一次打开要从 GitHub 下载 PICO XR SDK、导入资源,十来分钟。打开吗?",
|
|
723
|
+
run: () => void act("open"),
|
|
724
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(I, { d: D.open }), "在 Unity 里打开"]
|
|
725
|
+
}),
|
|
726
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
727
|
+
className: "line",
|
|
728
|
+
disabled: !open || busy,
|
|
729
|
+
"data-tip": !open ? "先在 Unity 里打开" : "编译、搭场景、整堂课自动走一遍:等手的地方模拟手靠近、虚影手示范后跳过;3 倍速、静音,每句旁白截一张图",
|
|
730
|
+
onClick: () => void act("autoplay"),
|
|
731
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(I, { d: D.play }), "自动试玩"]
|
|
732
|
+
}),
|
|
733
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
734
|
+
className: "line",
|
|
735
|
+
disabled: !open || busy,
|
|
736
|
+
"data-tip": !open ? "先在 Unity 里打开" : "编译、搭场景、打出 APK,不装",
|
|
737
|
+
onClick: () => void act("deploy", { buildOnly: true }),
|
|
738
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(I, { d: D.box }), "打包 APK"]
|
|
739
|
+
}),
|
|
740
|
+
heads.length > 1 ? heads.map((d) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Sure, {
|
|
741
|
+
disabled: !open || busy,
|
|
742
|
+
ask: `装进 ${d.serial} 并启动?`,
|
|
743
|
+
run: () => void act("deploy", { serial: d.serial }),
|
|
744
|
+
children: [
|
|
745
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(I, { d: D.send }),
|
|
746
|
+
"装进 ",
|
|
747
|
+
d.serial.slice(-4)
|
|
748
|
+
]
|
|
749
|
+
}, d.serial)) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Sure, {
|
|
750
|
+
disabled: !open || busy || !heads.length,
|
|
751
|
+
tip: !heads.length ? "头显打开开发者模式、USB 连上电脑、在头显里允许 USB 调试" : !open ? "先在 Unity 里打开" : void 0,
|
|
752
|
+
ask: "打包后装进头显并启动?装好后在头显里确认一下安全边界。",
|
|
753
|
+
run: () => void act("deploy"),
|
|
754
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(I, { d: D.send }), "装进头显"]
|
|
755
|
+
})
|
|
756
|
+
]
|
|
757
|
+
}),
|
|
758
|
+
err && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
759
|
+
className: "err",
|
|
760
|
+
role: "alert",
|
|
761
|
+
children: err
|
|
762
|
+
}),
|
|
763
|
+
jobs.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(JobLog, {
|
|
764
|
+
ids: jobs,
|
|
765
|
+
onDone: () => void load()
|
|
766
|
+
})
|
|
767
|
+
]
|
|
768
|
+
}),
|
|
769
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
|
|
770
|
+
className: "tabs",
|
|
771
|
+
children: [
|
|
772
|
+
["play", "试玩"],
|
|
773
|
+
["lines", `台词 ${lines.length}`],
|
|
774
|
+
["write", "写课和配音"]
|
|
775
|
+
].map(([k, t]) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
776
|
+
className: tab === k ? "on" : "",
|
|
777
|
+
"aria-pressed": tab === k,
|
|
778
|
+
onClick: () => setTab(k),
|
|
779
|
+
children: t
|
|
780
|
+
}, k))
|
|
781
|
+
}),
|
|
782
|
+
tab === "play" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
|
|
783
|
+
className: "card",
|
|
784
|
+
children: !ap.screenshots.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
785
|
+
className: "mut",
|
|
786
|
+
children: "还没试玩过。点上面的“自动试玩”,编辑器里会把整堂课走一遍,截图会出现在这里。"
|
|
787
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
788
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
789
|
+
className: "mut small",
|
|
790
|
+
children: [ap.finished ? `走完了:${ap.chapters?.length ?? 0} 章,游戏时间 ${ap.seconds} 秒(3 倍速)` : "上次没走完:看上面的日志,多半是某一章报错了", ap.linesWithoutAudio?.length ? `;${ap.linesWithoutAudio.length} 句没有录音` : ""]
|
|
791
|
+
}),
|
|
792
|
+
ap.chapters?.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
793
|
+
className: "chips",
|
|
794
|
+
children: ap.chapters.map((c) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
795
|
+
className: "chip",
|
|
796
|
+
children: c.title
|
|
797
|
+
}, c.index))
|
|
798
|
+
}),
|
|
799
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Shots, {
|
|
800
|
+
slug,
|
|
801
|
+
shots: ap.screenshots
|
|
802
|
+
})
|
|
803
|
+
] })
|
|
804
|
+
}),
|
|
805
|
+
tab === "lines" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
806
|
+
className: "card",
|
|
807
|
+
children: [problems.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
808
|
+
className: "problems",
|
|
809
|
+
children: problems.map((p, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: p }, i))
|
|
810
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Lines, {
|
|
811
|
+
slug,
|
|
812
|
+
script: v.script,
|
|
813
|
+
missing: v.check?.missingNarration ?? []
|
|
814
|
+
})]
|
|
815
|
+
}),
|
|
816
|
+
tab === "write" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
817
|
+
className: "card",
|
|
818
|
+
children: [
|
|
819
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", { children: "写课" }),
|
|
820
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
821
|
+
className: "mut",
|
|
822
|
+
children: "课的内容是代码和台词表,交给对话里的 Agent 写最顺手:把下面这段发给它。它会读框架说明、改章节和台词,再自动试玩、看截图改问题。"
|
|
823
|
+
}),
|
|
824
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
825
|
+
className: "quote",
|
|
826
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: writePrompt }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Copy, { text: writePrompt })]
|
|
827
|
+
}),
|
|
828
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", { children: "配音" }),
|
|
829
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
830
|
+
className: "mut",
|
|
831
|
+
children: "旁白用 Seed Audio 1.5,每章一次生成整段,全程用同一个参考音色。生成要花 LibLib 积分:在对话里让 Agent 生成,它会先问你。先在这里看看每章的提示词(不花钱):"
|
|
832
|
+
}),
|
|
833
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
834
|
+
className: "acts",
|
|
835
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
836
|
+
className: "line",
|
|
837
|
+
onClick: () => void post("prompts", { slug }).then(setPrompts, (e) => setErr(e.message)),
|
|
838
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(I, { d: D.mic }), "生成配音提示词"]
|
|
839
|
+
})
|
|
840
|
+
}),
|
|
841
|
+
prompts && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [prompts.note && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
842
|
+
className: "mut small",
|
|
843
|
+
children: prompts.note
|
|
844
|
+
}), prompts.prompts.map((p) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
845
|
+
className: "quote",
|
|
846
|
+
children: [
|
|
847
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: p.chapter === "intro" ? "开场" : `第 ${p.chapter + 1} 章` }),
|
|
848
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", { children: p.prompt }),
|
|
849
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Copy, { text: p.prompt })
|
|
850
|
+
]
|
|
851
|
+
}, String(p.chapter)))] })
|
|
852
|
+
]
|
|
853
|
+
})
|
|
854
|
+
] });
|
|
855
|
+
}
|
|
856
|
+
function App() {
|
|
857
|
+
const [s, setS] = (0, react.useState)(), [view, setView] = (0, react.useState)(() => localStorage.getItem("pico-lab.view") ?? ""), [err, setErr] = (0, react.useState)("");
|
|
858
|
+
const load = (0, react.useCallback)(async (fresh = false) => {
|
|
859
|
+
try {
|
|
860
|
+
setS(await get(`state${fresh ? "?fresh=1" : ""}`));
|
|
861
|
+
setErr("");
|
|
862
|
+
} catch (e) {
|
|
863
|
+
setErr(e.message);
|
|
864
|
+
}
|
|
865
|
+
}, []);
|
|
866
|
+
(0, react.useEffect)(() => {
|
|
867
|
+
load();
|
|
868
|
+
const t = setInterval(() => {
|
|
869
|
+
if (!document.hidden) load();
|
|
870
|
+
}, 5e3);
|
|
871
|
+
return () => clearInterval(t);
|
|
872
|
+
}, [load]);
|
|
873
|
+
(0, react.useEffect)(() => {
|
|
874
|
+
localStorage.setItem("pico-lab.view", view);
|
|
875
|
+
}, [view]);
|
|
876
|
+
if (!s) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
877
|
+
className: "plb",
|
|
878
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
879
|
+
className: "plb-main",
|
|
880
|
+
children: err ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
881
|
+
className: "err",
|
|
882
|
+
children: err
|
|
883
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
884
|
+
className: "mut",
|
|
885
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("i", { className: "spin" })
|
|
886
|
+
})
|
|
887
|
+
})
|
|
888
|
+
});
|
|
889
|
+
const worlds = s.worlds, cur = worlds.find((w) => w.slug === view) ? view : view === "env" || view === "new" ? view : worlds[0]?.slug ?? (s.deps.ok ? "new" : "env");
|
|
890
|
+
const missing = s.deps.deps.filter((d) => d.required && !d.ok).length;
|
|
891
|
+
if (!worlds.length && cur !== "env") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
892
|
+
className: "plb",
|
|
893
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
894
|
+
className: "plb-main solo",
|
|
895
|
+
children: [missing > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Env, {
|
|
896
|
+
s,
|
|
897
|
+
reload: load
|
|
898
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Create, {
|
|
899
|
+
first: true,
|
|
900
|
+
created: (slug) => {
|
|
901
|
+
setView(slug);
|
|
902
|
+
load();
|
|
903
|
+
}
|
|
904
|
+
})]
|
|
905
|
+
})
|
|
906
|
+
});
|
|
907
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
908
|
+
className: `plb ${cur ? "picked" : ""}`,
|
|
909
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("aside", {
|
|
910
|
+
className: "plb-side",
|
|
911
|
+
children: [
|
|
912
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
913
|
+
className: "brand",
|
|
914
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Mark, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: NAME })]
|
|
915
|
+
}),
|
|
916
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
917
|
+
className: `nav ${cur === "env" ? "on" : ""}`,
|
|
918
|
+
onClick: () => setView("env"),
|
|
919
|
+
children: [
|
|
920
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(I, {
|
|
921
|
+
d: D.wrench,
|
|
922
|
+
s: 14
|
|
923
|
+
}),
|
|
924
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
925
|
+
className: "grow",
|
|
926
|
+
children: "准备环境"
|
|
927
|
+
}),
|
|
928
|
+
missing ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("em", {
|
|
929
|
+
className: "warn",
|
|
930
|
+
children: ["缺 ", missing]
|
|
931
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("em", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(I, {
|
|
932
|
+
d: D.check,
|
|
933
|
+
s: 12
|
|
934
|
+
}) })
|
|
935
|
+
]
|
|
936
|
+
}),
|
|
937
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
938
|
+
className: `nav ${cur === "new" ? "on" : ""}`,
|
|
939
|
+
onClick: () => setView("new"),
|
|
940
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(I, {
|
|
941
|
+
d: D.plus,
|
|
942
|
+
s: 14
|
|
943
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
944
|
+
className: "grow",
|
|
945
|
+
children: "新建世界"
|
|
946
|
+
})]
|
|
947
|
+
}),
|
|
948
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h4", { children: "世界" }),
|
|
949
|
+
worlds.map((w) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
950
|
+
className: `nav world ${cur === w.slug ? "on" : ""}`,
|
|
951
|
+
onClick: () => setView(w.slug),
|
|
952
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
953
|
+
className: "grow",
|
|
954
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: w.title }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("small", { children: [w.slug, w.apk ? " · 有 APK" : ""] })]
|
|
955
|
+
})
|
|
956
|
+
}, w.slug)),
|
|
957
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
958
|
+
className: "mut tiny",
|
|
959
|
+
children: ["世界放在 ", s.worldsDir]
|
|
960
|
+
})
|
|
961
|
+
]
|
|
962
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("main", {
|
|
963
|
+
className: "plb-main",
|
|
964
|
+
children: [err && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
965
|
+
className: "err",
|
|
966
|
+
children: err
|
|
967
|
+
}), cur === "env" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Env, {
|
|
968
|
+
s,
|
|
969
|
+
reload: load
|
|
970
|
+
}) : cur === "new" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Create, { created: (slug) => {
|
|
971
|
+
setView(slug);
|
|
972
|
+
load();
|
|
973
|
+
} }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(World, {
|
|
974
|
+
slug: cur,
|
|
975
|
+
s,
|
|
976
|
+
back: () => setView("")
|
|
977
|
+
}, cur)]
|
|
978
|
+
})]
|
|
979
|
+
});
|
|
980
|
+
}
|
|
981
|
+
function Button(p) {
|
|
982
|
+
const h = useHere();
|
|
983
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
984
|
+
className: `plb-side-btn ${p.wide ? "wide" : "rail"} ${h ? "here" : ""}`,
|
|
985
|
+
title: NAME,
|
|
986
|
+
onClick: () => panel ? panel.select(ID) : setHere(!here),
|
|
987
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Mark, {}), p.wide && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: NAME })]
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
function Overlay() {
|
|
991
|
+
const h = useHere();
|
|
992
|
+
return !panel && h ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
993
|
+
className: "plb-over",
|
|
994
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(App, {})
|
|
995
|
+
}) : null;
|
|
996
|
+
}
|
|
997
|
+
function apply(ctx) {
|
|
998
|
+
ctx.effect(() => {
|
|
999
|
+
const el = document.createElement("style");
|
|
1000
|
+
el.textContent = CSS;
|
|
1001
|
+
document.head.append(el);
|
|
1002
|
+
return () => el.remove();
|
|
1003
|
+
}, "dsh-pico-lab: styles");
|
|
1004
|
+
ctx.slots.inject("sidebar.footer.action", () => ctx.slots.register({
|
|
1005
|
+
name: "sidebar.footer.action",
|
|
1006
|
+
id: "dsh-pico-lab",
|
|
1007
|
+
order: 56,
|
|
1008
|
+
label: () => NAME,
|
|
1009
|
+
inject: () => ({})
|
|
1010
|
+
}, Button));
|
|
1011
|
+
ctx.slots.inject("shell.overlay", () => ctx.slots.register({
|
|
1012
|
+
name: "shell.overlay",
|
|
1013
|
+
id: "dsh-pico-lab.page",
|
|
1014
|
+
order: 56,
|
|
1015
|
+
label: () => NAME,
|
|
1016
|
+
inject: () => ({})
|
|
1017
|
+
}, Overlay));
|
|
1018
|
+
ctx.inject(["layout"], (c) => {
|
|
1019
|
+
c.effect(() => {
|
|
1020
|
+
panel = {
|
|
1021
|
+
select: (id) => c.layout.selectPanel(id),
|
|
1022
|
+
active: () => c.layout.panelInfo.getSnapshot().activePanelId
|
|
1023
|
+
};
|
|
1024
|
+
const sync = () => setHere(panel?.active() === ID), off = c.layout.panelInfo.subscribe(sync);
|
|
1025
|
+
sync();
|
|
1026
|
+
return () => {
|
|
1027
|
+
off();
|
|
1028
|
+
panel = void 0;
|
|
1029
|
+
};
|
|
1030
|
+
}, "dsh-pico-lab: panel");
|
|
1031
|
+
c.slots.inject("main", () => c.slots.register({
|
|
1032
|
+
name: "main",
|
|
1033
|
+
key: ID,
|
|
1034
|
+
inject: () => ({})
|
|
1035
|
+
}, App));
|
|
1036
|
+
});
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
exports.apply = apply;
|
|
1040
|
+
exports.inject = inject;
|
|
1041
|
+
return module.exports; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { P as waitJobs } from "./core-RKJbGowf.mjs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { execFile, spawn } from "node:child_process";
|
|
2
|
-
import { cpSync, createWriteStream, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, writeFileSync } from "node:fs";
|
|
3
|
-
import { homedir } from "node:os";
|
|
2
|
+
import { cpSync, createWriteStream, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, statSync, writeFileSync } from "node:fs";
|
|
4
3
|
import { basename, dirname, isAbsolute, join, resolve } from "node:path";
|
|
4
|
+
import { homedir } from "node:os";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import { promisify } from "node:util";
|
|
7
7
|
// src/core.ts
|
|
@@ -452,11 +452,10 @@ async function devices() {
|
|
|
452
452
|
return {
|
|
453
453
|
adb,
|
|
454
454
|
devices: (await out(adb, ["devices", "-l"]) ?? "").split("\n").slice(1).filter((l) => l.trim()).map((l) => {
|
|
455
|
-
const [serial, state
|
|
455
|
+
const [serial, state] = l.trim().split(/\s+/);
|
|
456
456
|
return {
|
|
457
457
|
serial,
|
|
458
|
-
state
|
|
459
|
-
info: rest.join(" ")
|
|
458
|
+
state
|
|
460
459
|
};
|
|
461
460
|
})
|
|
462
461
|
};
|
|
@@ -570,4 +569,44 @@ async function makeSfx(o, dir) {
|
|
|
570
569
|
output: (r.stdout + r.stderr).trim().slice(-3e3)
|
|
571
570
|
};
|
|
572
571
|
}
|
|
573
|
-
|
|
572
|
+
async function scriptStatus(o, dir) {
|
|
573
|
+
const r = await py(o, dir, ["tools/world.py", "status"]);
|
|
574
|
+
return r.ok ? asJson(r.stdout) : { error: r.stderr.trim().slice(-800) };
|
|
575
|
+
}
|
|
576
|
+
/** Everything the page shows for one world. */
|
|
577
|
+
async function worldView(o, dir) {
|
|
578
|
+
const [check, script, editor] = await Promise.all([
|
|
579
|
+
py(o, dir, ["tools/world.py", "check"]).then((r) => asJson(r.stdout)),
|
|
580
|
+
scriptStatus(o, dir),
|
|
581
|
+
editorFor(dir)
|
|
582
|
+
]);
|
|
583
|
+
const w = readWorld(dir);
|
|
584
|
+
const apk = join(dir, "Builds", `${w.slug}.apk`);
|
|
585
|
+
return {
|
|
586
|
+
world: w,
|
|
587
|
+
check,
|
|
588
|
+
script,
|
|
589
|
+
editor,
|
|
590
|
+
sdk: sdkStatus(dir),
|
|
591
|
+
autoplay: autoplayResult(dir),
|
|
592
|
+
apk: existsSync(apk) ? {
|
|
593
|
+
path: apk,
|
|
594
|
+
at: statSync(apk).mtime.toISOString()
|
|
595
|
+
} : void 0,
|
|
596
|
+
running: [...jobs.values()].filter((j) => j.cwd === dir && j.state === "running").map((j) => ({
|
|
597
|
+
id: j.id,
|
|
598
|
+
title: j.title
|
|
599
|
+
}))
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
function narrationFile(dir, key) {
|
|
603
|
+
for (const ext of [
|
|
604
|
+
".wav",
|
|
605
|
+
".mp3",
|
|
606
|
+
".ogg"
|
|
607
|
+
]) {
|
|
608
|
+
const p = join(dir, "Assets/PicoWorld/Resources/Narration", key + ext);
|
|
609
|
+
if (existsSync(p)) return p;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
export { splitTake as A, normalize as C, resolveWorld as D, readWorld as E, worldView as F, tail as M, voicePrompts as N, scriptStatus as O, waitJobs as P, narrationFile as S, pythonBin as T, editorFor as _, PROTECTED_PACKAGES as a, listWorlds as b, WHISPER_MODEL as c, checkDeps as d, checkWorld as f, devices as g, deploy as h, PKG_ROOT as i, startJob as j, sdkStatus as k, autoplay as l, defaults as m, EXAMPLE_IDS as n, TEMPLATE as o, createWorld as p, HOME as r, UNITY_VERSION as s, EXAMPLES as t, autoplayResult as u, env as v, openWorld as w, makeSfx as x, installDep as y };
|
package/lib/index.mjs
CHANGED
|
@@ -1,7 +1,35 @@
|
|
|
1
|
-
import { m as defaults } from "./core-
|
|
2
|
-
import { n as createTools, r as failure, t as GUIDE } from "./tools-
|
|
1
|
+
import { D as resolveWorld, F as worldView, N as voicePrompts, P as waitJobs, S as narrationFile, _ as editorFor, b as listWorlds, d as checkDeps, g as devices, h as deploy, l as autoplay, m as defaults, p as createWorld, w as openWorld, y as installDep } from "./core-RKJbGowf.mjs";
|
|
2
|
+
import { n as createTools, r as failure, t as GUIDE } from "./tools-DIoSAX2i.mjs";
|
|
3
|
+
import { execFile } from "node:child_process";
|
|
4
|
+
import { createReadStream, statSync } from "node:fs";
|
|
5
|
+
import { extname, join, resolve, sep } from "node:path";
|
|
3
6
|
import z from "@deepseek-ai/schemastery";
|
|
4
7
|
// src/index.ts
|
|
8
|
+
/** dsh-pico-lab:PICO Lab(PICO 世界工坊)。Agent 用 pico_world_* 工具从模板搭一堂能走进去的互动课,装依赖、试玩、配音、装进头显。 */
|
|
9
|
+
const TYPES = {
|
|
10
|
+
".png": "image/png",
|
|
11
|
+
".jpg": "image/jpeg",
|
|
12
|
+
".wav": "audio/wav",
|
|
13
|
+
".mp3": "audio/mpeg",
|
|
14
|
+
".ogg": "audio/ogg"
|
|
15
|
+
};
|
|
16
|
+
function send(res, status, v) {
|
|
17
|
+
res.writeHead(status, {
|
|
18
|
+
"content-type": "application/json; charset=utf-8",
|
|
19
|
+
"cache-control": "no-store"
|
|
20
|
+
});
|
|
21
|
+
res.end(JSON.stringify(v));
|
|
22
|
+
}
|
|
23
|
+
async function body(req) {
|
|
24
|
+
const c = [];
|
|
25
|
+
let n = 0;
|
|
26
|
+
for await (const b of req) {
|
|
27
|
+
n += b.length;
|
|
28
|
+
if (n > 1 << 20) throw new Error("太大");
|
|
29
|
+
c.push(b);
|
|
30
|
+
}
|
|
31
|
+
return JSON.parse(Buffer.concat(c).toString("utf8") || "{}");
|
|
32
|
+
}
|
|
5
33
|
const name = "dsh-pico-lab";
|
|
6
34
|
const d = defaults();
|
|
7
35
|
const Config = z.object({
|
|
@@ -9,11 +37,88 @@ const Config = z.object({
|
|
|
9
37
|
dataDir: z.string().default(d.dataDir).description("插件自己的 Python 环境、任务日志。"),
|
|
10
38
|
confirm: z.boolean().default(true).description("安装软件、往头显装世界前先问我。")
|
|
11
39
|
});
|
|
40
|
+
const inject = ["webServer"];
|
|
12
41
|
function apply(ctx, config) {
|
|
13
|
-
const
|
|
42
|
+
const o = {
|
|
14
43
|
worldsDir: config.worldsDir,
|
|
15
44
|
dataDir: config.dataDir
|
|
16
|
-
}
|
|
45
|
+
};
|
|
46
|
+
const tools = createTools(o);
|
|
47
|
+
let deps;
|
|
48
|
+
const depsNow = async (fresh = false) => {
|
|
49
|
+
if (fresh || !deps || Date.now() - deps.at > 6e4) deps = {
|
|
50
|
+
at: Date.now(),
|
|
51
|
+
v: await checkDeps(o)
|
|
52
|
+
};
|
|
53
|
+
return deps.v;
|
|
54
|
+
};
|
|
55
|
+
const handler = async (req, res) => {
|
|
56
|
+
if (![
|
|
57
|
+
"127.0.0.1",
|
|
58
|
+
"localhost",
|
|
59
|
+
"[::1]"
|
|
60
|
+
].includes((req.headers.host ?? "").replace(/:\d+$/, ""))) return send(res, 403, { error: "只能本机访问" });
|
|
61
|
+
const url = new URL(req.url ?? "/", "http://x"), route = url.pathname.replace(/^\/pico-lab\/?/, ""), q = url.searchParams;
|
|
62
|
+
try {
|
|
63
|
+
if (req.method === "GET") {
|
|
64
|
+
if (route === "api/state") return send(res, 200, {
|
|
65
|
+
deps: await depsNow(q.get("fresh") === "1"),
|
|
66
|
+
...listWorlds(o),
|
|
67
|
+
headsets: (await devices()).devices,
|
|
68
|
+
jobs: await waitJobs(void 0, 0, 12)
|
|
69
|
+
});
|
|
70
|
+
if (route === "api/world") return send(res, 200, await worldView(o, resolveWorld(o, q.get("slug") ?? "")));
|
|
71
|
+
if (route === "api/jobs") return send(res, 200, { jobs: await waitJobs(q.get("ids")?.split(",").filter(Boolean), 0, Number(q.get("lines") ?? 60)) });
|
|
72
|
+
if (route === "file") {
|
|
73
|
+
const dir = resolveWorld(o, q.get("slug") ?? "");
|
|
74
|
+
const p = q.get("line") ? narrationFile(dir, q.get("line")) : resolve(dir, "Builds/autoplay", q.get("shot") ?? "");
|
|
75
|
+
if (!p || !p.startsWith(resolve(dir) + sep) || !TYPES[extname(p)]) return send(res, 404, { error: "没有这个文件" });
|
|
76
|
+
const size = statSync(p).size;
|
|
77
|
+
res.writeHead(200, {
|
|
78
|
+
"content-type": TYPES[extname(p)],
|
|
79
|
+
"content-length": size,
|
|
80
|
+
"cache-control": "no-cache"
|
|
81
|
+
});
|
|
82
|
+
createReadStream(p).pipe(res);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (req.method !== "POST" || req.headers["x-pico-lab"] !== "1") return send(res, 403, { error: "不允许" });
|
|
87
|
+
const b = await body(req);
|
|
88
|
+
const job = (j) => send(res, 200, {
|
|
89
|
+
job: j.id,
|
|
90
|
+
title: j.title
|
|
91
|
+
});
|
|
92
|
+
if (route === "api/install") {
|
|
93
|
+
deps = void 0;
|
|
94
|
+
return job(await installDep(o, String(b.dep)));
|
|
95
|
+
}
|
|
96
|
+
if (route === "api/create") return send(res, 200, createWorld(o, b));
|
|
97
|
+
const dir = resolveWorld(o, String(b.slug ?? ""));
|
|
98
|
+
if (route === "api/open") return await editorFor(dir) ? send(res, 200, { open: true }) : job(openWorld(o, dir));
|
|
99
|
+
if (route === "api/autoplay") {
|
|
100
|
+
if (!await editorFor(dir)) throw new Error("先在 Unity 里打开这个世界");
|
|
101
|
+
return job(autoplay(o, dir, 1500));
|
|
102
|
+
}
|
|
103
|
+
if (route === "api/deploy") {
|
|
104
|
+
if (!await editorFor(dir)) throw new Error("先在 Unity 里打开这个世界");
|
|
105
|
+
return job(deploy(o, dir, !!b.buildOnly, b.serial));
|
|
106
|
+
}
|
|
107
|
+
if (route === "api/prompts") return send(res, 200, await voicePrompts(o, dir));
|
|
108
|
+
if (route === "api/reveal") {
|
|
109
|
+
execFile("/usr/bin/open", ["-R", join(dir, String(b.path ?? "world.json"))]);
|
|
110
|
+
return send(res, 200, {});
|
|
111
|
+
}
|
|
112
|
+
send(res, 404, { error: "没有这个地址" });
|
|
113
|
+
} catch (e) {
|
|
114
|
+
send(res, 400, failure(e));
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
ctx.effect(() => ctx.webServer.register({
|
|
118
|
+
kind: "prefix",
|
|
119
|
+
path: "/pico-lab",
|
|
120
|
+
handler
|
|
121
|
+
}), "dsh-pico-lab: api");
|
|
17
122
|
ctx.inject(["tools"], (c) => {
|
|
18
123
|
for (const t of tools) c.effect(() => c.tools.register({
|
|
19
124
|
name: t.name,
|
|
@@ -63,4 +168,4 @@ function apply(ctx, config) {
|
|
|
63
168
|
}), "dsh-pico-lab: system prompt");
|
|
64
169
|
});
|
|
65
170
|
}
|
|
66
|
-
export { Config, apply, name };
|
|
171
|
+
export { Config, apply, inject, name };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as splitTake, C as normalize, D as resolveWorld, N as voicePrompts, P as waitJobs, _ as editorFor, a as PROTECTED_PACKAGES, b as listWorlds, d as checkDeps, f as checkWorld, g as devices, h as deploy, k as sdkStatus, l as autoplay, n as EXAMPLE_IDS, p as createWorld, s as UNITY_VERSION, w as openWorld, x as makeSfx, y as installDep } from "./core-RKJbGowf.mjs";
|
|
2
2
|
// src/tools.ts
|
|
3
3
|
/** 一份工具,两处用:DSH 对话里的 Agent,和命令行(Claude Code / Codex 等)。 */
|
|
4
4
|
const GUIDE = `PICO Lab(PICO 世界工坊):用一套现成框架搭“能走进去的世界”——在 PICO 头显里上的一堂十分钟互动课(Unity ${UNITY_VERSION} + PICO XR SDK),一章一章往下走,纪录片式旁白引导,每章关键一步由观众的手完成(碰、捏、搬、推、拧),然后装进头显。自带示例《走进大模型》(11 章,给大学文科生讲大模型原理)。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-pico-lab",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "PICO Lab(PICO 世界工坊) for DeepSeek Harness: 一句话搭出一个能走进去的世界——PICO 头显里的十分钟互动课,缺什么引导装什么,自带示例《走进大模型》",
|
|
5
5
|
"license": "PolyForm-Noncommercial-1.0.0",
|
|
6
6
|
"repository": {
|
|
@@ -19,6 +19,9 @@
|
|
|
19
19
|
".": {
|
|
20
20
|
"default": "./lib/index.mjs"
|
|
21
21
|
},
|
|
22
|
+
"./client": {
|
|
23
|
+
"default": "./lib/client.js"
|
|
24
|
+
},
|
|
22
25
|
"./package.json": "./package.json"
|
|
23
26
|
},
|
|
24
27
|
"bin": {
|
|
@@ -45,6 +48,15 @@
|
|
|
45
48
|
"dsh": {
|
|
46
49
|
"bundle": {
|
|
47
50
|
"patch": "./cordis.patch.yml"
|
|
51
|
+
},
|
|
52
|
+
"client": {
|
|
53
|
+
"platform": "web",
|
|
54
|
+
"inject": [
|
|
55
|
+
"@deepseek-ai/dsh-client-ui-renderer",
|
|
56
|
+
"@deepseek-ai/dsh-client-locale",
|
|
57
|
+
"@deepseek-ai/dsh-api-session-controller",
|
|
58
|
+
"@deepseek-ai/dsh-client-ui-layout"
|
|
59
|
+
]
|
|
48
60
|
}
|
|
49
61
|
},
|
|
50
62
|
"peerDependencies": {
|
|
@@ -56,7 +68,11 @@
|
|
|
56
68
|
"@deepseek-ai/schemastery": "^3.19.0",
|
|
57
69
|
"@types/node": "^24.0.0",
|
|
58
70
|
"tsdown": "^0.22.14",
|
|
59
|
-
"typescript": "^5.9.2"
|
|
71
|
+
"typescript": "^5.9.2",
|
|
72
|
+
"@types/react": "~18.3.31",
|
|
73
|
+
"@types/react-dom": "^18.3.7",
|
|
74
|
+
"react": "^18.3.1",
|
|
75
|
+
"react-dom": "^18.3.1"
|
|
60
76
|
},
|
|
61
77
|
"keywords": [
|
|
62
78
|
"dsh",
|
package/lib/core-ntjet8c1.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { M as waitJobs } from "./core-CCJIvdg3.mjs";
|