@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,260 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The workbench's read side: settings, discovery, capabilities and context
|
|
3
|
+
* cost, the overview and diagnostics, and migrating a whole harness. It keeps
|
|
4
|
+
* no state; the workbench row and the `/harness` command both read through it.
|
|
5
|
+
* @module @kirkchinese/harness-forge
|
|
6
|
+
*/
|
|
7
|
+
import { createRequire } from 'node:module';
|
|
8
|
+
import { resolve } from 'node:path';
|
|
9
|
+
import { assess, discoverPlugins, pluginId } from '@kirkchinese/harness-forge-core';
|
|
10
|
+
import { itemOf, overviewOf, unreadableItemOf } from './overview.js';
|
|
11
|
+
import { adapterCoverage, enabledAdapters } from './adapter-coverage.js';
|
|
12
|
+
import { readSettings, writeSettings } from './settings.js';
|
|
13
|
+
import { messageOf } from '../shared/util.js';
|
|
14
|
+
import { dshService } from '../dsh/host.js';
|
|
15
|
+
import { findBun } from '../opencode/bun.js';
|
|
16
|
+
/** A package's version as this process resolves it, if it resolves. */
|
|
17
|
+
function versionOf(specifier) {
|
|
18
|
+
try {
|
|
19
|
+
return createRequire(import.meta.url)(specifier).version;
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** Read the current host's optional services. */
|
|
26
|
+
export function probeHostCapabilities(ctx) {
|
|
27
|
+
const has = (name) => dshService(ctx, name) !== undefined;
|
|
28
|
+
return {
|
|
29
|
+
skills: has('skills'),
|
|
30
|
+
commands: has('commands'),
|
|
31
|
+
agentPresets: has('agentPresets'),
|
|
32
|
+
shell: has('shell'),
|
|
33
|
+
webServer: has('webServer'),
|
|
34
|
+
workingDirectory: has('workingDirectory'),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/** Workbench views over the installations. */
|
|
38
|
+
export class Workbench {
|
|
39
|
+
forge;
|
|
40
|
+
installs;
|
|
41
|
+
constructor(forge) {
|
|
42
|
+
this.forge = forge;
|
|
43
|
+
this.installs = forge.ledger;
|
|
44
|
+
}
|
|
45
|
+
/** Read the persisted workbench settings. */
|
|
46
|
+
settings() {
|
|
47
|
+
return readSettings(this.installs.statePath);
|
|
48
|
+
}
|
|
49
|
+
/** Save workbench settings; only known fields are accepted. */
|
|
50
|
+
saveSettings(input) {
|
|
51
|
+
const current = this.settings();
|
|
52
|
+
const roots = Array.isArray(input.discoveryRoots)
|
|
53
|
+
? [...new Set(input.discoveryRoots
|
|
54
|
+
.filter((value) => typeof value === 'string' && value.trim().length > 0)
|
|
55
|
+
.map(value => resolve(value)))]
|
|
56
|
+
: current.discoveryRoots;
|
|
57
|
+
const autoDiscover = typeof input.autoDiscover === 'boolean' ? input.autoDiscover : current.autoDiscover;
|
|
58
|
+
const contextBudgetTokens = typeof input.contextBudgetTokens === 'number'
|
|
59
|
+
&& Number.isFinite(input.contextBudgetTokens)
|
|
60
|
+
&& input.contextBudgetTokens > 0
|
|
61
|
+
? Math.round(input.contextBudgetTokens)
|
|
62
|
+
: undefined;
|
|
63
|
+
const next = {
|
|
64
|
+
schemaVersion: 1,
|
|
65
|
+
discoveryRoots: roots.length > 0 ? roots : current.discoveryRoots,
|
|
66
|
+
autoDiscover,
|
|
67
|
+
...(contextBudgetTokens !== undefined ? { contextBudgetTokens } : {}),
|
|
68
|
+
};
|
|
69
|
+
writeSettings(this.installs.statePath, next);
|
|
70
|
+
return next;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* A plugin the overview lists, by id, read from disk now, with its gaps:
|
|
74
|
+
* an installed plugin's recorded ones, else those its scan shows.
|
|
75
|
+
*/
|
|
76
|
+
findPlugin(id) {
|
|
77
|
+
const record = this.installs.list().find(item => item.id === id);
|
|
78
|
+
if (record !== undefined) {
|
|
79
|
+
const plugin = this.installs.scan(record.root, record.source);
|
|
80
|
+
return { plugin, gaps: record.compat?.gaps ?? assess(plugin).gaps };
|
|
81
|
+
}
|
|
82
|
+
// The overview lists a discovered plugin under its scanned id; the discovered name is only a hint.
|
|
83
|
+
const found = this.discover().plugins.filter(item => !item.installed);
|
|
84
|
+
for (const item of [...found.filter(item => pluginId(item.source, item.name) === id), ...found.filter(item => pluginId(item.source, item.name) !== id)]) {
|
|
85
|
+
let plugin;
|
|
86
|
+
try {
|
|
87
|
+
plugin = this.installs.scan(item.root, item.source);
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (plugin.id === id)
|
|
93
|
+
return { plugin, gaps: assess(plugin).gaps };
|
|
94
|
+
}
|
|
95
|
+
throw new Error(`no plugin ${id} is installed or discovered`);
|
|
96
|
+
}
|
|
97
|
+
/** Discover plugin roots using the saved settings. */
|
|
98
|
+
discover() {
|
|
99
|
+
const settings = this.settings();
|
|
100
|
+
const result = discoverPlugins(settings.discoveryRoots);
|
|
101
|
+
const installedRoots = new Set([...this.installs.live.values()].map(install => resolve(install.record.root)));
|
|
102
|
+
return {
|
|
103
|
+
settings,
|
|
104
|
+
plugins: result.plugins.map(plugin => ({
|
|
105
|
+
...plugin,
|
|
106
|
+
installed: installedRoots.has(resolve(plugin.root)) || this.installs.live.has(pluginId(plugin.source, plugin.name)),
|
|
107
|
+
})),
|
|
108
|
+
missingRoots: result.missingRoots,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/** Aggregate capabilities and context cost for installed plugins. */
|
|
112
|
+
capabilities() {
|
|
113
|
+
const settings = this.settings();
|
|
114
|
+
const meter = dshService(this.installs.ctx, 'tokenMeter');
|
|
115
|
+
const estimate = (text) => {
|
|
116
|
+
if (meter === undefined)
|
|
117
|
+
return Math.ceil(text.length / 4);
|
|
118
|
+
try {
|
|
119
|
+
return meter.estimateMessage({ role: 'user', content: [{ type: 'text', text }] });
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
return Math.ceil(text.length / 4);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
const plugins = [];
|
|
126
|
+
const totals = {};
|
|
127
|
+
let residentTokens = 0;
|
|
128
|
+
for (const install of this.installs.live.values()) {
|
|
129
|
+
const plugin = this.installs.scanRoot(install.record.root, install.record.source);
|
|
130
|
+
const compat = assess(plugin, [...install.outcomes.values()]);
|
|
131
|
+
const items = plugin.components.map((component) => {
|
|
132
|
+
const description = 'description' in component ? component.description : undefined;
|
|
133
|
+
return {
|
|
134
|
+
pluginId: plugin.id,
|
|
135
|
+
pluginName: plugin.name,
|
|
136
|
+
kind: component.kind,
|
|
137
|
+
name: component.name,
|
|
138
|
+
...(description !== undefined ? { description } : {}),
|
|
139
|
+
source: plugin.source,
|
|
140
|
+
};
|
|
141
|
+
});
|
|
142
|
+
for (const item of items)
|
|
143
|
+
totals[item.kind] = (totals[item.kind] ?? 0) + 1;
|
|
144
|
+
const measured = items.reduce((sum, item) => (item.kind === 'skill' || item.kind === 'command' || item.kind === 'agent'
|
|
145
|
+
? sum + estimate(`${item.name}\n${item.description ?? ''}`)
|
|
146
|
+
: sum), 0);
|
|
147
|
+
residentTokens += measured;
|
|
148
|
+
plugins.push({ pluginId: plugin.id, name: plugin.name, source: plugin.source, items, compat, residentTokens: measured });
|
|
149
|
+
}
|
|
150
|
+
const budgetTokens = settings.contextBudgetTokens;
|
|
151
|
+
const tools = dshService(this.installs.ctx, 'tools');
|
|
152
|
+
let toolCount = 0;
|
|
153
|
+
let toolTokens = 0;
|
|
154
|
+
try {
|
|
155
|
+
const schemas = tools?.schemas() ?? [];
|
|
156
|
+
toolCount = schemas.length;
|
|
157
|
+
toolTokens = schemas.reduce((sum, schema) => sum + estimate(JSON.stringify(schema)), 0);
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
// A composition without tool schema projection reports zero tools.
|
|
161
|
+
}
|
|
162
|
+
const totalResident = residentTokens + toolTokens;
|
|
163
|
+
return {
|
|
164
|
+
plugins,
|
|
165
|
+
totals,
|
|
166
|
+
residentTokens: totalResident,
|
|
167
|
+
...(toolCount > 0 ? { toolCount } : {}),
|
|
168
|
+
...(toolTokens > 0 ? { toolTokens } : {}),
|
|
169
|
+
...(budgetTokens !== undefined ? { budgetTokens } : {}),
|
|
170
|
+
overBudget: budgetTokens !== undefined && totalResident > budgetTokens,
|
|
171
|
+
basis: `${meter === undefined ? 'bytes/4' : 'ctx.tokenMeter'} over catalog text + visible tool schemas`,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
/** Current optional host services, for diagnostics. */
|
|
175
|
+
hostCapabilities() {
|
|
176
|
+
return probeHostCapabilities(this.forge.ctx);
|
|
177
|
+
}
|
|
178
|
+
/** The adapter packages installed in this DSH profile (see `adapter-coverage.ts`), read from disk now. */
|
|
179
|
+
adapters() {
|
|
180
|
+
const profile = dshService(this.installs.ctx, 'profileContext');
|
|
181
|
+
return adapterCoverage(profile?.dir !== undefined && profile.dir.length > 0 ? profile.dir : undefined);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* The adapters on disk that DSH lists as installed and enabled: what `harness_verify_port` requires too, so a link
|
|
185
|
+
* left by a failed install covers nothing.
|
|
186
|
+
*/
|
|
187
|
+
enabledAdapters() {
|
|
188
|
+
return enabledAdapters(this.adapters(), dshService(this.forge.ctx, 'pluginManager'));
|
|
189
|
+
}
|
|
190
|
+
/** The workbench's plain-language view of every harness: see `overview.ts`. */
|
|
191
|
+
async overview() {
|
|
192
|
+
const adapters = await this.enabledAdapters();
|
|
193
|
+
const items = [];
|
|
194
|
+
const seen = new Set();
|
|
195
|
+
for (const record of this.installs.list()) {
|
|
196
|
+
seen.add(resolve(record.root).toLowerCase());
|
|
197
|
+
try {
|
|
198
|
+
items.push(itemOf(this.installs.scan(record.root, record.source), record, adapters));
|
|
199
|
+
}
|
|
200
|
+
catch (error) {
|
|
201
|
+
// Its files are gone or unreadable: it stays listed, every part an error, with why.
|
|
202
|
+
items.push(unreadableItemOf(record, messageOf(error)));
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
for (const found of this.discover().plugins) {
|
|
206
|
+
if (found.installed || seen.has(resolve(found.root).toLowerCase()))
|
|
207
|
+
continue;
|
|
208
|
+
try {
|
|
209
|
+
items.push(itemOf(this.installs.scan(found.root, found.source), undefined, adapters));
|
|
210
|
+
}
|
|
211
|
+
catch {
|
|
212
|
+
// An unreadable root has nothing to show.
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return overviewOf(items);
|
|
216
|
+
}
|
|
217
|
+
/** Read-only workbench diagnostics: host services, mounts, tool budget and row failures. */
|
|
218
|
+
diagnostics() {
|
|
219
|
+
const catalog = this.capabilities();
|
|
220
|
+
return {
|
|
221
|
+
host: this.hostCapabilities(),
|
|
222
|
+
hookShell: { bash: this.forge.shell.bash ?? null, powershell: this.forge.shell.powershell, default: this.forge.shell.defaultKind },
|
|
223
|
+
bun: findBun(this.installs.dataRoot) ?? null,
|
|
224
|
+
versions: {
|
|
225
|
+
forge: versionOf('../package.json') ?? null,
|
|
226
|
+
dsh: versionOf('@deepseek-ai/dsh-session/package.json') ?? null,
|
|
227
|
+
node: process.versions.node,
|
|
228
|
+
},
|
|
229
|
+
platform: process.platform,
|
|
230
|
+
faults: this.forge.faults(),
|
|
231
|
+
tools: { count: catalog.toolCount ?? 0, tokens: catalog.toolTokens ?? 0, residentTokens: catalog.residentTokens },
|
|
232
|
+
skillRoots: this.listSkillRoots(),
|
|
233
|
+
failedMounts: this.installs.list().flatMap(plugin => (plugin.mounts ?? [])
|
|
234
|
+
.filter(mount => mount.status === 'failed')
|
|
235
|
+
.map(mount => ({ pluginId: plugin.id, kind: mount.kind, name: mount.name, error: mount.error ?? '' }))),
|
|
236
|
+
plugins: this.installs.list().map(plugin => ({ id: plugin.id, source: plugin.source, root: plugin.root, installedAt: plugin.installedAt })),
|
|
237
|
+
statePath: this.installs.statePath,
|
|
238
|
+
dataRoot: this.installs.dataRoot,
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
/** List all skill roots the skills row serves (none while it is off). */
|
|
242
|
+
listSkillRoots() {
|
|
243
|
+
return this.forge.lookup('skills')?.roots() ?? [];
|
|
244
|
+
}
|
|
245
|
+
/** Migrate everything of one harness that is not migrated yet: its plugins and the person's own assets. */
|
|
246
|
+
async migrate(source) {
|
|
247
|
+
const installed = [];
|
|
248
|
+
const failed = [];
|
|
249
|
+
for (const found of this.discover().plugins.filter(item => item.source === source && !item.installed)) {
|
|
250
|
+
try {
|
|
251
|
+
const report = await this.forge.install(found.root, found.source);
|
|
252
|
+
installed.push(report.plugin.name);
|
|
253
|
+
}
|
|
254
|
+
catch (error) {
|
|
255
|
+
failed.push({ name: found.name, error: messageOf(error) });
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
return { installed, failed };
|
|
259
|
+
}
|
|
260
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"title": "Harness Forge instructions",
|
|
4
|
+
"description": "Adds Claude Code's instruction files that DSH does not read (~/.claude/CLAUDE.md, .claude/CLAUDE.md, @path imports) and Codex's global AGENTS.md to the system prompt. Yields when the Recollect plugin runs. Needs the Harness Forge row."
|
|
5
|
+
}
|
|
6
|
+
}
|
package/locale/en.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"title": "Harness Forge",
|
|
4
|
+
"description": "Use Claude Code, Codex and OpenCode plugins, settings and sessions in DSH. Open Harness Forge in the sidebar to see what was found on this computer and migrate it. The other Harness Forge rows each run one kind of part and can be switched off on their own."
|
|
5
|
+
}
|
|
6
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"title": "Harness Forge porting",
|
|
4
|
+
"description": "Describes a Claude Code, Codex or OpenCode plugin part DSH cannot run as it is and hands the brief to DSH's creation mode, which writes and installs a local adapter plugin. Turn it off to hide porting. Needs the Harness Forge row."
|
|
5
|
+
}
|
|
6
|
+
}
|