@kirkchinese/harness-forge 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +46 -2
- package/assets/icon.svg +12 -0
- package/cordis.patch.yml +28 -0
- package/docs/DETAIL.zh.md +47 -0
- package/lib/agents/presets.d.ts +98 -0
- package/lib/agents/presets.js +292 -0
- package/lib/agents/profiles.d.ts +58 -0
- package/lib/agents/profiles.js +279 -0
- package/lib/agents/row.d.ts +17 -0
- package/lib/agents/row.js +148 -0
- package/lib/client/paths.d.ts +12 -0
- package/lib/client/paths.js +68 -0
- package/lib/client/styles.d.ts +8 -0
- package/lib/client/styles.js +89 -0
- package/lib/client/typert.d.ts +25 -0
- package/lib/client/typert.js +158 -0
- package/lib/client.js +23823 -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 +110 -0
- package/lib/dsh/host.js +217 -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 +271 -0
- package/lib/forge/contract.js +45 -0
- package/lib/forge/follow.d.ts +30 -0
- package/lib/forge/follow.js +73 -0
- package/lib/forge/ledger.d.ts +206 -0
- package/lib/forge/ledger.js +1005 -0
- package/lib/forge/live-mounts.d.ts +45 -0
- package/lib/forge/live-mounts.js +78 -0
- package/lib/forge/npm.d.ts +31 -0
- package/lib/forge/npm.js +60 -0
- package/lib/forge/projects.d.ts +97 -0
- package/lib/forge/projects.js +343 -0
- package/lib/forge/receipts.d.ts +5 -0
- package/lib/forge/receipts.js +31 -0
- 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/row.d.ts +32 -0
- package/lib/forge/row.js +59 -0
- package/lib/forge/service.d.ts +115 -0
- package/lib/forge/service.js +290 -0
- package/lib/forge/settings.d.ts +43 -0
- package/lib/forge/settings.js +122 -0
- package/lib/forge/state.d.ts +129 -0
- package/lib/forge/state.js +266 -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 +722 -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 +27 -0
- package/lib/hooks/broker/session-events.js +205 -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 +264 -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 +87 -0
- package/lib/hooks/condition.js +602 -0
- package/lib/hooks/config.d.ts +85 -0
- package/lib/hooks/config.js +154 -0
- package/lib/hooks/glob.d.ts +41 -0
- package/lib/hooks/glob.js +114 -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 +19 -0
- package/lib/hooks/permissions.js +202 -0
- package/lib/hooks/powershell-aliases.d.ts +19 -0
- package/lib/hooks/powershell-aliases.js +58 -0
- package/lib/hooks/process.d.ts +64 -0
- package/lib/hooks/process.js +289 -0
- package/lib/hooks/row.d.ts +17 -0
- package/lib/hooks/row.js +96 -0
- package/lib/hooks/runner.d.ts +98 -0
- package/lib/hooks/runner.js +322 -0
- package/lib/hooks/shell-commands.d.ts +28 -0
- package/lib/hooks/shell-commands.js +241 -0
- package/lib/hooks/shell.d.ts +44 -0
- package/lib/hooks/shell.js +129 -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 +366 -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 +39 -0
- package/lib/mcp/catalog.js +69 -0
- package/lib/mcp/mount.d.ts +113 -0
- package/lib/mcp/mount.js +317 -0
- package/lib/mcp/policy.d.ts +42 -0
- package/lib/mcp/policy.js +43 -0
- package/lib/mcp/remote.d.ts +45 -0
- package/lib/mcp/remote.js +133 -0
- package/lib/mcp/row.d.ts +9 -0
- package/lib/mcp/row.js +225 -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 +231 -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 +33 -0
- package/lib/mods/service/turns.js +136 -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 +168 -0
- package/lib/opencode/convert.d.ts +53 -0
- package/lib/opencode/convert.js +255 -0
- package/lib/opencode/row.d.ts +22 -0
- package/lib/opencode/row.js +104 -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 +354 -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/adapter-paths.d.ts +13 -0
- package/lib/porting/adapter-paths.js +120 -0
- package/lib/porting/port-gap.d.ts +36 -0
- package/lib/porting/port-gap.js +158 -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 +51 -0
- package/lib/porting/row.d.ts +16 -0
- package/lib/porting/row.js +27 -0
- package/lib/porting/verify-port.d.ts +46 -0
- package/lib/porting/verify-port.js +82 -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/chat-import.d.ts +48 -0
- package/lib/sessions/chat-import.js +44 -0
- package/lib/sessions/claude.d.ts +35 -0
- package/lib/sessions/claude.js +104 -0
- 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 +42 -0
- package/lib/sessions/codex.js +270 -0
- package/lib/sessions/opencode.d.ts +38 -0
- package/lib/sessions/opencode.js +339 -0
- package/lib/sessions/persist.d.ts +162 -0
- package/lib/sessions/persist.js +377 -0
- package/lib/sessions/row.d.ts +15 -0
- package/lib/sessions/row.js +101 -0
- 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/invocation.d.ts +169 -0
- package/lib/shared/invocation.js +325 -0
- package/lib/shared/render.d.ts +101 -0
- package/lib/shared/render.js +1353 -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 +74 -0
- package/lib/skills/provider.js +346 -0
- package/lib/skills/row.d.ts +22 -0
- package/lib/skills/row.js +204 -0
- package/lib/workbench/adapter-coverage.d.ts +65 -0
- package/lib/workbench/adapter-coverage.js +141 -0
- package/lib/workbench/model-tools.d.ts +10 -0
- package/lib/workbench/model-tools.js +122 -0
- package/lib/workbench/overview.d.ts +153 -0
- package/lib/workbench/overview.js +246 -0
- package/lib/workbench/remote.d.ts +161 -0
- package/lib/workbench/remote.js +561 -0
- package/lib/workbench/row.d.ts +15 -0
- package/lib/workbench/row.js +16 -0
- package/lib/workbench/settings.d.ts +19 -0
- package/lib/workbench/settings.js +60 -0
- package/lib/workbench/workbench.d.ts +130 -0
- package/lib/workbench/workbench.js +361 -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 +7 -0
- package/package.json +247 -3
- package/runtime/opencode-host.mjs +270 -0
- package/skills/harness-forge/SKILL.md +47 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The page's stylesheet, rendered once by the page so unmounting removes it.
|
|
3
|
+
* Classes carry the `hf-` prefix; colors and radii are DSH theme tokens, and
|
|
4
|
+
* the layout follows Plugin Manager (960px column, 20px title, list rows that
|
|
5
|
+
* reach 8px past the text on hover).
|
|
6
|
+
* @module @kirkchinese/harness-forge/client
|
|
7
|
+
*/
|
|
8
|
+
export const CSS = `
|
|
9
|
+
.hf-page { height: 100%; overflow-y: auto; box-sizing: border-box; padding: 0 clamp(24px, 4vw, 48px) 48px; color: var(--dsw-alias-label-primary); }
|
|
10
|
+
.hf-column { max-width: 960px; margin: 0 auto; }
|
|
11
|
+
.hf-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-top: 28px; flex-wrap: wrap; }
|
|
12
|
+
[data-platform='darwin'] .hf-head { padding-top: calc(28px + var(--dsh-frame-top-clearance, 0px)); }
|
|
13
|
+
.hf-title { margin: 0; font-size: 20px; font-weight: 500; line-height: 28px; }
|
|
14
|
+
.hf-subtitle { margin: 4px 0 0; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); }
|
|
15
|
+
.hf-actions { display: flex; align-items: center; gap: 8px; position: relative; }
|
|
16
|
+
.hf-tabs { display: inline-flex; gap: 2px; padding: 2px; margin: 20px 0 24px; border-radius: var(--dsw-radius-md, 8px); background: var(--dsw-alias-bg-layer-2, var(--dsw-alias-interactive-bg-hover)); }
|
|
17
|
+
.hf-tab { height: 30px; padding: 0 14px; border: 0; border-radius: calc(var(--dsw-radius-md, 8px) - 2px); background: transparent; color: var(--dsw-alias-label-secondary); font: inherit; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
|
|
18
|
+
.hf-tab[aria-selected='true'] { background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-primary); font-weight: 500; box-shadow: 0 0 0 0.5px var(--dsw-alias-border-l2); }
|
|
19
|
+
.hf-count { min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box; border-radius: 9px; font-size: 11px; line-height: 18px; text-align: center; background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-secondary); }
|
|
20
|
+
.hf-btn { height: 28px; padding: 0 12px; border-radius: var(--dsw-radius-md, 8px); border: 0.5px solid var(--dsw-alias-border-l2); background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-primary); font: inherit; font-size: 13px; line-height: 20px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
|
|
21
|
+
.hf-btn:disabled { opacity: 0.5; cursor: default; }
|
|
22
|
+
.hf-btn-primary { border-color: var(--dsw-alias-button-primary-fill); background: var(--dsw-alias-button-primary-fill); color: var(--dsw-alias-label-primary-foreground); }
|
|
23
|
+
.hf-btn-danger { color: var(--dsw-alias-state-error-primary); }
|
|
24
|
+
.hf-btn-link { border: 0; background: transparent; padding: 0 4px; color: var(--dsw-alias-label-secondary); }
|
|
25
|
+
@media (hover: hover) {
|
|
26
|
+
.hf-btn:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover); }
|
|
27
|
+
.hf-btn-primary:hover:not(:disabled) { background: var(--dsw-alias-button-primary-hover, var(--dsw-alias-button-primary-fill)); }
|
|
28
|
+
.hf-btn-danger:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover-danger, var(--dsw-alias-interactive-bg-hover)); }
|
|
29
|
+
.hf-btn-link:hover:not(:disabled) { color: var(--dsw-alias-label-primary); background: transparent; }
|
|
30
|
+
.hf-tab:hover:not([aria-selected='true']) { color: var(--dsw-alias-label-primary); }
|
|
31
|
+
.hf-row-button:hover { background: var(--dsw-alias-interactive-bg-hover); }
|
|
32
|
+
.hf-menu-item:hover { background: var(--dsw-alias-interactive-bg-hover); }
|
|
33
|
+
}
|
|
34
|
+
.hf-btn:focus-visible, .hf-tab:focus-visible, .hf-switch:focus-visible, .hf-row-button:focus-visible, .hf-menu-item:focus-visible { outline: var(--dsw-focus-ring-width, 2px) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary)); outline-offset: 1px; }
|
|
35
|
+
.hf-menu { position: absolute; top: 34px; right: 0; z-index: 5; min-width: 180px; padding: 4px; border-radius: var(--dsw-radius-lg, 10px); background: var(--dsw-alias-bg-layer-1, var(--dsw-alias-bg-base)); border: 0.5px solid var(--dsw-alias-border-l2); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); }
|
|
36
|
+
.hf-menu-item { display: block; width: 100%; padding: 7px 10px; border: 0; border-radius: var(--dsw-radius-sm, 6px); background: transparent; color: inherit; font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
|
|
37
|
+
.hf-intro { display: flex; align-items: flex-start; gap: 12px; margin-top: 20px; padding: 12px 14px; border-radius: var(--dsw-radius-lg, 10px); background: var(--dsw-alias-settings-card-fill, var(--dsw-alias-bg-layer-2)); font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); }
|
|
38
|
+
.hf-intro p { margin: 0; flex: 1; }
|
|
39
|
+
.hf-section { margin-bottom: 32px; }
|
|
40
|
+
.hf-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
|
|
41
|
+
.hf-section-title { margin: 0; font-size: 14px; line-height: 22px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
|
|
42
|
+
.hf-lead { margin: 0 0 16px; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); }
|
|
43
|
+
.hf-muted { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }
|
|
44
|
+
.hf-list { display: flex; flex-direction: column; gap: 2px; margin: 0 -8px; padding: 0; list-style: none; }
|
|
45
|
+
.hf-item { border-radius: var(--dsw-radius-xl, 12px); }
|
|
46
|
+
.hf-item[data-open='true'] { background: var(--dsw-alias-bg-layer-2, var(--dsw-alias-interactive-bg-hover)); }
|
|
47
|
+
.hf-item-head { display: flex; align-items: center; gap: 12px; padding: 10px 8px; }
|
|
48
|
+
.hf-row-button { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 4px; margin: -4px; border: 0; border-radius: var(--dsw-radius-md, 8px); background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
|
|
49
|
+
.hf-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
|
|
50
|
+
.hf-item-title { font-size: 14px; line-height: 20px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
|
|
51
|
+
.hf-item-desc { font-size: 13px; line-height: 18px; color: var(--dsw-alias-label-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
52
|
+
.hf-tag { flex: none; padding: 0 6px; border-radius: 4px; font-size: 11px; line-height: 18px; font-weight: 400; background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-secondary); }
|
|
53
|
+
.hf-verdict { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; width: 132px; }
|
|
54
|
+
.hf-verdict-label { font-size: 12px; line-height: 16px; display: flex; align-items: center; gap: 6px; }
|
|
55
|
+
.hf-bar { display: flex; width: 100%; height: 4px; border-radius: 2px; overflow: hidden; background: var(--dsw-alias-interactive-bg-hover); }
|
|
56
|
+
.hf-bar > span { display: block; height: 100%; }
|
|
57
|
+
.hf-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; display: inline-block; }
|
|
58
|
+
.hf-parts { padding: 0 8px 10px 34px; display: flex; flex-direction: column; gap: 2px; }
|
|
59
|
+
.hf-part { display: flex; align-items: flex-start; gap: 12px; padding: 7px 0; border-top: 0.5px solid var(--dsw-alias-border-l3); }
|
|
60
|
+
.hf-part:first-child { border-top: 0; }
|
|
61
|
+
.hf-part-main { flex: 1; min-width: 0; font-size: 13px; line-height: 20px; }
|
|
62
|
+
.hf-part-name { font-weight: 500; overflow-wrap: anywhere; }
|
|
63
|
+
.hf-part-kind { color: var(--dsw-alias-label-tertiary); margin-right: 8px; font-size: 12px; }
|
|
64
|
+
.hf-part-state { flex: none; width: 130px; font-size: 12px; line-height: 20px; display: flex; align-items: center; gap: 6px; color: var(--dsw-alias-label-secondary); }
|
|
65
|
+
.hf-reason { font-size: 12.5px; line-height: 18px; color: var(--dsw-alias-label-secondary); margin-top: 2px; }
|
|
66
|
+
.hf-code { font-family: var(--dsw-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: 12px; overflow-wrap: anywhere; color: var(--dsw-alias-label-tertiary); }
|
|
67
|
+
.hf-switch { flex: none; position: relative; width: 32px; height: 18px; margin-top: 1px; border: 0; border-radius: 9px; padding: 0; background: var(--dsw-alias-border-l2); cursor: pointer; transition: background 120ms; }
|
|
68
|
+
.hf-switch[aria-checked='true'] { background: var(--dsw-alias-state-business-primary); }
|
|
69
|
+
.hf-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform 120ms; }
|
|
70
|
+
.hf-switch[aria-checked='true']::after { transform: translateX(14px); }
|
|
71
|
+
.hf-switch:disabled { opacity: 0.5; cursor: default; }
|
|
72
|
+
.hf-input, .hf-select, .hf-textarea { box-sizing: border-box; height: 32px; padding: 0 10px; border-radius: var(--dsw-radius-md, 8px); border: 0.5px solid var(--dsw-alias-border-l2); background: var(--dsw-alias-bg-base); color: inherit; font: inherit; font-size: 13px; }
|
|
73
|
+
.hf-input { flex: 1 1 280px; min-width: 200px; }
|
|
74
|
+
.hf-textarea { width: 100%; height: auto; min-height: 132px; padding: 8px 10px; resize: vertical; line-height: 20px; }
|
|
75
|
+
@media (pointer: coarse) { .hf-input, .hf-select, .hf-textarea { font-size: 16px; } }
|
|
76
|
+
.hf-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
|
|
77
|
+
.hf-card { font-size: 13px; line-height: 20px; padding: 14px 16px; border-radius: var(--dsw-radius-xl, 12px); background: var(--dsw-alias-settings-card-fill, var(--dsw-alias-bg-layer-2)); border: 0.5px solid var(--dsw-alias-settings-card-stroke, transparent); }
|
|
78
|
+
.hf-notice { margin: 16px 0 0; padding: 9px 12px; border-radius: var(--dsw-radius-md, 8px); font-size: 13px; line-height: 20px; white-space: pre-wrap; background: var(--dsw-alias-settings-card-fill, var(--dsw-alias-bg-layer-2)); }
|
|
79
|
+
.hf-notice[data-kind='error'] { color: var(--dsw-alias-state-error-primary); }
|
|
80
|
+
.hf-notice-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
|
|
81
|
+
.hf-empty { padding: 20px 0; font-size: 13px; color: var(--dsw-alias-label-tertiary); }
|
|
82
|
+
.hf-facts { display: grid; grid-template-columns: minmax(160px, 240px) 1fr; margin: 0; }
|
|
83
|
+
.hf-facts dt, .hf-facts dd { margin: 0; padding: 9px 0; border-top: 0.5px solid var(--dsw-alias-border-l3); font-size: 13px; line-height: 20px; }
|
|
84
|
+
.hf-facts dt { color: var(--dsw-alias-label-secondary); }
|
|
85
|
+
.hf-facts dd { overflow-wrap: anywhere; }
|
|
86
|
+
.hf-brief { max-height: 320px; overflow: auto; margin: 10px 0; padding: 10px 12px; border-radius: var(--dsw-radius-md, 8px); background: var(--dsw-alias-bg-base); font-family: var(--dsw-font-mono, ui-monospace, monospace); font-size: 12px; line-height: 18px; white-space: pre-wrap; }
|
|
87
|
+
.hf-details summary { cursor: pointer; font-size: 13px; color: var(--dsw-alias-label-secondary); }
|
|
88
|
+
.hf-back { margin: 20px 0 4px -4px; }
|
|
89
|
+
`;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare const remote: import("@deepseek-ai/dsh-typert-protocol").TypertRemoteInfo<Readonly<Record<string, import("@deepseek-ai/dsh-typert-protocol").TypertRemoteMethod<object, unknown, "unary", never, unknown> | import("@deepseek-ai/dsh-typert-protocol").TypertRemoteMethod<object, unknown, "stream", unknown, unknown>>>>;
|
|
2
|
+
export declare const TYPERT_REMOTE: import("@deepseek-ai/dsh-typert-protocol").TypertRemoteInfo<Readonly<Record<string, import("@deepseek-ai/dsh-typert-protocol").TypertRemoteMethod<object, unknown, "unary", never, unknown> | import("@deepseek-ai/dsh-typert-protocol").TypertRemoteMethod<object, unknown, "stream", unknown, unknown>>>>;
|
|
3
|
+
export default remote;
|
|
4
|
+
/** Set by the plugin body once `$mount` registered the namespace. */
|
|
5
|
+
export declare function setMountedRemote(value: unknown): void;
|
|
6
|
+
export declare function setMountedRemoteError(error: unknown): void;
|
|
7
|
+
/** Why the namespace could not mount, when known. */
|
|
8
|
+
export declare function mountedRemoteError(): string | undefined;
|
|
9
|
+
/** A failed call: the Host's reason, and the Remote error code and its details when there are. */
|
|
10
|
+
export declare class CallError extends Error {
|
|
11
|
+
readonly code?: string | undefined;
|
|
12
|
+
readonly details?: Readonly<Record<string, unknown>> | undefined;
|
|
13
|
+
constructor(message: string, code?: string | undefined, details?: Readonly<Record<string, unknown>> | undefined);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Whether a failed call means the `harness-forge-workbench` row is switched off: the page is
|
|
17
|
+
* there (the client is declared once per package) but nothing on the Host answers `harnessCompat`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isWorkbenchOff(error: unknown): boolean;
|
|
20
|
+
/** Call one workbench method; a failure throws a CallError carrying the Host's reason. */
|
|
21
|
+
export declare function call<T>(method: string, request?: Record<string, unknown>): Promise<T>;
|
|
22
|
+
/** Open one workbench stream; dispose the handle to stop it. */
|
|
23
|
+
export declare function stream<T>(method: string, request: Record<string, unknown>): Promise<AsyncIterable<T> & {
|
|
24
|
+
dispose(): void;
|
|
25
|
+
}>;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The browser's view of the `harnessCompat` Remote namespace: the
|
|
3
|
+
* contribution `ctx.remote.$mount` needs (one entry per Host method in
|
|
4
|
+
* `workbench/remote.ts`, each taking at most one JSON `request`), and `call` / `stream`
|
|
5
|
+
* helpers the workbench uses. Every workbench request travels through DSH's
|
|
6
|
+
* own Remote carrier.
|
|
7
|
+
* @module @kirkchinese/harness-forge/client
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
import { createTypertRemoteInfo } from '@deepseek-ai/dsh-typert-protocol/remote-info';
|
|
11
|
+
/** [method, mode, takes a request]; mirrors REMOTE_METHODS of the Host. */
|
|
12
|
+
const METHODS = [
|
|
13
|
+
['overview', 'unary', false],
|
|
14
|
+
['workspaceTrust', 'unary', true],
|
|
15
|
+
['trustWorkspace', 'unary', true],
|
|
16
|
+
['trustDecisions', 'unary', false],
|
|
17
|
+
['dismissTrust', 'unary', true],
|
|
18
|
+
['discover', 'unary', false],
|
|
19
|
+
['contextStatus', 'unary', false],
|
|
20
|
+
['diagnostics', 'unary', false],
|
|
21
|
+
['settings', 'unary', false],
|
|
22
|
+
['saveSettings', 'unary', true],
|
|
23
|
+
['installPlugin', 'unary', true],
|
|
24
|
+
['migrate', 'unary', true],
|
|
25
|
+
['setPartEnabled', 'unary', true],
|
|
26
|
+
['removePlugin', 'unary', true],
|
|
27
|
+
['keepPlugin', 'unary', true],
|
|
28
|
+
['remoteSources', 'unary', false],
|
|
29
|
+
['remoteOpen', 'unary', true],
|
|
30
|
+
['remoteForget', 'unary', true],
|
|
31
|
+
['remotePrepare', 'unary', true],
|
|
32
|
+
['remoteInstall', 'unary', true],
|
|
33
|
+
['remoteCancel', 'unary', true],
|
|
34
|
+
['remoteCheckUpdates', 'unary', true],
|
|
35
|
+
['remotePrepareUpdate', 'unary', true],
|
|
36
|
+
['signIns', 'unary', false],
|
|
37
|
+
['signIn', 'unary', true],
|
|
38
|
+
['sessions', 'unary', true],
|
|
39
|
+
['importSession', 'unary', true],
|
|
40
|
+
['openImported', 'unary', true],
|
|
41
|
+
['sessionImport', 'unary', false],
|
|
42
|
+
['installChatImport', 'unary', false],
|
|
43
|
+
['modSurfaces', 'stream', true],
|
|
44
|
+
['modAct', 'unary', true],
|
|
45
|
+
['modClose', 'unary', true],
|
|
46
|
+
['modMove', 'unary', true],
|
|
47
|
+
['adapterSurface', 'stream', true],
|
|
48
|
+
['adapterRead', 'unary', true],
|
|
49
|
+
['portBrief', 'unary', true],
|
|
50
|
+
['portGap', 'unary', true],
|
|
51
|
+
['portSessions', 'unary', false],
|
|
52
|
+
['verifyPort', 'unary', true],
|
|
53
|
+
];
|
|
54
|
+
const json = (typeSymbol) => ({
|
|
55
|
+
mode: 'strict',
|
|
56
|
+
typeSymbol,
|
|
57
|
+
create: () => z.unknown(),
|
|
58
|
+
jsonSchema: {},
|
|
59
|
+
});
|
|
60
|
+
const remote = createTypertRemoteInfo({
|
|
61
|
+
package: '@kirkchinese/harness-forge',
|
|
62
|
+
methods: Object.fromEntries(METHODS.map(([method, mode, takesRequest]) => [`harnessCompat/${method}`, {
|
|
63
|
+
service: 'harnessCompat',
|
|
64
|
+
invocation: { kind: 'direct' },
|
|
65
|
+
...(mode === 'stream' ? { mode: 'stream' } : {}),
|
|
66
|
+
parameters: takesRequest
|
|
67
|
+
? [{ name: 'request', source: 'json', codec: json('@kirkchinese/harness-forge#Request'), strictCodec: json('@kirkchinese/harness-forge#Request') }]
|
|
68
|
+
: [],
|
|
69
|
+
result: json(`@kirkchinese/harness-forge#${method}`),
|
|
70
|
+
}])),
|
|
71
|
+
}, z);
|
|
72
|
+
export const TYPERT_REMOTE = remote;
|
|
73
|
+
export default remote;
|
|
74
|
+
let mounted;
|
|
75
|
+
let mountError;
|
|
76
|
+
const waiting = [];
|
|
77
|
+
/** Set by the plugin body once `$mount` registered the namespace. */
|
|
78
|
+
export function setMountedRemote(value) {
|
|
79
|
+
mounted = typeof value === 'object' && value !== null ? value : undefined;
|
|
80
|
+
mountError = undefined;
|
|
81
|
+
for (const resolve of waiting.splice(0))
|
|
82
|
+
resolve(mounted);
|
|
83
|
+
}
|
|
84
|
+
export function setMountedRemoteError(error) {
|
|
85
|
+
mounted = undefined;
|
|
86
|
+
mountError = error instanceof Error ? error.message : String(error);
|
|
87
|
+
for (const resolve of waiting.splice(0))
|
|
88
|
+
resolve(undefined);
|
|
89
|
+
}
|
|
90
|
+
/** Why the namespace could not mount, when known. */
|
|
91
|
+
export function mountedRemoteError() {
|
|
92
|
+
return mountError;
|
|
93
|
+
}
|
|
94
|
+
async function namespace() {
|
|
95
|
+
const ready = mounted ?? (mountError === undefined ? await new Promise((resolve) => { waiting.push(resolve); }) : undefined);
|
|
96
|
+
if (ready === undefined)
|
|
97
|
+
throw new Error(`Harness Forge is not reachable: ${mountError ?? 'the Remote namespace did not mount'}`);
|
|
98
|
+
return ready;
|
|
99
|
+
}
|
|
100
|
+
/** A failed call: the Host's reason, and the Remote error code and its details when there are. */
|
|
101
|
+
export class CallError extends Error {
|
|
102
|
+
code;
|
|
103
|
+
details;
|
|
104
|
+
constructor(message, code, details) {
|
|
105
|
+
super(message);
|
|
106
|
+
this.code = code;
|
|
107
|
+
this.details = details;
|
|
108
|
+
this.name = 'CallError';
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/** Gateway codes for an endpoint that no running Host service answers: the workbench row is off. */
|
|
112
|
+
const NOT_SERVED = new Set(['gateway/invocation-unavailable', 'gateway/service-unavailable', 'gateway/method-unavailable', 'gateway/definition-unavailable']);
|
|
113
|
+
/**
|
|
114
|
+
* Whether a failed call means the `harness-forge-workbench` row is switched off: the page is
|
|
115
|
+
* there (the client is declared once per package) but nothing on the Host answers `harnessCompat`.
|
|
116
|
+
*/
|
|
117
|
+
export function isWorkbenchOff(error) {
|
|
118
|
+
if (!(error instanceof Error))
|
|
119
|
+
return false;
|
|
120
|
+
const code = error.code;
|
|
121
|
+
if (typeof code === 'string' && NOT_SERVED.has(code))
|
|
122
|
+
return true;
|
|
123
|
+
// DSH 0.2.2 answers an endpoint no Host service exports with HTTP 404, which the client reports as a transport failure.
|
|
124
|
+
return /harness-forge-workbench/u.test(error.message)
|
|
125
|
+
|| /\/api\/harnessCompat\/\w+: HTTP 404\b/u.test(error.message)
|
|
126
|
+
|| /harnessCompat\/\w+.*(?:no active Remote method|active Service .* is unavailable|has no callable method|definition was withdrawn)/u.test(error.message);
|
|
127
|
+
}
|
|
128
|
+
function recordOf(value) {
|
|
129
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value) ? value : undefined;
|
|
130
|
+
}
|
|
131
|
+
/** Call one workbench method; a failure throws a CallError carrying the Host's reason. */
|
|
132
|
+
export async function call(method, request) {
|
|
133
|
+
const target = (await namespace())[method];
|
|
134
|
+
if (typeof target !== 'function')
|
|
135
|
+
throw new CallError(`Harness Forge has no method ${method}`);
|
|
136
|
+
let result;
|
|
137
|
+
try {
|
|
138
|
+
result = await (request === undefined ? target() : target(request));
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
const { code, details } = (error ?? {});
|
|
142
|
+
throw new CallError(error instanceof Error ? error.message : String(error), typeof code === 'string' ? code : undefined, recordOf(details));
|
|
143
|
+
}
|
|
144
|
+
if (typeof result === 'object' && result !== null && 'ok' in result) {
|
|
145
|
+
const outcome = result;
|
|
146
|
+
if (!outcome.ok)
|
|
147
|
+
throw new CallError(outcome.error?.message ?? outcome.error?.code ?? `${method} failed`, outcome.error?.code, recordOf(outcome.error?.details));
|
|
148
|
+
return outcome.value;
|
|
149
|
+
}
|
|
150
|
+
return result;
|
|
151
|
+
}
|
|
152
|
+
/** Open one workbench stream; dispose the handle to stop it. */
|
|
153
|
+
export async function stream(method, request) {
|
|
154
|
+
const target = (await namespace())[method];
|
|
155
|
+
if (typeof target !== 'function')
|
|
156
|
+
throw new Error(`Harness Forge has no method ${method}`);
|
|
157
|
+
return target(request);
|
|
158
|
+
}
|