@dsh-workbench/core 1.1.5 → 1.1.6

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 (27) hide show
  1. package/client.js +704 -520
  2. package/dist/client/client.body.js +704 -520
  3. package/dist/client/index.js +575 -391
  4. package/dist/host/index.js +613 -149
  5. package/dist/types/app/layouts/market/market-check.d.ts +7 -0
  6. package/dist/types/app/layouts/market/market-header.d.ts +3 -1
  7. package/dist/types/app/layouts/market/section-check.d.ts +12 -0
  8. package/dist/types/app/layouts/market/use-market-reload.d.ts +14 -0
  9. package/dist/types/app/layouts/market/use-module-versions.d.ts +20 -4
  10. package/dist/types/app/layouts/rightbar/FailureCard.d.ts +3 -3
  11. package/dist/types/app/layouts/rightbar/MarketView.d.ts +5 -3
  12. package/dist/types/app/layouts/rightbar/failure-card-text.d.ts +6 -0
  13. package/dist/types/app/layouts/rightbar/market-row-types.d.ts +2 -0
  14. package/dist/types/app/layouts/rightbar/market-rows.d.ts +2 -0
  15. package/dist/types/app/layouts/rightbar/market-uninstall.d.ts +10 -0
  16. package/dist/types/app/layouts/rightbar/market-update-verdict.d.ts +2 -0
  17. package/dist/types/kernel/contract/market-index.d.ts +1 -1
  18. package/dist/types/modules/panels/model/market-env.d.ts +2 -2
  19. package/dist/types/modules/panels/model/market-swap-stuck.d.ts +20 -0
  20. package/dist/types/modules/panels/model/market-swap-stuck.test.d.ts +1 -0
  21. package/dist/types/modules/panels/model/market-types.d.ts +3 -0
  22. package/dist/types/modules/panels/model/market-update-bundle.d.ts +5 -0
  23. package/dist/types/modules/panels/model/plugin-actions.d.ts +1 -1
  24. package/dist/types/shared/api/host/self-update-marker.d.ts +5 -0
  25. package/dist/types/shared/api/host/self-update-marker.test.d.ts +1 -0
  26. package/package.json +3 -3
  27. package/skills/workbench-module-diy/WIRING.md +2 -1
@@ -1,5 +1,12 @@
1
1
  import type { Translate } from '@dsh-workbench/shared';
2
2
  import type { LatestCheckSummary } from '../rightbar/market-rows';
3
+ export interface MarketRefreshButtonProps {
4
+ readonly label: string;
5
+ readonly checking: boolean;
6
+ readonly disabled: boolean;
7
+ readonly onCheck: () => void;
8
+ }
9
+ export declare function MarketRefreshButton({ label, checking, disabled, onCheck }: MarketRefreshButtonProps): JSX.Element;
3
10
  export interface MarketCheckProps {
4
11
  readonly t: Translate;
5
12
  readonly checkedAt: number | null;
@@ -5,7 +5,9 @@ export interface MarketHeaderProps {
5
5
  readonly idPrefix: string;
6
6
  readonly tab: MarketTab;
7
7
  readonly busy: boolean;
8
+ readonly checking: boolean;
8
9
  readonly onTab: (tab: MarketTab) => void;
10
+ readonly onReload: () => void;
9
11
  readonly onAdd: () => void;
10
12
  }
11
- export declare function MarketHeader({ t, idPrefix, tab, busy, onTab, onAdd }: MarketHeaderProps): JSX.Element;
13
+ export declare function MarketHeader({ t, idPrefix, tab, busy, checking, onTab, onReload, onAdd, }: MarketHeaderProps): JSX.Element;
@@ -0,0 +1,12 @@
1
+ import type { Translate } from '@dsh-workbench/shared';
2
+ import type { LatestCheckSummary } from '../rightbar/market-rows';
3
+ import type { VersionsCheck, VersionsPart } from './use-module-versions';
4
+ export interface SectionCheckProps {
5
+ readonly t: Translate;
6
+ readonly part: VersionsPart;
7
+ readonly seat: VersionsCheck;
8
+ readonly latest: LatestCheckSummary;
9
+ readonly disabled: boolean;
10
+ readonly onCheck?: ((part: VersionsPart) => void) | undefined;
11
+ }
12
+ export declare function SectionCheck({ t, part, seat, latest, disabled, onCheck, }: SectionCheckProps): JSX.Element;
@@ -0,0 +1,14 @@
1
+ import { type ModuleVersionsView, type VersionsPart } from './use-module-versions';
2
+ export interface MarketReload {
3
+ readonly reload: (options?: {
4
+ readonly force?: boolean;
5
+ }) => void;
6
+ readonly checkPart: (part: VersionsPart) => void;
7
+ }
8
+ export interface MarketReloadInput {
9
+ readonly checkedAt: number | null;
10
+ readonly forceProbe: () => void;
11
+ readonly reloadCapability: () => void;
12
+ readonly reloadVersions: ModuleVersionsView['reload'];
13
+ }
14
+ export declare function useMarketReload(input: MarketReloadInput): MarketReload;
@@ -1,26 +1,42 @@
1
1
  import type { ModuleVersion, WorkbenchSelfUpdate, WorkbenchVersion } from '../../../kernel/contract/bundle-install';
2
2
  import type { MarketInstalledModule } from '../../../kernel/contract/market-index';
3
3
  import type { InstalledPlugin } from '../../../shared/api/installed-plugins';
4
+ export type VersionsScope = 'all' | 'modules' | 'plugins';
5
+ export type VersionsPart = Exclude<VersionsScope, 'all'>;
6
+ export interface VersionsCheck {
7
+ readonly checking: boolean;
8
+ readonly failed: boolean;
9
+ readonly checkedAt: number | null;
10
+ }
4
11
  export interface ModuleVersionsState {
5
12
  readonly modules: readonly ModuleVersion[] | null;
6
13
  readonly plugins: readonly InstalledPlugin[] | null;
7
14
  readonly workbench: WorkbenchVersion | null;
8
15
  readonly selfUpdate: WorkbenchSelfUpdate | null;
9
16
  readonly read: boolean;
10
- readonly checking: boolean;
11
- readonly failed: boolean;
12
- readonly checkedAt: number | null;
17
+ readonly allChecking: boolean;
18
+ readonly modulesCheck: VersionsCheck;
19
+ readonly pluginsCheck: VersionsCheck;
13
20
  }
14
21
  export interface ModuleVersionsView extends ModuleVersionsState {
22
+ readonly checking: boolean;
15
23
  reload(options?: {
16
24
  readonly force?: boolean;
17
25
  readonly fresh?: boolean;
26
+ readonly scope?: VersionsScope;
18
27
  }): void;
19
28
  }
29
+ export interface ModuleVersionsRead {
30
+ force?: boolean;
31
+ fresh?: boolean;
32
+ scope?: VersionsScope;
33
+ }
20
34
  export declare function bumpModuleVersionsEpoch(): void;
21
35
  export declare function moduleVersionsValue(): ModuleVersionsState;
22
36
  export declare function resetModuleVersions(): void;
23
37
  export declare function subscribeModuleVersions(listener: () => void): () => void;
24
38
  export declare function withMarketUpdates(modules: readonly ModuleVersion[], rows: readonly MarketInstalledModule[]): readonly ModuleVersion[];
25
- export declare function runModuleVersionsRead(force?: boolean, fresh?: boolean): Promise<void>;
39
+ export declare function moduleVersionsCheckedAt(now: ModuleVersionsState): number | null;
40
+ export declare function moduleVersionsChecking(value: ModuleVersionsState): boolean;
41
+ export declare function runModuleVersionsRead(force?: boolean, fresh?: boolean, scope?: VersionsScope): Promise<void>;
26
42
  export declare function useModuleVersions(): ModuleVersionsView;
@@ -1,8 +1,8 @@
1
1
  import type { Translate } from '@dsh-workbench/shared';
2
- import type { InstallFailure } from '@dsh-workbench/shared';
3
- export declare function FailureCard({ t, failure, onRecheck, rechecking, }: {
2
+ import type { FailureCardModel } from './failure-card-text';
3
+ export declare function FailureCard({ t, model, onRecheck, rechecking, }: {
4
4
  readonly t: Translate;
5
- readonly failure: InstallFailure;
5
+ readonly model: FailureCardModel;
6
6
  readonly onRecheck: () => void;
7
7
  readonly rechecking: boolean;
8
8
  }): JSX.Element;
@@ -8,6 +8,7 @@ import type { TitleResolve } from './market-names';
8
8
  import type { MarketMock } from './market-mock';
9
9
  import type { ModuleUpdateMap } from './market-rows';
10
10
  import type { WorkbenchSelfUpdate, WorkbenchVersion } from '../../../kernel/contract/bundle-install';
11
+ import type { VersionsCheck, VersionsPart } from '../market/use-module-versions';
11
12
  export interface MarketViewProps {
12
13
  readonly t: Translate;
13
14
  readonly titleOf: TitleResolve;
@@ -20,8 +21,9 @@ export interface MarketViewProps {
20
21
  }) => void;
21
22
  readonly onPending?: ((pending: boolean) => void) | undefined;
22
23
  readonly updates?: ModuleUpdateMap | undefined;
23
- readonly updatesCheckedAt?: number | null | undefined;
24
- readonly updatesFailed?: boolean | undefined;
24
+ readonly modulesCheck?: VersionsCheck | undefined;
25
+ readonly pluginsCheck?: VersionsCheck | undefined;
26
+ readonly onCheck?: ((part: VersionsPart) => void) | undefined;
25
27
  readonly installed?: readonly InstalledWorkbenchModule[] | undefined;
26
28
  readonly installedRead?: boolean | undefined;
27
29
  readonly workbench?: WorkbenchVersion | null | undefined;
@@ -33,4 +35,4 @@ export interface MarketViewProps {
33
35
  readonly defaults?: readonly string[] | undefined;
34
36
  readonly changed?: Readonly<Record<string, number>> | undefined;
35
37
  }
36
- export declare function MarketView({ t, titleOf, manifests, installable, capabilities, freshness, onChanged, onPending, updates, updatesCheckedAt, updatesFailed, installed, installedRead, workbench, selfUpdate, plugins, settling, installing, mock, defaults, changed, }: MarketViewProps): JSX.Element;
38
+ export declare function MarketView({ t, titleOf, manifests, installable, capabilities, freshness, onChanged, onPending, updates, modulesCheck, pluginsCheck, onCheck, installed, installedRead, workbench, selfUpdate, plugins, settling, installing, mock, defaults, changed, }: MarketViewProps): JSX.Element;
@@ -9,6 +9,12 @@ export interface FailureCardModel {
9
9
  readonly output: string;
10
10
  readonly exitCode: number | null;
11
11
  }
12
+ export declare function updateStuckCardOf(t: Translate, input: {
13
+ readonly command: string;
14
+ readonly fact?: string | undefined;
15
+ readonly from?: string | undefined;
16
+ readonly latest?: string | undefined;
17
+ }): FailureCardModel;
12
18
  export declare function shellPath(path: string): string;
13
19
  export declare function ownerLabel(uid: number): string;
14
20
  export declare function failureCardOf(failure: InstallFailure, t: Translate): FailureCardModel;
@@ -1,10 +1,12 @@
1
1
  import type { ModuleUpdateBlock } from '../../../kernel/contract/bundle-install';
2
2
  import type { MarketInstalledModule } from '../../../kernel/contract/market-index';
3
3
  import type { InstallFailure } from '@dsh-workbench/shared';
4
+ import type { FailureCardModel } from './failure-card-text';
4
5
  export interface MarketFailure {
5
6
  readonly id: string;
6
7
  readonly message: string;
7
8
  readonly failure?: InstallFailure;
9
+ readonly card?: FailureCardModel;
8
10
  }
9
11
  export type MarketRowAction = 'install' | 'update' | 'update-bundle' | 'install-version' | 'remove-bundle' | 'uninstall' | 'update-dependency' | 'update-plugin' | 'uninstall-plugin' | 'update-workbench' | 'migrate-workbench' | 'dismiss-followup';
10
12
  export type MarketState = 'checking' | 'installed' | 'inactive' | 'unusable' | 'broken' | 'outdated' | 'pending-restart' | 'pending-followup' | 'missing' | 'unchecked' | 'unknown';
@@ -1,6 +1,7 @@
1
1
  import type { LatestUnavailable, ModuleUpdateBlock, ModuleVersion } from '../../../kernel/contract/bundle-install';
2
2
  import type { MarketInstalledModule } from '../../../kernel/contract/market-index';
3
3
  import type { Translate, UnitManifest, UnitTitle } from '@dsh-workbench/shared';
4
+ import type { InstalledPlugin } from '../../../shared/api/installed-plugins';
4
5
  import type { MarketNameMap } from './market-names';
5
6
  import type { MarketRow, MarketRowAction, MarketState, ModuleUpdate } from './market-row-types';
6
7
  import type { SharedRow } from './market-shared-rows';
@@ -37,6 +38,7 @@ export interface LatestCheckSummary {
37
38
  readonly unknown: number;
38
39
  }
39
40
  export declare function latestCheckSummary(modules: readonly InstalledWorkbenchModule[] | undefined): LatestCheckSummary;
41
+ export declare function checkedPluginCount(plugins: readonly InstalledPlugin[] | null | undefined): number;
40
42
  export declare function installedRows(modules: readonly InstalledWorkbenchModule[], manifests: readonly UnitManifest[], listed: ReadonlySet<string>, names?: MarketNameMap | undefined, defaults?: ReadonlySet<string>, changed?: Readonly<Record<string, number>>): MarketRow[];
41
43
  export declare function marketSwitchLocked(row: MarketRow): boolean;
42
44
  export declare function marketAsksAgent(row: MarketRow): boolean;
@@ -0,0 +1,10 @@
1
+ import type { Translate } from '@dsh-workbench/shared';
2
+ import type { MarketRow, MarketRowAction } from './market-rows';
3
+ export declare function UninstallConfirm({ t, confirming, row, onClose, act, rowById, }: {
4
+ readonly t: Translate;
5
+ readonly confirming: string | null;
6
+ readonly row: MarketRow | undefined;
7
+ readonly onClose: () => void;
8
+ readonly act: (id: string, action: MarketRowAction) => Promise<void>;
9
+ readonly rowById: ReadonlyMap<string, MarketRow>;
10
+ }): JSX.Element;
@@ -8,6 +8,8 @@ export interface UpdatedModule {
8
8
  }
9
9
  export type UpdateVerdict = {
10
10
  readonly kind: 'ok';
11
+ } | {
12
+ readonly kind: 'failed';
11
13
  } | {
12
14
  readonly kind: 'no-change';
13
15
  } | {
@@ -1,2 +1,2 @@
1
- export { MARKET_DISCOVER_ROUTE, MARKET_DOC_ROUTE, MARKET_GIT_PROBE_ROUTE, MARKET_INSTALLED_ROUTE, MARKET_INDEX_FORMAT, MARKET_INDEX_PATH, MARKET_PUBLISH_PREVIEW_ROUTE, MARKET_SOURCES_RESOURCE, MARKET_SOURCES_ROUTE, MARKET_WORKBENCH_LABEL, } from '@dsh-workbench/shared/contract/protocol/market-index';
1
+ export { MARKET_DISCOVER_ROUTE, MARKET_DOC_ROUTE, MARKET_GIT_PROBE_ROUTE, MARKET_INSTALLED_ROUTE, MARKET_INDEX_DIR, MARKET_INDEX_FORMAT, MARKET_INDEX_PATH, MARKET_PUBLISH_PREVIEW_ROUTE, MARKET_SOURCES_RESOURCE, MARKET_SOURCES_ROUTE, MARKET_WORKBENCH_LABEL, } from '@dsh-workbench/shared/contract/protocol/market-index';
2
2
  export type { DiscoverCompat, DiscoverDoc, DiscoverDocKind, DiscoverEntry, DiscoverFilter, DiscoverInstallState, DiscoverPayload, DiscoverProblem, DiscoverSourceRow, DiscoverState, DiscoverVersionRow, GitProbePayload, GitProbeStatus, GitTransportKind, MarketInstalledModule, MarketInstalledPayload, IndexSourceSpec, MarketClaim, MarketIndex, MarketIndexCategory, MarketIndexEngines, MarketIndexEntry, MarketIndexEntryMetadata, MarketIndexGitSource, MarketIndexLabel, MarketIndexMetadata, MarketIndexNpmSource, MarketIndexParse, MarketIndexProblem, MarketIndexProblemKind, MarketIndexSortKey, MarketIndexSource, MarketIndexVersion, MarketLocalizedText, MarketPublishDestination, MarketSourceConfig, MarketSourceKind, MarketSourcePolicy, MarketSourcesAction, MarketSourcesPayload, PublishChangelog, PublishPreview, } from '@dsh-workbench/shared/contract/protocol/market-index';
@@ -2,8 +2,8 @@ import type { Need, UnitCapability, UnitManifest } from '@dsh-workbench/shared/h
2
2
  import { type PluginReferences } from './plugin-actions';
3
3
  import type { PluginLedger } from './plugin-ledger';
4
4
  export interface EnvDropper {
5
- usersOf(plugin: string, except?: string): string[];
6
- drop(unit: string, needs: readonly Need[] | undefined, before: UnitCapability): Promise<string[]>;
5
+ usersOf(plugin: string, except?: string, roster?: readonly UnitManifest[]): string[];
6
+ drop(unit: string, needs: readonly Need[] | undefined, before: UnitCapability, roster?: readonly UnitManifest[]): Promise<string[]>;
7
7
  }
8
8
  export declare function createEnvDropper(options: {
9
9
  readonly catalog: () => readonly UnitManifest[];
@@ -0,0 +1,20 @@
1
+ import type { InstalledModule, SupplyPort } from '@dsh-workbench/shared/host';
2
+ export interface ExternalSwapDeps {
3
+ readonly supply: Pick<SupplyPort, 'startSelfUpdate'>;
4
+ readonly installed: ((pkg: string) => InstalledModule) | undefined;
5
+ readonly dshHome: string;
6
+ readonly profile: string;
7
+ readonly pollMs?: number | undefined;
8
+ readonly waitMs?: number | undefined;
9
+ readonly logger?: {
10
+ info?(message: string): void;
11
+ warn?(message: string): void;
12
+ } | undefined;
13
+ }
14
+ export interface ExternalSwapInput {
15
+ readonly pkg: string;
16
+ readonly from: string;
17
+ readonly to: string;
18
+ readonly pinned: boolean;
19
+ }
20
+ export declare function swapExternally(deps: ExternalSwapDeps, input: ExternalSwapInput): Promise<InstalledModule | undefined>;
@@ -41,6 +41,9 @@ export interface BundleInstallOutcome {
41
41
  readonly supply: BundleSupply;
42
42
  readonly plugin?: BundleInstalledPlugin;
43
43
  readonly restored?: string;
44
+ readonly remedy?: {
45
+ readonly command: string;
46
+ };
44
47
  }
45
48
  export interface BundleRemoveOutcome {
46
49
  readonly change: BundleChange;
@@ -15,5 +15,10 @@ export interface BundleUpdateDeps {
15
15
  warn?(message: string): void;
16
16
  } | undefined;
17
17
  readonly supply?: SupplyPort | undefined;
18
+ readonly profile?: string | undefined;
19
+ readonly dshHome?: string | undefined;
20
+ readonly profileName?: string | undefined;
21
+ readonly swapWaitMs?: number | undefined;
22
+ readonly swapPollMs?: number | undefined;
18
23
  }
19
24
  export declare function updateModuleBundle(unit: string, deps: BundleUpdateDeps): Promise<BundleInstallOutcome | null>;
@@ -34,7 +34,7 @@ export declare function pluginSweptText(pkg: string): string;
34
34
  export interface PluginActions {
35
35
  update(pkg: string): Promise<PluginUpdateOutcome>;
36
36
  uninstall(pkg: string): Promise<PluginUninstallOutcome>;
37
- sweep(): Promise<readonly string[]>;
37
+ sweep(claimedBy?: (plugin: string) => readonly string[]): Promise<readonly string[]>;
38
38
  }
39
39
  export declare function createPluginActions(options: {
40
40
  readonly ledger?: PluginLedger | undefined;
@@ -0,0 +1,5 @@
1
+ export interface SelfUpdateMarkerRead {
2
+ readonly pkg?: string | undefined;
3
+ readonly state?: string | undefined;
4
+ }
5
+ export declare function readSelfUpdateMarker(file: string): SelfUpdateMarkerRead;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsh-workbench/core",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "description": "个人工作台:Agent 工作台(左栏 + 常驻对话 + 自研右侧数据面板)。",
5
5
  "type": "module",
6
6
  "icon": "./icon.svg",
@@ -100,8 +100,8 @@
100
100
  "proper-lockfile": "^4.1.2",
101
101
  "which": "^7.0.0",
102
102
  "write-file-atomic": "^8.0.0",
103
- "@dsh-workbench/shared": "1.1.5",
104
- "@dsh-workbench/adapters-default": "1.1.5"
103
+ "@dsh-workbench/shared": "1.1.6",
104
+ "@dsh-workbench/adapters-default": "1.1.6"
105
105
  },
106
106
  "license": "MIT",
107
107
  "repository": {
@@ -70,9 +70,10 @@ DIY 族仅在选了 DIY 模式的会话出现(按模式,不按工作区)
70
70
  索引源跟当前选中无关:只有一个可发布源就用它;有多个时传 `source=<id>`(`workbench_market_sources` 会给)。
71
71
  用户要换署名(或在审批屏上说作者不对):传 `author="姓名 <邮箱>"`(或只给姓名),别手改 `package.json`,也别自己编。
72
72
  没写作者时审批屏显示推断的署名;他拒绝后说换成谁,再用 `author` 重发。
73
- 市场里一个包名归第一次发布的人(`market.json` 的 `owner`):换署名发同名会被拒,审批也放不过去;
73
+ 市场里一个包名归第一次发布的人(`market/<包名>/` 条目里的 `owner`):换署名发同名会被拒,审批也放不过去;
74
74
  用户真是接手的人,让他先找索引维护者改那一条的 `owner`,别自己改成对方的署名去绕。
75
75
  一个模块 id(`dsh.workbench.unit`)在同一个市场里只能有一个条目:换包名、沿用旧 unit 会被拒 ——
76
76
  换包名时把 unit 也换掉,别为了保留 id 去改别人的条目。
77
77
  2. 工具回 `needsUser` 时照 `text` 转述,不在对话里要 token / OTP;`otp` 交接后 `verify=true` 只核不发。
78
78
  3. 只改市集元数据(标题 / 作者 / 说明)不升版本:`refresh=true`(换作者时同时传 `author`,仍要过 `owner` 检查)。
79
+ 发布新版本不会改这些元数据(工具沿用远端条目当前的值),别指望发一版顺手把标题改掉。