@dsh-workbench/adapters-default 1.1.14-beta.2 → 1.1.14

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.
@@ -1,8 +1,8 @@
1
- import type { DshHostContext, DshShell } from '@dsh-workbench/shared';
2
- import type { AdapterSet } from '@dsh-workbench/shared/host';
1
+ import type { DshHostContext } from '@dsh-workbench/shared';
2
+ import type { AdapterSet, Seam } from '@dsh-workbench/shared/host';
3
3
  export declare const DEFAULT_ADAPTER_SET_ID = "@dsh-workbench/adapters-default";
4
4
  export interface DefaultAdapterSetOptions {
5
- readonly shell?: DshShell | undefined;
5
+ readonly seam?: Seam | undefined;
6
6
  readonly logger?: {
7
7
  info?(message: string): void;
8
8
  warn?(message: string): void;
@@ -1,4 +1,4 @@
1
- import { ADAPTER_SET_API_VERSION, runningVersionOf } from '@dsh-workbench/shared/host';
1
+ import { ADAPTER_SET_API_VERSION, runningVersionOf, seamOf } from '@dsh-workbench/shared/host';
2
2
  import { createCommandReader, createDataReader, createGitReader, createLibReader, opencliCommandOf } from '@dsh-workbench/adapter-runtime';
3
3
  import { dshPluginsHandler, profileDirOf } from '@dsh-workbench/adapter-supply';
4
4
  import { createHostActions } from '@dsh-workbench/adapter-profile';
@@ -7,22 +7,22 @@ import { createPluginSurface } from './plugin-surface.js';
7
7
  import { createRuntimePort } from './runtime-port.js';
8
8
  export const DEFAULT_ADAPTER_SET_ID = '@dsh-workbench/adapters-default';
9
9
  export function createAdapterSet(ctx, options = {}) {
10
- const shell = options.shell ?? ctx.get('shell');
10
+ const seam = options.seam ?? seamOf(ctx);
11
11
  const logger = options.logger ?? ctx.logger;
12
12
  const runtime = createRuntimePort();
13
13
  const opencli = opencliCommandOf(ctx);
14
- const supply = createSupplyPort();
14
+ const supply = createSupplyPort(seam === undefined ? {} : { seam });
15
15
  return {
16
16
  apiVersion: ADAPTER_SET_API_VERSION,
17
17
  id: DEFAULT_ADAPTER_SET_ID,
18
18
  version: runningVersionOf(import.meta.url) ?? '0.0.0',
19
- data: createDataReader({ shell, command: opencli.command }),
19
+ data: createDataReader({ seam, command: opencli.command }),
20
20
  libs: createLibReader(),
21
- ...(shell === undefined
21
+ ...(seam === undefined
22
22
  ? {}
23
23
  : {
24
- git: createGitReader({ shell, ...(logger === undefined ? {} : { logger }) }),
25
- commands: createCommandReader({ shell }),
24
+ git: createGitReader({ seam, ...(logger === undefined ? {} : { logger }) }),
25
+ commands: createCommandReader({ seam }),
26
26
  }),
27
27
  supply,
28
28
  modules: supply,
@@ -34,7 +34,7 @@ export function createAdapterSet(ctx, options = {}) {
34
34
  probe: createProbePort(),
35
35
  runtime,
36
36
  plugins: createPluginSurface({
37
- shell,
37
+ seam,
38
38
  command: opencli.command,
39
39
  ...(logger === undefined ? {} : { logger }),
40
40
  }),
@@ -0,0 +1,2 @@
1
+ import type { HostActions } from '@dsh-workbench/shared/host';
2
+ export declare function createHostActions(): HostActions;
@@ -0,0 +1,4 @@
1
+ import { configSyncAction, configSyncHandler, profileCreateAction, profileCreateHandler, } from '@dsh-workbench/adapter-profile';
2
+ export function createHostActions() {
3
+ return { configSyncAction, configSyncHandler, profileCreateAction, profileCreateHandler };
4
+ }
@@ -1,7 +1,6 @@
1
- import type { DshShell } from '@dsh-workbench/shared';
2
- import type { PluginSurface } from '@dsh-workbench/shared/host';
1
+ import type { PluginSurface, Seam } from '@dsh-workbench/shared/host';
3
2
  export declare function createPluginSurface(options: {
4
- readonly shell?: DshShell | undefined;
3
+ readonly seam?: Seam | undefined;
5
4
  readonly command: string;
6
5
  readonly logger?: {
7
6
  info?(message: string): void;
@@ -4,16 +4,16 @@ export function createPluginSurface(options) {
4
4
  return {
5
5
  declarationLookup: createDeclarationLookup,
6
6
  createUnits(input) {
7
- const shell = options.shell;
8
- if (shell === undefined)
9
- throw new Error('没有 shell 服务,插件的命令面起不来。');
10
- const catalog = createPluginCatalog({ shell, command: options.command });
7
+ const seam = options.seam;
8
+ if (seam === undefined)
9
+ throw new Error('没有执行缝,插件的命令面起不来。');
10
+ const catalog = createPluginCatalog({ seam, command: options.command });
11
11
  return createPluginUnits({
12
12
  registry: input.registry,
13
13
  catalog,
14
14
  rows: input.rows,
15
15
  declared: input.declared,
16
- opencliFor: (plugin) => createOpencli({ shell, plugin, command: options.command, logger: options.logger }),
16
+ opencliFor: (plugin) => createOpencli({ seam, plugin, command: options.command, logger: options.logger }),
17
17
  ...(input.toolNames === undefined ? {} : { toolNames: input.toolNames }),
18
18
  ...(input.logger === undefined ? {} : { logger: input.logger }),
19
19
  });
@@ -0,0 +1,2 @@
1
+ import type { ProbePort } from '@dsh-workbench/shared/host';
2
+ export declare function createProbePort(): ProbePort;
@@ -0,0 +1,5 @@
1
+ import { probeUnits, registerPreflight } from '@dsh-workbench/adapter-probe';
2
+ import { declaredPluginCommands } from '@dsh-workbench/adapter-supply';
3
+ export function createProbePort() {
4
+ return { probeUnits, registerPreflight, declaredPluginCommands };
5
+ }
@@ -1,9 +1,9 @@
1
1
  import { existsSync } from 'node:fs';
2
2
  import { dirname, join } from 'node:path';
3
- import { packageRootOf } from '@dsh-workbench/shared/host';
3
+ import { packageRootOf, seamOf } from '@dsh-workbench/shared/host';
4
4
  import { backgroundLine, libsBinDir } from '@dsh-workbench/adapter-runtime';
5
5
  import { ensureLibsOpencliPeer, opencliCommandOf, opencliRunnerOf } from '@dsh-workbench/adapter-runtime';
6
- import { isInstalledCopy, prependPath, runDetached, runtimeSeedPaths, runtimeSeedRootOf, seedRuntimeFiles, seedWorkbenchToolchain, warnUnwritableRoot, workshopSeedPlan, } from '@dsh-workbench/adapter-probe';
6
+ import { isInstalledCopy, prependPath, runDetached, runtimeSeedPaths, runtimeSeedRootOf, seedRuntimeFiles, seedWorkbenchToolchain, workshopSeedPlan, } from '@dsh-workbench/adapter-probe';
7
7
  export function runtimePathDirs(paths) {
8
8
  return [paths.opencliBinDir, libsBinDir(), paths.entryDir];
9
9
  }
@@ -19,7 +19,6 @@ const OPENCLI_RUNNER_TIMEOUT_MS = 30 * 60_000;
19
19
  export function createRuntimePort() {
20
20
  return {
21
21
  packageRoot: packageRootOf,
22
- warnUnwritableRoot,
23
22
  capabilities() {
24
23
  return {
25
24
  console: true,
@@ -114,6 +113,7 @@ export function createRuntimePort() {
114
113
  const root = runtimeSeedRootOf(ctx);
115
114
  if (root === null)
116
115
  return;
116
+ const seam = seamOf(ctx);
117
117
  const home = dirname(root);
118
118
  const packageRoot = packageRootOf(options.corePackageUrl);
119
119
  const paths = runtimeSeedPaths(root);
@@ -123,14 +123,15 @@ export function createRuntimePort() {
123
123
  ensureLibsOpencliPeer();
124
124
  for (const dir of prependRuntimePath(paths))
125
125
  log(`PATH 前插 ${dir}`);
126
- seedWorkbenchToolchain(root, log);
127
- const plan = workshopSeedPlan(packageRoot, home, root);
128
- runDetached(plan.entry, log);
129
- const workshopReady = existsSync(paths.workshopManifest) && existsSync(join(paths.workshop, 'node_modules'));
130
- if (isInstalledCopy(packageRoot) && !workshopReady) {
131
- log('DIY 工坊骨架不在:后台建起来(第一次会下载依赖,几百 MB)');
132
- runDetached(plan.full, log);
133
- }
126
+ void seedWorkbenchToolchain(root, log, seam).then(() => {
127
+ const plan = workshopSeedPlan(packageRoot, home, root);
128
+ runDetached(plan.entry, log, seam);
129
+ const workshopReady = existsSync(paths.workshopManifest) && existsSync(join(paths.workshop, 'node_modules'));
130
+ if (isInstalledCopy(packageRoot) && !workshopReady) {
131
+ log('DIY 工坊骨架不在:后台建起来(第一次会下载依赖,几百 MB)');
132
+ runDetached(plan.full, log, seam);
133
+ }
134
+ }, (error) => log(`工具链没装成:${String(error)}`));
134
135
  },
135
136
  };
136
137
  }
@@ -0,0 +1,2 @@
1
+ import type { SupplyPort } from '@dsh-workbench/shared/host';
2
+ export declare function createSupplyPort(): SupplyPort;
@@ -0,0 +1,41 @@
1
+ import { cliCatalogPath, ensureLibsBinOnPath, ensureLibsOpencliPeer, isolatedHome, libInstallCommand, vendorPluginsDir } from '@dsh-workbench/adapter-runtime';
2
+ import { isolatedRoot } from '@dsh-workbench/shared/host';
3
+ import { createRegistryNotebook, isNewerVersion, latestVersion, missingReleaseParts, probeRelease } from '@dsh-workbench/adapter-profile';
4
+ import { opencliInstallCommand, startSelfUpdate } from '@dsh-workbench/adapter-probe';
5
+ import { declarationGaps, declarationRefusalOf, moduleDeclarationOf, packageRouteOf, pathDeclarationOf, pluginInstallPlan, profileDirOf, profileModules, readBundleManager, readInstalledModule, readProfilePackage, refusalReason, registryDeclarationOf, resolvePluginSource, splitNpmSpec, } from '@dsh-workbench/adapter-supply';
6
+ export function createSupplyPort() {
7
+ const port = {
8
+ isolatedRoot,
9
+ isolatedHome,
10
+ cliCatalogPath,
11
+ vendorPluginsDir,
12
+ runtimeInstallCommand: opencliInstallCommand,
13
+ afterLibInstall() {
14
+ ensureLibsOpencliPeer();
15
+ ensureLibsBinOnPath();
16
+ },
17
+ profileDirOf,
18
+ profileModules,
19
+ readInstalledModule,
20
+ readProfilePackage,
21
+ readBundleManager,
22
+ createRegistryNotebook,
23
+ declarationGaps,
24
+ moduleDeclarationOf,
25
+ registryDeclarationOf,
26
+ pathDeclarationOf,
27
+ declarationRefusalOf,
28
+ refusalReason,
29
+ latestVersion,
30
+ missingReleaseParts,
31
+ isNewerVersion,
32
+ pluginInstallPlan,
33
+ packageRouteOf,
34
+ probeRelease,
35
+ resolvePluginSource,
36
+ splitNpmSpec,
37
+ libInstallCommand,
38
+ startSelfUpdate,
39
+ };
40
+ return { ...port, env: port, modules: port };
41
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsh-workbench/adapters-default",
3
- "version": "1.1.14-beta.2",
3
+ "version": "1.1.14",
4
4
  "description": "Default host adapter set installed with @dsh-workbench/core.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -13,11 +13,11 @@
13
13
  "dist"
14
14
  ],
15
15
  "dependencies": {
16
- "@dsh-workbench/adapter-profile": "1.1.14-beta.2",
17
- "@dsh-workbench/shared": "1.1.14-beta.2",
18
- "@dsh-workbench/adapter-probe": "1.1.14-beta.2",
19
- "@dsh-workbench/adapter-runtime": "1.1.14-beta.2",
20
- "@dsh-workbench/adapter-supply": "1.1.14-beta.2"
16
+ "@dsh-workbench/adapter-probe": "1.1.14",
17
+ "@dsh-workbench/adapter-profile": "1.1.14",
18
+ "@dsh-workbench/shared": "1.1.14",
19
+ "@dsh-workbench/adapter-runtime": "1.1.14",
20
+ "@dsh-workbench/adapter-supply": "1.1.14"
21
21
  },
22
22
  "publishConfig": {
23
23
  "access": "public"