@hirey/hi-mcp-server 0.1.15 → 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 +1 -1
- package/dist/installDefaults.d.ts +7 -0
- package/dist/installDefaults.d.ts.map +1 -0
- package/dist/installDefaults.js +13 -0
- package/dist/server.js +9 -11
- package/package.json +1 -1
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;
|
|
@@ -77,7 +78,7 @@ function normalizeCommandArgv(input) {
|
|
|
77
78
|
.filter(Boolean);
|
|
78
79
|
}
|
|
79
80
|
function controlTools() {
|
|
80
|
-
// control tools 只映射
|
|
81
|
+
// control tools 只映射 install/runtime 控制面;Hi 的正式业务面仍是 listing、matching、collaboration、meeting。
|
|
81
82
|
return [
|
|
82
83
|
{
|
|
83
84
|
name: 'hi_agent_status',
|
|
@@ -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 时,是否允许覆盖本地持久化身份。' },
|
|
@@ -699,7 +700,7 @@ function buildReceiverConfig(args) {
|
|
|
699
700
|
},
|
|
700
701
|
// OpenClaw 本地消息的展示前缀需要稳定,避免安装后又冒出第二套文案。
|
|
701
702
|
config: {
|
|
702
|
-
name:
|
|
703
|
+
name: 'Hirey Hi',
|
|
703
704
|
agent_id: 'main',
|
|
704
705
|
message_prefix: '[Hi Event]',
|
|
705
706
|
session_key: normalizeText(defaultReplyRoute?.session_key) || null,
|
|
@@ -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 =
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
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,
|
|
@@ -1732,7 +1730,7 @@ function createMcpServer() {
|
|
|
1732
1730
|
capabilities: {
|
|
1733
1731
|
tools: {},
|
|
1734
1732
|
},
|
|
1735
|
-
instructions: 'Hi MCP adapter: control-plane tools
|
|
1733
|
+
instructions: 'Hi MCP adapter: control-plane tools cover install/runtime state, while business tools mirror Hi public capabilities for listings, matching, collaboration, and meetings.',
|
|
1736
1734
|
});
|
|
1737
1735
|
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
1738
1736
|
return {
|