@dsh-workbench/shared 1.0.1 → 1.1.1

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.
Files changed (35) hide show
  1. package/dist/contract/protocol/bundle-install.d.ts +9 -1
  2. package/dist/contract/protocol/market-index.d.ts +1 -0
  3. package/dist/contract/protocol/market-index.js +1 -0
  4. package/dist/contract/unit-declaration.d.ts +11 -5
  5. package/dist/contract/unit-declaration.js +43 -17
  6. package/dist/contract/unit.d.ts +18 -3
  7. package/dist/contract/unit.js +8 -0
  8. package/dist/contract/workbench-contract.d.ts +1 -1
  9. package/dist/host/provision.d.ts +1 -1
  10. package/dist/host/provision.js +8 -2
  11. package/dist/host/supply-index.d.ts +4 -1
  12. package/dist/host/supply-index.js +18 -12
  13. package/dist/i18n/en.js +54 -32
  14. package/dist/i18n/index.d.ts +56 -34
  15. package/dist/i18n/zh.d.ts +55 -33
  16. package/dist/i18n/zh.js +55 -33
  17. package/dist/lib/dsh-client.d.ts +3 -1
  18. package/dist/testing/needs.js +5 -2
  19. package/package.json +1 -1
  20. package/src/contract/__tests__/unit-declaration.test.ts +34 -1
  21. package/src/contract/__tests__/unit.test.ts +1 -1
  22. package/src/contract/protocol/bundle-install.ts +11 -1
  23. package/src/contract/protocol/market-index.ts +1 -0
  24. package/src/contract/unit-declaration.ts +53 -22
  25. package/src/contract/unit.ts +22 -3
  26. package/src/contract/workbench-contract.ts +3 -1
  27. package/src/host/__tests__/provision.test.ts +2 -0
  28. package/src/host/__tests__/supply-index.test.ts +42 -6
  29. package/src/host/provision.ts +6 -2
  30. package/src/host/supply-index.ts +40 -11
  31. package/src/i18n/en.ts +54 -32
  32. package/src/i18n/zh.ts +55 -33
  33. package/src/lib/dsh-client.ts +3 -1
  34. package/src/testing/__tests__/declaration.test.ts +7 -3
  35. package/src/testing/needs.ts +5 -2
package/src/i18n/en.ts CHANGED
@@ -134,15 +134,14 @@ export const en: Record<keyof WorkbenchMessages, string> = {
134
134
  'panels.market.update': 'Update',
135
135
  'panels.market.swapSlow': 'Not swapped yet — maybe a slow or failed download. Press Update again; if it stays like this, restart dsh.',
136
136
  'panels.market.removeSlow': 'Not removed yet — maybe a slow network or an uninstall that did not finish. Check again in a moment; if it stays like this, restart dsh.',
137
- 'panels.market.updateNoChange': 'Not updated: you were on {from}, and after the run the disk still has that version; the newest on the registry is {latest}.',
137
+ 'panels.market.updateNoChange': 'Update failed: still {from}. The newest on the registry is {latest} — press Update again.',
138
138
  'panels.market.updateUnknownVersion': '(unknown)',
139
- 'panels.market.updateGone': 'Not updated: after the run the module cannot be read from disk.',
140
- 'panels.market.updateRestored': 'Not updated: the new version was missing from disk, so {version} was put back.',
139
+ 'panels.market.updateGone': 'Update failed: the module is gone after the update.',
140
+ 'panels.market.updateRestored': 'Update failed: the new version could not be found after the update, so {version} was put back.',
141
141
  'panels.market.updateBehind': 'Installed {installed}, but the newest on the registry is {latest} — not the latest; you can update once more.',
142
- 'panels.market.selfUpdateFailed': 'Self-update failed: {reason}',
142
+ 'panels.market.selfUpdateFailed': 'Workbench update failed: {reason}',
143
143
  'panels.market.selfUpdateUnknown': 'the outside process left no reason (see ~/.dsh/workbench/self-update.log)',
144
- 'panels.market.selfUpdateRolledBack': 'Not swapped; rolled back to {version}.',
145
- 'panels.market.selfUpdateNeedsMigrate': 'Workbench updated. Old sessions and projects are not merged automatically: quit every dsh, then run dsh-workbench migrate (--force to merge again).',
144
+ 'panels.market.selfUpdateRolledBack': 'Workbench update failed; rolled back to {version}.',
146
145
  'panels.market.uninstall': 'Uninstall',
147
146
  'panels.market.uninstallLabel': 'Uninstall {name}',
148
147
  'panels.market.installing': 'Installing…',
@@ -166,9 +165,27 @@ export const en: Record<keyof WorkbenchMessages, string> = {
166
165
  'panels.market.empty': 'No modules available',
167
166
  'panels.market.sectionPlugins': 'Installed opencli plugins',
168
167
  'panels.market.moduleOutdated': 'update available',
168
+ 'panels.market.updateNeedsWorkbench': 'this version needs a newer workbench first',
169
+ 'panels.market.updateIncompatible': 'the new version does not match this workbench, so it cannot be installed now',
169
170
  'panels.market.moduleRefused': 'This module does not match this workbench, so it cannot be used for now.',
170
171
  'panels.market.moduleRestartHint': 'restart dsh once to bring it up',
171
172
  'panels.market.pendingRestart': 'restart required',
173
+ 'panels.market.pendingFollowUp': 'old data to migrate',
174
+ 'panels.market.migrationHint': 'old sessions and projects are not merged yet',
175
+ 'panels.market.migrateAction': 'Migrate old data',
176
+ 'panels.market.migrating': 'Migrating…',
177
+ 'panels.market.migrateConfirmTitle': 'Migrate old data?',
178
+ 'panels.market.migrateConfirmDetail': 'Quit dsh web / Desktop first. Only missing data is added; nothing is overwritten.',
179
+ 'panels.market.migrateConfirmAck': "I've quit dsh web / Desktop",
180
+ 'panels.market.migrateConfirmYes': 'Start migration',
181
+ 'panels.market.migrateDone': 'Migration complete: {added} projects added; restart the workbench and dsh web to see them.',
182
+ 'panels.market.dismissFollowUp': "Don't remind me",
183
+ 'panels.market.dismissing': 'Dismissing…',
184
+ 'panels.market.dismissFollowUpTitle': 'Stop reminding about this?',
185
+ 'panels.market.dismissFollowUpDetail': "The reminder will be hidden from the market, but old data will not be migrated or deleted. Old sessions and projects stay in the old directory and won't appear in the new version; you can still run dsh-workbench migrate later.",
186
+ 'panels.market.dismissFollowUpAck': "I understand the old data won't appear automatically",
187
+ 'panels.market.dismissFollowUpYes': "Don't remind me",
188
+ 'panels.market.dismissed': 'No longer reminded; old data stays in the old directory and can still be migrated with dsh-workbench migrate.',
172
189
  'panels.market.workbenchName': 'Workbench',
173
190
  'panels.market.pluginBroken': 'This plugin install is broken: it cannot be identified. Uninstall it first, then ask the agent to reinstall it by package name.',
174
191
  'panels.market.restartNeeded': 'The new version is installed — restart once to pick it up.',
@@ -255,7 +272,7 @@ export const en: Record<keyof WorkbenchMessages, string> = {
255
272
  'panels.market.add.exampleTitle': 'Examples',
256
273
  'panels.market.add.exampleFill': 'Fill in an example',
257
274
  'panels.market.add.registryLabel': 'Source',
258
- 'panels.market.add.registryProfile': "This profile's registry",
275
+ 'panels.market.add.registryProfile': "This workbench's registry",
259
276
  'panels.market.add.registryPnpm': "pnpm's own registry",
260
277
  'panels.market.add.check': 'Check',
261
278
  'panels.market.add.checking': 'Checking…',
@@ -276,14 +293,19 @@ export const en: Record<keyof WorkbenchMessages, string> = {
276
293
  'panels.market.tabs': 'The two faces of the module market',
277
294
  'panels.tab.discover': 'Discover',
278
295
  'panels.discover.loading': 'Reading the index',
296
+ 'panels.discover.slowHint': 'Slow to load: finish any authorization prompt, or switch sources.',
279
297
  'panels.discover.lead': 'Browse modules from an index source; install and go.',
280
298
  'panels.discover.addSource': 'Add',
281
299
  'panels.discover.addingSource': 'Adding…',
282
300
  'panels.discover.addFirstSource': 'Add index source',
283
301
  'panels.discover.removeSource': 'Remove',
284
302
  'panels.discover.removeSourceNamed': 'Remove {url}',
303
+ 'panels.discover.useSource': 'Use',
304
+ 'panels.discover.useSourceNamed': 'Use {label}',
305
+ 'panels.discover.sourceCurrent': 'In use',
285
306
  'panels.discover.refresh': 'Refresh',
286
307
  'panels.discover.search': 'Search modules',
308
+ 'panels.discover.clearSearch': 'Clear search',
287
309
  'panels.discover.all': 'All',
288
310
  'panels.discover.sourceLabel': 'Name',
289
311
  'panels.discover.sourceKind': 'Type',
@@ -293,8 +315,8 @@ export const en: Record<keyof WorkbenchMessages, string> = {
293
315
  'panels.discover.sourcePlaceholder': 'https://example.com/index.json or git@git.example.com:wb/market.git',
294
316
  'panels.discover.sourceRef': 'Branch',
295
317
  'panels.discover.sourcePath': 'Index file',
296
- 'panels.discover.sourceLocal': 'Local clone (optional)',
297
- 'panels.discover.sourceLocalHint': 'Leave empty to clone into ~/.dsh/workbench/market-index/.',
318
+ 'panels.discover.sourceLocal': 'Local copy folder (optional)',
319
+ 'panels.discover.sourceLocalHint': 'Leave empty to keep it in ~/.dsh/workbench/market-index/.',
298
320
  'panels.discover.save': 'Save and refresh',
299
321
  'panels.discover.cancel': 'Cancel',
300
322
  'panels.discover.retry': 'Retry',
@@ -307,9 +329,9 @@ export const en: Record<keyof WorkbenchMessages, string> = {
307
329
  'panels.discover.missingIndex': 'This repository has no {path} yet.',
308
330
  'panels.discover.initTitle': 'Initialize this repository as a module market index?',
309
331
  'panels.discover.initCta': 'Initialize market index',
310
- 'panels.discover.initWhat': 'It will write market.json and README.md on {branch}, commit once, and push. Modules you publish from this workbench will commit their artifacts under packages/<unit>/. The repository stays owned by its owner.',
332
+ 'panels.discover.initWhat': 'It will write market.json and README.md on {branch}, commit once, and push. Modules you publish from this workbench will commit their build files under packages/<unit>/. The repository stays owned by its owner.',
311
333
  'panels.discover.initBranch': 'Branch',
312
- 'panels.discover.initBranchHint': 'The index and artifacts go to this branch; an empty repository gets it created.',
334
+ 'panels.discover.initBranchHint': 'The index and build files go to this branch; an empty repository gets it created.',
313
335
  'panels.discover.initBranchBad': 'Use only letters, digits, dots, underscores, slashes, or dashes in a branch name.',
314
336
  'panels.discover.initOk': 'Initialize',
315
337
  'panels.discover.initBusy': 'Initializing…',
@@ -413,12 +435,12 @@ export const en: Record<keyof WorkbenchMessages, string> = {
413
435
  'panels.market.add.doneApplied': 'Installed and live.',
414
436
  'panels.market.add.doneRestart': 'Installed — restart once to pick it up.',
415
437
  'panels.market.add.restartWhy': 'Why this needs a restart: {reason}',
416
- 'panels.market.add.restartWhy.no-hmr': 'this configuration only applies changes at startup (hot reload is off)',
438
+ 'panels.market.add.restartWhy.no-hmr': 'this configuration is only read at startup, so a restart is needed',
417
439
  'panels.market.add.restartWhy.package-moved':
418
440
  'an installed package now resolves to another directory, or the change replaced something dsh itself provides',
419
441
  'panels.market.add.restartWhy.host-module': 'the change reaches modules dsh itself loaded',
420
- 'panels.market.add.restartWhy.unmanaged-plugin': 'the change reaches a plugin running outside the plugin list',
421
- 'panels.market.add.restartWhy.module-comparison': 'dsh could not compare loaded plugins with their files',
442
+ 'panels.market.add.restartWhy.unmanaged-plugin': 'the change reaches a plugin that is running but not on the install list',
443
+ 'panels.market.add.restartWhy.module-comparison': 'dsh could not confirm that the running plugin is the copy installed on this machine',
422
444
  'panels.market.add.cancelled': 'Cancelled.',
423
445
  'panels.market.add.failed': "Didn't work: {reason}",
424
446
  'panels.market.add.removed': 'It has been removed.',
@@ -428,10 +450,10 @@ export const en: Record<keyof WorkbenchMessages, string> = {
428
450
  'panels.market.add.removedRestart': 'Removed — restart once to finish.',
429
451
  'panels.market.add.remove': 'Remove it',
430
452
  'panels.market.add.problem.invalidSpec': "That is not a spec we accept: it cannot be empty or start with a dash.",
431
- 'panels.market.add.problem.alreadyInstalled': 'That package is already in the profile (add @version to switch versions).',
453
+ 'panels.market.add.problem.alreadyInstalled': 'That package is already in this workbench (add @version to switch versions).',
432
454
  'panels.market.add.problem.notFound': 'No such package on that source. Try another name or version.',
433
455
  'panels.market.add.problem.notAPackage': 'There is no package at that location. Pick a folder that contains a package.json.',
434
- 'panels.market.add.problem.notABundle': 'It is an npm package, but not a dsh plugin (it is missing the dsh wiring declaration).',
456
+ 'panels.market.add.problem.notABundle': 'It is an npm package, but not a dsh plugin (dsh cannot find what to load inside it).',
435
457
  'panels.market.add.problem.network': 'The source is unreachable. Check the network and retry.',
436
458
  'panels.market.add.problem.unknown': 'The check did not pass (reason unknown). Open the install details for the raw output, or retry.',
437
459
  'panels.market.add.reason.invalidSpec': 'the spec is not accepted',
@@ -439,7 +461,7 @@ export const en: Record<keyof WorkbenchMessages, string> = {
439
461
  'panels.market.add.reason.notBundle': 'it is not a dsh plugin package',
440
462
  'panels.market.add.reason.notRemovable': 'it ships with the installation and cannot be removed',
441
463
  'panels.market.add.reason.bundleInUse': 'something is still using it',
442
- 'panels.market.add.reason.stopProfile': 'this configuration has no hot reload, so stop the process first',
464
+ 'panels.market.add.reason.stopProfile': 'this configuration needs a restart, so stop the workbench first',
443
465
  'panels.market.add.reason.staleApproval': 'the scripts to allow changed — start over',
444
466
  'panels.market.add.reason.operationError': 'pnpm failed (see the install output)',
445
467
  'panels.market.add.reason.buildBlocked': 'pnpm blocked install scripts',
@@ -469,8 +491,8 @@ export const en: Record<keyof WorkbenchMessages, string> = {
469
491
  'blocker.forbidden.titleGeneric': 'No access',
470
492
  'blocker.forbidden.hint': 'You are signed in, but this project/repo is not permitted for your account.',
471
493
  'blocker.forbidden.open': 'Open permissions page',
472
- 'blocker.timeout.hint': 'The headless browser may not have started; retrying usually helps.',
473
- 'blocker.exec.hint': 'Make sure opencli is installed and on PATH (which opencli).',
494
+ 'blocker.timeout.hint': 'The background browser may not have started; retrying usually helps.',
495
+ 'blocker.exec.hint': 'Make sure opencli is installed and runs from your terminal (which opencli).',
474
496
  'blocker.unknown.title': 'Something went wrong',
475
497
  'panels.reading': 'Reading the panel setup…',
476
498
  'panels.cardBroken': 'This module will not render: {unit} ({reason})',
@@ -484,7 +506,7 @@ export const en: Record<keyof WorkbenchMessages, string> = {
484
506
  'env.elapsed': 'Waiting {seconds}s',
485
507
  'env.stepFailed.install': 'install failed',
486
508
  'env.stepFailed.path': 'installed but not found',
487
- 'env.stepFailed.shell': 'no shell channel',
509
+ 'env.stepFailed.shell': 'cannot reach the command line',
488
510
  'env.toolchain.ok': 'Looks good',
489
511
  'env.toolchain.warn': 'Almost ready',
490
512
  'env.opencli.ok': 'Ready',
@@ -501,10 +523,10 @@ export const en: Record<keyof WorkbenchMessages, string> = {
501
523
  'env.fix.title': 'How to fix it',
502
524
  'env.fix.why': 'The workbench uses its own background tool (installed separately from the one in your terminal), and it is not set up on this machine yet.',
503
525
  'env.fix.whyPath': 'The background tool is installed, but this environment cannot find it \u2014 usually a PATH or shell-session issue.',
504
- 'env.fix.whyShell': 'The workbench has no shell channel, so it cannot fetch data \u2014 you cannot install this from here; someone needs to fix the background environment.',
526
+ 'env.fix.whyShell': 'The workbench cannot reach the command line on this machine, so it cannot fetch data \u2014 you cannot install this from here; someone needs to fix the background environment.',
505
527
  'env.fix.step': 'Run this in a terminal, then hit Retry:',
506
528
  'env.fix.stepPath': 'Open a new terminal window (or make sure npm\u2019s global bin directory is on PATH), then hit Retry.',
507
- 'env.fix.stepShell': 'Restart the workbench (or dsh); if it keeps happening, the shell channel is not wired up.',
529
+ 'env.fix.stepShell': 'Restart the workbench (or dsh); if it keeps happening, the workbench still cannot reach the command line.',
508
530
  'env.fix.permission': 'Permission denied: rerun with sudo, or point npm\u2019s global directory at your home.',
509
531
  'env.fix.network': 'Network unreachable: check your network or proxy, then retry.',
510
532
  'env.fix.details': 'Details (for troubleshooting)',
@@ -533,9 +555,9 @@ export const en: Record<keyof WorkbenchMessages, string> = {
533
555
  'env.warm.done': 'Ready ({n} sites)',
534
556
  'env.warm.short': 'Could not sign in early this time \u2014 nothing breaks; the first read fills it in',
535
557
  'env.unit.failed': 'This module cannot start',
536
- 'env.unit.failedHint': 'It failed while assembling itself; other modules are unaffected.',
537
- 'env.unit.unchecked': 'Cannot check: no shell channel',
538
- 'env.unit.uncheckedHint': 'The module is not the problem \u2014 the shell channel is unavailable. Restart the workbench.',
558
+ 'env.unit.failedHint': 'It failed while starting up; other modules are unaffected.',
559
+ 'env.unit.unchecked': 'Cannot check: no command line',
560
+ 'env.unit.uncheckedHint': 'The module is not the problem \u2014 the workbench cannot reach the command line. Restart the workbench.',
539
561
  'adapterSet.not-configured': 'No adapter set configured; using the default.',
540
562
  'adapterSet.no-profile': 'No profile found, so the adapter set cannot load; using the default.',
541
563
  'adapterSet.malformed': 'An adapter set must be a package name (for example @acme/adapters-set); using the default.',
@@ -582,7 +604,7 @@ export const en: Record<keyof WorkbenchMessages, string> = {
582
604
  'sidebarEdition.official': 'Official',
583
605
  'sidebarEdition.officialHint': 'Matches dsh exactly and stays stable: search, view options, show more, archive, add workspace — no waiting for us to catch up. Pick it to keep things simple.',
584
606
  'sidebarEdition.custom': 'Custom',
585
- 'sidebarEdition.customHint': 'Built for multi-project work: one project per dropdown, recency-first sessions, edge fades, marquee, DIY new session. Easier when you juggle projects.',
607
+ 'sidebarEdition.customHint': 'Built for multi-project work: one project per dropdown, recency-first sessions, long names scroll, edges fade, DIY new session. Easier when you juggle projects.',
586
608
  'sidebarEdition.saving': 'Configuring…',
587
609
  'sidebarEdition.reloadRequired': 'Saved. Reload the page to apply — no workbench restart needed.',
588
610
  'sidebarEdition.reload': 'Reload page',
@@ -613,26 +635,26 @@ export const en: Record<keyof WorkbenchMessages, string> = {
613
635
  'record.act.halt': 'Halt',
614
636
  'approval.record.site': 'Site',
615
637
  'approval.record.what': 'Records',
616
- 'approval.record.lands': 'Lands in',
638
+ 'approval.record.lands': 'Saves to',
617
639
  'approval.record.noUrl': 'no site given (this call gets refused)',
618
640
  'approval.record.oneAction': 'one action',
619
641
  'approval.record.noSwitch': 'it will not switch you back (the leftbar footer shows the state)',
620
- 'approval.longTask.what': 'Stops',
642
+ 'approval.longTask.what': 'Task to stop',
621
643
  'approval.longTask.signal':
622
- 'stopping only sends an interrupt signal — how the platform-side run finishes is up to the module',
644
+ 'stopping only sends an interrupt signal \u2014 wrapping up the run is up to the module',
623
645
  'approval.publish.module': 'Module',
624
646
  'approval.publish.target': 'Target',
625
647
  'approval.publish.version': 'Version',
626
648
  'approval.publish.author': 'Author',
627
- 'approval.publish.authorMissing': 'unsigned (commits use the local git identity)',
649
+ 'approval.publish.authorMissing': 'unsigned',
628
650
  'approval.publish.registry': 'Registry',
629
651
  'approval.publish.repo': 'Repository',
630
652
  'approval.publish.branch': 'Branch',
631
653
  'approval.publish.defaultBranch': 'default branch',
632
- 'approval.publish.artifacts': 'Artifacts',
654
+ 'approval.publish.artifacts': 'Build files',
633
655
  'approval.publish.index': 'Index',
634
656
  'approval.publish.commits': 'Commits',
635
- 'approval.publish.twoCommits': 'artifacts + market.json in 2 commits, one push',
657
+ 'approval.publish.twoCommits': 'build files + market.json in 2 commits, one push',
636
658
  'approval.publish.reading': 'Reading…',
637
659
  'approval.publish.changelog': 'Changelog for {version}',
638
660
  'approval.publish.changelogMissing': 'No changelog entry for {version}; publishing will be blocked',
package/src/i18n/zh.ts CHANGED
@@ -133,15 +133,14 @@ export const zh = {
133
133
  'panels.market.update': '更新',
134
134
  'panels.market.swapSlow': '还没换上:可能网慢或没装上。再点一次「更新」;一直这样就把 dsh 重启一遍。',
135
135
  'panels.market.removeSlow': '还没卸掉:可能网慢或卸载没走完。等一下再看;一直这样就把 dsh 重启一遍。',
136
- 'panels.market.updateNoChange': '没换成:点下去是 {from},跑完盘上还是这一版;源上最新是 {latest}。',
136
+ 'panels.market.updateNoChange': '更新失败:还是 {from};源上最新是 {latest},可以再点一次「更新」。',
137
137
  'panels.market.updateUnknownVersion': '(问不到)',
138
- 'panels.market.updateGone': '没换成:更新跑完盘上读不到这个模块。',
139
- 'panels.market.updateRestored': '没换成:盘上已经读不到新版本,已把 {version} 装回去。',
138
+ 'panels.market.updateGone': '更新失败:更新后找不到这个模块。',
139
+ 'panels.market.updateRestored': '更新失败:更新后找不到新版本,已把 {version} 装回去。',
140
140
  'panels.market.updateBehind': '装上了 {installed},但源上最新是 {latest} —— 没更到最新,可以再点一次。',
141
- 'panels.market.selfUpdateFailed': '自更新没成:{reason}',
141
+ 'panels.market.selfUpdateFailed': '工作台更新失败:{reason}',
142
142
  'panels.market.selfUpdateUnknown': '外部进程没留下原因(看 ~/.dsh/workbench/self-update.log)',
143
- 'panels.market.selfUpdateRolledBack': '没换成,已回滚到 {version}。',
144
- 'panels.market.selfUpdateNeedsMigrate': '工作台已更新。旧会话 / 项目不会自动并:先退出所有 dsh,再运行 dsh-workbench migrate(--force 可补并)。',
143
+ 'panels.market.selfUpdateRolledBack': '工作台更新失败,已回滚到 {version}。',
145
144
  'panels.market.uninstall': '卸载',
146
145
  'panels.market.uninstallLabel': '卸载 {name}',
147
146
  'panels.market.installing': '正在安装…',
@@ -163,9 +162,27 @@ export const zh = {
163
162
  'panels.market.empty': '暂无可用模块',
164
163
  'panels.market.sectionPlugins': '已安装 opencli 插件',
165
164
  'panels.market.moduleOutdated': '有新版',
165
+ 'panels.market.updateNeedsWorkbench': '新版本要先把工作台升级才能用',
166
+ 'panels.market.updateIncompatible': '新版本和当前的工作台不匹配,暂时不能更新',
166
167
  'panels.market.moduleRefused': '模块版本与工作台不匹配,暂时无法使用',
167
168
  'panels.market.moduleRestartHint': '重启后生效',
168
169
  'panels.market.pendingRestart': '重启后生效',
170
+ 'panels.market.pendingFollowUp': '旧数据待迁移',
171
+ 'panels.market.migrationHint': '旧会话和项目还没搬过来',
172
+ 'panels.market.migrateAction': '迁移旧数据',
173
+ 'panels.market.migrating': '正在迁移…',
174
+ 'panels.market.migrateConfirmTitle': '迁移旧数据?',
175
+ 'panels.market.migrateConfirmDetail': '先退出 dsh web / Desktop。迁移只补缺、不覆盖;旧目录保留。',
176
+ 'panels.market.migrateConfirmAck': '我已经退出 dsh web / Desktop',
177
+ 'panels.market.migrateConfirmYes': '开始迁移',
178
+ 'panels.market.migrateDone': '迁移完成:补了 {added} 个项目;重启工作台和 dsh web 后出现。',
179
+ 'panels.market.dismissFollowUp': '不再提醒',
180
+ 'panels.market.dismissing': '正在收起…',
181
+ 'panels.market.dismissFollowUpTitle': '不再提醒这件事?',
182
+ 'panels.market.dismissFollowUpDetail': '提示会从模块市场收起,但不会迁移或删除旧数据。旧会话和项目仍留在旧目录,新版本里看不到;以后需要时仍可运行 dsh-workbench migrate。',
183
+ 'panels.market.dismissFollowUpAck': '我知道旧数据不会自动出现',
184
+ 'panels.market.dismissFollowUpYes': '不再提醒',
185
+ 'panels.market.dismissed': '已不再提醒;旧数据仍在旧目录,需要时仍可运行 dsh-workbench migrate。',
169
186
  'panels.market.workbenchName': '工作台',
170
187
  'panels.market.pluginBroken': '这份插件装坏了:认不出它是什么。可以先卸载,再让 agent 按包名重装一次。',
171
188
  'panels.market.restartNeeded': '新版装好了,重启一次才生效。',
@@ -252,7 +269,7 @@ export const zh = {
252
269
  'panels.market.add.exampleTitle': '示例',
253
270
  'panels.market.add.exampleFill': '填入示例',
254
271
  'panels.market.add.registryLabel': '安装源',
255
- 'panels.market.add.registryProfile': '这个 profile 配的源',
272
+ 'panels.market.add.registryProfile': '这份工作台配的源',
256
273
  'panels.market.add.registryPnpm': 'pnpm 自己配的源',
257
274
  'panels.market.add.check': '预检',
258
275
  'panels.market.add.checking': '正在预检…',
@@ -273,14 +290,19 @@ export const zh = {
273
290
  'panels.market.tabs': '模块市场的两个面',
274
291
  'panels.tab.discover': '发现',
275
292
  'panels.discover.loading': '正在读取索引',
293
+ 'panels.discover.slowHint': '读取较慢:如有授权提示,先完成它,或换一个索引源。',
276
294
  'panels.discover.lead': '从索引源浏览模块;装上就能用。',
277
295
  'panels.discover.addSource': '添加',
278
296
  'panels.discover.addingSource': '正在添加…',
279
297
  'panels.discover.addFirstSource': '添加索引源',
280
298
  'panels.discover.removeSource': '移除',
281
299
  'panels.discover.removeSourceNamed': '移除 {url}',
300
+ 'panels.discover.useSource': '使用',
301
+ 'panels.discover.useSourceNamed': '使用 {label}',
302
+ 'panels.discover.sourceCurrent': '当前使用',
282
303
  'panels.discover.refresh': '刷新',
283
304
  'panels.discover.search': '搜索模块',
305
+ 'panels.discover.clearSearch': '清除搜索',
284
306
  'panels.discover.all': '全部',
285
307
  'panels.discover.sourceLabel': '名字',
286
308
  'panels.discover.sourceKind': '类型',
@@ -290,8 +312,8 @@ export const zh = {
290
312
  'panels.discover.sourcePlaceholder': 'https://example.com/index.json 或 git@git.example.com:wb/market.git',
291
313
  'panels.discover.sourceRef': '分支',
292
314
  'panels.discover.sourcePath': '索引文件',
293
- 'panels.discover.sourceLocal': '本地 clone(可选)',
294
- 'panels.discover.sourceLocalHint': '不填就 clone 到 ~/.dsh/workbench/market-index/。',
315
+ 'panels.discover.sourceLocal': '本地副本目录(可选)',
316
+ 'panels.discover.sourceLocalHint': '不填就放到 ~/.dsh/workbench/market-index/。',
295
317
  'panels.discover.save': '保存并刷新',
296
318
  'panels.discover.cancel': '取消',
297
319
  'panels.discover.retry': '重试',
@@ -304,9 +326,9 @@ export const zh = {
304
326
  'panels.discover.missingIndex': '仓库里还没有索引文件 {path}',
305
327
  'panels.discover.initTitle': '把这个仓库初始化成模块市场索引?',
306
328
  'panels.discover.initCta': '初始化成市场索引',
307
- 'panels.discover.initWhat': '会在 {branch} 分支写 market.json 与 README.md,提交一次并推上去;之后从这个工作台发布的模块会把产物提交到 packages/<unit>/。仓库的写权限归它的所有者。',
329
+ 'panels.discover.initWhat': '会在 {branch} 分支写 market.json 与 README.md,提交一次并推上去;之后从这个工作台发布的模块会把打包好的文件提交到 packages/<unit>/。仓库的写权限归它的所有者。',
308
330
  'panels.discover.initBranch': '分支',
309
- 'panels.discover.initBranchHint': '索引与产物都发到这个分支;空仓库会新建它。',
331
+ 'panels.discover.initBranchHint': '索引和打包文件都发到这个分支;空仓库会新建它。',
310
332
  'panels.discover.initBranchBad': '分支名只能用字母、数字、点、下划线、斜杠或短横线',
311
333
  'panels.discover.initOk': '初始化',
312
334
  'panels.discover.initBusy': '正在初始化…',
@@ -410,11 +432,11 @@ export const zh = {
410
432
  'panels.market.add.doneApplied': '装好了,已经生效。',
411
433
  'panels.market.add.doneRestart': '装好了,重启一次才生效。',
412
434
  'panels.market.add.restartWhy': '为什么这一版要重启:{reason}',
413
- 'panels.market.add.restartWhy.no-hmr': '这个配置只在启动时应用改动(没开热更新)',
435
+ 'panels.market.add.restartWhy.no-hmr': '这份配置只在启动时读一次,改了得重启',
414
436
  'panels.market.add.restartWhy.package-moved': '某个已经装着的包换到了新的目录,或者这一下换掉了 dsh 自己提供的那份',
415
437
  'panels.market.add.restartWhy.host-module': '这一下动到了 dsh 自己加载的模块',
416
- 'panels.market.add.restartWhy.unmanaged-plugin': '这一下动到了插件清单之外正在跑的插件',
417
- 'panels.market.add.restartWhy.module-comparison': 'dsh 没能把已加载的插件与盘上的文件对上',
438
+ 'panels.market.add.restartWhy.unmanaged-plugin': '这一下动到了没登记过、正在运行的插件',
439
+ 'panels.market.add.restartWhy.module-comparison': 'dsh 没法确认正在跑的插件就是这台机器上装好的那一份',
418
440
  'panels.market.add.cancelled': '已取消。',
419
441
  'panels.market.add.failed': '没成功:{reason}',
420
442
  'panels.market.add.removed': '已经移除了。',
@@ -424,10 +446,10 @@ export const zh = {
424
446
  'panels.market.add.removedRestart': '卸掉了,重启一次才彻底生效。',
425
447
  'panels.market.add.remove': '移除它',
426
448
  'panels.market.add.problem.invalidSpec': '这个写法不认:不能是空的,也不能以横杠开头。',
427
- 'panels.market.add.problem.alreadyInstalled': '这个包已经在 profile 里了(要换版本请带上 @版本)。',
449
+ 'panels.market.add.problem.alreadyInstalled': '这个包已经在这份工作台里了(要换版本请带上 @版本)。',
428
450
  'panels.market.add.problem.notFound': '源上没有这个包。换个包名或版本再试。',
429
451
  'panels.market.add.problem.notAPackage': '这个位置没有包。选一个包含 package.json 的目录。',
430
- 'panels.market.add.problem.notABundle': '它是一个 npm 包,但不是 dsh 插件包(缺 dsh 的接线声明)。',
452
+ 'panels.market.add.problem.notABundle': '它是一个 npm 包,但不是 dsh 插件包(dsh 在里面找不到该加载什么)。',
431
453
  'panels.market.add.problem.network': '源连不上。检查网络后重试。',
432
454
  'panels.market.add.problem.unknown': '预检没通过(原因未知)。展开安装详情看原始输出,或重试。',
433
455
  'panels.market.add.reason.invalidSpec': '写法不认',
@@ -435,7 +457,7 @@ export const zh = {
435
457
  'panels.market.add.reason.notBundle': '它不是一个 dsh 插件包',
436
458
  'panels.market.add.reason.notRemovable': '它是安装自带的组合包,不能卸',
437
459
  'panels.market.add.reason.bundleInUse': '还有东西在用它,卸不掉',
438
- 'panels.market.add.reason.stopProfile': '这个配置没开热更新,得先停掉进程',
460
+ 'panels.market.add.reason.stopProfile': '这份配置改了要重启,得先停掉工作台',
439
461
  'panels.market.add.reason.staleApproval': '要允许的安装脚本已经变了,重新来一次',
440
462
  'panels.market.add.reason.operationError': 'pnpm 执行出错(详情见安装输出)',
441
463
  'panels.market.add.reason.buildBlocked': 'pnpm 拦下了安装脚本',
@@ -458,15 +480,15 @@ export const zh = {
458
480
  'blocker.market.open': '去模块市场',
459
481
  'blocker.login.title': '需要登录 {platform}',
460
482
  'blocker.login.titleGeneric': '需要登录',
461
- 'blocker.login.hint': '工作台用你的浏览器登录态;登录一次就行,之后不用再登。',
483
+ 'blocker.login.hint': '工作台借你浏览器里的登录状态;登录一次就行,之后不用再登。',
462
484
  'blocker.login.go': '去登录',
463
485
  'blocker.login.manual': '在终端执行该插件的登录命令(见插件的文档),按提示完成登录后重试。',
464
486
  'blocker.forbidden.title': '没有权限访问 {platform}',
465
487
  'blocker.forbidden.titleGeneric': '没有权限',
466
488
  'blocker.forbidden.hint': '账号已登录,但没有这个项目/仓库的权限;申请之后再试。',
467
489
  'blocker.forbidden.open': '打开权限页',
468
- 'blocker.timeout.hint': '无头浏览器可能没起来,重试一次通常就好。',
469
- 'blocker.exec.hint': '确认 opencli 已安装且在 PATH 里(which opencli)。',
490
+ 'blocker.timeout.hint': '后台浏览器没起来,重试一次通常就好。',
491
+ 'blocker.exec.hint': '确认 opencli 已经装好、在终端里能直接运行(which opencli)。',
470
492
  'blocker.unknown.title': '出了点问题',
471
493
  'panels.reading': '正在读取面板配置…',
472
494
  'panels.cardBroken': '这个模块起不来:{unit}({reason})',
@@ -480,7 +502,7 @@ export const zh = {
480
502
  'env.elapsed': '已等待 {seconds} 秒',
481
503
  'env.stepFailed.install': '装不上',
482
504
  'env.stepFailed.path': '装了但还找不到',
483
- 'env.stepFailed.shell': '执行通道不可用',
505
+ 'env.stepFailed.shell': '连不上命令行',
484
506
  'env.toolchain.ok': '正常',
485
507
  'env.toolchain.warn': '还没完全准备好',
486
508
  'env.opencli.ok': '已就绪',
@@ -497,10 +519,10 @@ export const zh = {
497
519
  'env.fix.title': '怎么解决',
498
520
  'env.fix.why': '工作台用它自己那份后台工具(与你在终端里那套分开装,互不影响),这台机器上还没装好它。',
499
521
  'env.fix.whyPath': '后台工具装上了,但当前环境还找不到它 —— 通常是 PATH 或终端会话的问题。',
500
- 'env.fix.whyShell': '工作台拿不到执行命令的通道,所以取不了数据 —— 这一步你装不了,需要有人处理后台环境。',
522
+ 'env.fix.whyShell': '工作台拿不到这台机器的命令行,所以取不了数据 —— 这一步你装不了,需要有人处理后台环境。',
501
523
  'env.fix.step': '在终端里运行下面这条命令,装好之后点「重试」:',
502
524
  'env.fix.stepPath': '新开一个终端窗口(或确认 npm 的全局 bin 目录在 PATH 里),然后点「重试」。',
503
- 'env.fix.stepShell': '重启一次工作台(或 dsh);如果反复出现,说明执行通道没配好。',
525
+ 'env.fix.stepShell': '重启一次工作台(或 dsh);如果反复出现,说明工作台还是拿不到命令行。',
504
526
  'env.fix.permission': '权限不够:在命令前加 sudo 重跑,或先把 npm 的全局目录配到你的用户目录。',
505
527
  'env.fix.network': '网络不通:检查网络或代理设置后重试。',
506
528
  'env.fix.details': '详细输出(排障用)',
@@ -529,9 +551,9 @@ export const zh = {
529
551
  'env.warm.done': '已就绪({n} 个站点)',
530
552
  'env.warm.short': '这次没提前连上 —— 不影响用,第一次取数会自己补',
531
553
  'env.unit.failed': '这个模块起不来',
532
- 'env.unit.failedHint': '它自己装配时报了错,别的模块不受影响。',
533
- 'env.unit.unchecked': '检测不了:拿不到执行通道',
534
- 'env.unit.uncheckedHint': '不是这个模块的问题,是执行通道不可用 —— 重启一次工作台再试。',
554
+ 'env.unit.failedHint': '它自己启动时报了错,别的模块不受影响。',
555
+ 'env.unit.unchecked': '检测不了:拿不到命令行',
556
+ 'env.unit.uncheckedHint': '不是这个模块的问题,是工作台拿不到命令行 —— 重启一次工作台再试。',
535
557
  'adapterSet.not-configured': '没配置适配器集合,用默认的。',
536
558
  'adapterSet.no-profile': '找不到 profile,没法加载适配器集合;先用默认的。',
537
559
  'adapterSet.malformed': '适配器集合要写包名(如 @acme/adapters-set);先用默认的。',
@@ -578,7 +600,7 @@ export const zh = {
578
600
  'sidebarEdition.official': '官方',
579
601
  'sidebarEdition.officialHint': '跟 dsh 官方一致、最稳:搜索、视图选项、显示更多、归档、添加工作区都齐,升级也不等我们适配。想省心就选它。',
580
602
  'sidebarEdition.custom': '自定义',
581
- 'sidebarEdition.customHint': '为多项目工作流做的:项目下拉一屏一个项目,会话按最近更新排,两端淡出、跑马灯、工坊 DIY 新会话。项目多时更顺手。',
603
+ 'sidebarEdition.customHint': '为多项目工作流做的:项目下拉一屏一个项目,会话按最近更新排,名字自动滚动、两侧渐隐,工坊 DIY 新会话。项目多时更顺手。',
582
604
  'sidebarEdition.saving': '配置中…',
583
605
  'sidebarEdition.reloadRequired': '已写入。刷新页面后生效(不用重启工作台)。',
584
606
  'sidebarEdition.reload': '刷新页面',
@@ -609,25 +631,25 @@ export const zh = {
609
631
  'record.act.halt': '停',
610
632
  'approval.record.site': '站点',
611
633
  'approval.record.what': '录制功能',
612
- 'approval.record.lands': '落点',
634
+ 'approval.record.lands': '保存到',
613
635
  'approval.record.noUrl': '没给站点地址(这次会被当场拒)',
614
636
  'approval.record.oneAction': '一次操作',
615
637
  'approval.record.noSwitch': '录完不会替你切回来(左栏底部会亮一条状态)',
616
- 'approval.longTask.what': '要停的那一趟',
617
- 'approval.longTask.signal': '停了只是让工作台发出中断信号 —— 平台侧那趟活儿的收尾看模块自己',
638
+ 'approval.longTask.what': '要停的那次任务',
639
+ 'approval.longTask.signal': '停了只是让工作台发出中断信号 —— 这次任务怎么收尾由模块自己负责',
618
640
  'approval.publish.module': '模块',
619
641
  'approval.publish.target': '目标',
620
642
  'approval.publish.version': '版本',
621
643
  'approval.publish.author': '作者',
622
- 'approval.publish.authorMissing': '未署名(提交用本机 git 身份)',
644
+ 'approval.publish.authorMissing': '未署名',
623
645
  'approval.publish.registry': '源',
624
646
  'approval.publish.repo': '仓库',
625
647
  'approval.publish.branch': '分支',
626
648
  'approval.publish.defaultBranch': '默认分支',
627
- 'approval.publish.artifacts': '产物',
649
+ 'approval.publish.artifacts': '打包文件',
628
650
  'approval.publish.index': '索引',
629
651
  'approval.publish.commits': '提交',
630
- 'approval.publish.twoCommits': '产物 + market.json 两个 commit,一次 push',
652
+ 'approval.publish.twoCommits': '打包文件 + market.json 两次提交,一次推送',
631
653
  'approval.publish.reading': '读取中…',
632
654
  'approval.publish.changelog': '{version} 的更新日志',
633
655
  'approval.publish.changelogMissing': '这一版还没有更新日志({version}),发布会被拦下',
@@ -130,11 +130,13 @@ export interface DshSlots {
130
130
  }
131
131
 
132
132
  /**
133
- * dsh 的语言服务:按命名空间注册字典,再取回那个命名空间的文案函数。
133
+ * dsh 的语言服务:按命名空间注册字典,再取回那个命名空间的文案函数;
134
+ * `resolveText` 按当前语言取一份字面量(字符串原样返回,映射按语言回退链取)。
134
135
  */
135
136
  export interface DshLocale {
136
137
  register(namespace: string, dictionaries: Record<string, Record<string, string>>): () => void;
137
138
  bind(namespace: string): Translate;
139
+ resolveText?(text: string | Readonly<Record<string, string | undefined>>): string;
138
140
  }
139
141
 
140
142
  /**
@@ -2,6 +2,7 @@ import fs from 'node:fs';
2
2
  import os from 'node:os';
3
3
  import path from 'node:path';
4
4
  import { afterEach, describe, expect, it } from 'vitest';
5
+ import { unitTitleKey } from '../../contract/unit.js';
5
6
  import { declarationOfPackage } from '../declaration.js';
6
7
 
7
8
  const roots: string[] = [];
@@ -19,9 +20,10 @@ afterEach(() => {
19
20
  });
20
21
 
21
22
  const DECLARED = {
22
- apiVersion: 2,
23
+ apiVersion: 3,
23
24
  unit: 'demo',
24
- card: { titleKey: 'demo.cardTitle', order: 7 },
25
+ title: { zh: '演示', en: 'Demo' },
26
+ card: { order: 7 },
25
27
  tools: [{ name: 'workbench_demo_list', writes: false }],
26
28
  host: { inject: [] },
27
29
  };
@@ -31,7 +33,9 @@ describe('模块作者写用例时读自己那份声明', () => {
31
33
  const manifest = declarationOfPackage('@t/demo', packageAt(DECLARED));
32
34
 
33
35
  expect(manifest.id).toBe('demo');
34
- expect(manifest.card).toEqual({ titleKey: 'demo.cardTitle', order: 7 });
36
+ expect(manifest.title).toEqual({ zh: '演示', en: 'Demo' });
37
+ expect(manifest.titleKey).toBe(unitTitleKey('demo'));
38
+ expect(manifest.card).toEqual({ order: 7 });
35
39
  expect(manifest.tools).toEqual([{ name: 'workbench_demo_list', writes: false }]);
36
40
  });
37
41
 
@@ -10,6 +10,7 @@ import type {
10
10
  import type { NeedState } from '../contract/unit-capability.js';
11
11
  import type { UnitCapability } from '../contract/unit-capability.js';
12
12
  import type { UnitManifest } from '../contract/unit.js';
13
+ import { unitTitleKey } from '../contract/unit.js';
13
14
 
14
15
  export const fakeNpmSource: SupplySource = {
15
16
  kind: 'npm',
@@ -47,9 +48,11 @@ export function manifestOf(
47
48
  readonly card?: UnitManifest['card'];
48
49
  } = {},
49
50
  ): UnitManifest {
51
+ const id = options.id ?? 'fixture';
50
52
  return {
51
- id: options.id ?? 'fixture',
52
- card: options.card === undefined ? { titleKey: `${options.id ?? 'fixture'}.mine`, order: 10 } : options.card,
53
+ id,
54
+ titleKey: unitTitleKey(id),
55
+ card: options.card === undefined ? { order: 10 } : options.card,
53
56
  tools: [],
54
57
  host: { inject: [] },
55
58
  ...(options.needs === undefined ? {} : { needs: options.needs }),