@kirkchinese/harness-forge 0.0.0-stage → 0.4.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.
- package/LICENSE +21 -0
- package/README.md +42 -2
- package/assets/icon.svg +12 -0
- package/cordis.patch.yml +28 -0
- package/lib/agents/presets.d.ts +91 -0
- package/lib/agents/presets.js +282 -0
- package/lib/agents/profiles.d.ts +58 -0
- package/lib/agents/profiles.js +278 -0
- package/lib/agents/row.d.ts +17 -0
- package/lib/agents/row.js +146 -0
- package/lib/client/styles.d.ts +8 -0
- package/lib/client/styles.js +89 -0
- package/lib/client/typert.d.ts +14 -0
- package/lib/client/typert.js +110 -0
- package/lib/client.js +22500 -0
- package/lib/commands/definition.d.ts +40 -0
- package/lib/commands/definition.js +113 -0
- package/lib/commands/output-styles.d.ts +42 -0
- package/lib/commands/output-styles.js +152 -0
- package/lib/commands/row.d.ts +9 -0
- package/lib/commands/row.js +157 -0
- package/lib/context/instructions.d.ts +32 -0
- package/lib/context/instructions.js +88 -0
- package/lib/context/row.d.ts +16 -0
- package/lib/context/row.js +17 -0
- package/lib/dsh/commands.d.ts +30 -0
- package/lib/dsh/commands.js +61 -0
- package/lib/dsh/host.d.ts +107 -0
- package/lib/dsh/host.js +214 -0
- package/lib/dsh/model-route.d.ts +21 -0
- package/lib/dsh/model-route.js +37 -0
- package/lib/dsh/session-records.d.ts +78 -0
- package/lib/dsh/session-records.js +36 -0
- package/lib/dsh/subagents.d.ts +46 -0
- package/lib/dsh/subagents.js +14 -0
- package/lib/forge/contract.d.ts +231 -0
- package/lib/forge/contract.js +43 -0
- package/lib/forge/ledger.d.ts +143 -0
- package/lib/forge/ledger.js +733 -0
- package/lib/forge/live-mounts.d.ts +45 -0
- package/lib/forge/live-mounts.js +78 -0
- package/lib/forge/marketplace-install.d.ts +3 -0
- package/lib/forge/marketplace-install.js +64 -0
- package/lib/forge/npm.d.ts +31 -0
- package/lib/forge/npm.js +60 -0
- package/lib/forge/projects.d.ts +94 -0
- package/lib/forge/projects.js +336 -0
- package/lib/forge/receipts.d.ts +5 -0
- package/lib/forge/receipts.js +31 -0
- package/lib/forge/row.d.ts +32 -0
- package/lib/forge/row.js +59 -0
- package/lib/forge/service.d.ts +105 -0
- package/lib/forge/service.js +274 -0
- package/lib/forge/settings.d.ts +41 -0
- package/lib/forge/settings.js +115 -0
- package/lib/forge/state.d.ts +69 -0
- package/lib/forge/state.js +150 -0
- package/lib/forge/trust.d.ts +48 -0
- package/lib/forge/trust.js +107 -0
- package/lib/forge/turns.d.ts +13 -0
- package/lib/forge/turns.js +56 -0
- package/lib/hooks/broker/engine.d.ts +112 -0
- package/lib/hooks/broker/engine.js +728 -0
- package/lib/hooks/broker/helpers.d.ts +10 -0
- package/lib/hooks/broker/helpers.js +22 -0
- package/lib/hooks/broker/lifecycle.d.ts +65 -0
- package/lib/hooks/broker/lifecycle.js +342 -0
- package/lib/hooks/broker/session-events.d.ts +22 -0
- package/lib/hooks/broker/session-events.js +196 -0
- package/lib/hooks/broker/tools.d.ts +52 -0
- package/lib/hooks/broker/tools.js +424 -0
- package/lib/hooks/broker/types.d.ts +262 -0
- package/lib/hooks/broker/types.js +1 -0
- package/lib/hooks/broker.d.ts +80 -0
- package/lib/hooks/broker.js +95 -0
- package/lib/hooks/codex-user.d.ts +5 -0
- package/lib/hooks/codex-user.js +109 -0
- package/lib/hooks/condition.d.ts +11 -0
- package/lib/hooks/condition.js +181 -0
- package/lib/hooks/config.d.ts +85 -0
- package/lib/hooks/config.js +150 -0
- package/lib/hooks/matcher.d.ts +20 -0
- package/lib/hooks/matcher.js +39 -0
- package/lib/hooks/notice.d.ts +17 -0
- package/lib/hooks/notice.js +39 -0
- package/lib/hooks/output.d.ts +56 -0
- package/lib/hooks/output.js +214 -0
- package/lib/hooks/permissions.d.ts +14 -0
- package/lib/hooks/permissions.js +109 -0
- package/lib/hooks/process.d.ts +47 -0
- package/lib/hooks/process.js +134 -0
- package/lib/hooks/row.d.ts +17 -0
- package/lib/hooks/row.js +94 -0
- package/lib/hooks/runner.d.ts +85 -0
- package/lib/hooks/runner.js +293 -0
- package/lib/hooks/shell-commands.d.ts +19 -0
- package/lib/hooks/shell-commands.js +177 -0
- package/lib/hooks/shell.d.ts +43 -0
- package/lib/hooks/shell.js +126 -0
- package/lib/hooks/transcript.d.ts +28 -0
- package/lib/hooks/transcript.js +141 -0
- package/lib/hooks/vocabulary.d.ts +57 -0
- package/lib/hooks/vocabulary.js +364 -0
- package/lib/index.d.ts +31 -0
- package/lib/index.js +287 -0
- package/lib/mcp/auth.d.ts +35 -0
- package/lib/mcp/auth.js +178 -0
- package/lib/mcp/catalog.d.ts +36 -0
- package/lib/mcp/catalog.js +61 -0
- package/lib/mcp/mount.d.ts +75 -0
- package/lib/mcp/mount.js +217 -0
- package/lib/mcp/remote.d.ts +45 -0
- package/lib/mcp/remote.js +143 -0
- package/lib/mcp/row.d.ts +9 -0
- package/lib/mcp/row.js +131 -0
- package/lib/mods/bundler.d.ts +38 -0
- package/lib/mods/bundler.js +157 -0
- package/lib/mods/chain.d.ts +103 -0
- package/lib/mods/chain.js +436 -0
- package/lib/mods/claude.d.ts +27 -0
- package/lib/mods/claude.js +56 -0
- package/lib/mods/engine.d.ts +160 -0
- package/lib/mods/engine.js +701 -0
- package/lib/mods/expect.d.ts +8 -0
- package/lib/mods/expect.js +248 -0
- package/lib/mods/host.d.ts +105 -0
- package/lib/mods/host.js +462 -0
- package/lib/mods/loader.d.ts +53 -0
- package/lib/mods/loader.js +227 -0
- package/lib/mods/ops.d.ts +13 -0
- package/lib/mods/ops.js +117 -0
- package/lib/mods/row.d.ts +9 -0
- package/lib/mods/row.js +77 -0
- package/lib/mods/runtime.d.ts +60 -0
- package/lib/mods/runtime.js +133 -0
- package/lib/mods/service/commands.d.ts +17 -0
- package/lib/mods/service/commands.js +121 -0
- package/lib/mods/service/drawings.d.ts +36 -0
- package/lib/mods/service/drawings.js +64 -0
- package/lib/mods/service/sessions.d.ts +63 -0
- package/lib/mods/service/sessions.js +345 -0
- package/lib/mods/service/tools.d.ts +32 -0
- package/lib/mods/service/tools.js +253 -0
- package/lib/mods/service/turns.d.ts +32 -0
- package/lib/mods/service/turns.js +161 -0
- package/lib/mods/service/types.d.ts +151 -0
- package/lib/mods/service/types.js +1 -0
- package/lib/mods/service.d.ts +72 -0
- package/lib/mods/service.js +104 -0
- package/lib/mods/surfaces.d.ts +93 -0
- package/lib/mods/surfaces.js +309 -0
- package/lib/mods/values.d.ts +30 -0
- package/lib/mods/values.js +95 -0
- package/lib/opencode/bun.d.ts +40 -0
- package/lib/opencode/bun.js +156 -0
- package/lib/opencode/convert.d.ts +53 -0
- package/lib/opencode/convert.js +255 -0
- package/lib/opencode/row.d.ts +9 -0
- package/lib/opencode/row.js +86 -0
- package/lib/opencode/runtime/core.d.ts +74 -0
- package/lib/opencode/runtime/core.js +249 -0
- package/lib/opencode/runtime/events.d.ts +80 -0
- package/lib/opencode/runtime/events.js +281 -0
- package/lib/opencode/runtime/mount.d.ts +27 -0
- package/lib/opencode/runtime/mount.js +283 -0
- package/lib/opencode/runtime/server.d.ts +27 -0
- package/lib/opencode/runtime/server.js +353 -0
- package/lib/opencode/runtime/types.d.ts +109 -0
- package/lib/opencode/runtime/types.js +1 -0
- package/lib/opencode/runtime.d.ts +55 -0
- package/lib/opencode/runtime.js +79 -0
- package/lib/porting/port-gap.d.ts +30 -0
- package/lib/porting/port-gap.js +122 -0
- package/lib/porting/port-sessions.d.ts +41 -0
- package/lib/porting/port-sessions.js +98 -0
- package/lib/porting/prompt.d.ts +23 -0
- package/lib/porting/prompt.js +49 -0
- package/lib/porting/row.d.ts +16 -0
- package/lib/porting/row.js +25 -0
- package/lib/porting/verify-port.d.ts +53 -0
- package/lib/porting/verify-port.js +104 -0
- package/lib/presets/fs-search.d.ts +25 -0
- package/lib/presets/fs-search.js +17 -0
- package/lib/presets/tool-filter.d.ts +35 -0
- package/lib/presets/tool-filter.js +91 -0
- package/lib/sessions/claude.d.ts +29 -0
- package/lib/sessions/claude.js +83 -0
- package/lib/sessions/codex.d.ts +30 -0
- package/lib/sessions/codex.js +303 -0
- package/lib/sessions/opencode.d.ts +32 -0
- package/lib/sessions/opencode.js +320 -0
- package/lib/sessions/row.d.ts +14 -0
- package/lib/sessions/row.js +35 -0
- package/lib/shared/invocation.d.ts +169 -0
- package/lib/shared/invocation.js +325 -0
- package/lib/shared/render.d.ts +72 -0
- package/lib/shared/render.js +588 -0
- package/lib/shared/util.d.ts +21 -0
- package/lib/shared/util.js +32 -0
- package/lib/skills/bundled.d.ts +3 -0
- package/lib/skills/bundled.js +42 -0
- package/lib/skills/provider.d.ts +72 -0
- package/lib/skills/provider.js +340 -0
- package/lib/skills/row.d.ts +22 -0
- package/lib/skills/row.js +204 -0
- package/lib/workbench/adapter-coverage.d.ts +47 -0
- package/lib/workbench/adapter-coverage.js +102 -0
- package/lib/workbench/model-tools.d.ts +10 -0
- package/lib/workbench/model-tools.js +122 -0
- package/lib/workbench/overview.d.ts +103 -0
- package/lib/workbench/overview.js +159 -0
- package/lib/workbench/remote.d.ts +118 -0
- package/lib/workbench/remote.js +422 -0
- package/lib/workbench/row.d.ts +15 -0
- package/lib/workbench/row.js +16 -0
- package/lib/workbench/settings.d.ts +15 -0
- package/lib/workbench/settings.js +56 -0
- package/lib/workbench/workbench.d.ts +100 -0
- package/lib/workbench/workbench.js +260 -0
- package/locale/agents/en.json +6 -0
- package/locale/agents/zh.json +6 -0
- package/locale/commands/en.json +6 -0
- package/locale/commands/zh.json +6 -0
- package/locale/context/en.json +6 -0
- package/locale/context/zh.json +6 -0
- package/locale/en.json +6 -0
- package/locale/hooks/en.json +6 -0
- package/locale/hooks/zh.json +6 -0
- package/locale/mcp/en.json +6 -0
- package/locale/mcp/zh.json +6 -0
- package/locale/mods/en.json +6 -0
- package/locale/mods/zh.json +6 -0
- package/locale/opencode/en.json +6 -0
- package/locale/opencode/zh.json +6 -0
- package/locale/porter/en.json +6 -0
- package/locale/porter/zh.json +6 -0
- package/locale/sessions/en.json +6 -0
- package/locale/sessions/zh.json +6 -0
- package/locale/skills/en.json +6 -0
- package/locale/skills/zh.json +6 -0
- package/locale/workbench/en.json +6 -0
- package/locale/workbench/zh.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +246 -3
- package/runtime/opencode-host.mjs +270 -0
- package/skills/harness-forge/SKILL.md +47 -0
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
import { assess } from '@kirkchinese/harness-forge-core';
|
|
2
|
+
import { Remote, RemoteError, TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
|
|
3
|
+
import { Workbench } from './workbench.js';
|
|
4
|
+
import { waitingParts } from '../forge/projects.js';
|
|
5
|
+
import { forgeVerifyDeps, livePorts, verifyPort } from '../porting/verify-port.js';
|
|
6
|
+
import { stateOf } from '../porting/port-sessions.js';
|
|
7
|
+
function sourceOf(value) {
|
|
8
|
+
return value === 'codex' || value === 'opencode' ? value : 'claude-code';
|
|
9
|
+
}
|
|
10
|
+
function text(request, key) {
|
|
11
|
+
const value = request?.[key];
|
|
12
|
+
return typeof value === 'string' ? value : '';
|
|
13
|
+
}
|
|
14
|
+
function required(request, key, operation) {
|
|
15
|
+
const value = text(request, key);
|
|
16
|
+
if (value.length === 0)
|
|
17
|
+
throw new RemoteError('harness-forge/failed', `${key} is required`, { operation });
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
/** Plugin facts the workbench shows for a scan. */
|
|
21
|
+
function summary(plugin) {
|
|
22
|
+
const counts = new Map();
|
|
23
|
+
for (const component of plugin.components)
|
|
24
|
+
counts.set(component.kind, (counts.get(component.kind) ?? 0) + 1);
|
|
25
|
+
return {
|
|
26
|
+
id: plugin.id,
|
|
27
|
+
name: plugin.name,
|
|
28
|
+
source: plugin.source,
|
|
29
|
+
version: plugin.version,
|
|
30
|
+
license: plugin.license,
|
|
31
|
+
root: plugin.root,
|
|
32
|
+
manifestKind: plugin.ref.manifestKind,
|
|
33
|
+
components: Object.fromEntries(counts),
|
|
34
|
+
warnings: plugin.warnings.map(warning => warning.code),
|
|
35
|
+
compat: assess(plugin),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/** What an install reports to the workbench. */
|
|
39
|
+
function reportOf(report) {
|
|
40
|
+
return {
|
|
41
|
+
plugin: summary(report.plugin),
|
|
42
|
+
compat: report.compat,
|
|
43
|
+
receipt: report.receipt,
|
|
44
|
+
outcomes: report.outcomes,
|
|
45
|
+
alreadyInstalled: report.alreadyInstalled,
|
|
46
|
+
skillRoots: report.skillRoots,
|
|
47
|
+
commands: report.commands,
|
|
48
|
+
mcp: report.mcp,
|
|
49
|
+
hooks: report.hooks,
|
|
50
|
+
agents: report.agents,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/** The installation service as Remote methods. */
|
|
54
|
+
export class HarnessRemoteService extends TypertRemoteService {
|
|
55
|
+
forge;
|
|
56
|
+
workbench;
|
|
57
|
+
adapterSurfaces = new Map();
|
|
58
|
+
adapterListeners = new Map();
|
|
59
|
+
constructor(ctx, forge) {
|
|
60
|
+
super(ctx, 'harnessCompat');
|
|
61
|
+
this.forge = forge;
|
|
62
|
+
this.workbench = new Workbench(forge);
|
|
63
|
+
}
|
|
64
|
+
/** A row's API, or a failure naming the row that is off. */
|
|
65
|
+
row(name, operation) {
|
|
66
|
+
const api = this.forge.lookup(name);
|
|
67
|
+
if (api === undefined)
|
|
68
|
+
throw new RemoteError('harness-forge/failed', `the Harness Forge ${name} row is off; turn it on in Plugin Manager`, { operation });
|
|
69
|
+
return api;
|
|
70
|
+
}
|
|
71
|
+
/** Run one operation; anything it throws reaches the browser with its message. */
|
|
72
|
+
async guard(operation, run) {
|
|
73
|
+
try {
|
|
74
|
+
return await run();
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
if (typeof error === 'object' && error !== null && error.isDSHRemoteError === true)
|
|
78
|
+
throw error;
|
|
79
|
+
throw new RemoteError('harness-forge/failed', error instanceof Error ? error.message : String(error), { operation }, { cause: error });
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
// --- reading --------------------------------------------------------------
|
|
83
|
+
/** The instruction files added to the default workspace's prompt (`{ active, yieldingTo?, files }`); inactive while the context row is off. */
|
|
84
|
+
contextStatus() {
|
|
85
|
+
return this.guard('contextStatus', () => this.forge.lookup('context')?.status() ?? { active: false, files: [] });
|
|
86
|
+
}
|
|
87
|
+
/** The overview, plus the workspaces of open sessions with their trust and the project parts that wait for it. */
|
|
88
|
+
overview() {
|
|
89
|
+
return this.guard('overview', async () => ({ ...await this.workbench.overview(), workspaces: await this.forge.projects.workspaces() }));
|
|
90
|
+
}
|
|
91
|
+
// --- workspace trust ----------------------------------------------------------
|
|
92
|
+
/** A workspace's trust (`{ workspace, trusted, sources, waiting }`): its project parts that run code wait until it is trusted. */
|
|
93
|
+
workspaceTrust(request) {
|
|
94
|
+
return this.guard('workspaceTrust', () => this.trustOf(required(request, 'cwd', 'workspaceTrust')));
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Trust (or stop trusting) a workspace in Harness Forge; returns once open sessions in it have mounted or withdrawn what changed
|
|
98
|
+
* (`{ decision, stillLive: [{ componentId, reason }] }`: the parts whose withdrawal failed are still live, and calling it again retries).
|
|
99
|
+
*/
|
|
100
|
+
trustWorkspace(request) {
|
|
101
|
+
return this.guard('trustWorkspace', async () => {
|
|
102
|
+
const cwd = required(request, 'cwd', 'trustWorkspace');
|
|
103
|
+
if (typeof request['trusted'] !== 'boolean')
|
|
104
|
+
throw new RemoteError('harness-forge/failed', 'trusted must be true or false', { operation: 'trustWorkspace' });
|
|
105
|
+
const { stillLive } = await this.forge.projects.setTrust(cwd, request['trusted']);
|
|
106
|
+
return { decision: this.trustOf(cwd), stillLive };
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
/** The workspaces Harness Forge holds a trust decision on (`{ workspaces: [{ workspace, trusted, sources, dismissed, trustedAt?, dismissedAt? }] }`): trusted here, or dismissed with "Not now". */
|
|
110
|
+
trustDecisions() {
|
|
111
|
+
return this.guard('trustDecisions', () => ({ workspaces: this.forge.projects.trust.list() }));
|
|
112
|
+
}
|
|
113
|
+
/** Hide (or show again) a workspace's trust banner; trusts nothing. */
|
|
114
|
+
dismissTrust(request) {
|
|
115
|
+
return this.guard('dismissTrust', () => {
|
|
116
|
+
const cwd = required(request, 'cwd', 'dismissTrust');
|
|
117
|
+
if (typeof request['dismissed'] !== 'boolean')
|
|
118
|
+
throw new RemoteError('harness-forge/failed', 'dismissed must be true or false', { operation: 'dismissTrust' });
|
|
119
|
+
this.forge.projects.trust.dismiss(cwd, request['dismissed']);
|
|
120
|
+
return this.trustOf(cwd);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
trustOf(cwd) {
|
|
124
|
+
const state = this.forge.projects.trust.state(cwd);
|
|
125
|
+
return { ...state, waiting: waitingParts(cwd, state) };
|
|
126
|
+
}
|
|
127
|
+
discover() {
|
|
128
|
+
return this.guard('discover', () => this.workbench.discover());
|
|
129
|
+
}
|
|
130
|
+
diagnostics() {
|
|
131
|
+
return this.guard('diagnostics', () => this.workbench.diagnostics());
|
|
132
|
+
}
|
|
133
|
+
settings() {
|
|
134
|
+
return this.guard('settings', () => this.workbench.settings());
|
|
135
|
+
}
|
|
136
|
+
saveSettings(request) {
|
|
137
|
+
return this.guard('saveSettings', () => this.workbench.saveSettings(request));
|
|
138
|
+
}
|
|
139
|
+
// --- migrating --------------------------------------------------------------
|
|
140
|
+
installPlugin(request) {
|
|
141
|
+
return this.guard('installPlugin', async () => {
|
|
142
|
+
return reportOf(await this.forge.install(required(request, 'path', 'installPlugin'), text(request, 'source') || 'claude-code'));
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
migrate(request) {
|
|
146
|
+
return this.guard('migrate', () => this.workbench.migrate(sourceOf(request['source'])));
|
|
147
|
+
}
|
|
148
|
+
setPartEnabled(request) {
|
|
149
|
+
return this.guard('setPartEnabled', async () => {
|
|
150
|
+
const pluginId = required(request, 'pluginId', 'setPartEnabled');
|
|
151
|
+
const componentId = required(request, 'componentId', 'setPartEnabled');
|
|
152
|
+
if (typeof request['enabled'] !== 'boolean')
|
|
153
|
+
throw new RemoteError('harness-forge/failed', 'enabled must be true or false', { operation: 'setPartEnabled' });
|
|
154
|
+
return { changed: await this.forge.setPartEnabled(pluginId, componentId, request['enabled']) };
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
removePlugin(request) {
|
|
158
|
+
return this.guard('removePlugin', async () => {
|
|
159
|
+
const id = required(request, 'id', 'removePlugin');
|
|
160
|
+
if (!await this.forge.uninstall(id))
|
|
161
|
+
throw new RemoteError('harness-forge/failed', `no installed plugin ${id}`, { operation: 'removePlugin' });
|
|
162
|
+
return { removed: true };
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
marketplaceScan(request) {
|
|
166
|
+
return this.guard('marketplaceScan', () => {
|
|
167
|
+
const index = this.forge.scanMarketplace(required(request, 'path', 'marketplaceScan'));
|
|
168
|
+
return {
|
|
169
|
+
name: index.name,
|
|
170
|
+
description: index.description,
|
|
171
|
+
owner: index.owner,
|
|
172
|
+
manifestPath: index.manifestPath,
|
|
173
|
+
warnings: index.warnings,
|
|
174
|
+
entries: index.entries.map(entry => ({
|
|
175
|
+
name: entry.name,
|
|
176
|
+
description: entry.description,
|
|
177
|
+
version: entry.version,
|
|
178
|
+
license: entry.license,
|
|
179
|
+
category: entry.category,
|
|
180
|
+
tags: entry.tags,
|
|
181
|
+
source: {
|
|
182
|
+
kind: entry.source.kind,
|
|
183
|
+
...(entry.source.path !== undefined ? { path: entry.source.path } : {}),
|
|
184
|
+
...(entry.source.url !== undefined ? { url: entry.source.url } : {}),
|
|
185
|
+
...(entry.source.package !== undefined ? { package: entry.source.package } : {}),
|
|
186
|
+
},
|
|
187
|
+
})),
|
|
188
|
+
};
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
marketplaceInstall(request) {
|
|
192
|
+
return this.guard('marketplaceInstall', async () => {
|
|
193
|
+
return reportOf(await this.forge.installMarketplace(required(request, 'path', 'marketplaceInstall'), required(request, 'name', 'marketplaceInstall')));
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
// --- sign-in, sessions ------------------------------------------------------
|
|
197
|
+
signIns() {
|
|
198
|
+
return this.guard('signIns', () => ({ waiting: this.row('mcp', 'signIns').pendingSignIns() }));
|
|
199
|
+
}
|
|
200
|
+
signIn(request) {
|
|
201
|
+
return this.guard('signIn', () => {
|
|
202
|
+
const server = required(request, 'server', 'signIn');
|
|
203
|
+
return { server, signInUrl: this.row('mcp', 'signIn').startSignIn(server) };
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
sessions(request) {
|
|
207
|
+
return this.guard('sessions', async () => ({ sessions: await this.row('sessions', 'sessions').sessions(undefined, sourceOf(request?.['source'])) }));
|
|
208
|
+
}
|
|
209
|
+
importSession(request) {
|
|
210
|
+
return this.guard('importSession', () => this.row('sessions', 'importSession').importSession(required(request, 'path', 'importSession'), text(request, 'targetId') || undefined, sourceOf(request['source']), text(request, 'sourceId') || undefined));
|
|
211
|
+
}
|
|
212
|
+
// --- mod surfaces -------------------------------------------------------------
|
|
213
|
+
/**
|
|
214
|
+
* A session's mod drawings: the current one, then every new one, until the
|
|
215
|
+
* browser stops reading. Ends at once when the session's mods draw nothing.
|
|
216
|
+
*/
|
|
217
|
+
async *modSurfaces(request, signal) {
|
|
218
|
+
const session = text(request, 'session');
|
|
219
|
+
const queue = [];
|
|
220
|
+
let wake;
|
|
221
|
+
const stop = this.forge.lookup('mods')?.watch(session, (snapshot) => {
|
|
222
|
+
queue.push(snapshot);
|
|
223
|
+
wake?.();
|
|
224
|
+
});
|
|
225
|
+
if (stop === undefined)
|
|
226
|
+
return;
|
|
227
|
+
const aborted = new Promise((resolve) => {
|
|
228
|
+
if (signal?.aborted === true)
|
|
229
|
+
resolve();
|
|
230
|
+
signal?.addEventListener('abort', () => { resolve(); }, { once: true });
|
|
231
|
+
});
|
|
232
|
+
try {
|
|
233
|
+
while (signal?.aborted !== true) {
|
|
234
|
+
while (queue.length > 0)
|
|
235
|
+
yield queue.shift();
|
|
236
|
+
await Promise.race([new Promise((resolve) => { wake = resolve; }), aborted]);
|
|
237
|
+
wake = undefined;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
finally {
|
|
241
|
+
stop();
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
modAct(request) {
|
|
245
|
+
return this.guard('modAct', () => this.row('mods', 'modAct').act(text(request, 'session'), Number(request['generation']), text(request, 'action'), request['value']));
|
|
246
|
+
}
|
|
247
|
+
modClose(request) {
|
|
248
|
+
return this.guard('modClose', () => this.row('mods', 'modClose').closePane(text(request, 'session'), text(request, 'pane')));
|
|
249
|
+
}
|
|
250
|
+
modMove(request) {
|
|
251
|
+
return this.guard('modMove', () => {
|
|
252
|
+
const kind = request['kind'] === 'scroll' ? 'scroll' : 'focus';
|
|
253
|
+
return this.row('mods', 'modMove').move(text(request, 'session'), kind, request);
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
// --- adapter surfaces ---------------------------------------------------------
|
|
257
|
+
/**
|
|
258
|
+
* For an adapter's Node half (not a Remote method): publish a surface its
|
|
259
|
+
* browser half reads through `adapterSurface`, so an adapter needs no HTTP
|
|
260
|
+
* route of its own. `read` gives what the surface shows for one session;
|
|
261
|
+
* `changed(session)` tells the browser to read again.
|
|
262
|
+
*/
|
|
263
|
+
registerAdapterSurface(id, source) {
|
|
264
|
+
this.adapterSurfaces.set(id, source);
|
|
265
|
+
const listeners = this.adapterListeners.get(id) ?? new Set();
|
|
266
|
+
this.adapterListeners.set(id, listeners);
|
|
267
|
+
return {
|
|
268
|
+
changed: (sessionId) => { for (const listener of [...listeners])
|
|
269
|
+
listener(sessionId); },
|
|
270
|
+
dispose: () => {
|
|
271
|
+
if (this.adapterSurfaces.get(id) === source)
|
|
272
|
+
this.adapterSurfaces.delete(id);
|
|
273
|
+
},
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
/** What an adapter's surface shows for a session now, read once (a browser half that sets its own pace). */
|
|
277
|
+
async adapterRead(request) {
|
|
278
|
+
const id = required(request, 'adapter', 'adapterRead');
|
|
279
|
+
const source = this.adapterSurfaces.get(id);
|
|
280
|
+
if (source === undefined)
|
|
281
|
+
throw new RemoteError('harness-forge/failed', `no adapter surface "${id}" is registered in this DSH`, { operation: 'adapterRead' });
|
|
282
|
+
return this.guard('adapterRead', () => source.read(text(request, 'session'), request));
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* What an adapter's surface shows for a session: now, then again each time
|
|
286
|
+
* the adapter says it changed, until the browser stops reading.
|
|
287
|
+
*/
|
|
288
|
+
async *adapterSurface(request, signal) {
|
|
289
|
+
const id = required(request, 'adapter', 'adapterSurface');
|
|
290
|
+
const session = text(request, 'session');
|
|
291
|
+
if (!this.adapterSurfaces.has(id))
|
|
292
|
+
throw new RemoteError('harness-forge/failed', `no adapter surface "${id}" is registered in this DSH`, { operation: 'adapterSurface' });
|
|
293
|
+
let pending = true;
|
|
294
|
+
let wake;
|
|
295
|
+
const listener = (changed) => {
|
|
296
|
+
if (changed !== session)
|
|
297
|
+
return;
|
|
298
|
+
pending = true;
|
|
299
|
+
wake?.();
|
|
300
|
+
};
|
|
301
|
+
const listeners = this.adapterListeners.get(id) ?? new Set();
|
|
302
|
+
this.adapterListeners.set(id, listeners);
|
|
303
|
+
listeners.add(listener);
|
|
304
|
+
const aborted = new Promise((resolve) => {
|
|
305
|
+
if (signal?.aborted === true)
|
|
306
|
+
resolve();
|
|
307
|
+
signal?.addEventListener('abort', () => { resolve(); }, { once: true });
|
|
308
|
+
});
|
|
309
|
+
try {
|
|
310
|
+
while (signal?.aborted !== true) {
|
|
311
|
+
if (pending) {
|
|
312
|
+
pending = false;
|
|
313
|
+
const source = this.adapterSurfaces.get(id);
|
|
314
|
+
if (source === undefined)
|
|
315
|
+
return;
|
|
316
|
+
yield await source.read(session, request);
|
|
317
|
+
continue;
|
|
318
|
+
}
|
|
319
|
+
await Promise.race([new Promise((resolve) => { wake = resolve; }), aborted]);
|
|
320
|
+
wake = undefined;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
finally {
|
|
324
|
+
listeners.delete(listener);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
// --- porting ----------------------------------------------------------------
|
|
328
|
+
/**
|
|
329
|
+
* The task a port session starts with (the working protocol, then the part's brief), as Markdown, to preview or
|
|
330
|
+
* copy; `language` is the user's interface language, which the agent is told to talk in.
|
|
331
|
+
*/
|
|
332
|
+
portBrief(request) {
|
|
333
|
+
return this.guard('portBrief', () => {
|
|
334
|
+
const porter = this.row('porter', 'portBrief');
|
|
335
|
+
const { plugin, gaps } = this.workbench.findPlugin(required(request, 'pluginId', 'portBrief'));
|
|
336
|
+
return { markdown: porter.task(plugin, gaps, required(request, 'componentId', 'portBrief'), text(request, 'language') || undefined) };
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* The parts being ported or ported (`{ ports: [{ pluginId, componentId, state, sessionId?, verifiedAt?, adapter? }] }`,
|
|
341
|
+
* `state` `in-progress` or `verified`). A port whose session was deleted is dropped, so the part can be ported again.
|
|
342
|
+
*/
|
|
343
|
+
portSessions() {
|
|
344
|
+
return this.guard('portSessions', async () => ({ ports: (await livePorts(this.forge)).map(record => ({ ...record, state: stateOf(record) })) }));
|
|
345
|
+
}
|
|
346
|
+
/** What `harness_verify_port` answers for a part (`{ covered, checks, adapter? }`), recorded the same way. */
|
|
347
|
+
verifyPort(request) {
|
|
348
|
+
return this.guard('verifyPort', () => verifyPort(forgeVerifyDeps(this.forge, this.workbench), required(request, 'pluginId', 'verifyPort'), required(request, 'componentId', 'verifyPort')));
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Port one part of a plugin: start a session in DSH's creation mode working
|
|
352
|
+
* on its task, in the given Workspace (`workspaceId`) or directory (`cwd`),
|
|
353
|
+
* and record it as the part's port session.
|
|
354
|
+
*/
|
|
355
|
+
portGap(request) {
|
|
356
|
+
return this.guard('portGap', async () => {
|
|
357
|
+
const porter = this.row('porter', 'portGap');
|
|
358
|
+
const { plugin, gaps } = this.workbench.findPlugin(required(request, 'pluginId', 'portGap'));
|
|
359
|
+
const workspaceId = text(request, 'workspaceId');
|
|
360
|
+
const cwd = text(request, 'cwd');
|
|
361
|
+
const location = workspaceId.length > 0 ? { workspaceId } : cwd.length > 0 ? { cwd } : {};
|
|
362
|
+
const { sessionId } = await porter.port(plugin, gaps, required(request, 'componentId', 'portGap'), location, text(request, 'language') || undefined);
|
|
363
|
+
return { sessionId };
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
/** The Remote methods and whether each streams; the client contribution mirrors this list. */
|
|
368
|
+
export const REMOTE_METHODS = [
|
|
369
|
+
// [method, mode, takes a request]
|
|
370
|
+
['overview', 'unary', false],
|
|
371
|
+
['workspaceTrust', 'unary', true],
|
|
372
|
+
['trustWorkspace', 'unary', true],
|
|
373
|
+
['trustDecisions', 'unary', false],
|
|
374
|
+
['dismissTrust', 'unary', true],
|
|
375
|
+
['discover', 'unary', false],
|
|
376
|
+
['contextStatus', 'unary', false],
|
|
377
|
+
['diagnostics', 'unary', false],
|
|
378
|
+
['settings', 'unary', false],
|
|
379
|
+
['saveSettings', 'unary', true],
|
|
380
|
+
['installPlugin', 'unary', true],
|
|
381
|
+
['migrate', 'unary', true],
|
|
382
|
+
['setPartEnabled', 'unary', true],
|
|
383
|
+
['removePlugin', 'unary', true],
|
|
384
|
+
['marketplaceScan', 'unary', true],
|
|
385
|
+
['marketplaceInstall', 'unary', true],
|
|
386
|
+
['signIns', 'unary', false],
|
|
387
|
+
['signIn', 'unary', true],
|
|
388
|
+
['sessions', 'unary', true],
|
|
389
|
+
['importSession', 'unary', true],
|
|
390
|
+
['modSurfaces', 'stream', true],
|
|
391
|
+
['modAct', 'unary', true],
|
|
392
|
+
['modClose', 'unary', true],
|
|
393
|
+
['modMove', 'unary', true],
|
|
394
|
+
['adapterSurface', 'stream', true],
|
|
395
|
+
['adapterRead', 'unary', true],
|
|
396
|
+
['portBrief', 'unary', true],
|
|
397
|
+
['portGap', 'unary', true],
|
|
398
|
+
['portSessions', 'unary', false],
|
|
399
|
+
['verifyPort', 'unary', true],
|
|
400
|
+
];
|
|
401
|
+
/**
|
|
402
|
+
* Attach the same marker the decorator would attach. The decorator's context
|
|
403
|
+
* only calls `addInitializer`; running it against a synthetic instance is the
|
|
404
|
+
* public runtime equivalent.
|
|
405
|
+
*/
|
|
406
|
+
function markRemote(method, mode) {
|
|
407
|
+
const prototype = HarnessRemoteService.prototype;
|
|
408
|
+
const synthetic = Object.create(prototype);
|
|
409
|
+
const context = {
|
|
410
|
+
kind: 'method',
|
|
411
|
+
name: method,
|
|
412
|
+
static: false,
|
|
413
|
+
private: false,
|
|
414
|
+
addInitializer(initializer) {
|
|
415
|
+
initializer.call(synthetic);
|
|
416
|
+
},
|
|
417
|
+
};
|
|
418
|
+
const decorator = mode === 'stream' ? Remote({ name: method, mode: 'stream' }) : Remote(method);
|
|
419
|
+
decorator(prototype[method], context);
|
|
420
|
+
}
|
|
421
|
+
for (const [method, mode] of REMOTE_METHODS)
|
|
422
|
+
markRemote(method, mode);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The workbench row: the workbench's Host surface, as Remote methods under
|
|
3
|
+
* the `harnessCompat` namespace, which the client panel calls. A method that
|
|
4
|
+
* needs a row that is off fails with the row's name.
|
|
5
|
+
* @module @kirkchinese/harness-forge/workbench
|
|
6
|
+
*/
|
|
7
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
8
|
+
import type { Disposer } from '../forge/contract.js';
|
|
9
|
+
import { type HarnessForge } from '../forge/service.js';
|
|
10
|
+
export declare const name = "harness-forge-workbench";
|
|
11
|
+
export declare const inject: string[];
|
|
12
|
+
/** The workbench row. */
|
|
13
|
+
export declare function apply(ctx: Context): void;
|
|
14
|
+
/** Start the workbench row on the shared service. Returns its teardown. */
|
|
15
|
+
export declare function startWorkbench(ctx: Context, forge: HarnessForge): Disposer;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FORGE_SERVICE } from '../forge/service.js';
|
|
2
|
+
import { HarnessRemoteService } from './remote.js';
|
|
3
|
+
import { rowEffect } from '../forge/row.js';
|
|
4
|
+
export const name = 'harness-forge-workbench';
|
|
5
|
+
export const inject = [FORGE_SERVICE];
|
|
6
|
+
/** The workbench row. */
|
|
7
|
+
export function apply(ctx) {
|
|
8
|
+
rowEffect(ctx, 'workbench', forge => startWorkbench(ctx, forge));
|
|
9
|
+
}
|
|
10
|
+
/** Start the workbench row on the shared service. Returns its teardown. */
|
|
11
|
+
export function startWorkbench(ctx, forge) {
|
|
12
|
+
// The Remote service registers itself on the row's context and goes with it.
|
|
13
|
+
if (typeof ctx.provide === 'function')
|
|
14
|
+
new HarnessRemoteService(ctx, forge);
|
|
15
|
+
return () => { };
|
|
16
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** User-visible workbench settings. */
|
|
2
|
+
export interface HarnessSettings {
|
|
3
|
+
readonly schemaVersion: 1;
|
|
4
|
+
readonly discoveryRoots: readonly string[];
|
|
5
|
+
readonly autoDiscover: boolean;
|
|
6
|
+
readonly contextBudgetTokens?: number;
|
|
7
|
+
}
|
|
8
|
+
/** Default roots: common harness caches plus the current workspace. */
|
|
9
|
+
export declare function defaultSettings(): HarnessSettings;
|
|
10
|
+
/** Settings file lives beside `state.json`/`receipts/`. */
|
|
11
|
+
export declare function settingsPathFor(statePath: string): string;
|
|
12
|
+
/** Read settings, falling back to defaults when the file is absent/invalid. */
|
|
13
|
+
export declare function readSettings(statePath: string): HarnessSettings;
|
|
14
|
+
/** Persist settings atomically. */
|
|
15
|
+
export declare function writeSettings(statePath: string, settings: HarnessSettings): void;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workbench settings persisted beside the installation ledger. Settings are a
|
|
3
|
+
* small, explicit JSON file rather than YAML so the UI and service agree on the
|
|
4
|
+
* same source of truth.
|
|
5
|
+
* @module @kirkchinese/harness-forge
|
|
6
|
+
*/
|
|
7
|
+
import { mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
8
|
+
import { dirname, join, resolve } from 'node:path';
|
|
9
|
+
import { defaultDiscoveryRoots } from '@kirkchinese/harness-forge-core';
|
|
10
|
+
/** Default roots: common harness caches plus the current workspace. */
|
|
11
|
+
export function defaultSettings() {
|
|
12
|
+
return {
|
|
13
|
+
schemaVersion: 1,
|
|
14
|
+
discoveryRoots: [...defaultDiscoveryRoots(), resolve(process.cwd())],
|
|
15
|
+
autoDiscover: true,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/** Settings file lives beside `state.json`/`receipts/`. */
|
|
19
|
+
export function settingsPathFor(statePath) {
|
|
20
|
+
return join(dirname(statePath), 'settings.json');
|
|
21
|
+
}
|
|
22
|
+
/** Read settings, falling back to defaults when the file is absent/invalid. */
|
|
23
|
+
export function readSettings(statePath) {
|
|
24
|
+
const defaults = defaultSettings();
|
|
25
|
+
let raw;
|
|
26
|
+
try {
|
|
27
|
+
raw = JSON.parse(readFileSync(settingsPathFor(statePath), 'utf8'));
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return defaults;
|
|
31
|
+
}
|
|
32
|
+
if (typeof raw !== 'object' || raw === null || Array.isArray(raw))
|
|
33
|
+
return defaults;
|
|
34
|
+
const record = raw;
|
|
35
|
+
const roots = Array.isArray(record['discoveryRoots'])
|
|
36
|
+
? [...new Set(record['discoveryRoots'].filter((value) => typeof value === 'string' && value.trim().length > 0).map(value => resolve(value)))]
|
|
37
|
+
: defaults.discoveryRoots;
|
|
38
|
+
const autoDiscover = typeof record['autoDiscover'] === 'boolean' ? record['autoDiscover'] : defaults.autoDiscover;
|
|
39
|
+
const contextBudgetTokens = typeof record['contextBudgetTokens'] === 'number' && Number.isFinite(record['contextBudgetTokens']) && record['contextBudgetTokens'] > 0
|
|
40
|
+
? Math.round(record['contextBudgetTokens'])
|
|
41
|
+
: undefined;
|
|
42
|
+
return {
|
|
43
|
+
schemaVersion: 1,
|
|
44
|
+
discoveryRoots: roots.length > 0 ? roots : defaults.discoveryRoots,
|
|
45
|
+
autoDiscover,
|
|
46
|
+
...(contextBudgetTokens !== undefined ? { contextBudgetTokens } : {}),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/** Persist settings atomically. */
|
|
50
|
+
export function writeSettings(statePath, settings) {
|
|
51
|
+
const path = settingsPathFor(statePath);
|
|
52
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
53
|
+
const temporary = `${path}.tmp`;
|
|
54
|
+
writeFileSync(temporary, `${JSON.stringify(settings, null, 2)}\n`, 'utf8');
|
|
55
|
+
renameSync(temporary, path);
|
|
56
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import { type CompatibilityVector, type DiscoveredPlugin, type ForeignPlugin, type Gap } from '@kirkchinese/harness-forge-core';
|
|
3
|
+
import { type AdapterCoverage, type Overview } from './overview.js';
|
|
4
|
+
import { type HarnessSettings } from './settings.js';
|
|
5
|
+
import type { HarnessForge } from '../forge/service.js';
|
|
6
|
+
/** One component exposed by an installed plugin. */
|
|
7
|
+
export interface CapabilityItem {
|
|
8
|
+
readonly pluginId: string;
|
|
9
|
+
readonly pluginName: string;
|
|
10
|
+
readonly kind: string;
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly description?: string;
|
|
13
|
+
readonly source: string;
|
|
14
|
+
}
|
|
15
|
+
/** Per-plugin capability summary. */
|
|
16
|
+
export interface PluginCapabilities {
|
|
17
|
+
readonly pluginId: string;
|
|
18
|
+
readonly name: string;
|
|
19
|
+
readonly source: string;
|
|
20
|
+
readonly items: readonly CapabilityItem[];
|
|
21
|
+
readonly compat: CompatibilityVector;
|
|
22
|
+
readonly residentTokens: number;
|
|
23
|
+
}
|
|
24
|
+
/** Aggregate capability and context budget view. */
|
|
25
|
+
export interface CapabilityCatalog {
|
|
26
|
+
readonly plugins: readonly PluginCapabilities[];
|
|
27
|
+
readonly totals: Readonly<Record<string, number>>;
|
|
28
|
+
readonly residentTokens: number;
|
|
29
|
+
readonly toolCount?: number;
|
|
30
|
+
readonly toolTokens?: number;
|
|
31
|
+
readonly budgetTokens?: number;
|
|
32
|
+
readonly overBudget: boolean;
|
|
33
|
+
readonly basis: string;
|
|
34
|
+
}
|
|
35
|
+
/** Services the compatibility layer can use when present. */
|
|
36
|
+
export interface HostCapabilities {
|
|
37
|
+
readonly skills: boolean;
|
|
38
|
+
readonly commands: boolean;
|
|
39
|
+
readonly agentPresets: boolean;
|
|
40
|
+
readonly shell: boolean;
|
|
41
|
+
readonly webServer: boolean;
|
|
42
|
+
readonly workingDirectory: boolean;
|
|
43
|
+
}
|
|
44
|
+
/** Read the current host's optional services. */
|
|
45
|
+
export declare function probeHostCapabilities(ctx: Context): HostCapabilities;
|
|
46
|
+
/** Workbench views over the installations. */
|
|
47
|
+
export declare class Workbench {
|
|
48
|
+
private readonly forge;
|
|
49
|
+
private readonly installs;
|
|
50
|
+
constructor(forge: HarnessForge);
|
|
51
|
+
/** Read the persisted workbench settings. */
|
|
52
|
+
settings(): HarnessSettings;
|
|
53
|
+
/** Save workbench settings; only known fields are accepted. */
|
|
54
|
+
saveSettings(input: {
|
|
55
|
+
readonly discoveryRoots?: unknown;
|
|
56
|
+
readonly autoDiscover?: unknown;
|
|
57
|
+
readonly contextBudgetTokens?: unknown;
|
|
58
|
+
}): HarnessSettings;
|
|
59
|
+
/**
|
|
60
|
+
* A plugin the overview lists, by id, read from disk now, with its gaps:
|
|
61
|
+
* an installed plugin's recorded ones, else those its scan shows.
|
|
62
|
+
*/
|
|
63
|
+
findPlugin(id: string): {
|
|
64
|
+
readonly plugin: ForeignPlugin;
|
|
65
|
+
readonly gaps: readonly Gap[];
|
|
66
|
+
};
|
|
67
|
+
/** Discover plugin roots using the saved settings. */
|
|
68
|
+
discover(): {
|
|
69
|
+
settings: HarnessSettings;
|
|
70
|
+
plugins: Array<DiscoveredPlugin & {
|
|
71
|
+
installed: boolean;
|
|
72
|
+
}>;
|
|
73
|
+
missingRoots: readonly string[];
|
|
74
|
+
};
|
|
75
|
+
/** Aggregate capabilities and context cost for installed plugins. */
|
|
76
|
+
capabilities(): CapabilityCatalog;
|
|
77
|
+
/** Current optional host services, for diagnostics. */
|
|
78
|
+
hostCapabilities(): HostCapabilities;
|
|
79
|
+
/** The adapter packages installed in this DSH profile (see `adapter-coverage.ts`), read from disk now. */
|
|
80
|
+
adapters(): AdapterCoverage[];
|
|
81
|
+
/**
|
|
82
|
+
* The adapters on disk that DSH lists as installed and enabled: what `harness_verify_port` requires too, so a link
|
|
83
|
+
* left by a failed install covers nothing.
|
|
84
|
+
*/
|
|
85
|
+
enabledAdapters(): Promise<AdapterCoverage[]>;
|
|
86
|
+
/** The workbench's plain-language view of every harness: see `overview.ts`. */
|
|
87
|
+
overview(): Promise<Overview>;
|
|
88
|
+
/** Read-only workbench diagnostics: host services, mounts, tool budget and row failures. */
|
|
89
|
+
diagnostics(): Record<string, unknown>;
|
|
90
|
+
/** List all skill roots the skills row serves (none while it is off). */
|
|
91
|
+
listSkillRoots(): readonly string[];
|
|
92
|
+
/** Migrate everything of one harness that is not migrated yet: its plugins and the person's own assets. */
|
|
93
|
+
migrate(source: 'claude-code' | 'codex' | 'opencode'): Promise<{
|
|
94
|
+
readonly installed: readonly string[];
|
|
95
|
+
readonly failed: ReadonlyArray<{
|
|
96
|
+
readonly name: string;
|
|
97
|
+
readonly error: string;
|
|
98
|
+
}>;
|
|
99
|
+
}>;
|
|
100
|
+
}
|