@dsh-workbench/core 0.1.7 → 0.1.9

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 (31) hide show
  1. package/client.js +858 -408
  2. package/dist/client/client.body.js +858 -408
  3. package/dist/client/index.js +858 -408
  4. package/dist/host/index.js +154 -6
  5. package/dist/types/app/client.d.ts +78 -15
  6. package/dist/types/app/layouts/env-gate/__tests__/gate-deadline.test.d.ts +1 -0
  7. package/dist/types/app/layouts/env-gate/gate-deadline.d.ts +4 -0
  8. package/dist/types/app/layouts/rightbar/ColumnSwitch.d.ts +10 -0
  9. package/dist/types/app/layouts/rightbar/MarketStates.d.ts +7 -0
  10. package/dist/types/app/layouts/rightbar/MarketView.d.ts +2 -1
  11. package/dist/types/app/layouts/rightbar/Rightbar.d.ts +3 -1
  12. package/dist/types/app/layouts/rightbar/SharedSection.d.ts +11 -0
  13. package/dist/types/app/layouts/rightbar/__tests__/market-change.test.d.ts +1 -0
  14. package/dist/types/app/layouts/rightbar/__tests__/market-live.test.d.ts +1 -0
  15. package/dist/types/app/layouts/rightbar/__tests__/market-settle.test.d.ts +1 -0
  16. package/dist/types/app/layouts/rightbar/dsh-column-source.d.ts +6 -0
  17. package/dist/types/app/layouts/rightbar/dsh-column-source.test.d.ts +1 -0
  18. package/dist/types/app/layouts/rightbar/market-change.d.ts +4 -0
  19. package/dist/types/app/layouts/rightbar/market-rows.d.ts +3 -1
  20. package/dist/types/app/layouts/rightbar/market-settle.d.ts +2 -0
  21. package/dist/types/app/layouts/rightbar/market-view-text.d.ts +10 -0
  22. package/dist/types/app/layouts/rightbar/presentation.d.ts +9 -0
  23. package/dist/types/app/layouts/rightbar/presentation.test.d.ts +1 -0
  24. package/dist/types/app/layouts/rightbar/store.d.ts +9 -0
  25. package/dist/types/modules/panels/__tests__/market-registries.test.d.ts +1 -0
  26. package/dist/types/modules/panels/model/market.d.ts +2 -0
  27. package/dist/types/shared/api/host/__tests__/profile-registries.test.d.ts +1 -0
  28. package/dist/types/shared/api/host/profile-registries.d.ts +21 -0
  29. package/docs/OPERATIONS.md +2 -0
  30. package/package.json +2 -2
  31. package/dist/types/app/layouts/rightbar/ExpandButton.d.ts +0 -9
@@ -0,0 +1,10 @@
1
+ import type { MarketRowAction } from './market-rows';
2
+ export declare const PROGRESS_KEY: Readonly<Record<MarketRowAction, string>>;
3
+ export declare const ACTION_LABEL_KEY: Readonly<Record<MarketRowAction, string>>;
4
+ export interface Pending {
5
+ readonly id: string;
6
+ readonly action: MarketRowAction;
7
+ readonly titleKey?: string | undefined;
8
+ readonly pkg?: string | undefined;
9
+ readonly version?: string | undefined;
10
+ }
@@ -0,0 +1,9 @@
1
+ export interface RightbarPresentation {
2
+ readonly track: boolean;
3
+ readonly fullscreen: boolean;
4
+ }
5
+ export declare function rightbarPresentation(input: {
6
+ shown: boolean;
7
+ viewportWidth: number;
8
+ canShow: boolean;
9
+ }): RightbarPresentation;
@@ -1,7 +1,9 @@
1
1
  import type { PanelStep } from '@dsh-workbench/shared';
2
2
  export type { PanelStep } from '@dsh-workbench/shared';
3
+ export type RightbarColumn = 'workbench' | 'dsh';
3
4
  export interface RightbarState {
4
5
  readonly expanded: boolean;
6
+ readonly column: RightbarColumn;
5
7
  readonly trail: readonly PanelStep[];
6
8
  }
7
9
  export interface RightbarStore {
@@ -9,6 +11,7 @@ export interface RightbarStore {
9
11
  subscribe(listener: () => void): () => void;
10
12
  setExpanded(expanded: boolean): void;
11
13
  toggleExpanded(): void;
14
+ setColumn(column: RightbarColumn): void;
12
15
  open(step: PanelStep): void;
13
16
  goTo(index: number): void;
14
17
  back(): void;
@@ -20,4 +23,10 @@ export interface RightbarPersistence {
20
23
  writeText(key: string, value: string | null): void;
21
24
  }
22
25
  export declare const RIGHTBAR_DEFAULT_EXPANDED = true;
26
+ export declare const RIGHTBAR_DEFAULT_COLUMN: RightbarColumn;
27
+ export interface RightbarColumnPressed {
28
+ readonly workbench: boolean;
29
+ readonly dsh: boolean;
30
+ }
31
+ export declare function pressedColumns(state: RightbarState, dshExpanded: boolean): RightbarColumnPressed;
23
32
  export declare function createRightbarStore(persistence?: RightbarPersistence): RightbarStore;
@@ -3,6 +3,7 @@ import type { PluginSource, UnitManifest } from '@dsh-workbench/shared';
3
3
  import type { BundleCancellation, BundleChange } from '../../../shared/api/bundle-install';
4
4
  import type { BundleManager } from '../../../shared/api/host/bundle-manager';
5
5
  import type { InstalledModule, ProfileModule } from '../../../shared/api/host/installed-module';
6
+ import { type RegistryNotebook } from '../../../shared/api/host/profile-registries';
6
7
  import type { UnitCapability } from '../../../shared/api/host/probe-units';
7
8
  import type { ProvisionAction } from '@dsh-workbench/shared/host';
8
9
  import type { UnitMountDeps } from '@dsh-workbench/shared/host';
@@ -81,6 +82,7 @@ export declare function createMarketService(options: {
81
82
  bundles?: BundleManager | undefined;
82
83
  installed?: ((pkg: string) => InstalledModule) | undefined;
83
84
  modules?: (() => readonly ProfileModule[]) | undefined;
85
+ registries?: RegistryNotebook | undefined;
84
86
  logger?: {
85
87
  info?(message: string): void;
86
88
  warn?(message: string): void;
@@ -0,0 +1,21 @@
1
+ import type { BundleChange } from '../bundle-install.js';
2
+ export interface RegistryEntry {
3
+ readonly scope: string;
4
+ readonly registry: string;
5
+ }
6
+ export interface RegistryNotebook {
7
+ sources(): readonly RegistryEntry[];
8
+ remember(entries: readonly RegistryEntry[]): readonly string[];
9
+ }
10
+ export declare const REGISTRY_MARKER = "# dsh-workbench \u5199\u7684\uFF1A\u8FD9\u4E00\u884C\u7684\u5305\u53EA\u5728\u8FD9\u4E2A\u6E90\u4E0A\uFF08dsh \u5378\u8F7D\u6CA1\u6709\u6E90\u53C2\u6570\uFF0Cpnpm \u5F97\u95EE\u5F97\u5230\uFF09";
11
+ export declare function scopeOf(pkg: string): string | null;
12
+ export declare function normalizeRegistry(url: string): string;
13
+ export declare function sameRegistry(a: string | null | undefined, b: string | null | undefined): boolean;
14
+ export declare function sourcesFromLockfile(text: string): readonly RegistryEntry[];
15
+ export interface RegistryConfigMerge {
16
+ readonly text: string;
17
+ readonly added: readonly string[];
18
+ }
19
+ export declare function mergeRegistryConfig(text: string, entries: readonly RegistryEntry[]): RegistryConfigMerge;
20
+ export declare function registryFailure(change: BundleChange): boolean;
21
+ export declare function createRegistryNotebook(dir: string | null): RegistryNotebook;
@@ -103,6 +103,7 @@ WORKBENCH_PORT=3091 pnpm run dev # 换端口(监听与实例同一个端口
103
103
  | API 凭据 | ❌ **有意共享** | `~/.dsh/.credentials.yaml`,两边同一把 key |
104
104
  | opencli 运行时(CLI + 插件) | ✅ | `~/.dsh/workbench/opencli/`(`HOME` 指到 `…/home`,见 [ADR-0014](../../../docs/adr/0014-opencli-cost-has-one-owner.md) §2.2) |
105
105
  | opencli **daemon** | ❌ **整机一个,隔离不了** | 端口 **19825 被扩展写死**(`background.js` 里 `DAEMON_PORT = 19825`;CLI 侧 `OPENCLI_DAEMON_PORT` 设非默认值直接报错)。所以本机的全局 opencli 与工作台的隔离运行时**抢同一个 daemon**:两边版本不一致时,谁的命令后跑谁就把 daemon 重启成自己那版 |
106
+ | profile 的 pnpm 源(私有 scope) | ⚠️ **由工作台写进去** | `<profile>/.npmrc` 里的 `@scope:registry=…`,前面带一行 `# dsh-workbench 写的…` 标记。**为什么在工作台这一侧写**:dsh 的卸载没有源参数(`runPnpm(['remove', name])`),pnpm 只能从 profile 的 `.npmrc` 链知道源;不写它,装私有源的模块能成、卸不了。规则与边界见 [ADR-0030](../../../docs/adr/0030-private-registries-live-in-the-profile-pnpm-config.md):只加不改、只写 scope 行、不碰 `~/.npmrc`。**删了会怎样**:下次从这个源装会再写回来;已经装着的那种,点卸载时撞 404 会自愈补回再重试一次 |
106
107
 
107
108
  ## 排障
108
109
 
@@ -113,6 +114,7 @@ WORKBENCH_PORT=3091 pnpm run dev # 换端口(监听与实例同一个端口
113
114
  | 面板显示"这个项目不是 Coding 仓库" | 该工作区的 git `origin` 不指向 `e.coding.net`(或没有 origin) |
114
115
  | 打开面板/按刷新要等 5–8 秒 | 正常:opencli 每次调用有**固定约 5 秒**开销(起浏览器会话;接口本身只要 ~260ms)。**没有缓存**——数据一律实时,列表 = 缺陷 + 状态目录两次调用(限并发 2,实测约 7 秒) |
115
116
  | 改了源码没变化 | 忘了 `pnpm run build`,或没重启进程(宿主缓存已加载的包) |
117
+ | 市场页点「卸载」报 `没成功:… ERR_PNPM_FETCH_404 GET https://registry.npmjs.org/@你的私有 scope/…` 之类 | 这个 profile 里的私有包不在 pnpm 默认源上,而 dsh 的卸载**不带源**。工作台会自己补上 `<profile>/.npmrc` 的 `@scope:registry=` 再重试一次([ADR-0030](../../../docs/adr/0030-private-registries-live-in-the-profile-pnpm-config.md));**还失败**说明那个包没有 scope(一行 scope 行表达不了),这时才需要人/agent 上手:`dsh plugin --profile <p> remove '<包名>' --config.registry=<那个源>`(`pnpm remove` 不认 `--registry=`),或者给 profile 自己配一行默认 `registry=` |
116
118
  | 体检那屏「检测浏览器通道 · 没连上」,可面板照样能用 | 本机全局 opencli 与隔离运行时版本不一致 ⇒ daemon 被顶成对方那版(`Stale daemon detected: daemon vX != CLI vY`)。下一条浏览器命令会自动把它重启回来,体检也会复检后改回「已连接」([ADR-0024](../../../docs/adr/0024-warm-the-sites-before-the-panel.md) §3.2.1)。**要彻底不抖**:让两边同版本 —— 把 `OPENCLI_PIN`(`src/shared/config/constants.ts`)对齐到 `opencli --version`,再 `npm i --prefix ~/.dsh/workbench/opencli/toolchain @jackwener/opencli@<那个版本> --cache ~/.dsh/workbench/opencli/npm-cache` |
117
119
  | Settings 页报 `overridden by a home patch` | 想在 Settings 里改的行被 `$DSH_HOME/cordis.patch.yml` 或 `--patch` 覆盖了 |
118
120
  | **别人机器上** `npx @dsh-workbench/core setup` 报 `scripts/seed-profile.sh: Permission denied`(或体检永远说"隔离运行时没装好") | 发出去的包里**随包脚本丢了 x 位**:`pnpm publish` 只给 `package.json#bin` 点名那条文件 755,其余一律 644(`npm pack` 会保留,而 `git` 里的 x 位不进 tarball —— 所以**本机永远复现不出来**)。0.1.6 的已知缺陷:应急 `chmod +x <包目录>/{scripts/seed-profile.sh,bin/opencli-isolated}`,正规解是升到 0.1.7(启动器与 `selfcheck` 已改成不吃 x 位) |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsh-workbench/core",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "个人工作台:Agent 工作台外壳(左栏 + 常驻对话 + 自研右侧数据面板)。",
5
5
  "type": "module",
6
6
  "icon": "./icon.svg",
@@ -78,7 +78,7 @@
78
78
  "access": "public"
79
79
  },
80
80
  "dependencies": {
81
- "@dsh-workbench/shared": "0.1.7"
81
+ "@dsh-workbench/shared": "0.1.9"
82
82
  },
83
83
  "scripts": {
84
84
  "build": "node scripts/build.mjs && node scripts/build-types.mjs",
@@ -1,9 +0,0 @@
1
- import type { Translate } from '@dsh-workbench/shared';
2
- export interface ExpandButtonProps {
3
- useRightbar: <R>(selector: (state: {
4
- expanded: boolean;
5
- }) => R) => R;
6
- toggleRightbar: () => void;
7
- t: Translate;
8
- }
9
- export declare function ExpandButton({ useRightbar, toggleRightbar, t }: ExpandButtonProps): JSX.Element | null;