@mohou/shell 1.0.20 → 1.0.22

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mohou/shell",
3
- "version": "1.0.20",
3
+ "version": "1.0.22",
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/host": "^1.0.20",
35
- "@mohou/runtime-pi": "^1.0.20",
36
- "@mohou/panel": "^1.0.20",
37
- "@mohou/runtime-provider": "^1.0.20"
34
+ "@mohou/panel": "^1.0.22",
35
+ "@mohou/runtime-pi": "^1.0.22",
36
+ "@mohou/runtime-provider": "^1.0.22",
37
+ "@mohou/host": "^1.0.22"
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.20
4
+ version: 1.0.22
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
 
@@ -17,6 +17,7 @@ import {
17
17
  type PanelUpdateAttempt,
18
18
  type PanelUpdateCheck,
19
19
  type PanelUpdateFailureCode,
20
+ type PanelUpdateSource,
20
21
  type McpCheckResult,
21
22
  type McpServerDraft,
22
23
  type PanelCredential,
@@ -248,6 +249,7 @@ function publicPolicy(value: unknown): PanelPolicy {
248
249
  const policy = record(value)
249
250
  const llm = policy.llm
250
251
  const desk = optionalText(policy.defaultWorkbenchId)
252
+ const updateRegistry = optionalText(policy.updateRegistry)
251
253
  return {
252
254
  theme: policy.theme === 'dark' || policy.theme === 'system' ? policy.theme : 'light',
253
255
  palette: typeof policy.palette === 'string' ? policy.palette : '',
@@ -257,6 +259,7 @@ function publicPolicy(value: unknown): PanelPolicy {
257
259
  llm: llmOf(llm),
258
260
  runtimeProvider: { id: text(record(policy.runtimeProvider).id) },
259
261
  ...desk === undefined ? {} : { defaultWorkbenchId: desk },
262
+ ...updateRegistry === undefined ? {} : { updateRegistry },
260
263
  }
261
264
  }
262
265
 
@@ -437,10 +440,12 @@ function stringMap(value: unknown, field: 'env' | 'headers'): { env: Record<stri
437
440
 
438
441
  function panelAbout(value: Record<string, unknown>): PanelAbout {
439
442
  const authoring = record(value.authoring)
443
+ const source = updateSource(value.source)
440
444
  return {
441
445
  name: text(value.name),
442
446
  current: text(value.current),
443
447
  platform: text(value.platform),
448
+ ...source === undefined ? {} : { source },
444
449
  authoring: {
445
450
  url: text(authoring.url),
446
451
  token: text(authoring.token),
@@ -548,6 +553,8 @@ function authorMcpAgent(value: unknown): PanelAuthorMcpStatus['agents'] {
548
553
 
549
554
  function updateCheck(value: Record<string, unknown>): PanelUpdateCheck {
550
555
  const attempt = updateAttempt(value.lastAttempt)
556
+ const registry = updateText(value.registry)
557
+ const tarballDir = updateText(value.tarballDir)
551
558
  return {
552
559
  name: text(value.name),
553
560
  current: text(value.current),
@@ -555,6 +562,8 @@ function updateCheck(value: Record<string, unknown>): PanelUpdateCheck {
555
562
  updateAvailable: value.updateAvailable === true,
556
563
  ...value.channel === 'registry' || value.channel === 'tarball' ? { channel: value.channel } : {},
557
564
  ...value.installable === true ? { installable: true } : {},
565
+ ...registry === undefined ? {} : { registry },
566
+ ...tarballDir === undefined ? {} : { tarballDir },
558
567
  ...typeof value.error === 'string' ? { error: value.error } : {},
559
568
  ...attempt === undefined ? {} : { lastAttempt: attempt },
560
569
  }
@@ -590,6 +599,24 @@ function updateAttempt(value: unknown): PanelUpdateAttempt | undefined {
590
599
  }
591
600
  }
592
601
 
602
+ /** The source a record named, when it named a complete one. A channel with no detail reads as none. */
603
+ function updateSource(value: unknown): PanelUpdateSource | undefined {
604
+ const row = record(value)
605
+ if (row.channel === 'registry') {
606
+ const registry = updateText(row.registry)
607
+ return registry === undefined ? undefined : { channel: 'registry', registry }
608
+ }
609
+ if (row.channel === 'tarball') {
610
+ const tarballDir = updateText(row.tarballDir)
611
+ return tarballDir === undefined ? undefined : { channel: 'tarball', tarballDir }
612
+ }
613
+ return row.channel === 'none' ? { channel: 'none' } : undefined
614
+ }
615
+
616
+ function updateText(value: unknown): string | undefined {
617
+ return typeof value === 'string' && value.length > 0 ? value : undefined
618
+ }
619
+
593
620
  function updateVersion(value: unknown): string | undefined {
594
621
  return typeof value === 'string' && value.length > 0 ? value : undefined
595
622
  }