@hmharness/cli 0.23.18 → 0.23.19

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.
Files changed (2) hide show
  1. package/dist/main.js +50 -0
  2. package/package.json +12 -12
package/dist/main.js CHANGED
@@ -911,6 +911,56 @@ flags:
911
911
  await tui(yes, rest.includes('--no-web'));
912
912
  return;
913
913
  }
914
+ if (cmd === 'lsp') {
915
+ // LSP management surface (Capability OS first slice: source trust)
916
+ await initHome();
917
+ const sub = rest[0] ?? 'list';
918
+ const { discoverServers } = await import('@hmharness/lsp');
919
+ const { listTrust, trustServer, untrustServer } = await import('@hmharness/lsp');
920
+ if (sub === 'list') {
921
+ const servers = discoverServers(true);
922
+ const trusted = new Map((await listTrust(homeDir())).map((t) => [t.id, t]));
923
+ if (servers.length === 0) {
924
+ stdout.write('(本机未发现任何 language server——PATH 与 DevEco 安装目录均无)\n');
925
+ return;
926
+ }
927
+ for (const s of servers) {
928
+ const t = trusted.get(s.id);
929
+ const state = !t ? (s.origin.includes('DevEco-local') ? '自动信任(官方布局,首次使用钉哈希)' : '未信任(hmh lsp trust ' + s.id + ')') : `${t.autoTrusted ? '自动' : '手动'}信任@${t.trustedAt.slice(0, 10)} sha:${t.sha256.slice(0, 8)}…`;
930
+ stdout.write(` ${s.healthy ? '✓' : '✗'} ${s.id.padEnd(16)} ${s.origin.padEnd(18)} ${s.official ? 'official' : 'COMMUNITY'} · ${state}\n`);
931
+ if (!s.healthy && s.unhealthyReason)
932
+ stdout.write(DIM(` ${s.unhealthyReason}\n`));
933
+ }
934
+ return;
935
+ }
936
+ if (sub === 'trust' || sub === 'untrust') {
937
+ const id = rest[1];
938
+ if (!id) {
939
+ stdout.write(`用法: hmh lsp ${sub} <server-id>(见 hmh lsp list)\n`);
940
+ return;
941
+ }
942
+ if (sub === 'untrust') {
943
+ const ok = await untrustServer(homeDir(), id);
944
+ stdout.write(ok ? `已撤销 ${id} 的信任\n` : `${id} 本就未信任\n`);
945
+ return;
946
+ }
947
+ const server = discoverServers().find((s) => s.id === id);
948
+ if (!server) {
949
+ stdout.write(`未发现 server '${id}'(hmh lsp list 查看可用项)\n`);
950
+ return;
951
+ }
952
+ const r = await trustServer(homeDir(), server);
953
+ if (!r.ok) {
954
+ stdout.write(`信任失败: ${r.error}\n`);
955
+ return;
956
+ }
957
+ stdout.write(`已信任 ${id}(${server.origin})· sha256 钉住 ${r.sha256.slice(0, 16)}…\n`);
958
+ stdout.write(DIM(' 二进制变更后将被拒绝执行(篡改检测);撤销: hmh lsp untrust ' + id + '\n'));
959
+ return;
960
+ }
961
+ stdout.write('用法: hmh lsp list | trust <id> | untrust <id> — 语言服务器发现与健康/信任状态\n');
962
+ return;
963
+ }
914
964
  if (cmd === 'cognitive') {
915
965
  // Cognitive OS (blueprint 2026-09): read-only status one-pager. The
916
966
  // subsystems are libraries first — they come alive when the agent loop
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hmharness/cli",
3
- "version": "0.23.18",
3
+ "version": "0.23.19",
4
4
  "description": "hmharness command line: one-shot tasks, an interactive REPL, a fullscreen TUI, the web frontend, and direct tool invocation.",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
@@ -44,17 +44,17 @@
44
44
  "build": "tsc -p tsconfig.build.json"
45
45
  },
46
46
  "dependencies": {
47
- "@hmharness/agent": "0.23.18",
48
- "@hmharness/cognitive": "0.23.18",
49
- "@hmharness/domain-harmony": "0.23.18",
50
- "@hmharness/domain-ops": "0.23.18",
51
- "@hmharness/environments": "0.23.18",
52
- "@hmharness/evaluation": "0.23.18",
53
- "@hmharness/evolution": "0.23.18",
54
- "@hmharness/kernel": "0.23.18",
55
- "@hmharness/observability": "0.23.18",
56
- "@hmharness/sandbox": "0.23.18",
57
- "@hmharness/web": "0.23.18",
47
+ "@hmharness/agent": "0.23.19",
48
+ "@hmharness/cognitive": "0.23.19",
49
+ "@hmharness/domain-harmony": "0.23.19",
50
+ "@hmharness/domain-ops": "0.23.19",
51
+ "@hmharness/environments": "0.23.19",
52
+ "@hmharness/evaluation": "0.23.19",
53
+ "@hmharness/evolution": "0.23.19",
54
+ "@hmharness/kernel": "0.23.19",
55
+ "@hmharness/observability": "0.23.19",
56
+ "@hmharness/sandbox": "0.23.19",
57
+ "@hmharness/web": "0.23.19",
58
58
  "qrcode": "^1.5.4"
59
59
  }
60
60
  }