@dsh-workbench/adapters-default 1.1.7 → 1.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.
- package/dist/adapter-set.js +2 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/runtime-port.d.ts +3 -0
- package/dist/runtime-port.js +109 -5
- package/dist/supply-port.js +8 -2
- package/package.json +6 -6
package/dist/adapter-set.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { ADAPTER_SET_API_VERSION, runningVersionOf } 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
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { createHostActions } from '@dsh-workbench/adapter-profile';
|
|
5
|
+
import { createProbePort, createSupplyPort, readSelfUpdateView } from '@dsh-workbench/adapter-probe';
|
|
6
6
|
import { createPluginSurface } from './plugin-surface.js';
|
|
7
|
-
import { createProbePort } from './probe-port.js';
|
|
8
7
|
import { createRuntimePort } from './runtime-port.js';
|
|
9
|
-
import { createSupplyPort } from './supply-port.js';
|
|
10
8
|
export const DEFAULT_ADAPTER_SET_ID = '@dsh-workbench/adapters-default';
|
|
11
9
|
export function createAdapterSet(ctx, options = {}) {
|
|
12
10
|
const shell = options.shell ?? ctx.get('shell');
|
package/dist/index.d.ts
CHANGED
|
@@ -7,5 +7,5 @@ export interface AdapterDescriptor {
|
|
|
7
7
|
readonly runtime: 'host';
|
|
8
8
|
}
|
|
9
9
|
export declare const DEFAULT_ADAPTERS: readonly AdapterDescriptor[];
|
|
10
|
-
export { createSupplyPort } from '
|
|
10
|
+
export { createSupplyPort } from '@dsh-workbench/adapter-probe';
|
|
11
11
|
export { createAdapterSet, DEFAULT_ADAPTER_SET_ID } from './adapter-set.js';
|
package/dist/index.js
CHANGED
|
@@ -10,5 +10,5 @@ export const DEFAULT_ADAPTERS = Object.freeze([
|
|
|
10
10
|
Object.freeze({ id: 'probe', runtime: 'host' }),
|
|
11
11
|
Object.freeze({ id: 'data', runtime: 'host' }),
|
|
12
12
|
]);
|
|
13
|
-
export { createSupplyPort } from '
|
|
13
|
+
export { createSupplyPort } from '@dsh-workbench/adapter-probe';
|
|
14
14
|
export { createAdapterSet, DEFAULT_ADAPTER_SET_ID } from './adapter-set.js';
|
package/dist/runtime-port.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import type { RuntimePort } from '@dsh-workbench/shared/host';
|
|
2
|
+
import { runtimeSeedPaths } from '@dsh-workbench/adapter-probe';
|
|
3
|
+
export declare function runtimePathDirs(paths: ReturnType<typeof runtimeSeedPaths>): readonly string[];
|
|
4
|
+
export declare function prependRuntimePath(paths: ReturnType<typeof runtimeSeedPaths>, env?: NodeJS.ProcessEnv): readonly string[];
|
|
2
5
|
export declare function createRuntimePort(): RuntimePort;
|
package/dist/runtime-port.js
CHANGED
|
@@ -1,12 +1,115 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
2
|
import { dirname, join } from 'node:path';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { packageRootOf } from '@dsh-workbench/shared/host';
|
|
4
|
+
import { backgroundLine, libsBinDir } from '@dsh-workbench/adapter-runtime';
|
|
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';
|
|
7
|
+
export function runtimePathDirs(paths) {
|
|
8
|
+
return [paths.opencliBinDir, libsBinDir(), paths.entryDir];
|
|
9
|
+
}
|
|
10
|
+
export function prependRuntimePath(paths, env = process.env) {
|
|
11
|
+
const added = [];
|
|
12
|
+
for (const dir of [...runtimePathDirs(paths)].reverse()) {
|
|
13
|
+
if (prependPath(dir, env))
|
|
14
|
+
added.push(dir);
|
|
15
|
+
}
|
|
16
|
+
return added;
|
|
17
|
+
}
|
|
18
|
+
const OPENCLI_RUNNER_TIMEOUT_MS = 30 * 60_000;
|
|
5
19
|
export function createRuntimePort() {
|
|
6
20
|
return {
|
|
7
21
|
packageRoot: packageRootOf,
|
|
8
|
-
opencliCommand: opencliCommandOf,
|
|
9
22
|
warnUnwritableRoot,
|
|
23
|
+
capabilities() {
|
|
24
|
+
return {
|
|
25
|
+
console: true,
|
|
26
|
+
pluginMarket: true,
|
|
27
|
+
browserBridge: true,
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
profile() {
|
|
31
|
+
return {
|
|
32
|
+
label: 'opencli',
|
|
33
|
+
terms: {
|
|
34
|
+
plugin: { zh: 'opencli 插件', en: 'opencli plugin' },
|
|
35
|
+
pluginOf: { zh: 'opencli 的插件', en: 'an opencli plugin' },
|
|
36
|
+
pluginThing: { zh: 'opencli 插件', en: 'an opencli plugin' },
|
|
37
|
+
pluginArea: { zh: 'opencli 的插件区', en: 'the opencli plugin area' },
|
|
38
|
+
},
|
|
39
|
+
installHint: {
|
|
40
|
+
zh: '确认 opencli 已经装好、在终端里能直接运行(which opencli)。',
|
|
41
|
+
en: 'Make sure opencli is installed and runs from your terminal (which opencli).',
|
|
42
|
+
},
|
|
43
|
+
diagnose: {
|
|
44
|
+
exec: {
|
|
45
|
+
zh: '确认 opencli 已经装好、在终端里能直接运行(which opencli)。',
|
|
46
|
+
en: 'Make sure opencli is installed and runs from your terminal (which opencli).',
|
|
47
|
+
},
|
|
48
|
+
login: {
|
|
49
|
+
zh: '在工作台的浏览器桥里登录一次;登录态会一直留着。',
|
|
50
|
+
en: 'Sign in once through the workbench browser bridge; the session stays.',
|
|
51
|
+
},
|
|
52
|
+
bridge: {
|
|
53
|
+
zh: '后台浏览器没起来,重试一次通常就好。',
|
|
54
|
+
en: 'The background browser is not up; a retry usually fixes it.',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
bridge: {
|
|
58
|
+
daemon: {
|
|
59
|
+
text: {
|
|
60
|
+
zh: '后台服务没起来:正常它会自己起,先在终端跑下面这条命令。',
|
|
61
|
+
en: 'The opencli daemon is not running. It usually starts by itself — run the command below in your terminal first.',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
extension: {
|
|
65
|
+
text: {
|
|
66
|
+
zh: '浏览器扩展没连上:确认浏览器开着、扩展已启用;没装就从商店装一次(装完回来点「重试」)。',
|
|
67
|
+
en: 'The opencli browser extension is not connected. Make sure the browser is running and the extension is enabled; install it once from the store if needed (then hit Retry here).',
|
|
68
|
+
},
|
|
69
|
+
link: {
|
|
70
|
+
label: { zh: '去 Chrome 应用商店装扩展', en: 'Get the extension in the Chrome Web Store' },
|
|
71
|
+
href: 'https://chromewebstore.google.com/detail/opencli/ildkmabpimmkaediidaifkhjpohdnifk',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
profile: {
|
|
75
|
+
text: {
|
|
76
|
+
zh: '连上了多个浏览器账号,但没选默认的那个:先看有哪些(下面这条命令),再选一个。',
|
|
77
|
+
en: 'Several browser accounts are connected but none is the default: list them (command below), then pick one.',
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
stale: {
|
|
81
|
+
text: {
|
|
82
|
+
zh: '默认的浏览器账号已经失效(它记的是上一次的扩展实例):重新选一个。',
|
|
83
|
+
en: 'The default browser account is stale (it names an extension instance that no longer exists): pick one again.',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
},
|
|
89
|
+
commandSurface() {
|
|
90
|
+
return {
|
|
91
|
+
name: 'opencli',
|
|
92
|
+
pluginPrefix: 'opencli-plugin-',
|
|
93
|
+
invoke: (site, command) => command === undefined || command === '' ? `opencli ${site}` : `opencli ${site} ${command}`,
|
|
94
|
+
help: (site) => `opencli ${site} --help`,
|
|
95
|
+
browser: (verb) => `opencli browser ${verb.join(' ')}`,
|
|
96
|
+
background: (command, argv) => backgroundLine(command, argv),
|
|
97
|
+
authorHint: 'opencli skills read opencli-adapter-author',
|
|
98
|
+
};
|
|
99
|
+
},
|
|
100
|
+
commands(ctx) {
|
|
101
|
+
return { opencli: opencliCommandOf(ctx).command };
|
|
102
|
+
},
|
|
103
|
+
runners(ctx, data) {
|
|
104
|
+
return {
|
|
105
|
+
opencli: opencliRunnerOf((request) => data.read(request), {
|
|
106
|
+
timeoutMs: OPENCLI_RUNNER_TIMEOUT_MS,
|
|
107
|
+
}),
|
|
108
|
+
};
|
|
109
|
+
},
|
|
110
|
+
health(ctx) {
|
|
111
|
+
return { opencli: opencliCommandOf(ctx) };
|
|
112
|
+
},
|
|
10
113
|
seed(ctx, options) {
|
|
11
114
|
const root = runtimeSeedRootOf(ctx);
|
|
12
115
|
if (root === null)
|
|
@@ -17,8 +120,9 @@ export function createRuntimePort() {
|
|
|
17
120
|
const log = options.log;
|
|
18
121
|
for (const file of seedRuntimeFiles({ root, home, packageRoot, log }))
|
|
19
122
|
log(`自举写下 ${file}`);
|
|
20
|
-
|
|
21
|
-
|
|
123
|
+
ensureLibsOpencliPeer();
|
|
124
|
+
for (const dir of prependRuntimePath(paths))
|
|
125
|
+
log(`PATH 前插 ${dir}`);
|
|
22
126
|
seedWorkbenchToolchain(root, log);
|
|
23
127
|
const plan = workshopSeedPlan(packageRoot, home, root);
|
|
24
128
|
runDetached(plan.entry, log);
|
package/dist/supply-port.js
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import { cliCatalogPath, isolatedHome, libInstallCommand, vendorPluginsDir } from '@dsh-workbench/adapter-runtime';
|
|
1
|
+
import { cliCatalogPath, ensureLibsBinOnPath, ensureLibsOpencliPeer, isolatedHome, libInstallCommand, vendorPluginsDir } from '@dsh-workbench/adapter-runtime';
|
|
2
|
+
import { isolatedRoot } from '@dsh-workbench/shared/host';
|
|
2
3
|
import { createRegistryNotebook, isNewerVersion, latestVersion, missingReleaseParts, probeRelease } from '@dsh-workbench/adapter-profile';
|
|
3
4
|
import { opencliInstallCommand, startSelfUpdate } from '@dsh-workbench/adapter-probe';
|
|
4
5
|
import { declarationGaps, declarationRefusalOf, moduleDeclarationOf, packageRouteOf, pathDeclarationOf, pluginInstallPlan, profileDirOf, profileModules, readBundleManager, readInstalledModule, readProfilePackage, refusalReason, registryDeclarationOf, resolvePluginSource, splitNpmSpec, } from '@dsh-workbench/adapter-supply';
|
|
5
6
|
export function createSupplyPort() {
|
|
6
7
|
const port = {
|
|
8
|
+
isolatedRoot,
|
|
7
9
|
isolatedHome,
|
|
8
10
|
cliCatalogPath,
|
|
9
11
|
vendorPluginsDir,
|
|
10
|
-
opencliInstallCommand,
|
|
12
|
+
runtimeInstallCommand: opencliInstallCommand,
|
|
13
|
+
afterLibInstall() {
|
|
14
|
+
ensureLibsOpencliPeer();
|
|
15
|
+
ensureLibsBinOnPath();
|
|
16
|
+
},
|
|
11
17
|
profileDirOf,
|
|
12
18
|
profileModules,
|
|
13
19
|
readInstalledModule,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dsh-workbench/adapters-default",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.9",
|
|
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-probe": "1.1.
|
|
17
|
-
"@dsh-workbench/
|
|
18
|
-
"@dsh-workbench/adapter-
|
|
19
|
-
"@dsh-workbench/adapter-
|
|
20
|
-
"@dsh-workbench/
|
|
16
|
+
"@dsh-workbench/adapter-probe": "1.1.9",
|
|
17
|
+
"@dsh-workbench/adapter-runtime": "1.1.9",
|
|
18
|
+
"@dsh-workbench/adapter-profile": "1.1.9",
|
|
19
|
+
"@dsh-workbench/adapter-supply": "1.1.9",
|
|
20
|
+
"@dsh-workbench/shared": "1.1.9"
|
|
21
21
|
},
|
|
22
22
|
"publishConfig": {
|
|
23
23
|
"access": "public"
|