@kirkchinese/harness-forge 0.4.0 → 0.5.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/README.md +4 -0
- package/docs/DETAIL.zh.md +47 -0
- package/lib/agents/presets.d.ts +7 -0
- package/lib/agents/presets.js +11 -1
- package/lib/agents/profiles.js +3 -2
- package/lib/agents/row.js +3 -1
- package/lib/client/paths.d.ts +12 -0
- package/lib/client/paths.js +68 -0
- package/lib/client/typert.d.ts +12 -1
- package/lib/client/typert.js +54 -6
- package/lib/client.js +1593 -270
- package/lib/commands/row.js +1 -1
- package/lib/context/instructions.js +5 -5
- package/lib/dsh/host.d.ts +3 -0
- package/lib/dsh/host.js +3 -0
- package/lib/forge/contract.d.ts +42 -2
- package/lib/forge/contract.js +3 -1
- package/lib/forge/follow.d.ts +30 -0
- package/lib/forge/follow.js +73 -0
- package/lib/forge/ledger.d.ts +70 -7
- package/lib/forge/ledger.js +314 -42
- package/lib/forge/projects.d.ts +5 -2
- package/lib/forge/projects.js +23 -16
- package/lib/forge/remote/archive.d.ts +65 -0
- package/lib/forge/remote/archive.js +565 -0
- package/lib/forge/remote/code-parts.d.ts +18 -0
- package/lib/forge/remote/code-parts.js +76 -0
- package/lib/forge/remote/fetch.d.ts +265 -0
- package/lib/forge/remote/fetch.js +1133 -0
- package/lib/forge/remote/service.d.ts +256 -0
- package/lib/forge/remote/service.js +868 -0
- package/lib/forge/service.d.ts +19 -9
- package/lib/forge/service.js +47 -31
- package/lib/forge/settings.d.ts +5 -3
- package/lib/forge/settings.js +11 -4
- package/lib/forge/state.d.ts +60 -0
- package/lib/forge/state.js +174 -58
- package/lib/hooks/broker/engine.js +2 -8
- package/lib/hooks/broker/session-events.d.ts +5 -0
- package/lib/hooks/broker/session-events.js +12 -3
- package/lib/hooks/broker/types.d.ts +7 -5
- package/lib/hooks/condition.d.ts +78 -2
- package/lib/hooks/condition.js +494 -73
- package/lib/hooks/config.d.ts +1 -1
- package/lib/hooks/config.js +4 -0
- package/lib/hooks/glob.d.ts +41 -0
- package/lib/hooks/glob.js +114 -0
- package/lib/hooks/permissions.d.ts +8 -3
- package/lib/hooks/permissions.js +119 -26
- package/lib/hooks/powershell-aliases.d.ts +19 -0
- package/lib/hooks/powershell-aliases.js +58 -0
- package/lib/hooks/process.d.ts +17 -0
- package/lib/hooks/process.js +156 -1
- package/lib/hooks/row.js +2 -0
- package/lib/hooks/runner.d.ts +17 -4
- package/lib/hooks/runner.js +42 -13
- package/lib/hooks/shell-commands.d.ts +10 -1
- package/lib/hooks/shell-commands.js +74 -10
- package/lib/hooks/shell.d.ts +3 -2
- package/lib/hooks/shell.js +5 -2
- package/lib/hooks/vocabulary.js +3 -1
- package/lib/mcp/catalog.d.ts +5 -2
- package/lib/mcp/catalog.js +18 -10
- package/lib/mcp/mount.d.ts +40 -2
- package/lib/mcp/mount.js +131 -31
- package/lib/mcp/policy.d.ts +42 -0
- package/lib/mcp/policy.js +43 -0
- package/lib/mcp/remote.js +5 -15
- package/lib/mcp/row.js +111 -17
- package/lib/mods/loader.js +4 -0
- package/lib/mods/service/turns.d.ts +8 -7
- package/lib/mods/service/turns.js +10 -35
- package/lib/opencode/bun.js +14 -2
- package/lib/opencode/row.d.ts +14 -1
- package/lib/opencode/row.js +38 -20
- package/lib/opencode/runtime/server.js +2 -1
- package/lib/porting/adapter-paths.d.ts +13 -0
- package/lib/porting/adapter-paths.js +120 -0
- package/lib/porting/port-gap.d.ts +10 -4
- package/lib/porting/port-gap.js +43 -7
- package/lib/porting/prompt.js +9 -7
- package/lib/porting/row.js +7 -5
- package/lib/porting/verify-port.d.ts +3 -10
- package/lib/porting/verify-port.js +12 -34
- package/lib/sessions/chat-import.d.ts +48 -0
- package/lib/sessions/chat-import.js +44 -0
- package/lib/sessions/claude.d.ts +16 -10
- package/lib/sessions/claude.js +76 -55
- package/lib/sessions/codex-discover.d.ts +34 -0
- package/lib/sessions/codex-discover.js +205 -0
- package/lib/sessions/codex-meta.d.ts +63 -0
- package/lib/sessions/codex-meta.js +148 -0
- package/lib/sessions/codex-text.d.ts +9 -0
- package/lib/sessions/codex-text.js +44 -0
- package/lib/sessions/codex.d.ts +34 -22
- package/lib/sessions/codex.js +150 -183
- package/lib/sessions/opencode.d.ts +15 -9
- package/lib/sessions/opencode.js +77 -58
- package/lib/sessions/persist.d.ts +162 -0
- package/lib/sessions/persist.js +377 -0
- package/lib/sessions/row.d.ts +2 -1
- package/lib/sessions/row.js +75 -9
- package/lib/sessions/turns.d.ts +31 -0
- package/lib/sessions/turns.js +63 -0
- package/lib/sessions/zstd.d.ts +15 -0
- package/lib/sessions/zstd.js +152 -0
- package/lib/shared/render.d.ts +30 -1
- package/lib/shared/render.js +813 -48
- package/lib/skills/provider.d.ts +2 -0
- package/lib/skills/provider.js +8 -2
- package/lib/skills/row.js +1 -1
- package/lib/workbench/adapter-coverage.d.ts +20 -2
- package/lib/workbench/adapter-coverage.js +46 -7
- package/lib/workbench/overview.d.ts +77 -27
- package/lib/workbench/overview.js +99 -12
- package/lib/workbench/remote.d.ts +64 -21
- package/lib/workbench/remote.js +181 -42
- package/lib/workbench/settings.d.ts +5 -1
- package/lib/workbench/settings.js +6 -2
- package/lib/workbench/workbench.d.ts +34 -4
- package/lib/workbench/workbench.js +147 -46
- package/locale/zh.json +2 -1
- package/package.json +3 -2
- package/lib/forge/marketplace-install.d.ts +0 -3
- package/lib/forge/marketplace-install.js +0 -64
package/lib/skills/provider.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export interface SkillRootOrigin {
|
|
|
8
8
|
readonly pluginRoot?: string;
|
|
9
9
|
/** The plugin's name; a skill a DSH-native skill would shadow is listed as `<plugin>-<skill>`. */
|
|
10
10
|
readonly pluginName?: string;
|
|
11
|
+
/** The suffix that tells this plugin from another of the same name; a skill name both ship takes it, so one plugin has one suffix. */
|
|
12
|
+
readonly pluginVariant?: string;
|
|
11
13
|
readonly dataDir?: string;
|
|
12
14
|
/** A project's skills are listed only to sessions whose directory is inside the project. */
|
|
13
15
|
readonly projectRoot?: string;
|
package/lib/skills/provider.js
CHANGED
|
@@ -12,7 +12,7 @@ import { createHash } from 'node:crypto';
|
|
|
12
12
|
import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
13
13
|
import { homedir } from 'node:os';
|
|
14
14
|
import { basename, dirname, join, resolve } from 'node:path';
|
|
15
|
-
import { childDirectories, isFile, isInside, parseSkillFrontmatter, readMarkdownAsset, shortHash, stem, toolList, } from '@kirkchinese/harness-forge-core';
|
|
15
|
+
import { childDirectories, isFile, isInside, leadsToShare, parseSkillFrontmatter, readMarkdownAsset, shortHash, stem, toolList, } from '@kirkchinese/harness-forge-core';
|
|
16
16
|
import { pathPatternMatches } from '../hooks/condition.js';
|
|
17
17
|
import { untrustedShell } from '../forge/trust.js';
|
|
18
18
|
import { renderBody } from '../shared/render.js';
|
|
@@ -121,7 +121,7 @@ export class ForeignSkillProvider {
|
|
|
121
121
|
const prefixed = origin.pluginName !== undefined && native.has(candidate.name) ? `${kebab(origin.pluginName)}-${candidate.name}` : candidate.name;
|
|
122
122
|
// Two plugins may ship a skill with the same name; the later one stays
|
|
123
123
|
// reachable under a stable suffix instead of breaking the catalog.
|
|
124
|
-
const name = names.has(prefixed) || native.has(prefixed) ? `${prefixed}-${shortHash(bodyPath, 6)}` : prefixed;
|
|
124
|
+
const name = names.has(prefixed) || native.has(prefixed) ? `${prefixed}-${origin.pluginVariant ?? shortHash(bodyPath, 6)}` : prefixed;
|
|
125
125
|
names.add(name);
|
|
126
126
|
candidates.push(name === candidate.name ? candidate : { ...candidate, name });
|
|
127
127
|
};
|
|
@@ -315,6 +315,9 @@ function nativeSkillNames(cwd) {
|
|
|
315
315
|
}
|
|
316
316
|
/** sha256 of a file with line endings normalised, or undefined when unreadable. */
|
|
317
317
|
function contentHash(path) {
|
|
318
|
+
// On a link to a network share the path is not on: as unreadable (see `leadsToShare`).
|
|
319
|
+
if (leadsToShare(path))
|
|
320
|
+
return undefined;
|
|
318
321
|
try {
|
|
319
322
|
return createHash('sha256').update(readFileSync(path, 'utf8').replace(/\r\n/gu, '\n')).digest('hex');
|
|
320
323
|
}
|
|
@@ -331,6 +334,9 @@ function firstLine(body) {
|
|
|
331
334
|
return line === undefined ? undefined : line.slice(0, 1536);
|
|
332
335
|
}
|
|
333
336
|
function safeEntries(root) {
|
|
337
|
+
// On a link to a network share the path is not on: as unreadable (see `leadsToShare`).
|
|
338
|
+
if (leadsToShare(root))
|
|
339
|
+
return [];
|
|
334
340
|
try {
|
|
335
341
|
return readdirSync(root, { withFileTypes: true });
|
|
336
342
|
}
|
package/lib/skills/row.js
CHANGED
|
@@ -168,7 +168,7 @@ export function startSkills(ctx, forge, config) {
|
|
|
168
168
|
if (component.kind !== 'skill')
|
|
169
169
|
throw new HarnessError('component-failed', `action expects a skill: ${component.id}`);
|
|
170
170
|
const projectRoot = projectRootOf(plugin);
|
|
171
|
-
const releaseSkill = provider.addSkill(component.bodyPath, { pluginRoot: plugin.root, pluginName: plugin.name, dataDir, scope: templateScope(plugin), ...(projectRoot !== undefined ? { projectRoot } : {}) });
|
|
171
|
+
const releaseSkill = provider.addSkill(component.bodyPath, { pluginRoot: plugin.root, pluginName: plugin.name, ...(plugin.displayName !== undefined ? { pluginVariant: plugin.name.slice(plugin.displayName.length + 1) } : {}), dataDir, scope: templateScope(plugin), ...(projectRoot !== undefined ? { projectRoot } : {}) });
|
|
172
172
|
bodies.set(component.bodyPath, component.id);
|
|
173
173
|
const hooks = component.frontmatter.raw['hooks'];
|
|
174
174
|
const name = component.frontmatter.name;
|
|
@@ -40,8 +40,26 @@ export type BundleState = {
|
|
|
40
40
|
};
|
|
41
41
|
/** The state of the bundle named `name` among the plugin manager's bundles. */
|
|
42
42
|
export declare function bundleState(name: string, bundles: readonly ListedBundle[]): BundleState;
|
|
43
|
+
/** One step of an adapter's readiness, as `harness_verify_port` reports it. */
|
|
44
|
+
export interface ReadinessCheck {
|
|
45
|
+
readonly check: 'declared' | 'enabled' | 'loaded';
|
|
46
|
+
readonly ok: boolean;
|
|
47
|
+
readonly detail: string;
|
|
48
|
+
}
|
|
49
|
+
/** What the plugin manager says now, read once for any number of adapters. */
|
|
50
|
+
export interface ManagerSnapshot {
|
|
51
|
+
readonly bundles: readonly ListedBundle[];
|
|
52
|
+
readonly plugins: Awaited<ReturnType<PluginManagerLike['listPlugins']>>;
|
|
53
|
+
}
|
|
54
|
+
export declare function managerSnapshot(manager: PluginManagerLike): Promise<ManagerSnapshot>;
|
|
55
|
+
/**
|
|
56
|
+
* Whether an adapter package found on disk is ready: DSH lists it as an enabled bundle that loads, and every
|
|
57
|
+
* plugin row it declares runs, active, without a startup fault. The one decision the overview counts an adapter
|
|
58
|
+
* by and `harness_verify_port` reports step by step; the last check returned is the first that failed.
|
|
59
|
+
*/
|
|
60
|
+
export declare function adapterReadiness(name: string, snapshot: ManagerSnapshot): ReadinessCheck[];
|
|
43
61
|
/**
|
|
44
|
-
* The adapters on disk that
|
|
45
|
-
*
|
|
62
|
+
* The adapters on disk that are ready (see `adapterReadiness`). Without a plugin manager none is confirmed, so
|
|
63
|
+
* none counts.
|
|
46
64
|
*/
|
|
47
65
|
export declare function enabledAdapters(adapters: readonly AdapterCoverage[], manager: PluginManagerLike | undefined): Promise<AdapterCoverage[]>;
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* or one installed from npm) declares `harnessForge.ports`
|
|
5
5
|
* (`[{ plugin, component }]`, the original's names) in its package.json.
|
|
6
6
|
* A package found on disk only counts once DSH's plugin manager lists it as an
|
|
7
|
-
* enabled bundle
|
|
8
|
-
* `node_modules` link behind that DSH never runs.
|
|
9
|
-
* `harness_verify_port` apply
|
|
7
|
+
* enabled bundle whose plugin rows started without a fault (`adapterReadiness`):
|
|
8
|
+
* a failed install can leave a `node_modules` link behind that DSH never runs.
|
|
9
|
+
* The workbench overview and `harness_verify_port` apply that one decision.
|
|
10
10
|
* @module @kirkchinese/harness-forge
|
|
11
11
|
*/
|
|
12
12
|
import { existsSync, readdirSync, readFileSync, realpathSync } from 'node:fs';
|
|
@@ -90,13 +90,52 @@ export function bundleState(name, bundles) {
|
|
|
90
90
|
return { state: 'broken', error: bundle.error };
|
|
91
91
|
return { state: 'enabled', bundle };
|
|
92
92
|
}
|
|
93
|
+
const step = (name, ok, detail) => ({ check: name, ok, detail });
|
|
94
|
+
export async function managerSnapshot(manager) {
|
|
95
|
+
const [bundles, plugins] = await Promise.all([manager.listBundles(), manager.listPlugins()]);
|
|
96
|
+
return { bundles, plugins };
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Whether an adapter package found on disk is ready: DSH lists it as an enabled bundle that loads, and every
|
|
100
|
+
* plugin row it declares runs, active, without a startup fault. The one decision the overview counts an adapter
|
|
101
|
+
* by and `harness_verify_port` reports step by step; the last check returned is the first that failed.
|
|
102
|
+
*/
|
|
103
|
+
export function adapterReadiness(name, snapshot) {
|
|
104
|
+
const status = bundleState(name, snapshot.bundles);
|
|
105
|
+
if (status.state === 'unlisted')
|
|
106
|
+
return [step('enabled', false, `${name} is on disk but DSH does not list it as an installed bundle: install it with plugin_manager install_bundle (a link left by a failed install does not count), and check that its package.json declares a bundle (dsh-doc references/host-plugin.md)`)];
|
|
107
|
+
if (status.state === 'off')
|
|
108
|
+
return [step('enabled', false, `${name} is installed but switched off: enable it with plugin_manager set_bundle`)];
|
|
109
|
+
if (status.state === 'broken')
|
|
110
|
+
return [step('enabled', false, `${name} is enabled but its bundle cannot load: ${status.error.code}${status.error.diagnostic !== undefined ? ` — ${status.error.diagnostic}` : ''}`)];
|
|
111
|
+
const enabled = step('enabled', true, `${name} is enabled`);
|
|
112
|
+
const rows = status.bundle.rows;
|
|
113
|
+
if (rows.length === 0)
|
|
114
|
+
return [enabled, step('loaded', true, 'its bundle declares no plugin rows, so nothing has to start')];
|
|
115
|
+
const entries = new Map(snapshot.plugins.map(entry => [entry.entryId, entry]));
|
|
116
|
+
const problems = [];
|
|
117
|
+
for (const row of rows) {
|
|
118
|
+
const entry = row.entryId === undefined ? undefined : entries.get(row.entryId);
|
|
119
|
+
if (entry === undefined)
|
|
120
|
+
problems.push(`row "${row.rowId}" has no running entry`);
|
|
121
|
+
else if (entry.diagnostic !== undefined)
|
|
122
|
+
problems.push(`row "${row.rowId}" failed to start: ${entry.diagnostic}`);
|
|
123
|
+
else if (!entry.enabled)
|
|
124
|
+
problems.push(`row "${row.rowId}" is disabled`);
|
|
125
|
+
else if (entry.fiberPhase !== 'active')
|
|
126
|
+
problems.push(`row "${row.rowId}" is ${entry.fiberPhase ?? 'not running'}`);
|
|
127
|
+
}
|
|
128
|
+
return [enabled, problems.length === 0
|
|
129
|
+
? step('loaded', true, `all ${String(rows.length)} plugin row(s) of its bundle are active, without startup failures`)
|
|
130
|
+
: step('loaded', false, problems.join('; '))];
|
|
131
|
+
}
|
|
93
132
|
/**
|
|
94
|
-
* The adapters on disk that
|
|
95
|
-
*
|
|
133
|
+
* The adapters on disk that are ready (see `adapterReadiness`). Without a plugin manager none is confirmed, so
|
|
134
|
+
* none counts.
|
|
96
135
|
*/
|
|
97
136
|
export async function enabledAdapters(adapters, manager) {
|
|
98
137
|
if (manager === undefined || adapters.length === 0)
|
|
99
138
|
return [];
|
|
100
|
-
const
|
|
101
|
-
return adapters.filter(adapter =>
|
|
139
|
+
const snapshot = await managerSnapshot(manager);
|
|
140
|
+
return adapters.filter(adapter => adapterReadiness(adapter.name, snapshot).every(item => item.ok));
|
|
102
141
|
}
|
|
@@ -1,27 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* details; this is what a person who never heard of them reads.
|
|
6
|
-
*
|
|
7
|
-
* | State | When |
|
|
8
|
-
* | --- | --- |
|
|
9
|
-
* | `works` | set up in DSH (or covered by an installed adapter) with nothing known missing; `checked` says whether a run here was observed |
|
|
10
|
-
* | `partial` | set up, but something it uses does not carry over, or a run of it failed in part |
|
|
11
|
-
* | `needs-port` | DSH has no equivalent; DSH's creation mode can write an adapter from its brief |
|
|
12
|
-
* | `unsupported` | DSH has no equivalent and none can be written from what the plugin declares |
|
|
13
|
-
* | `failed` | setting it up or running it failed |
|
|
14
|
-
* | `inactive` | the part of Harness Forge that runs it is switched off |
|
|
15
|
-
* | `off` | the person switched this part off |
|
|
16
|
-
*
|
|
17
|
-
* A reason is a code the browser words in the person's language, plus the
|
|
18
|
-
* specifics (event names, the error) as they are. A plugin not migrated yet
|
|
19
|
-
* shows the states its parts would have, predicted from its scan.
|
|
20
|
-
* @module @kirkchinese/harness-forge
|
|
21
|
-
*/
|
|
22
|
-
import { type ComponentOutcome, type ForeignComponent, type ForeignPlugin, type Gap } from '@kirkchinese/harness-forge-core';
|
|
23
|
-
export type PartState = 'works' | 'partial' | 'needs-port' | 'unsupported' | 'failed' | 'inactive' | 'off';
|
|
24
|
-
export type ReasonCode = 'events-never-raised' | 'cannot-block' | 'handlers-inert' | 'output-style' | 'experimental-runtime' | 'no-equivalent-ui' | 'not-mapped' | 'hosted-connector' | 'unknown-transport' | 'run-failed' | 'setup-failed' | 'unreadable' | 'row-off' | 'other';
|
|
1
|
+
import type { DetachedReason, InstalledPluginRecord } from '../forge/state.js';
|
|
2
|
+
import { type ComponentOutcome, type ForeignComponent, type ForeignPlugin, type Gap, type PluginIdProblem } from '@kirkchinese/harness-forge-core';
|
|
3
|
+
export type PartState = 'works' | 'partial' | 'needs-port' | 'unsupported' | 'failed' | 'inactive' | 'off' | 'provided';
|
|
4
|
+
export type ReasonCode = 'events-never-raised' | 'cannot-block' | 'handlers-inert' | 'output-style' | 'experimental-runtime' | 'no-equivalent-ui' | 'not-mapped' | 'hosted-connector' | 'unknown-transport' | 'disabled-in-plugin' | 'disabled-in-config' | 'disabled-in-claude-code' | 'needs-chatgpt-sign-in' | 'run-failed' | 'setup-failed' | 'unreadable' | 'folder-gone' | 'not-followed' | 'row-off' | 'other';
|
|
25
5
|
export interface OverviewPart {
|
|
26
6
|
readonly id: string;
|
|
27
7
|
readonly kind: ForeignComponent['kind'];
|
|
@@ -37,6 +17,13 @@ export interface OverviewPart {
|
|
|
37
17
|
readonly portGap?: string;
|
|
38
18
|
/** The installed adapter that covers this part. */
|
|
39
19
|
readonly adapter?: string;
|
|
20
|
+
/** Another part supplies this settings entry; only that part counts toward the overview. */
|
|
21
|
+
readonly providedBy?: {
|
|
22
|
+
readonly name: string;
|
|
23
|
+
readonly adapter?: string;
|
|
24
|
+
};
|
|
25
|
+
/** It acts when a session starts (see {@link actsAtSessionStart}): a session already open keeps what it started with. */
|
|
26
|
+
readonly atStart?: true;
|
|
40
27
|
}
|
|
41
28
|
export interface OverviewItem {
|
|
42
29
|
readonly id: string;
|
|
@@ -51,7 +38,42 @@ export interface OverviewItem {
|
|
|
51
38
|
readonly counts: Readonly<Record<PartState, number>>;
|
|
52
39
|
/** Of the parts that work, how many have run here and been checked. */
|
|
53
40
|
readonly checked: number;
|
|
41
|
+
/** Installed from the network ("Get plugins"), not found in a harness's own folders. */
|
|
42
|
+
readonly fetched?: true;
|
|
43
|
+
/**
|
|
44
|
+
* Not migrated, and switched off in its own harness (Claude Code `enabledPlugins`, Codex `enabled = false`):
|
|
45
|
+
* listed, but "Migrate all" leaves it out (see {@link migratable}).
|
|
46
|
+
*/
|
|
47
|
+
readonly enabled?: false;
|
|
48
|
+
/**
|
|
49
|
+
* Not migrated, and whether its harness runs it cannot be told, saying why: an OpenCode plugin whose id its source
|
|
50
|
+
* does not settle, under an entry that switches plugins by id. "Migrate all" leaves it out too.
|
|
51
|
+
*/
|
|
52
|
+
readonly enabledUnknown?: PluginIdProblem;
|
|
53
|
+
/** Migrated, but its harness no longer runs it (see `forge/follow.ts`): nothing of it runs until kept or removed. */
|
|
54
|
+
readonly detached?: {
|
|
55
|
+
readonly reason: DetachedReason;
|
|
56
|
+
readonly harness: string;
|
|
57
|
+
readonly folderGone: boolean;
|
|
58
|
+
};
|
|
59
|
+
/** The last update its harness made, which the migrated plugin followed. */
|
|
60
|
+
readonly updated?: {
|
|
61
|
+
readonly harness: string;
|
|
62
|
+
readonly from?: string;
|
|
63
|
+
readonly to?: string;
|
|
64
|
+
readonly at: string;
|
|
65
|
+
};
|
|
54
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Whether "Migrate all" takes a plugin: not migrated yet, and surely not switched off in the harness it came from.
|
|
69
|
+
* The one rule for the overview's count, the button's label and the batch itself; a plugin it leaves out can still
|
|
70
|
+
* be migrated on its own.
|
|
71
|
+
*/
|
|
72
|
+
export declare function migratable(item: {
|
|
73
|
+
readonly installed: boolean;
|
|
74
|
+
readonly enabled?: boolean;
|
|
75
|
+
readonly enabledUnknown?: PluginIdProblem;
|
|
76
|
+
}): boolean;
|
|
55
77
|
export interface OverviewHarness {
|
|
56
78
|
readonly source: string;
|
|
57
79
|
/** Product name; not translated. */
|
|
@@ -60,10 +82,14 @@ export interface OverviewHarness {
|
|
|
60
82
|
readonly counts: Readonly<Record<PartState, number>>;
|
|
61
83
|
/** Of the parts that work, how many have run here and been checked. */
|
|
62
84
|
readonly checked: number;
|
|
85
|
+
/** How many items "Migrate all" takes ({@link migratable}). */
|
|
63
86
|
readonly toMigrate: number;
|
|
64
87
|
}
|
|
65
88
|
export interface Overview {
|
|
89
|
+
/** What was found on this computer in each harness's own folders. */
|
|
66
90
|
readonly harnesses: readonly OverviewHarness[];
|
|
91
|
+
/** Plugins installed from the network: migrated, but in no harness's folders. */
|
|
92
|
+
readonly fetched: readonly OverviewItem[];
|
|
67
93
|
}
|
|
68
94
|
/** An installed adapter and the parts it brings: plugin name and component name of the original. */
|
|
69
95
|
export interface AdapterCoverage {
|
|
@@ -77,6 +103,14 @@ export interface AdapterCoverage {
|
|
|
77
103
|
}
|
|
78
104
|
/** The installed adapter that covers a part: one declaring it in `harnessForge.ports`, or named for it (`adapterPackageName`). */
|
|
79
105
|
export declare function coveringAdapter(plugin: Pick<ForeignPlugin, 'name'>, component: Pick<ForeignComponent, 'name'>, adapters: readonly AdapterCoverage[]): string | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Whether a part acts only when a session starts: a SessionStart hook runs once as the session begins, so a session
|
|
108
|
+
* already open does not get it. Everything else takes effect at once: skills, commands, agents and MCP tools are
|
|
109
|
+
* looked up when they are used, the other hooks run at their events, and system-prompt sections (output styles,
|
|
110
|
+
* Codex's global instructions, instruction files) are read again at every step, because DSH assembles the system
|
|
111
|
+
* prompt once per step (dsh-system-prompt: "The agent loop calls `assemble(context)` once per proposed step").
|
|
112
|
+
*/
|
|
113
|
+
export declare function actsAtSessionStart(component: ForeignComponent): boolean;
|
|
80
114
|
/** The state of one part, from what happened when it was set up and run (or, before migration, from its gaps). */
|
|
81
115
|
export declare function partOf(component: ForeignComponent, gaps: readonly Gap[], outcome: ComponentOutcome | undefined, adapter: string | undefined, off?: boolean): OverviewPart;
|
|
82
116
|
/** One plugin or own-assets root, installed (with outcomes) or only discovered. */
|
|
@@ -91,6 +125,7 @@ export declare function itemOf(plugin: ForeignPlugin, record: {
|
|
|
91
125
|
export declare function unreadableItemOf(record: {
|
|
92
126
|
readonly id: string;
|
|
93
127
|
readonly name: string;
|
|
128
|
+
readonly displayName?: string;
|
|
94
129
|
readonly source: string;
|
|
95
130
|
readonly root: string;
|
|
96
131
|
readonly version?: string;
|
|
@@ -98,6 +133,21 @@ export declare function unreadableItemOf(record: {
|
|
|
98
133
|
readonly kind: string;
|
|
99
134
|
readonly name: string;
|
|
100
135
|
}>;
|
|
101
|
-
}, error: string): OverviewItem;
|
|
102
|
-
/**
|
|
103
|
-
|
|
136
|
+
}, error: string, code?: 'unreadable' | 'folder-gone'): OverviewItem;
|
|
137
|
+
/**
|
|
138
|
+
* A migrated item as its harness install has it: a detached one's parts (but those the person switched off, or that
|
|
139
|
+
* could not be withdrawn) do not run, saying so; an updated one says from which version.
|
|
140
|
+
*/
|
|
141
|
+
export declare function followedItemOf(item: OverviewItem, record: Pick<InstalledPluginRecord, 'harnessInstall' | 'detached' | 'harnessUpdate' | 'root'> | undefined, folderGone: boolean): OverviewItem;
|
|
142
|
+
/**
|
|
143
|
+
* Installed plugins that genuinely share a name are told apart in plain words, the same way wherever they are listed:
|
|
144
|
+
* `name (where it came from)`, and the folder it is in when that is the same too. A plugin with a name of its own is
|
|
145
|
+
* shown as it is: the suffix the ledger gives its id is never part of what people read.
|
|
146
|
+
*/
|
|
147
|
+
export declare function qualifyDuplicateNames<T extends OverviewItem>(items: readonly T[]): T[];
|
|
148
|
+
/** Group items by harness, in dialect order: own assets first, then installed plugins, then the rest by name; those fetched from the network apart. */
|
|
149
|
+
export declare function overviewOf(items: readonly OverviewItem[], link?: {
|
|
150
|
+
readonly settingsId: string;
|
|
151
|
+
readonly providerId: string;
|
|
152
|
+
readonly name: string;
|
|
153
|
+
}): Overview;
|
|
@@ -19,7 +19,16 @@
|
|
|
19
19
|
* shows the states its parts would have, predicted from its scan.
|
|
20
20
|
* @module @kirkchinese/harness-forge
|
|
21
21
|
*/
|
|
22
|
+
import { basename, dirname } from 'node:path';
|
|
22
23
|
import { adapterPackageName, assess, dialects } from '@kirkchinese/harness-forge-core';
|
|
24
|
+
/**
|
|
25
|
+
* Whether "Migrate all" takes a plugin: not migrated yet, and surely not switched off in the harness it came from.
|
|
26
|
+
* The one rule for the overview's count, the button's label and the batch itself; a plugin it leaves out can still
|
|
27
|
+
* be migrated on its own.
|
|
28
|
+
*/
|
|
29
|
+
export function migratable(item) {
|
|
30
|
+
return !item.installed && item.enabled !== false && item.enabledUnknown === undefined;
|
|
31
|
+
}
|
|
23
32
|
/** The installed adapter that covers a part: one declaring it in `harnessForge.ports`, or named for it (`adapterPackageName`). */
|
|
24
33
|
export function coveringAdapter(plugin, component, adapters) {
|
|
25
34
|
return adapters.find(adapter => adapter.name === adapterPackageName(plugin, component) || adapter.ports.some(port => port.plugin === plugin.name && port.component === component.name))?.name;
|
|
@@ -27,14 +36,19 @@ export function coveringAdapter(plugin, component, adapters) {
|
|
|
27
36
|
/** Harnesses always shown, found or not; other dialects only when they found something. */
|
|
28
37
|
const ALWAYS_SHOWN = new Set(['claude-code', 'codex', 'opencode']);
|
|
29
38
|
function emptyCounts() {
|
|
30
|
-
return { works: 0, partial: 0, 'needs-port': 0, unsupported: 0, failed: 0, inactive: 0, off: 0 };
|
|
39
|
+
return { works: 0, partial: 0, 'needs-port': 0, unsupported: 0, failed: 0, inactive: 0, off: 0, provided: 0 };
|
|
31
40
|
}
|
|
32
41
|
/** The specifics after "…: " in a gap summary (event or handler names), else the summary. */
|
|
33
42
|
function specifics(summary) {
|
|
34
43
|
const at = summary.indexOf(': ');
|
|
35
44
|
return at >= 0 ? summary.slice(at + 2) : summary;
|
|
36
45
|
}
|
|
37
|
-
|
|
46
|
+
/** Why a part DSH does not run was left out: the code its own configuration or approval gave, else what the outcome said. */
|
|
47
|
+
function skippedReason(component, outcome) {
|
|
48
|
+
const code = outcome?.skippedBy ?? (component.kind === 'mcp' ? component.notStarted?.code : undefined);
|
|
49
|
+
return code !== undefined ? { code, detail: '' } : { code: 'other', detail: outcome?.message ?? '' };
|
|
50
|
+
}
|
|
51
|
+
function reasonOf(gap, component) {
|
|
38
52
|
switch (gap.kind) {
|
|
39
53
|
case 'unsupported-event': return { code: 'events-never-raised', detail: specifics(gap.summary) };
|
|
40
54
|
case 'semantic-difference': return gap.id.endsWith(':output-style') ? { code: 'output-style', detail: '' } : { code: 'cannot-block', detail: specifics(gap.summary) };
|
|
@@ -43,6 +57,7 @@ function reasonOf(gap) {
|
|
|
43
57
|
case 'ui-surface': return { code: 'no-equivalent-ui', detail: '' };
|
|
44
58
|
case 'unsupported-component': return { code: 'not-mapped', detail: gap.summary.replace(/ is not mapped to DSH$/u, '') };
|
|
45
59
|
case 'unsupported-transport': return { code: 'unknown-transport', detail: '' };
|
|
60
|
+
case 'external-requirement': return component?.kind === 'mcp' && component.notStarted !== undefined ? skippedReason(component, undefined) : { code: 'other', detail: gap.summary };
|
|
46
61
|
case 'runtime-failure': return { code: 'setup-failed', detail: gap.summary };
|
|
47
62
|
default: return { code: 'other', detail: gap.summary };
|
|
48
63
|
}
|
|
@@ -51,8 +66,24 @@ function reasonOf(gap) {
|
|
|
51
66
|
function portable(gap) {
|
|
52
67
|
return gap.kind === 'ui-surface' || gap.kind === 'unsupported-component' || gap.kind === 'unsupported-event' || gap.kind === 'unsupported-handler';
|
|
53
68
|
}
|
|
69
|
+
/** The hook event DSH raises once as a session starts. */
|
|
70
|
+
const SESSION_START_EVENT = 'SessionStart';
|
|
71
|
+
/**
|
|
72
|
+
* Whether a part acts only when a session starts: a SessionStart hook runs once as the session begins, so a session
|
|
73
|
+
* already open does not get it. Everything else takes effect at once: skills, commands, agents and MCP tools are
|
|
74
|
+
* looked up when they are used, the other hooks run at their events, and system-prompt sections (output styles,
|
|
75
|
+
* Codex's global instructions, instruction files) are read again at every step, because DSH assembles the system
|
|
76
|
+
* prompt once per step (dsh-system-prompt: "The agent loop calls `assemble(context)` once per proposed step").
|
|
77
|
+
*/
|
|
78
|
+
export function actsAtSessionStart(component) {
|
|
79
|
+
return component.kind === 'hooks' && component.events.includes(SESSION_START_EVENT);
|
|
80
|
+
}
|
|
54
81
|
/** The state of one part, from what happened when it was set up and run (or, before migration, from its gaps). */
|
|
55
82
|
export function partOf(component, gaps, outcome, adapter, off = false) {
|
|
83
|
+
const part = stateOfPart(component, gaps, outcome, adapter, off);
|
|
84
|
+
return actsAtSessionStart(component) ? { ...part, atStart: true } : part;
|
|
85
|
+
}
|
|
86
|
+
function stateOfPart(component, gaps, outcome, adapter, off) {
|
|
56
87
|
const own = gaps.filter(gap => gap.componentId === component.id && gap.kind !== 'license' && gap.kind !== 'runtime-failure');
|
|
57
88
|
const base = { id: component.id, kind: component.kind, name: component.name };
|
|
58
89
|
if (off)
|
|
@@ -78,14 +109,14 @@ export function partOf(component, gaps, outcome, adapter, off = false) {
|
|
|
78
109
|
const runReasons = failedRuns.map(item => ({ code: 'run-failed', detail: item.detail ?? item.signal }));
|
|
79
110
|
return { ...base, state: failedRuns.length < observations.length ? 'partial' : 'failed', checked: true, reasons: runReasons, ...port };
|
|
80
111
|
}
|
|
81
|
-
const blocking = own.find(gap => gap.kind === 'ui-surface' || gap.kind === 'unsupported-component' || gap.kind === 'unsupported-transport');
|
|
112
|
+
const blocking = own.find(gap => gap.kind === 'ui-surface' || gap.kind === 'unsupported-component' || gap.kind === 'unsupported-transport' || gap.kind === 'external-requirement');
|
|
82
113
|
if (blocking !== undefined || outcome?.status === 'skipped') {
|
|
83
|
-
const reasons = blocking !== undefined ? [reasonOf(blocking)] : [
|
|
114
|
+
const reasons = blocking !== undefined ? [reasonOf(blocking, component)] : [skippedReason(component, outcome)];
|
|
84
115
|
return { ...base, state: portGap !== undefined ? 'needs-port' : 'unsupported', checked: false, reasons, ...port };
|
|
85
116
|
}
|
|
86
117
|
const verified = outcome?.status === 'verified';
|
|
87
118
|
// A verified code runtime has shown the API it needs is there.
|
|
88
|
-
const reasons = own.filter(gap => !(verified && gap.kind === 'missing-host-api')).map(reasonOf);
|
|
119
|
+
const reasons = own.filter(gap => !(verified && gap.kind === 'missing-host-api')).map(gap => reasonOf(gap, component));
|
|
89
120
|
if (reasons.length > 0)
|
|
90
121
|
return { ...base, state: 'partial', checked: verified, reasons, ...port };
|
|
91
122
|
return { ...base, state: 'works', checked: verified, reasons: [] };
|
|
@@ -102,7 +133,7 @@ export function itemOf(plugin, record, adapters = []) {
|
|
|
102
133
|
counts[part.state]++;
|
|
103
134
|
return {
|
|
104
135
|
id: plugin.id,
|
|
105
|
-
name: plugin.name,
|
|
136
|
+
name: plugin.displayName ?? plugin.name,
|
|
106
137
|
source: plugin.source,
|
|
107
138
|
root: plugin.root,
|
|
108
139
|
own: plugin.manifest['scope'] === 'user',
|
|
@@ -114,20 +145,20 @@ export function itemOf(plugin, record, adapters = []) {
|
|
|
114
145
|
};
|
|
115
146
|
}
|
|
116
147
|
/** An installed plugin whose files can no longer be read: every recorded part is an error, with the reason. */
|
|
117
|
-
export function unreadableItemOf(record, error) {
|
|
148
|
+
export function unreadableItemOf(record, error, code = 'unreadable') {
|
|
118
149
|
const parts = record.components.map((component, index) => ({
|
|
119
150
|
id: `${record.id}:${String(index)}`,
|
|
120
151
|
kind: component.kind,
|
|
121
152
|
name: component.name,
|
|
122
153
|
state: 'failed',
|
|
123
154
|
checked: true,
|
|
124
|
-
reasons: [{ code
|
|
155
|
+
reasons: [{ code, detail: error }],
|
|
125
156
|
}));
|
|
126
157
|
const counts = emptyCounts();
|
|
127
158
|
counts.failed = parts.length;
|
|
128
159
|
return {
|
|
129
160
|
id: record.id,
|
|
130
|
-
name: record.name,
|
|
161
|
+
name: record.displayName ?? record.name,
|
|
131
162
|
source: record.source,
|
|
132
163
|
root: record.root,
|
|
133
164
|
own: record.id.endsWith(':user'),
|
|
@@ -138,8 +169,63 @@ export function unreadableItemOf(record, error) {
|
|
|
138
169
|
checked: 0,
|
|
139
170
|
};
|
|
140
171
|
}
|
|
141
|
-
/**
|
|
142
|
-
|
|
172
|
+
/**
|
|
173
|
+
* A migrated item as its harness install has it: a detached one's parts (but those the person switched off, or that
|
|
174
|
+
* could not be withdrawn) do not run, saying so; an updated one says from which version.
|
|
175
|
+
*/
|
|
176
|
+
export function followedItemOf(item, record, folderGone) {
|
|
177
|
+
const harness = record?.harnessInstall?.harness ?? item.source;
|
|
178
|
+
const updated = record?.harnessUpdate === undefined ? {} : { updated: { harness, ...record.harnessUpdate } };
|
|
179
|
+
if (record?.detached === undefined)
|
|
180
|
+
return { ...item, ...updated };
|
|
181
|
+
const parts = item.parts.map((part) => part.state === 'off' || part.state === 'failed' ? part : { ...part, state: 'inactive', checked: false, reasons: [{ code: 'not-followed', detail: harness }] });
|
|
182
|
+
const counts = emptyCounts();
|
|
183
|
+
for (const part of parts)
|
|
184
|
+
counts[part.state]++;
|
|
185
|
+
return { ...item, ...updated, parts, counts, checked: 0, detached: { reason: record.detached.reason, harness, folderGone } };
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Installed plugins that genuinely share a name are told apart in plain words, the same way wherever they are listed:
|
|
189
|
+
* `name (where it came from)`, and the folder it is in when that is the same too. A plugin with a name of its own is
|
|
190
|
+
* shown as it is: the suffix the ledger gives its id is never part of what people read.
|
|
191
|
+
*/
|
|
192
|
+
export function qualifyDuplicateNames(items) {
|
|
193
|
+
const groups = new Map();
|
|
194
|
+
for (const item of items) {
|
|
195
|
+
if (!item.installed)
|
|
196
|
+
continue;
|
|
197
|
+
groups.set(item.name.toLowerCase(), [...groups.get(item.name.toLowerCase()) ?? [], item]);
|
|
198
|
+
}
|
|
199
|
+
const qualified = new Map();
|
|
200
|
+
for (const group of groups.values()) {
|
|
201
|
+
if (group.length < 2)
|
|
202
|
+
continue;
|
|
203
|
+
const origin = (item) => (item.fetched === true ? 'network' : item.source);
|
|
204
|
+
const unique = new Set(group.map(origin)).size === group.length;
|
|
205
|
+
for (const item of group)
|
|
206
|
+
qualified.set(item, `${item.name} (${unique ? origin(item) : `${origin(item)}, ${basename(dirname(item.root))}`})`);
|
|
207
|
+
}
|
|
208
|
+
return items.map(item => (qualified.has(item) ? { ...item, name: qualified.get(item) } : item));
|
|
209
|
+
}
|
|
210
|
+
/** Group items by harness, in dialect order: own assets first, then installed plugins, then the rest by name; those fetched from the network apart. */
|
|
211
|
+
export function overviewOf(items, link) {
|
|
212
|
+
const provider = link === undefined ? undefined : items.flatMap(item => item.parts).find(part => part.id === link.providerId);
|
|
213
|
+
if (link !== undefined && provider !== undefined) {
|
|
214
|
+
items = items.map(item => {
|
|
215
|
+
const settings = item.parts.find(part => part.id === link.settingsId);
|
|
216
|
+
if (settings === undefined)
|
|
217
|
+
return item;
|
|
218
|
+
const counts = { ...item.counts, [settings.state]: item.counts[settings.state] - 1 };
|
|
219
|
+
const alias = {
|
|
220
|
+
id: settings.id, kind: settings.kind, name: settings.name,
|
|
221
|
+
state: 'provided', checked: provider.checked, reasons: [],
|
|
222
|
+
providedBy: { name: link.name, ...(provider.adapter !== undefined ? { adapter: provider.adapter } : {}) },
|
|
223
|
+
};
|
|
224
|
+
return { ...item, parts: item.parts.map(part => part === settings ? alias : part), counts, checked: item.checked - Number(settings.state === 'works' && settings.checked) };
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
const fetched = items.filter(item => item.fetched === true).sort((a, b) => a.name.localeCompare(b.name, 'en'));
|
|
228
|
+
items = items.filter(item => item.fetched !== true);
|
|
143
229
|
const known = dialects().map(dialect => ({ source: dialect.id, label: dialect.label }));
|
|
144
230
|
const unknown = [...new Set(items.map(item => item.source))].filter(source => !known.some(dialect => dialect.source === source)).map(source => ({ source, label: source }));
|
|
145
231
|
return {
|
|
@@ -153,7 +239,8 @@ export function overviewOf(items) {
|
|
|
153
239
|
for (const state of Object.keys(counts))
|
|
154
240
|
counts[state] += item.counts[state];
|
|
155
241
|
const checked = own.reduce((sum, item) => sum + item.checked, 0);
|
|
156
|
-
return [{ source, label, items: own, counts, checked, toMigrate: own.filter(
|
|
242
|
+
return [{ source, label, items: own, counts, checked, toMigrate: own.filter(migratable).length }];
|
|
157
243
|
}),
|
|
244
|
+
fetched,
|
|
158
245
|
};
|
|
159
246
|
}
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The workbench's whole Host surface, as Typert Remote methods under the
|
|
3
|
-
* `harnessCompat` namespace: the browser reaches them through DSH's own
|
|
4
|
-
* Remote carrier, like every DSH service, and Harness Forge registers no HTTP
|
|
5
|
-
* routes of its own. Each method takes at most one `request` object, so the
|
|
6
|
-
* Gateway's source-mode reflection maps one named wire argument and no
|
|
7
|
-
* parameter name can collide with a Host lookup. Method names avoid the
|
|
8
|
-
* browser namespace service's own members (`install`, `remove`, `has`, …). Failures are RemoteErrors
|
|
9
|
-
* whose message is the reason the person reads.
|
|
10
|
-
*
|
|
11
|
-
* Methods are marked with the protocol's runtime marker helper rather than
|
|
12
|
-
* decorator syntax so Vitest can load the Host entry without a decorator
|
|
13
|
-
* transform.
|
|
14
|
-
* @module @kirkchinese/harness-forge
|
|
15
|
-
*/
|
|
16
1
|
import type { Context } from '@deepseek-ai/cordis';
|
|
17
2
|
import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
|
|
18
3
|
import type { HarnessForge } from '../forge/service.js';
|
|
@@ -22,8 +7,27 @@ declare module '@deepseek-ai/dsh-typert-protocol' {
|
|
|
22
7
|
'harness-forge/failed': {
|
|
23
8
|
readonly operation: string;
|
|
24
9
|
};
|
|
10
|
+
/** A session above the import ceiling (`size` when known: a compressed one is cut off while decoding); the browser words it in the person's language. */
|
|
11
|
+
'harness-forge/session-too-large': {
|
|
12
|
+
readonly operation: string;
|
|
13
|
+
readonly limit: number;
|
|
14
|
+
readonly size?: number;
|
|
15
|
+
};
|
|
16
|
+
/** A stored session may already hold the one being imported; the browser offers to open it or import as new. */
|
|
17
|
+
'harness-forge/session-maybe-imported': {
|
|
18
|
+
readonly operation: string;
|
|
19
|
+
readonly existingId: string;
|
|
20
|
+
};
|
|
25
21
|
}
|
|
26
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* An answer as plain JSON, the only kind DSH's Remote carrier passes: fields
|
|
25
|
+
* that are `undefined` (or functions) are dropped, an `undefined` list item
|
|
26
|
+
* becomes `null`, `-0` becomes `0`, and anything with `toJSON` is converted as
|
|
27
|
+
* JSON would. A number JSON cannot carry, a bigint or a cycle is refused with
|
|
28
|
+
* where it sits, instead of reaching the browser as something else.
|
|
29
|
+
*/
|
|
30
|
+
export declare function plainJson(value: unknown, at?: string, ancestors?: Set<object>): unknown;
|
|
27
31
|
/** What an adapter's surface shows for one session (the ui-slot template's `{ lines, at }`). */
|
|
28
32
|
export interface AdapterSurfaceSource {
|
|
29
33
|
/** `request`: what the browser half sent with it (a width, say). */
|
|
@@ -38,11 +42,15 @@ export declare class HarnessRemoteService extends TypertRemoteService {
|
|
|
38
42
|
constructor(ctx: Context, forge: HarnessForge);
|
|
39
43
|
/** A row's API, or a failure naming the row that is off. */
|
|
40
44
|
private row;
|
|
41
|
-
/** Run one operation; anything it throws reaches the browser with its message. */
|
|
45
|
+
/** Run one operation and answer it as plain JSON; anything it throws reaches the browser with its message. */
|
|
42
46
|
private guard;
|
|
43
47
|
/** The instruction files added to the default workspace's prompt (`{ active, yieldingTo?, files }`); inactive while the context row is off. */
|
|
44
48
|
contextStatus(): Promise<unknown>;
|
|
45
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* The overview, plus the home folder (the page shows paths under it as `~/…`), the workspaces of open sessions with
|
|
51
|
+
* their trust and the project parts that wait for it, and how many records are still being applied. It starts following the harnesses' changes without waiting for it:
|
|
52
|
+
* `applying` says it is under way, and the next overview shows the result.
|
|
53
|
+
*/
|
|
46
54
|
overview(): Promise<unknown>;
|
|
47
55
|
/** A workspace's trust (`{ workspace, trusted, sources, waiting }`): its project parts that run code wait until it is trusted. */
|
|
48
56
|
workspaceTrust(request: Record<string, unknown>): Promise<unknown>;
|
|
@@ -64,12 +72,47 @@ export declare class HarnessRemoteService extends TypertRemoteService {
|
|
|
64
72
|
migrate(request: Record<string, unknown>): Promise<unknown>;
|
|
65
73
|
setPartEnabled(request: Record<string, unknown>): Promise<unknown>;
|
|
66
74
|
removePlugin(request: Record<string, unknown>): Promise<unknown>;
|
|
67
|
-
|
|
68
|
-
|
|
75
|
+
/** Keep a plugin its harness no longer runs as the person's own copy. */
|
|
76
|
+
keepPlugin(request: Record<string, unknown>): Promise<unknown>;
|
|
77
|
+
/**
|
|
78
|
+
* The default marketplaces, the ones the person added, the local
|
|
79
|
+
* marketplaces the harnesses on this computer added, what was installed
|
|
80
|
+
* from the network, and whether git is installed.
|
|
81
|
+
*/
|
|
82
|
+
remoteSources(): Promise<unknown>;
|
|
83
|
+
/** Open a pasted marketplace or plugin (`owner/repo`, a git URL, a marketplace.json URL, an npm package, a local folder): its entries, fetched now. */
|
|
84
|
+
remoteOpen(request: Record<string, unknown>): Promise<unknown>;
|
|
85
|
+
/** Stop listing a marketplace the person added. */
|
|
86
|
+
remoteForget(request: Record<string, unknown>): Promise<unknown>;
|
|
87
|
+
/**
|
|
88
|
+
* Fetch one plugin (a marketplace's `entry`, or the pasted `input` itself) and say what it contains, to confirm:
|
|
89
|
+
* `{ token, name, source, page?, revision, parts, codeParts, … }`. Nothing is installed yet.
|
|
90
|
+
*/
|
|
91
|
+
remotePrepare(request: Record<string, unknown>): Promise<unknown>;
|
|
92
|
+
/** Install (or, for an update, apply) exactly what `remotePrepare` or `remotePrepareUpdate` showed. */
|
|
93
|
+
remoteInstall(request: Record<string, unknown>): Promise<unknown>;
|
|
94
|
+
/** Drop a confirmation the person declined, with the files it fetched. */
|
|
95
|
+
remoteCancel(request: Record<string, unknown>): Promise<unknown>;
|
|
96
|
+
/**
|
|
97
|
+
* Compare what was installed from the network with its source now
|
|
98
|
+
* (`{ updates: [{ pluginId, current, latest?, update, token?, error? }] }`); `token` names the revision found.
|
|
99
|
+
*/
|
|
100
|
+
remoteCheckUpdates(request: Record<string, unknown> | undefined): Promise<unknown>;
|
|
101
|
+
/**
|
|
102
|
+
* Fetch the revision a check found (`{ pluginId, token }`) and say what it contains and what changed, to confirm
|
|
103
|
+
* like an install; `remoteInstall` with the returned token applies it.
|
|
104
|
+
*/
|
|
105
|
+
remotePrepareUpdate(request: Record<string, unknown>): Promise<unknown>;
|
|
69
106
|
signIns(): Promise<unknown>;
|
|
70
107
|
signIn(request: Record<string, unknown>): Promise<unknown>;
|
|
71
108
|
sessions(request: Record<string, unknown> | undefined): Promise<unknown>;
|
|
72
109
|
importSession(request: Record<string, unknown>): Promise<unknown>;
|
|
110
|
+
/** Open a session an import stored: registered with DSH and out of its archive (`{ id, live, unarchived, archived }`). */
|
|
111
|
+
openImported(request: Record<string, unknown>): Promise<unknown>;
|
|
112
|
+
/** Who imports sessions (`{ provider: 'harness-forge' | 'dsh-chat-import', canInstall, command }`). */
|
|
113
|
+
sessionImport(): Promise<unknown>;
|
|
114
|
+
/** Install and enable dsh-chat-import through DSH's plugin manager; the browser asks the person first. */
|
|
115
|
+
installChatImport(): Promise<unknown>;
|
|
73
116
|
/**
|
|
74
117
|
* A session's mod drawings: the current one, then every new one, until the
|
|
75
118
|
* browser stops reading. Ends at once when the session's mods draw nothing.
|
|
@@ -109,8 +152,8 @@ export declare class HarnessRemoteService extends TypertRemoteService {
|
|
|
109
152
|
verifyPort(request: Record<string, unknown>): Promise<unknown>;
|
|
110
153
|
/**
|
|
111
154
|
* Port one part of a plugin: start a session in DSH's creation mode working
|
|
112
|
-
* on its task
|
|
113
|
-
* and record it as the part's port session.
|
|
155
|
+
* on its task in the adapters directory by default (or the given `workspaceId`
|
|
156
|
+
* or `cwd`), and record it as the part's port session.
|
|
114
157
|
*/
|
|
115
158
|
portGap(request: Record<string, unknown>): Promise<unknown>;
|
|
116
159
|
}
|