@mohou/shell 1.0.21 → 1.0.23
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/dist/panel.js +111 -5
- package/package.json +5 -5
- package/skill/mohou-mini-app/SKILL.md +1 -1
- package/src/clients.ts +1 -0
- package/src/http-client.ts +2 -0
package/dist/panel.js
CHANGED
|
@@ -23964,6 +23964,13 @@ var en = {
|
|
|
23964
23964
|
"delete-failed": "Delete failed",
|
|
23965
23965
|
"unsaved-confirm": "Discard unsaved changes?",
|
|
23966
23966
|
"port-invalid": "Port must be from 1024 to 65535",
|
|
23967
|
+
"update-registry": "Update registry",
|
|
23968
|
+
"update-registry-default": "Packaged default",
|
|
23969
|
+
"update-registry-npmmirror": "Alibaba npmmirror",
|
|
23970
|
+
"update-registry-tencent": "Tencent Cloud",
|
|
23971
|
+
"update-registry-custom": "Custom\u2026",
|
|
23972
|
+
"update-registry-hint": "Only this product's own update check and install use it. Your npm config, and an app's own dependency installs, are untouched.",
|
|
23973
|
+
"update-registry-invalid": "Use an https url without a username or password.",
|
|
23967
23974
|
"save-failed": "Save failed",
|
|
23968
23975
|
"update-failed": "Update check failed",
|
|
23969
23976
|
"storage-failed": "Storage failed to load",
|
|
@@ -24218,6 +24225,13 @@ var zhCN = {
|
|
|
24218
24225
|
"delete-failed": "\u5220\u9664\u5931\u8D25",
|
|
24219
24226
|
"unsaved-confirm": "\u653E\u5F03\u672A\u4FDD\u5B58\u7684\u4FEE\u6539\uFF1F",
|
|
24220
24227
|
"port-invalid": "\u7AEF\u53E3\u5FC5\u987B\u5728 1024 \u5230 65535 \u4E4B\u95F4",
|
|
24228
|
+
"update-registry": "\u66F4\u65B0\u6E90 registry",
|
|
24229
|
+
"update-registry-default": "\u5B89\u88C5\u5305\u9ED8\u8BA4",
|
|
24230
|
+
"update-registry-npmmirror": "\u963F\u91CC npmmirror",
|
|
24231
|
+
"update-registry-tencent": "\u817E\u8BAF\u4E91",
|
|
24232
|
+
"update-registry-custom": "\u81EA\u5B9A\u4E49\u2026",
|
|
24233
|
+
"update-registry-hint": "\u53EA\u6709 Mohou \u81EA\u5DF1\u7684\u201C\u68C0\u67E5\u66F4\u65B0/\u5B89\u88C5\u66F4\u65B0\u201D\u7528\u5B83\uFF1B\u4E0D\u52A8\u4F60\u7684 npm \u914D\u7F6E\uFF0C\u4E5F\u4E0D\u5F71\u54CD\u5C0F\u7A0B\u5E8F\u81EA\u8EAB\u7684\u4F9D\u8D56\u5B89\u88C5\u3002",
|
|
24234
|
+
"update-registry-invalid": "\u8BF7\u586B https \u5730\u5740\uFF0C\u4E14\u4E0D\u8981\u5E26\u7528\u6237\u540D\u5BC6\u7801\u3002",
|
|
24221
24235
|
"save-failed": "\u4FDD\u5B58\u5931\u8D25",
|
|
24222
24236
|
"update-failed": "\u66F4\u65B0\u68C0\u67E5\u5931\u8D25",
|
|
24223
24237
|
"storage-failed": "\u5B58\u50A8\u52A0\u8F7D\u5931\u8D25",
|
|
@@ -24462,6 +24476,32 @@ function isPanelLocale(value) {
|
|
|
24462
24476
|
}
|
|
24463
24477
|
|
|
24464
24478
|
// ../../panel/src/settings/form.ts
|
|
24479
|
+
var updateRegistryPresets = {
|
|
24480
|
+
npmmirror: "https://registry.npmmirror.com",
|
|
24481
|
+
tencent: "https://mirrors.cloud.tencent.com/npm/"
|
|
24482
|
+
};
|
|
24483
|
+
function registryChoice(registry) {
|
|
24484
|
+
const value = registry.trim();
|
|
24485
|
+
if (value.length === 0) return "default";
|
|
24486
|
+
for (const [name, url] of Object.entries(updateRegistryPresets)) {
|
|
24487
|
+
if (value === url) return name;
|
|
24488
|
+
}
|
|
24489
|
+
return "custom";
|
|
24490
|
+
}
|
|
24491
|
+
function admitUpdateRegistry(value) {
|
|
24492
|
+
const registry = value.trim();
|
|
24493
|
+
if (registry.length === 0) return { ok: true, registry: "" };
|
|
24494
|
+
let url;
|
|
24495
|
+
try {
|
|
24496
|
+
url = new URL(registry);
|
|
24497
|
+
} catch {
|
|
24498
|
+
return { ok: false, key: "registry-invalid" };
|
|
24499
|
+
}
|
|
24500
|
+
if (url.protocol !== "https:" || url.hostname.length === 0 || url.username.length > 0 || url.password.length > 0) {
|
|
24501
|
+
return { ok: false, key: "registry-invalid" };
|
|
24502
|
+
}
|
|
24503
|
+
return { ok: true, registry };
|
|
24504
|
+
}
|
|
24465
24505
|
var panelPortBound = { min: 1024, max: 65535 };
|
|
24466
24506
|
function admitPanelPort(value) {
|
|
24467
24507
|
if (typeof value !== "number" || !Number.isInteger(value)) return { ok: false, key: "port-invalid" };
|
|
@@ -25778,12 +25818,14 @@ function settingsState() {
|
|
|
25778
25818
|
palette: "",
|
|
25779
25819
|
locale: "en",
|
|
25780
25820
|
port: "",
|
|
25821
|
+
registry: "",
|
|
25781
25822
|
providerId: "",
|
|
25782
25823
|
modelProvider: "",
|
|
25783
25824
|
model: "",
|
|
25784
25825
|
workbenchId: "default",
|
|
25785
25826
|
dirty: false,
|
|
25786
25827
|
portError: false,
|
|
25828
|
+
registryError: false,
|
|
25787
25829
|
saveError: false,
|
|
25788
25830
|
closed: false,
|
|
25789
25831
|
restartRequired: false,
|
|
@@ -25803,6 +25845,8 @@ function reduceSettings(state, action) {
|
|
|
25803
25845
|
return { ...state, locale: action.locale, dirty: true, saveError: false };
|
|
25804
25846
|
case "edit-port":
|
|
25805
25847
|
return { ...state, port: action.port, dirty: true, portError: false, saveError: false };
|
|
25848
|
+
case "edit-registry":
|
|
25849
|
+
return { ...state, registry: action.registry, dirty: true, registryError: false, saveError: false };
|
|
25806
25850
|
case "edit-provider":
|
|
25807
25851
|
return { ...state, providerId: action.providerId, dirty: true, saveError: false };
|
|
25808
25852
|
case "edit-model":
|
|
@@ -25840,6 +25884,10 @@ function reduceSettings(state, action) {
|
|
|
25840
25884
|
}
|
|
25841
25885
|
case "port-invalid":
|
|
25842
25886
|
return { ...state, portError: true, dirty: true };
|
|
25887
|
+
case "registry-invalid":
|
|
25888
|
+
return { ...state, registryError: true, dirty: true };
|
|
25889
|
+
case "save-blocked":
|
|
25890
|
+
return { ...omitSaveMessage(state), saveError: true, dirty: true };
|
|
25843
25891
|
case "save-failed":
|
|
25844
25892
|
return {
|
|
25845
25893
|
...omitSaveMessage(state),
|
|
@@ -25872,12 +25920,14 @@ function reduceSettings(state, action) {
|
|
|
25872
25920
|
}
|
|
25873
25921
|
function settingsDraft(state) {
|
|
25874
25922
|
const port = admitPanelPort(Number(state.port));
|
|
25875
|
-
if (!port.ok) return { ok: false };
|
|
25923
|
+
if (!port.ok) return { ok: false, key: "port-invalid" };
|
|
25924
|
+
const registry = admitUpdateRegistry(state.registry);
|
|
25925
|
+
if (!registry.ok) return { ok: false, key: "registry-invalid" };
|
|
25876
25926
|
let language;
|
|
25877
25927
|
try {
|
|
25878
25928
|
language = panelLanguageFields(state.locale);
|
|
25879
25929
|
} catch {
|
|
25880
|
-
return { ok: false };
|
|
25930
|
+
return { ok: false, key: "save-blocked" };
|
|
25881
25931
|
}
|
|
25882
25932
|
return {
|
|
25883
25933
|
ok: true,
|
|
@@ -25889,6 +25939,7 @@ function settingsDraft(state) {
|
|
|
25889
25939
|
hostPort: port.port,
|
|
25890
25940
|
llm: state.modelProvider === "" && state.model === "" ? null : { provider: state.modelProvider, model: state.model },
|
|
25891
25941
|
runtimeProvider: { id: state.providerId },
|
|
25942
|
+
updateRegistry: registry.registry,
|
|
25892
25943
|
...state.workbenchId === "default" ? {} : { defaultWorkbenchId: state.workbenchId }
|
|
25893
25944
|
}
|
|
25894
25945
|
};
|
|
@@ -25903,12 +25954,14 @@ function fromPolicy(policy2) {
|
|
|
25903
25954
|
palette: policy2.palette,
|
|
25904
25955
|
locale: policy2.locale,
|
|
25905
25956
|
port: String(policy2.hostPort),
|
|
25957
|
+
registry: policy2.updateRegistry ?? "",
|
|
25906
25958
|
providerId: policy2.runtimeProvider.id,
|
|
25907
25959
|
modelProvider: policy2.llm?.provider ?? "",
|
|
25908
25960
|
model: policy2.llm?.model ?? "",
|
|
25909
25961
|
workbenchId: policy2.defaultWorkbenchId ?? "default",
|
|
25910
25962
|
dirty: false,
|
|
25911
25963
|
portError: false,
|
|
25964
|
+
registryError: false,
|
|
25912
25965
|
saveError: false,
|
|
25913
25966
|
closed: false,
|
|
25914
25967
|
restartRequired: false,
|
|
@@ -27244,6 +27297,7 @@ function PanelSettings(props) {
|
|
|
27244
27297
|
return;
|
|
27245
27298
|
}
|
|
27246
27299
|
props.onPolicy?.(written);
|
|
27300
|
+
setAbout(void 0);
|
|
27247
27301
|
setSaveFeedback("saved");
|
|
27248
27302
|
window.setTimeout(() => setSaveFeedback("idle"), 2e3);
|
|
27249
27303
|
};
|
|
@@ -27368,7 +27422,8 @@ function PanelSettings(props) {
|
|
|
27368
27422
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("code", { className: "rounded bg-muted px-1.5 py-0.5 font-mono text-[11px] text-foreground", children: `${hostOrigin(state.port)}/mcp` })
|
|
27369
27423
|
] })
|
|
27370
27424
|
] }),
|
|
27371
|
-
state.portError ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-xs text-muted-foreground", children: label("port-invalid") }) : null
|
|
27425
|
+
state.portError ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-xs text-muted-foreground", children: label("port-invalid") }) : null,
|
|
27426
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(RegistryField, { state, dispatch, label })
|
|
27372
27427
|
] })
|
|
27373
27428
|
] }) : null,
|
|
27374
27429
|
section === "agent" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
@@ -27610,10 +27665,59 @@ function cardKey(style) {
|
|
|
27610
27665
|
if (style === "glass") return "card-glass";
|
|
27611
27666
|
return "card-hero";
|
|
27612
27667
|
}
|
|
27668
|
+
function RegistryField(props) {
|
|
27669
|
+
const choice = registryChoice(props.state.registry);
|
|
27670
|
+
const [custom, setCustom] = (0, import_react10.useState)(choice === "custom");
|
|
27671
|
+
const seen = (0, import_react10.useRef)(props.state.registry);
|
|
27672
|
+
(0, import_react10.useEffect)(() => {
|
|
27673
|
+
if (seen.current === props.state.registry) return;
|
|
27674
|
+
seen.current = props.state.registry;
|
|
27675
|
+
if (choice !== "custom") setCustom(false);
|
|
27676
|
+
}, [choice, props.state.registry]);
|
|
27677
|
+
const shown = custom ? "custom" : choice;
|
|
27678
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "mt-2 flex flex-col gap-2", children: [
|
|
27679
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("label", { className: "text-sm text-muted-foreground", htmlFor: "settings-update-registry", children: props.label("update-registry") }),
|
|
27680
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "m-0 max-w-xl text-xs leading-5 text-muted-foreground", children: props.label("update-registry-hint") }),
|
|
27681
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
27682
|
+
"select",
|
|
27683
|
+
{
|
|
27684
|
+
id: "settings-update-registry",
|
|
27685
|
+
"data-field": "update-registry",
|
|
27686
|
+
className: "h-9 max-w-md rounded-lg border bg-card px-3 text-sm outline-none",
|
|
27687
|
+
value: shown,
|
|
27688
|
+
onChange: (event) => {
|
|
27689
|
+
const picked = event.target.value;
|
|
27690
|
+
setCustom(picked === "custom");
|
|
27691
|
+
props.dispatch({
|
|
27692
|
+
type: "edit-registry",
|
|
27693
|
+
registry: picked === "default" ? "" : picked === "custom" ? props.state.registry : updateRegistryPresets[picked]
|
|
27694
|
+
});
|
|
27695
|
+
},
|
|
27696
|
+
children: [
|
|
27697
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "default", children: props.label("update-registry-default") }),
|
|
27698
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "npmmirror", children: `${props.label("update-registry-npmmirror")} \xB7 ${updateRegistryPresets.npmmirror}` }),
|
|
27699
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "tencent", children: `${props.label("update-registry-tencent")} \xB7 ${updateRegistryPresets.tencent}` }),
|
|
27700
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "custom", children: props.label("update-registry-custom") })
|
|
27701
|
+
]
|
|
27702
|
+
}
|
|
27703
|
+
),
|
|
27704
|
+
shown !== "custom" ? null : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
27705
|
+
"input",
|
|
27706
|
+
{
|
|
27707
|
+
"data-field": "update-registry-custom",
|
|
27708
|
+
className: "h-9 max-w-md rounded-lg border bg-card px-3 font-mono text-sm outline-none",
|
|
27709
|
+
placeholder: "https://registry.example.com/",
|
|
27710
|
+
value: props.state.registry,
|
|
27711
|
+
onChange: (event) => props.dispatch({ type: "edit-registry", registry: event.target.value })
|
|
27712
|
+
}
|
|
27713
|
+
),
|
|
27714
|
+
props.state.registryError ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "m-0 text-xs text-destructive", children: props.label("update-registry-invalid") }) : null
|
|
27715
|
+
] });
|
|
27716
|
+
}
|
|
27613
27717
|
async function saveSettings(client, state, dispatch) {
|
|
27614
27718
|
const draft = settingsDraft(state);
|
|
27615
27719
|
if (!draft.ok) {
|
|
27616
|
-
dispatch({ type:
|
|
27720
|
+
dispatch({ type: draft.key });
|
|
27617
27721
|
return void 0;
|
|
27618
27722
|
}
|
|
27619
27723
|
try {
|
|
@@ -28728,6 +28832,7 @@ function publicPolicy(value) {
|
|
|
28728
28832
|
const policy2 = record(value);
|
|
28729
28833
|
const llm = policy2.llm;
|
|
28730
28834
|
const desk = optionalText(policy2.defaultWorkbenchId);
|
|
28835
|
+
const updateRegistry = optionalText(policy2.updateRegistry);
|
|
28731
28836
|
return {
|
|
28732
28837
|
theme: policy2.theme === "dark" || policy2.theme === "system" ? policy2.theme : "light",
|
|
28733
28838
|
palette: typeof policy2.palette === "string" ? policy2.palette : "",
|
|
@@ -28736,7 +28841,8 @@ function publicPolicy(value) {
|
|
|
28736
28841
|
hostPort: typeof policy2.hostPort === "number" ? policy2.hostPort : 0,
|
|
28737
28842
|
llm: llmOf(llm),
|
|
28738
28843
|
runtimeProvider: { id: text(record(policy2.runtimeProvider).id) },
|
|
28739
|
-
...desk === void 0 ? {} : { defaultWorkbenchId: desk }
|
|
28844
|
+
...desk === void 0 ? {} : { defaultWorkbenchId: desk },
|
|
28845
|
+
...updateRegistry === void 0 ? {} : { updateRegistry }
|
|
28740
28846
|
};
|
|
28741
28847
|
}
|
|
28742
28848
|
async function readApps(origin, path) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mohou/shell",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.23",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"esbuild": "^0.28.2",
|
|
32
32
|
"react": "^19.2.0",
|
|
33
33
|
"react-dom": "^19.2.0",
|
|
34
|
-
"@mohou/
|
|
35
|
-
"@mohou/
|
|
36
|
-
"@mohou/runtime-
|
|
37
|
-
"@mohou/runtime-
|
|
34
|
+
"@mohou/host": "^1.0.23",
|
|
35
|
+
"@mohou/panel": "^1.0.23",
|
|
36
|
+
"@mohou/runtime-pi": "^1.0.23",
|
|
37
|
+
"@mohou/runtime-provider": "^1.0.23"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/react": "^19.2.0",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: mohou-mini-app
|
|
3
3
|
description: Create or edit local mini-apps (ui.tsx + main.api.ts) that run in the mini-app panel. Confirm the core choices before mini_app_register when the ask is vague. Then write source with your file tools, compile with mini_app_reload, smoke-test with mini_app_call, and reveal with mini_app_open. Triggers include 做个小程序 / 小工具 / 面板 / 仪表盘 / dashboard / 看板 / 工作台 / mini-app. Not for editing Host, Panel, or Shell source.
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.23
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Mini-app authoring
|
package/src/clients.ts
CHANGED
|
@@ -65,6 +65,7 @@ function panelPolicy(policy: HostPolicy): OwnerPolicy {
|
|
|
65
65
|
llm: policy.llm,
|
|
66
66
|
runtimeProvider: { id: policy.runtimeProvider.id },
|
|
67
67
|
...policy.defaultWorkbenchId === undefined ? {} : { defaultWorkbenchId: policy.defaultWorkbenchId },
|
|
68
|
+
...policy.updateRegistry === undefined ? {} : { updateRegistry: policy.updateRegistry },
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
71
|
|
package/src/http-client.ts
CHANGED
|
@@ -249,6 +249,7 @@ function publicPolicy(value: unknown): PanelPolicy {
|
|
|
249
249
|
const policy = record(value)
|
|
250
250
|
const llm = policy.llm
|
|
251
251
|
const desk = optionalText(policy.defaultWorkbenchId)
|
|
252
|
+
const updateRegistry = optionalText(policy.updateRegistry)
|
|
252
253
|
return {
|
|
253
254
|
theme: policy.theme === 'dark' || policy.theme === 'system' ? policy.theme : 'light',
|
|
254
255
|
palette: typeof policy.palette === 'string' ? policy.palette : '',
|
|
@@ -258,6 +259,7 @@ function publicPolicy(value: unknown): PanelPolicy {
|
|
|
258
259
|
llm: llmOf(llm),
|
|
259
260
|
runtimeProvider: { id: text(record(policy.runtimeProvider).id) },
|
|
260
261
|
...desk === undefined ? {} : { defaultWorkbenchId: desk },
|
|
262
|
+
...updateRegistry === undefined ? {} : { updateRegistry },
|
|
261
263
|
}
|
|
262
264
|
}
|
|
263
265
|
|