@hirey/hi-mcp-server 0.1.16 → 0.1.17

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 CHANGED
@@ -92,7 +92,7 @@ npm install -g @hirey/hi-mcp-server
92
92
 
93
93
  1. 用宿主把 `hi-mcp-server` 作为 `stdio` MCP server 挂上
94
94
  2. 优先执行 `hi_agent_install`,而不是让用户手工走 `register -> connect -> activate`
95
- 3. `hi_agent_install` 会自动完成 register / activate、delivery capability 声明、默认订阅,以及在 OpenClaw 场景下的 receiver 配置
95
+ 3. `hi_agent_install` 会自动完成 register / activate、delivery capability 声明、默认订阅,以及在 OpenClaw 场景下的 receiver 配置;首次安装如果没有显式传 `display_name`,OpenClaw 会稳定默认成 `OpenClaw Hi Agent`,generic host 会默认成 `Hi Agent`
96
96
  4. 当 receiver 的物料配置(例如 hooks token、adapter URL、transport、default reply route)发生变化时,`hi_agent_install` 会先停止当前 profile 记录的 receiver,再写入新配置并按需要重新启动;如果配置没变,则保留现有 runtime cursor,不重置消费进度
97
97
  5. `agent_id` 可以省略;省略时由 gateway 正式生成 canonical `ag_...`,不需要用户手写
98
98
  6. 完成后执行 `hi_agent_doctor`
@@ -0,0 +1,7 @@
1
+ export declare const DEFAULT_OPENCLAW_INSTALL_DISPLAY_NAME = "OpenClaw Hi Agent";
2
+ export declare const DEFAULT_GENERIC_INSTALL_DISPLAY_NAME = "Hi Agent";
3
+ export declare function resolveInstallDisplayName(args: {
4
+ explicitDisplayName?: unknown;
5
+ hostKind: 'openclaw' | 'generic';
6
+ }): string;
7
+ //# sourceMappingURL=installDefaults.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"installDefaults.d.ts","sourceRoot":"","sources":["../src/installDefaults.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,qCAAqC,sBAAsB,CAAC;AACzE,eAAO,MAAM,oCAAoC,aAAa,CAAC;AAE/D,wBAAgB,yBAAyB,CAAC,IAAI,EAAE;IAC9C,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,EAAE,UAAU,GAAG,SAAS,CAAC;CAClC,UAMA"}
@@ -0,0 +1,13 @@
1
+ function normalizeText(input) {
2
+ return String(input || '').trim();
3
+ }
4
+ export const DEFAULT_OPENCLAW_INSTALL_DISPLAY_NAME = 'OpenClaw Hi Agent';
5
+ export const DEFAULT_GENERIC_INSTALL_DISPLAY_NAME = 'Hi Agent';
6
+ export function resolveInstallDisplayName(args) {
7
+ const explicitDisplayName = normalizeText(args.explicitDisplayName);
8
+ if (explicitDisplayName)
9
+ return explicitDisplayName;
10
+ return args.hostKind === 'openclaw'
11
+ ? DEFAULT_OPENCLAW_INSTALL_DISPLAY_NAME
12
+ : DEFAULT_GENERIC_INSTALL_DISPLAY_NAME;
13
+ }
package/dist/server.js CHANGED
@@ -16,6 +16,7 @@ import { looksLikeOpenClawSessionKey, validateOpenClawSessionKey, } from './open
16
16
  import { buildInstallReceiverCommandArgv, } from './receiver-command.js';
17
17
  import { applyReceiverRuntimeSnapshot, receiverConfigMaterialEquals, } from './receiver-config-material.js';
18
18
  import { resolveInstallDefaultReplyDeliveryContext, resolveInstallRouteMissingPolicy, } from './defaultReplyRoute.js';
19
+ import { resolveInstallDisplayName } from './installDefaults.js';
19
20
  const CAPABILITY_CACHE_TTL_MS = 30_000;
20
21
  const RECEIVER_STOP_TIMEOUT_MS = 3_000;
21
22
  const RECEIVER_STOP_POLL_MS = 100;
@@ -95,7 +96,7 @@ function controlTools() {
95
96
  inputSchema: {
96
97
  type: 'object',
97
98
  properties: {
98
- display_name: { type: 'string', description: '首次安装且当前 profile 还没有 identity 时使用的人类可读名称。' },
99
+ display_name: { type: 'string', description: '首次安装且当前 profile 还没有 identity 时使用的人类可读名称。省略时会按 host_kind 使用稳定默认值:OpenClaw 为 `OpenClaw Hi Agent`,generic 为 `Hi Agent`。' },
99
100
  host_kind: { type: 'string', description: "可选:'openclaw'|'generic'。默认 generic。" },
100
101
  agent_kind: { type: 'string', description: '首次 register 时可选的 agent_kind。默认 external。' },
101
102
  replace_existing_state: { type: 'boolean', description: '首次 register 且本地已有 state 时,是否允许覆盖本地持久化身份。' },
@@ -1240,13 +1241,10 @@ async function handleInstall(args) {
1240
1241
  let state = await loadPersistedState();
1241
1242
  let registerPayload = null;
1242
1243
  if (!state.identity) {
1243
- const displayName = normalizeText(args.display_name);
1244
- if (!displayName) {
1245
- return fail('missing_display_name', {
1246
- profile: config.profile,
1247
- state_file: resolveCurrentStateFile(),
1248
- });
1249
- }
1244
+ const displayName = resolveInstallDisplayName({
1245
+ explicitDisplayName: args.display_name,
1246
+ hostKind,
1247
+ });
1250
1248
  const registerResult = await handleRegister({
1251
1249
  display_name: displayName,
1252
1250
  agent_kind: normalizeText(args.agent_kind) || undefined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hirey/hi-mcp-server",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/server.js",