@hualinge/relay-mcp-server 0.1.3
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 +11 -0
- package/dist/collab.d.ts +8 -0
- package/dist/collab.d.ts.map +1 -0
- package/dist/collab.js +47 -0
- package/dist/collab.js.map +1 -0
- package/dist/dare.d.ts +4 -0
- package/dist/dare.d.ts.map +1 -0
- package/dist/dare.js +46 -0
- package/dist/dare.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +47 -0
- package/dist/index.js.map +1 -0
- package/dist/memory.d.ts +8 -0
- package/dist/memory.d.ts.map +1 -0
- package/dist/memory.js +47 -0
- package/dist/memory.js.map +1 -0
- package/dist/server-toolsets.d.ts +13 -0
- package/dist/server-toolsets.d.ts.map +1 -0
- package/dist/server-toolsets.js +119 -0
- package/dist/server-toolsets.js.map +1 -0
- package/dist/tools/callback-memory-tools.d.ts +46 -0
- package/dist/tools/callback-memory-tools.d.ts.map +1 -0
- package/dist/tools/callback-memory-tools.js +59 -0
- package/dist/tools/callback-memory-tools.js.map +1 -0
- package/dist/tools/callback-outbox.d.ts +15 -0
- package/dist/tools/callback-outbox.d.ts.map +1 -0
- package/dist/tools/callback-outbox.js +162 -0
- package/dist/tools/callback-outbox.js.map +1 -0
- package/dist/tools/callback-retry.d.ts +14 -0
- package/dist/tools/callback-retry.d.ts.map +1 -0
- package/dist/tools/callback-retry.js +58 -0
- package/dist/tools/callback-retry.js.map +1 -0
- package/dist/tools/callback-tools.d.ts +444 -0
- package/dist/tools/callback-tools.d.ts.map +1 -0
- package/dist/tools/callback-tools.js +771 -0
- package/dist/tools/callback-tools.js.map +1 -0
- package/dist/tools/evidence-tools.d.ts +36 -0
- package/dist/tools/evidence-tools.d.ts.map +1 -0
- package/dist/tools/evidence-tools.js +87 -0
- package/dist/tools/evidence-tools.js.map +1 -0
- package/dist/tools/file-tools.d.ts +78 -0
- package/dist/tools/file-tools.d.ts.map +1 -0
- package/dist/tools/file-tools.js +178 -0
- package/dist/tools/file-tools.js.map +1 -0
- package/dist/tools/index.d.ts +13 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +18 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/limb-tools.d.ts +113 -0
- package/dist/tools/limb-tools.d.ts.map +1 -0
- package/dist/tools/limb-tools.js +120 -0
- package/dist/tools/limb-tools.js.map +1 -0
- package/dist/tools/reflect-tools.d.ts +23 -0
- package/dist/tools/reflect-tools.d.ts.map +1 -0
- package/dist/tools/reflect-tools.js +52 -0
- package/dist/tools/reflect-tools.js.map +1 -0
- package/dist/tools/rich-block-rules-tool.d.ts +17 -0
- package/dist/tools/rich-block-rules-tool.d.ts.map +1 -0
- package/dist/tools/rich-block-rules-tool.js +36 -0
- package/dist/tools/rich-block-rules-tool.js.map +1 -0
- package/dist/tools/schedule-tools.d.ts +134 -0
- package/dist/tools/schedule-tools.d.ts.map +1 -0
- package/dist/tools/schedule-tools.js +397 -0
- package/dist/tools/schedule-tools.js.map +1 -0
- package/dist/tools/session-chain-tools.d.ts +99 -0
- package/dist/tools/session-chain-tools.d.ts.map +1 -0
- package/dist/tools/session-chain-tools.js +288 -0
- package/dist/tools/session-chain-tools.js.map +1 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +11 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/path-utils.d.ts +6 -0
- package/dist/utils/path-utils.d.ts.map +1 -0
- package/dist/utils/path-utils.js +63 -0
- package/dist/utils/path-utils.js.map +1 -0
- package/dist/utils/path-validator.d.ts +45 -0
- package/dist/utils/path-validator.d.ts.map +1 -0
- package/dist/utils/path-validator.js +126 -0
- package/dist/utils/path-validator.js.map +1 -0
- package/package.json +44 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* *
|
|
3
|
+
* * Copyright (C) Huawei Technologies Co., Ltd. 2026. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Limb MCP Tools — F126 四肢控制面
|
|
8
|
+
*
|
|
9
|
+
* limb_list_available: 列出当前在线的四肢节点及其能力
|
|
10
|
+
* limb_invoke: 调用指定四肢节点的能力
|
|
11
|
+
*/
|
|
12
|
+
import { callbackPost, getCallbackConfig, NO_CONFIG_ERROR } from './callback-tools.js';
|
|
13
|
+
import { errorResult } from './file-tools.js';
|
|
14
|
+
// ─── Input Schemas ───────────────────────────────────────────
|
|
15
|
+
export const limbListAvailableInputSchema = {
|
|
16
|
+
type: 'object',
|
|
17
|
+
properties: {
|
|
18
|
+
capability: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
description: '按能力类别过滤(可选,如 "camera", "gpu_render")',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
export const limbInvokeInputSchema = {
|
|
25
|
+
type: 'object',
|
|
26
|
+
properties: {
|
|
27
|
+
nodeId: {
|
|
28
|
+
type: 'string',
|
|
29
|
+
description: '目标四肢节点 ID',
|
|
30
|
+
},
|
|
31
|
+
command: {
|
|
32
|
+
type: 'string',
|
|
33
|
+
description: '要执行的命令(如 "camera.snap", "exec.run")',
|
|
34
|
+
},
|
|
35
|
+
params: {
|
|
36
|
+
type: 'object',
|
|
37
|
+
description: '命令参数(可选)',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
required: ['nodeId', 'command'],
|
|
41
|
+
};
|
|
42
|
+
// ─── Handlers ────────────────────────────────────────────────
|
|
43
|
+
export async function handleLimbListAvailable(args) {
|
|
44
|
+
const config = getCallbackConfig();
|
|
45
|
+
if (!config)
|
|
46
|
+
return errorResult(NO_CONFIG_ERROR);
|
|
47
|
+
const body = {};
|
|
48
|
+
if (args.capability)
|
|
49
|
+
body.capability = args.capability;
|
|
50
|
+
return callbackPost('/api/callback/limb/list', body);
|
|
51
|
+
}
|
|
52
|
+
export async function handleLimbInvoke(args) {
|
|
53
|
+
const config = getCallbackConfig();
|
|
54
|
+
if (!config)
|
|
55
|
+
return errorResult(NO_CONFIG_ERROR);
|
|
56
|
+
return callbackPost('/api/callback/limb/invoke', {
|
|
57
|
+
nodeId: args.nodeId,
|
|
58
|
+
command: args.command,
|
|
59
|
+
params: args.params ?? {},
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
// ─── Phase C: Pairing Tools ──────────────────────────────────
|
|
63
|
+
export const limbPairListInputSchema = {
|
|
64
|
+
type: 'object',
|
|
65
|
+
properties: {},
|
|
66
|
+
};
|
|
67
|
+
export const limbPairApproveInputSchema = {
|
|
68
|
+
type: 'object',
|
|
69
|
+
properties: {
|
|
70
|
+
requestId: { type: 'string', description: '配对请求 ID' },
|
|
71
|
+
},
|
|
72
|
+
required: ['requestId'],
|
|
73
|
+
};
|
|
74
|
+
export async function handleLimbPairList() {
|
|
75
|
+
const config = getCallbackConfig();
|
|
76
|
+
if (!config)
|
|
77
|
+
return errorResult(NO_CONFIG_ERROR);
|
|
78
|
+
return callbackPost('/api/callback/limb/pair/list', {});
|
|
79
|
+
}
|
|
80
|
+
export async function handleLimbPairApprove(args) {
|
|
81
|
+
const config = getCallbackConfig();
|
|
82
|
+
if (!config)
|
|
83
|
+
return errorResult(NO_CONFIG_ERROR);
|
|
84
|
+
return callbackPost('/api/callback/limb/pair/approve', { requestId: args.requestId });
|
|
85
|
+
}
|
|
86
|
+
// ─── Tool Definitions ────────────────────────────────────────
|
|
87
|
+
export const limbTools = [
|
|
88
|
+
{
|
|
89
|
+
name: 'limb_list_available',
|
|
90
|
+
description: 'List currently online limb nodes and their capabilities. Optionally filter by capability category. ' +
|
|
91
|
+
'Limbs are external devices/nodes (iPhone, Windows PC, Mac Mini, etc.) — NOT cats. ' +
|
|
92
|
+
'Use when you need to discover what physical devices are available for tasks like camera capture, GPU rendering, etc.',
|
|
93
|
+
inputSchema: limbListAvailableInputSchema,
|
|
94
|
+
handler: handleLimbListAvailable,
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'limb_invoke',
|
|
98
|
+
description: 'Invoke a capability on a specific limb node. Requires nodeId and command. ' +
|
|
99
|
+
'Example: limb_invoke(nodeId="iphone-1", command="camera.snap") ' +
|
|
100
|
+
'GOTCHA: Get the nodeId from limb_list_available first — do not guess node IDs.',
|
|
101
|
+
inputSchema: limbInvokeInputSchema,
|
|
102
|
+
handler: handleLimbInvoke,
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: 'limb_pair_list',
|
|
106
|
+
description: 'List pending limb pairing requests. Remote devices must be approved by 用户 before agents can use them. ' +
|
|
107
|
+
'Use to check if any new devices are waiting for approval.',
|
|
108
|
+
inputSchema: limbPairListInputSchema,
|
|
109
|
+
handler: handleLimbPairList,
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: 'limb_pair_approve',
|
|
113
|
+
description: 'Approve a limb pairing request. After approval, the remote device is automatically registered in the Registry ' +
|
|
114
|
+
'and becomes available for agents to invoke. ' +
|
|
115
|
+
'GOTCHA: Only 用户 should initiate approval — do not auto-approve without user consent.',
|
|
116
|
+
inputSchema: limbPairApproveInputSchema,
|
|
117
|
+
handler: handleLimbPairApprove,
|
|
118
|
+
},
|
|
119
|
+
];
|
|
120
|
+
//# sourceMappingURL=limb-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limb-tools.js","sourceRoot":"","sources":["../../src/tools/limb-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEvF,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,gEAAgE;AAEhE,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,IAAI,EAAE,QAAiB;IACvB,UAAU,EAAE;QACV,U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AmB;QACzB,WAAW,EACT,gHAAgH;YAChH,8CAA8C;YAC9C,sFAAsF;QACxF,WAAW,EAAE,0BAA0B;QACvC,OAAO,EAAE,qBAAqB;KAC/B;CACO,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reflect Tool
|
|
3
|
+
* MCP 工具: 项目知识反思 (SQLite-backed)
|
|
4
|
+
*
|
|
5
|
+
* F102: 智能体可通过 MCP 调用 /reflect 获取项目知识反思。
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import type { ToolResult } from './file-tools.js';
|
|
9
|
+
export declare const reflectInputSchema: {
|
|
10
|
+
query: z.ZodString;
|
|
11
|
+
};
|
|
12
|
+
export declare function handleReflect(input: {
|
|
13
|
+
query: string;
|
|
14
|
+
}): Promise<ToolResult>;
|
|
15
|
+
export declare const reflectTools: readonly [{
|
|
16
|
+
readonly name: "office_claw_reflect";
|
|
17
|
+
readonly description: string;
|
|
18
|
+
readonly inputSchema: {
|
|
19
|
+
query: z.ZodString;
|
|
20
|
+
};
|
|
21
|
+
readonly handler: typeof handleReflect;
|
|
22
|
+
}];
|
|
23
|
+
//# sourceMappingURL=reflect-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reflect-tools.d.ts","sourceRoot":"","sources":["../../src/tools/reflect-tools.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAKlD,eAAO,MAAM,kBAAkB;;CAE9B,CAAC;AAEF,wBAAsB,aAAa,CAAC,KAAK,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAgCjF;AAED,eAAO,MAAM,YAAY;;;;;;;EAWf,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* *
|
|
3
|
+
* * Copyright (C) Huawei Technologies Co., Ltd. 2026. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Reflect Tool
|
|
8
|
+
* MCP 工具: 项目知识反思 (SQLite-backed)
|
|
9
|
+
*
|
|
10
|
+
* F102: 智能体可通过 MCP 调用 /reflect 获取项目知识反思。
|
|
11
|
+
*/
|
|
12
|
+
import { z } from 'zod';
|
|
13
|
+
import { errorResult, successResult } from './file-tools.js';
|
|
14
|
+
const API_URL = process.env['OFFICE_CLAW_API_URL'];
|
|
15
|
+
export const reflectInputSchema = {
|
|
16
|
+
query: z.string().trim().min(1).describe('Question to reflect on using project knowledge'),
|
|
17
|
+
};
|
|
18
|
+
export async function handleReflect(input) {
|
|
19
|
+
const url = `${API_URL}/api/reflect`;
|
|
20
|
+
try {
|
|
21
|
+
const response = await fetch(url, {
|
|
22
|
+
method: 'POST',
|
|
23
|
+
headers: { 'Content-Type': 'application/json' },
|
|
24
|
+
body: JSON.stringify({ query: input.query }),
|
|
25
|
+
});
|
|
26
|
+
if (!response.ok) {
|
|
27
|
+
const text = await response.text();
|
|
28
|
+
return errorResult(`Reflect failed (${response.status}): ${text}`);
|
|
29
|
+
}
|
|
30
|
+
const data = (await response.json());
|
|
31
|
+
if (data.degraded) {
|
|
32
|
+
return successResult(`[DEGRADED] Reflection service unavailable (${data.degradeReason ?? 'unknown'}). Use search_evidence instead.`);
|
|
33
|
+
}
|
|
34
|
+
return successResult(data.reflection);
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
38
|
+
return errorResult(`Reflect request failed: ${message}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export const reflectTools = [
|
|
42
|
+
{
|
|
43
|
+
name: 'office_claw_reflect',
|
|
44
|
+
description: 'Ask a reflective question about the project. Synthesizes insights from stored project knowledge (SQLite-backed). ' +
|
|
45
|
+
'Use for open-ended "why" questions that benefit from synthesis across multiple sources. ' +
|
|
46
|
+
'GOTCHA: Currently degraded — use search_evidence instead. This tool is kept for future synthesis capability. ' +
|
|
47
|
+
'WHEN TO USE: search_evidence finds facts; reflect synthesizes meaning. If search_evidence already answered your question, skip this.',
|
|
48
|
+
inputSchema: reflectInputSchema,
|
|
49
|
+
handler: handleReflect,
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
//# sourceMappingURL=reflect-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reflect-tools.js","sourceRoot":"","sources":["../../src/tools/reflect-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE7D,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAE,CAAC;AAEpD,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,gDAAgD,CAAC;CAC3F,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,KAAwB;IAC1D,MAAM,GAAG,GAAG,GAAG,OAAO,cAAc,CAAC;IAErC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;YAChC,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;YAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;SAC7C,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACnC,OAAO,WAAW,CAAC,mBAAmB,QAAQ,CAAC,MAAM,MAAM,IAAI,EAAE,CAAC,CAAC;QACrE,CAAC;QAED,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAIlC,CAAC;QAEF,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,OAAO,aAAa,CAClB,8CAA8C,IAAI,CAAC,aAAa,IAAI,SAAS,iCAAiC,CAC/G,CAAC;QACJ,CAAC;QAED,OAAO,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACjE,OAAO,WAAW,CAAC,2BAA2B,OAAO,EAAE,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B;QACE,IAAI,EAAE,qBAAqB;QAC3B,WAAW,EACT,mHAAmH;YACnH,0FAA0F;YAC1F,+GAA+G;YAC/G,sIAAsI;QACxI,WAAW,EAAE,kBAAkB;QAC/B,OAAO,EAAE,aAAa;KACvB;CACO,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rich Block Rules Tool
|
|
3
|
+
* MCP 工具: 按需获取富消息块完整使用规范
|
|
4
|
+
*
|
|
5
|
+
* F-BLOAT: 渐进式披露——系统提示词只含短引用,
|
|
6
|
+
* 智能体首次使用富块前调用此工具获取完整规则。
|
|
7
|
+
*/
|
|
8
|
+
import type { ToolResult } from './file-tools.js';
|
|
9
|
+
export declare function handleGetRichBlockRules(): Promise<ToolResult>;
|
|
10
|
+
export declare const richBlockRulesInputSchema: {};
|
|
11
|
+
export declare const richBlockRulesTools: readonly [{
|
|
12
|
+
readonly name: "office_claw_get_rich_block_rules";
|
|
13
|
+
readonly description: string;
|
|
14
|
+
readonly inputSchema: {};
|
|
15
|
+
readonly handler: typeof handleGetRichBlockRules;
|
|
16
|
+
}];
|
|
17
|
+
//# sourceMappingURL=rich-block-rules-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rich-block-rules-tool.d.ts","sourceRoot":"","sources":["../../src/tools/rich-block-rules-tool.ts"],"names":[],"mappings":"AAMA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAKlD,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,UAAU,CAAC,CAiBnE;AAED,eAAO,MAAM,yBAAyB,IAAK,CAAC;AAE5C,eAAO,MAAM,mBAAmB;;;;;EAWtB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* *
|
|
3
|
+
* * Copyright (C) Huawei Technologies Co., Ltd. 2026. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
import { errorResult, successResult } from './file-tools.js';
|
|
7
|
+
const API_URL = process.env['OFFICE_CLAW_API_URL'];
|
|
8
|
+
export async function handleGetRichBlockRules() {
|
|
9
|
+
const url = `${API_URL}/api/callbacks/rich-block-rules`;
|
|
10
|
+
try {
|
|
11
|
+
const response = await fetch(url);
|
|
12
|
+
if (!response.ok) {
|
|
13
|
+
const text = await response.text();
|
|
14
|
+
return errorResult(`Failed to fetch rich block rules (${response.status}): ${text}`);
|
|
15
|
+
}
|
|
16
|
+
const data = (await response.json());
|
|
17
|
+
return successResult(data.rules);
|
|
18
|
+
}
|
|
19
|
+
catch (err) {
|
|
20
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
21
|
+
return errorResult(`Rich block rules request failed: ${message}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export const richBlockRulesInputSchema = {};
|
|
25
|
+
export const richBlockRulesTools = [
|
|
26
|
+
{
|
|
27
|
+
name: 'office_claw_get_rich_block_rules',
|
|
28
|
+
description: 'Get the full rich block usage rules (card/diff/checklist/media_gallery/audio/interactive). ' +
|
|
29
|
+
'Call this BEFORE creating your first rich block in a session — it returns the full schema and constraints. ' +
|
|
30
|
+
'You only need to call this once per session; the rules do not change within a session. ' +
|
|
31
|
+
'GOTCHA: Without loading these rules first, you will likely produce invalid block JSON (wrong field names, missing required fields).',
|
|
32
|
+
inputSchema: richBlockRulesInputSchema,
|
|
33
|
+
handler: handleGetRichBlockRules,
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
//# sourceMappingURL=rich-block-rules-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rich-block-rules-tool.js","sourceRoot":"","sources":["../../src/tools/rich-block-rules-tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE7D,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAE,CAAC;AAEpD,MAAM,CAAC,KAAK,UAAU,uBAAuB;IAC3C,MAAM,GAAG,GAAG,GAAG,OAAO,iCAAiC,CAAC;IAExD,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;QAElC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACnC,OAAO,WAAW,CAAC,qCAAqC,QAAQ,CAAC,MAAM,MAAM,IAAI,EAAE,CAAC,CAAC;QACvF,CAAC;QAED,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAsB,CAAC;QAC1D,OAAO,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACjE,OAAO,WAAW,CAAC,oCAAoC,OAAO,EAAE,CAAC,CAAC;IACpE,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAE5C,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC;QACE,IAAI,EAAE,kCAAkC;QACxC,WAAW,EACT,6FAA6F;YAC7F,6GAA6G;YAC7G,yFAAyF;YACzF,qIAAqI;QACvI,WAAW,EAAE,yBAAyB;QACtC,OAAO,EAAE,uBAAuB;KACjC;CACO,CAAC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ToolResult } from './file-tools.js';
|
|
3
|
+
export declare const listScheduledTasksInputSchema: {};
|
|
4
|
+
export declare function handleListScheduledTasks(_input: Record<string, never>): Promise<ToolResult>;
|
|
5
|
+
export declare const listScheduleTemplatesInputSchema: {};
|
|
6
|
+
export declare function handleListScheduleTemplates(_input: Record<string, never>): Promise<ToolResult>;
|
|
7
|
+
export declare const registerScheduledTaskInputSchema: {
|
|
8
|
+
templateId: z.ZodString;
|
|
9
|
+
trigger: z.ZodString;
|
|
10
|
+
params: z.ZodOptional<z.ZodString>;
|
|
11
|
+
deliveryThreadId: z.ZodOptional<z.ZodString>;
|
|
12
|
+
label: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
13
|
+
category: z.ZodOptional<z.ZodString>;
|
|
14
|
+
description: z.ZodOptional<z.ZodString>;
|
|
15
|
+
};
|
|
16
|
+
export declare function handleRegisterScheduledTask(input: {
|
|
17
|
+
templateId: string;
|
|
18
|
+
trigger: string;
|
|
19
|
+
params?: string;
|
|
20
|
+
deliveryThreadId?: string;
|
|
21
|
+
label?: string;
|
|
22
|
+
category?: string;
|
|
23
|
+
description?: string;
|
|
24
|
+
}): Promise<ToolResult>;
|
|
25
|
+
export declare const previewScheduledTaskInputSchema: {
|
|
26
|
+
templateId: z.ZodString;
|
|
27
|
+
trigger: z.ZodString;
|
|
28
|
+
params: z.ZodOptional<z.ZodString>;
|
|
29
|
+
deliveryThreadId: z.ZodOptional<z.ZodString>;
|
|
30
|
+
};
|
|
31
|
+
export declare function handlePreviewScheduledTask(input: {
|
|
32
|
+
templateId: string;
|
|
33
|
+
trigger: string;
|
|
34
|
+
params?: string;
|
|
35
|
+
deliveryThreadId?: string;
|
|
36
|
+
}): Promise<ToolResult>;
|
|
37
|
+
export declare const updateScheduledTaskInputSchema: {
|
|
38
|
+
taskId: z.ZodString;
|
|
39
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
40
|
+
trigger: z.ZodOptional<z.ZodString>;
|
|
41
|
+
params: z.ZodOptional<z.ZodString>;
|
|
42
|
+
deliveryThreadId: z.ZodOptional<z.ZodString>;
|
|
43
|
+
label: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
44
|
+
category: z.ZodOptional<z.ZodString>;
|
|
45
|
+
description: z.ZodOptional<z.ZodString>;
|
|
46
|
+
};
|
|
47
|
+
export declare function handleUpdateScheduledTask(input: {
|
|
48
|
+
taskId: string;
|
|
49
|
+
enabled?: boolean;
|
|
50
|
+
trigger?: string;
|
|
51
|
+
params?: string;
|
|
52
|
+
deliveryThreadId?: string;
|
|
53
|
+
label?: string;
|
|
54
|
+
category?: string;
|
|
55
|
+
description?: string;
|
|
56
|
+
}): Promise<ToolResult>;
|
|
57
|
+
export declare const removeScheduledTaskInputSchema: {
|
|
58
|
+
taskId: z.ZodString;
|
|
59
|
+
};
|
|
60
|
+
export declare function handleRemoveScheduledTask(input: {
|
|
61
|
+
taskId: string;
|
|
62
|
+
}): Promise<ToolResult>;
|
|
63
|
+
export declare const setScheduledTaskEnabledInputSchema: {
|
|
64
|
+
taskId: z.ZodString;
|
|
65
|
+
enabled: z.ZodBoolean;
|
|
66
|
+
};
|
|
67
|
+
export declare function handleSetScheduledTaskEnabled(input: {
|
|
68
|
+
taskId: string;
|
|
69
|
+
enabled: boolean;
|
|
70
|
+
}): Promise<ToolResult>;
|
|
71
|
+
export declare const scheduleTools: readonly [{
|
|
72
|
+
readonly name: "office_claw_list_scheduled_tasks";
|
|
73
|
+
readonly description: string;
|
|
74
|
+
readonly inputSchema: {};
|
|
75
|
+
readonly handler: typeof handleListScheduledTasks;
|
|
76
|
+
}, {
|
|
77
|
+
readonly name: "office_claw_list_schedule_templates";
|
|
78
|
+
readonly description: string;
|
|
79
|
+
readonly inputSchema: {};
|
|
80
|
+
readonly handler: typeof handleListScheduleTemplates;
|
|
81
|
+
}, {
|
|
82
|
+
readonly name: "office_claw_preview_scheduled_task";
|
|
83
|
+
readonly description: string;
|
|
84
|
+
readonly inputSchema: {
|
|
85
|
+
templateId: z.ZodString;
|
|
86
|
+
trigger: z.ZodString;
|
|
87
|
+
params: z.ZodOptional<z.ZodString>;
|
|
88
|
+
deliveryThreadId: z.ZodOptional<z.ZodString>;
|
|
89
|
+
};
|
|
90
|
+
readonly handler: typeof handlePreviewScheduledTask;
|
|
91
|
+
}, {
|
|
92
|
+
readonly name: "office_claw_register_scheduled_task";
|
|
93
|
+
readonly description: string;
|
|
94
|
+
readonly inputSchema: {
|
|
95
|
+
templateId: z.ZodString;
|
|
96
|
+
trigger: z.ZodString;
|
|
97
|
+
params: z.ZodOptional<z.ZodString>;
|
|
98
|
+
deliveryThreadId: z.ZodOptional<z.ZodString>;
|
|
99
|
+
label: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
100
|
+
category: z.ZodOptional<z.ZodString>;
|
|
101
|
+
description: z.ZodOptional<z.ZodString>;
|
|
102
|
+
};
|
|
103
|
+
readonly handler: typeof handleRegisterScheduledTask;
|
|
104
|
+
}, {
|
|
105
|
+
readonly name: "office_claw_update_scheduled_task";
|
|
106
|
+
readonly description: string;
|
|
107
|
+
readonly inputSchema: {
|
|
108
|
+
taskId: z.ZodString;
|
|
109
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
110
|
+
trigger: z.ZodOptional<z.ZodString>;
|
|
111
|
+
params: z.ZodOptional<z.ZodString>;
|
|
112
|
+
deliveryThreadId: z.ZodOptional<z.ZodString>;
|
|
113
|
+
label: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
114
|
+
category: z.ZodOptional<z.ZodString>;
|
|
115
|
+
description: z.ZodOptional<z.ZodString>;
|
|
116
|
+
};
|
|
117
|
+
readonly handler: typeof handleUpdateScheduledTask;
|
|
118
|
+
}, {
|
|
119
|
+
readonly name: "office_claw_set_scheduled_task_enabled";
|
|
120
|
+
readonly description: string;
|
|
121
|
+
readonly inputSchema: {
|
|
122
|
+
taskId: z.ZodString;
|
|
123
|
+
enabled: z.ZodBoolean;
|
|
124
|
+
};
|
|
125
|
+
readonly handler: typeof handleSetScheduledTaskEnabled;
|
|
126
|
+
}, {
|
|
127
|
+
readonly name: "office_claw_remove_scheduled_task";
|
|
128
|
+
readonly description: string;
|
|
129
|
+
readonly inputSchema: {
|
|
130
|
+
taskId: z.ZodString;
|
|
131
|
+
};
|
|
132
|
+
readonly handler: typeof handleRemoveScheduledTask;
|
|
133
|
+
}];
|
|
134
|
+
//# sourceMappingURL=schedule-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-tools.d.ts","sourceRoot":"","sources":["../../src/tools/schedule-tools.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AA+DlD,eAAO,MAAM,6BAA6B,IAAK,CAAC;AAEhD,wBAAsB,wBAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC,UAAU,CAA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