@dsh-workbench/core 0.1.18 → 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.
Files changed (60) hide show
  1. package/client.js +1003 -537
  2. package/dist/client/client.body.js +1003 -537
  3. package/dist/client/index.js +1004 -538
  4. package/dist/host/index.js +1162 -145
  5. package/dist/types/app/client.d.ts +99 -39
  6. package/dist/types/app/layouts/market/__tests__/add-module-stages.test.d.ts +1 -0
  7. package/dist/types/app/layouts/market/add-module-text.d.ts +16 -1
  8. package/dist/types/app/layouts/market/use-add-module.d.ts +2 -8
  9. package/dist/types/app/layouts/market/use-module-versions.d.ts +2 -1
  10. package/dist/types/app/layouts/rightbar/MarketView.d.ts +5 -1
  11. package/dist/types/app/layouts/rightbar/ModulesPage.d.ts +4 -2
  12. package/dist/types/app/layouts/rightbar/PanelModules.d.ts +2 -2
  13. package/dist/types/app/layouts/rightbar/PanelPluginRows.d.ts +9 -0
  14. package/dist/types/app/layouts/rightbar/PanelRowControls.d.ts +14 -0
  15. package/dist/types/app/layouts/rightbar/__tests__/market-row-icon.test.d.ts +1 -0
  16. package/dist/types/app/layouts/rightbar/__tests__/market-section-icon.test.d.ts +1 -0
  17. package/dist/types/app/layouts/rightbar/__tests__/market-workbench.test.d.ts +1 -0
  18. package/dist/types/app/layouts/rightbar/__tests__/panel-plugin-rows.test.d.ts +1 -0
  19. package/dist/types/app/layouts/rightbar/__tests__/panel-scope-ui.test.d.ts +1 -0
  20. package/dist/types/app/layouts/rightbar/board-selection.d.ts +11 -0
  21. package/dist/types/app/layouts/rightbar/market-act.d.ts +21 -0
  22. package/dist/types/app/layouts/rightbar/market-mock.d.ts +6 -1
  23. package/dist/types/app/layouts/rightbar/market-plugin-rows.d.ts +3 -1
  24. package/dist/types/app/layouts/rightbar/market-row-icon.d.ts +7 -0
  25. package/dist/types/app/layouts/rightbar/market-row-types.d.ts +35 -0
  26. package/dist/types/app/layouts/rightbar/market-rows.d.ts +8 -35
  27. package/dist/types/app/layouts/rightbar/market-section-icon.d.ts +3 -0
  28. package/dist/types/app/layouts/rightbar/market-section.d.ts +18 -0
  29. package/dist/types/app/layouts/rightbar/market-view-text.d.ts +7 -1
  30. package/dist/types/app/layouts/rightbar/market-workbench-row.d.ts +5 -0
  31. package/dist/types/app/layouts/rightbar/panel-mock.d.ts +2 -1
  32. package/dist/types/app/layouts/rightbar/use-panels.d.ts +15 -1
  33. package/dist/types/app/units/registry.d.ts +1 -1
  34. package/dist/types/modules/panels/__tests__/plugin-panel-market-parity.test.d.ts +1 -0
  35. package/dist/types/modules/panels/__tests__/plugin-panel.test.d.ts +1 -0
  36. package/dist/types/modules/panels/__tests__/plugin-tool-units.test.d.ts +1 -0
  37. package/dist/types/modules/panels/__tests__/scope-machine.test.d.ts +1 -0
  38. package/dist/types/modules/panels/__tests__/scope-support.d.ts +51 -0
  39. package/dist/types/modules/panels/model/config.d.ts +19 -0
  40. package/dist/types/modules/panels/model/market-dispatch.d.ts +4 -0
  41. package/dist/types/modules/panels/model/market-registry.d.ts +12 -0
  42. package/dist/types/modules/panels/model/market-registry.test.d.ts +1 -0
  43. package/dist/types/modules/panels/model/market-types.d.ts +1 -0
  44. package/dist/types/modules/panels/model/market.d.ts +3 -2
  45. package/dist/types/modules/panels/model/plugin-panel.d.ts +3 -0
  46. package/dist/types/modules/panels/model/prefs.d.ts +3 -1
  47. package/dist/types/modules/panels/model/service.d.ts +5 -1
  48. package/dist/types/shared/api/bundle-install.d.ts +15 -1
  49. package/dist/types/shared/api/host/__tests__/plugin-catalog.test.d.ts +1 -0
  50. package/dist/types/shared/api/host/__tests__/plugin-login-hint.test.d.ts +1 -0
  51. package/dist/types/shared/api/host/__tests__/plugin-tools.test.d.ts +1 -0
  52. package/dist/types/shared/api/host/bundle-inspect-kind.test.d.ts +1 -0
  53. package/dist/types/shared/api/host/bundle-routes-self.test.d.ts +1 -0
  54. package/dist/types/shared/api/host/installed-module.d.ts +10 -0
  55. package/dist/types/shared/api/host/plugin-catalog.d.ts +60 -0
  56. package/dist/types/shared/api/host/plugin-login-hint.d.ts +2 -0
  57. package/dist/types/shared/api/host/plugin-tools.d.ts +10 -0
  58. package/dist/types/shared/api/host/plugin-units.d.ts +47 -0
  59. package/dist/types/shared/api/host/unit-registry.d.ts +3 -0
  60. package/package.json +2 -2
@@ -1,10 +1,12 @@
1
+ import type { BoardTarget } from './config';
1
2
  import type { PanelsService } from './service';
2
3
  export declare const PANELS_PREF_RESOURCE = "panels";
3
4
  export interface PanelsPrefAction {
4
- readonly action: 'show' | 'hide' | 'enable' | 'disable' | 'move' | 'reset';
5
+ readonly action: 'show' | 'hide' | 'move' | 'reset' | 'follow';
5
6
  readonly id?: string;
6
7
  readonly index?: number;
7
8
  readonly path?: string;
9
+ readonly scope?: BoardTarget;
8
10
  }
9
11
  export declare function parsePanelsPrefAction(payload: unknown): PanelsPrefAction;
10
12
  export declare function applyPanelsPref(panels: PanelsService, payload: unknown): {
@@ -1,11 +1,12 @@
1
1
  import type { WorkspaceStore } from '@dsh-workbench/shared/host';
2
2
  import type { UnitManifest } from '@dsh-workbench/shared';
3
- import { type BoardTarget, type PanelEntry, type ScopeBoards } from './config';
3
+ import { type BoardTarget, type PanelEntry, type PanelPluginEntry, type PanelPluginRef, type ScopeBoards } from './config';
4
4
  export declare const PANELS_MODULE_ID = "panels";
5
5
  export declare const PANELS_FILE = "config.json";
6
6
  export declare const RELEASED_FILE = "released.json";
7
7
  export interface PanelsService {
8
8
  list(workspace: string | null, target?: BoardTarget): PanelEntry[];
9
+ listPlugins(workspace: string | null, target?: BoardTarget): PanelPluginEntry[];
9
10
  boards(workspace: string | null): ScopeBoards;
10
11
  isReleased(id: string): boolean;
11
12
  release(id: string): void;
@@ -16,11 +17,14 @@ export interface PanelsService {
16
17
  hide(id: string, workspace: string | null, target?: BoardTarget): PanelEntry[];
17
18
  move(id: string, index: number, workspace: string | null, target?: BoardTarget): PanelEntry[];
18
19
  reset(workspace: string | null, target?: BoardTarget): PanelEntry[];
20
+ follow(workspace: string | null, id?: string): PanelEntry[];
21
+ changedBy(): ReadonlyMap<string, number>;
19
22
  }
20
23
  export declare function createPanelsService(options: {
21
24
  manifests: () => readonly UnitManifest[];
22
25
  store: WorkspaceStore;
23
26
  owned?: (() => readonly string[]) | undefined;
27
+ plugins?: (() => readonly PanelPluginRef[]) | undefined;
24
28
  logger?: {
25
29
  warn?(message: string): void;
26
30
  } | undefined;
@@ -26,7 +26,14 @@ export interface BundleInspectionRefused {
26
26
  readonly reason: string;
27
27
  readonly registries?: readonly BundleRegistry[];
28
28
  }
29
- export type BundleInspection = BundleInspectionAccepted | BundleInspectionRefused;
29
+ export interface BundleInspectionPlugin {
30
+ readonly status: 'plugin';
31
+ readonly pkg: string;
32
+ readonly registry: BundleRegistry;
33
+ readonly pluginName?: string;
34
+ readonly version?: string;
35
+ }
36
+ export type BundleInspection = BundleInspectionAccepted | BundleInspectionRefused | BundleInspectionPlugin;
30
37
  export interface BundleRegistriesPayload {
31
38
  readonly available: boolean;
32
39
  readonly registries: BundleRegistries | null;
@@ -100,6 +107,13 @@ export interface ModuleVersion {
100
107
  readonly local?: boolean;
101
108
  readonly refused?: readonly string[];
102
109
  }
110
+ export interface WorkbenchVersion {
111
+ readonly pkg: string;
112
+ readonly installed: string;
113
+ readonly latest?: string;
114
+ readonly local?: boolean;
115
+ }
103
116
  export interface ModuleVersionsPayload {
104
117
  readonly modules: readonly ModuleVersion[];
118
+ readonly workbench?: WorkbenchVersion;
105
119
  }
@@ -30,4 +30,14 @@ export interface DeclarationGap {
30
30
  readonly problems: readonly string[];
31
31
  }
32
32
  export declare function declarationGaps(profileDir: string | null): readonly DeclarationGap[] | undefined;
33
+ export declare function declaredPluginCommands(profileDir: string | null): ReadonlyMap<string, ReadonlySet<string>>;
33
34
  export declare function readInstalledModule(profileDir: string | null, pkg: string): InstalledModule;
35
+ export declare function isLocalDependencySpec(spec: string): boolean;
36
+ export interface ProfilePackage {
37
+ readonly pkg: string;
38
+ readonly version: string;
39
+ readonly registry?: string;
40
+ readonly local?: boolean;
41
+ }
42
+ export declare function readProfilePackage(profileDir: string | null, pkg: string): ProfilePackage | undefined;
43
+ export declare function packageVersionAt(packageRoot: string): string | undefined;
@@ -0,0 +1,60 @@
1
+ import type { DshShell } from '@dsh-workbench/shared';
2
+ export interface PluginCommandArg {
3
+ readonly name: string;
4
+ readonly type: string;
5
+ readonly required: boolean;
6
+ readonly positional: boolean;
7
+ readonly valueRequired: boolean;
8
+ readonly choices: readonly string[];
9
+ readonly defaultValue?: unknown;
10
+ readonly help: string;
11
+ }
12
+ export interface PluginCommand {
13
+ readonly plugin: string;
14
+ readonly name: string;
15
+ readonly description: string;
16
+ readonly access: string;
17
+ readonly domain?: string;
18
+ readonly args: readonly PluginCommandArg[];
19
+ }
20
+ export interface PluginCommandSet {
21
+ readonly plugin: string;
22
+ readonly version: string;
23
+ readonly commands: readonly PluginCommand[];
24
+ }
25
+ export interface PluginRow {
26
+ readonly name: string;
27
+ readonly version: string;
28
+ readonly commands: readonly string[];
29
+ }
30
+ export interface CommandRow {
31
+ readonly site: string;
32
+ readonly name: string;
33
+ readonly description: string;
34
+ readonly access: string;
35
+ readonly args: readonly PluginCommandArg[];
36
+ }
37
+ export interface PluginCatalogSnapshot {
38
+ readonly ok: boolean;
39
+ readonly at: number;
40
+ readonly sets: readonly PluginCommandSet[];
41
+ readonly problems: readonly string[];
42
+ }
43
+ export interface PluginCatalog {
44
+ refresh(options?: {
45
+ readonly force?: boolean;
46
+ }): Promise<PluginCatalogSnapshot>;
47
+ snapshot(): PluginCatalogSnapshot;
48
+ }
49
+ export interface PluginCatalogOptions {
50
+ readonly shell?: DshShell | undefined;
51
+ readonly command: string;
52
+ readonly timeoutMs?: number;
53
+ }
54
+ export declare function parsePluginRows(stdout: string): PluginRow[] | undefined;
55
+ export declare function parseCommandRows(stdout: string): CommandRow[] | undefined;
56
+ export declare function attributeCommands(plugins: readonly PluginRow[], rows: readonly CommandRow[]): {
57
+ readonly sets: PluginCommandSet[];
58
+ readonly problems: string[];
59
+ };
60
+ export declare function createPluginCatalog(options: PluginCatalogOptions): PluginCatalog;
@@ -0,0 +1,2 @@
1
+ export declare function loginUrlOfDomain(domain: string | undefined): string | undefined;
2
+ export declare function pluginLoginHint(error: unknown, domain: string | undefined): string;
@@ -0,0 +1,10 @@
1
+ import type { ApprovalDetail, ApprovalPolicy } from '@dsh-workbench/shared/host';
2
+ import type { PluginCommand } from './plugin-catalog';
3
+ export declare function pluginToolName(plugin: string, command: string): string;
4
+ export declare function pluginToolParameters(command: PluginCommand): Record<string, unknown>;
5
+ export declare function pluginToolDescription(command: PluginCommand): string;
6
+ export declare function pluginToolWrites(command: PluginCommand): boolean;
7
+ export declare function pluginToolArgv(command: PluginCommand, raw: unknown): string[];
8
+ export declare function pluginKeyArgs(command: PluginCommand, raw: unknown): string;
9
+ export declare function pluginApprovalQuestion(command: PluginCommand, raw: unknown): ApprovalDetail;
10
+ export declare function pluginApprovalFor(command: PluginCommand): ApprovalPolicy;
@@ -0,0 +1,47 @@
1
+ import type { Opencli } from '@dsh-workbench/shared/host';
2
+ import type { PluginCatalog } from './plugin-catalog';
3
+ import type { UnitRegistry } from './unit-registry';
4
+ export interface PluginRowRef {
5
+ readonly id: string;
6
+ readonly pkg: string;
7
+ readonly name?: string | undefined;
8
+ }
9
+ export interface PluginRowsSource {
10
+ listPlugins(workspace: string | null): readonly PluginRowRef[];
11
+ subscribe?(listener: () => void): () => void;
12
+ }
13
+ export interface PluginUnitRow {
14
+ readonly plugin: string;
15
+ readonly pkg: string;
16
+ readonly version: string;
17
+ readonly commands: number;
18
+ readonly synthesized: number;
19
+ readonly tools: readonly string[];
20
+ }
21
+ export interface PluginUnitReport {
22
+ readonly ok: boolean;
23
+ readonly at: number;
24
+ readonly plugins: readonly PluginUnitRow[];
25
+ readonly problems: readonly string[];
26
+ }
27
+ export interface PluginUnits {
28
+ refresh(options?: {
29
+ readonly force?: boolean;
30
+ }): Promise<PluginUnitReport>;
31
+ touch(): void;
32
+ report(): PluginUnitReport;
33
+ dispose(): void;
34
+ }
35
+ export interface PluginUnitsOptions {
36
+ readonly registry: UnitRegistry;
37
+ readonly catalog: PluginCatalog;
38
+ readonly rows: () => readonly PluginRowRef[];
39
+ readonly declared: (plugin: string) => ReadonlySet<string>;
40
+ readonly opencliFor: (plugin: string) => Opencli;
41
+ readonly toolNames?: () => ReadonlySet<string>;
42
+ readonly logger?: {
43
+ info?(message: string): void;
44
+ warn?(message: string): void;
45
+ } | undefined;
46
+ }
47
+ export declare function createPluginUnits(options: PluginUnitsOptions): PluginUnits;
@@ -10,6 +10,8 @@ export type UnitSource = {
10
10
  readonly pkg: string;
11
11
  } | {
12
12
  readonly kind: 'owned';
13
+ } | {
14
+ readonly kind: 'plugin';
13
15
  };
14
16
  export interface HostUnit {
15
17
  readonly unit: string;
@@ -24,6 +26,7 @@ export interface UnitDeclarationSource {
24
26
  export interface UnitRegistry {
25
27
  register(face: UnitModuleFace): () => void;
26
28
  registerOwned(face: UnitOwnedFace): () => void;
29
+ registerPlugin(face: UnitOwnedFace): () => void;
27
30
  all(): readonly HostUnit[];
28
31
  owned(): readonly string[];
29
32
  refusals(): readonly UnitRefusal[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsh-workbench/core",
3
- "version": "0.1.18",
3
+ "version": "0.2.0",
4
4
  "description": "个人工作台:Agent 工作台外壳(左栏 + 常驻对话 + 自研右侧数据面板)。",
5
5
  "type": "module",
6
6
  "icon": "./icon.svg",
@@ -87,7 +87,7 @@
87
87
  "access": "public"
88
88
  },
89
89
  "dependencies": {
90
- "@dsh-workbench/shared": "0.1.18"
90
+ "@dsh-workbench/shared": "0.2.0"
91
91
  },
92
92
  "scripts": {
93
93
  "build": "node scripts/build.mjs && node scripts/build-types.mjs",