@recued/dsh-officeroutines 0.0.0-stage → 0.1.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 +73 -2
- package/cordis.patch.yml +7 -0
- package/icon.svg +6 -0
- package/index.js +11 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +34 -4
- package/server.js +105 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 OfficeRoutines contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,74 @@
|
|
|
1
|
-
#
|
|
1
|
+
# OfficeRoutines for DeepSeek Harness
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This [DSH](https://github.com/deepseek-ai/deepseek-harness) plugin connects
|
|
4
|
+
[OfficeRoutines](https://github.com/recued/office-routines), so the agent can
|
|
5
|
+
read and change Excel, Word, and PowerPoint files, and documents open in
|
|
6
|
+
Office.
|
|
7
|
+
|
|
8
|
+
[中文说明](#中文说明)
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
1. Install OfficeRoutines from its
|
|
13
|
+
[releases](https://github.com/recued/office-routines/releases), and
|
|
14
|
+
[OfficeCLI](https://github.com/iOfficeAI/OfficeCLI#for-humans).
|
|
15
|
+
2. Add the plugin, then restart DSH:
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
dsh plugin --profile web add @recued/dsh-officeroutines
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The plugin finds `ofrt` on PATH, then where the OfficeRoutines installers put
|
|
22
|
+
it: the Mac app, `~/.local/bin` on Linux, and
|
|
23
|
+
`%LOCALAPPDATA%\Programs\OfficeRoutines` on Windows. When the Office companion
|
|
24
|
+
is set up, the plugin also passes its connection file, so the agent can change
|
|
25
|
+
documents open in Office. The tools are named `mcp__officeroutines__…`.
|
|
26
|
+
|
|
27
|
+
It needs DSH 0.2.2-rc.5 or a later 0.2 release, in a profile with DSH's MCP
|
|
28
|
+
server manager, such as `web`.
|
|
29
|
+
|
|
30
|
+
## Configure
|
|
31
|
+
|
|
32
|
+
To choose the command or its arguments, override the plugin's row in the
|
|
33
|
+
profile's `cordis.patch.yml`. Without `--allow-folder`, the agent can open any
|
|
34
|
+
file your account can.
|
|
35
|
+
|
|
36
|
+
```yaml
|
|
37
|
+
- id: officeroutines-plugin
|
|
38
|
+
config:
|
|
39
|
+
command: /Applications/OfficeRoutines.app/Contents/MacOS/ofrt
|
|
40
|
+
args: [job, mcp, --allow-folder, /Users/me/Reports]
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`ofrt job mcp install dsh` connects DSH to OfficeRoutines without npm. Use one
|
|
44
|
+
or the other: both name the server `officeroutines`.
|
|
45
|
+
|
|
46
|
+
## 中文说明
|
|
47
|
+
|
|
48
|
+
此 DSH 插件连接 [OfficeRoutines](https://github.com/recued/office-routines),
|
|
49
|
+
让智能体读取和修改 Excel、Word 和 PowerPoint 文件,以及在 Office 中打开的文档。
|
|
50
|
+
|
|
51
|
+
1. 从 [发布页面](https://github.com/recued/office-routines/releases) 安装
|
|
52
|
+
OfficeRoutines,并安装 [OfficeCLI](https://github.com/iOfficeAI/OfficeCLI#for-humans)。
|
|
53
|
+
2. 添加插件,然后重启 DSH:
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
dsh plugin --profile web add @recued/dsh-officeroutines
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
插件先在 PATH 中查找 `ofrt`,再查找安装程序的默认位置:Mac 应用、Linux 的
|
|
60
|
+
`~/.local/bin`,以及 Windows 的 `%LOCALAPPDATA%\Programs\OfficeRoutines`。设置好
|
|
61
|
+
OfficeRoutines 配套程序后,插件还会传入它的连接文件,让智能体修改在 Office
|
|
62
|
+
中打开的文档。工具名称以 `mcp__officeroutines__` 开头。
|
|
63
|
+
|
|
64
|
+
需要 DSH 0.2.2-rc.5 或更高的 0.2 版本,并使用带有 MCP 服务器管理器的配置(如
|
|
65
|
+
`web`)。如需指定命令或参数,请按上面的示例在配置的 `cordis.patch.yml` 中覆盖
|
|
66
|
+
`officeroutines-plugin` 这一行。除非参数包含 `--allow-folder`,否则智能体可以打开
|
|
67
|
+
当前账户能访问的任何文件。
|
|
68
|
+
|
|
69
|
+
`ofrt job mcp install dsh` 无需 npm 也能连接 DSH。两者只选其一:它们都把服务器
|
|
70
|
+
命名为 `officeroutines`。
|
|
71
|
+
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
MIT
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Adds the OfficeRoutines plugin, which registers ofrt with DSH's MCP server
|
|
2
|
+
# manager. Override this row by id in a profile's cordis.patch.yml to set its
|
|
3
|
+
# command or args.
|
|
4
|
+
- insert:
|
|
5
|
+
- id: officeroutines-plugin
|
|
6
|
+
name: '@recued/dsh-officeroutines'
|
|
7
|
+
config: {}
|
package/icon.svg
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 36 36">
|
|
2
|
+
<path d="M12 6.5h9l5.5 5.5v15.5a2 2 0 0 1-2 2H12a2 2 0 0 1-2-2v-19a2 2 0 0 1 2-2z" fill="none" stroke="#247bbf" stroke-width="2" stroke-linejoin="round"/>
|
|
3
|
+
<path d="M21 6.5V12h5.5" fill="none" stroke="#247bbf" stroke-width="2" stroke-linejoin="round"/>
|
|
4
|
+
<rect x="13" y="16" width="10.5" height="10" rx="1" fill="none" stroke="#247bbf" stroke-width="1.6"/>
|
|
5
|
+
<path d="M13 19.5h10.5M13 23h10.5M16.75 16v10" fill="none" stroke="#247bbf" stroke-width="1.6"/>
|
|
6
|
+
</svg>
|
package/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { findServer } from './server.js'
|
|
2
|
+
|
|
3
|
+
export const name = 'officeroutines'
|
|
4
|
+
export const inject = ['mcpManager']
|
|
5
|
+
|
|
6
|
+
// apply registers OfficeRoutines with DSH's MCP server manager for as long as
|
|
7
|
+
// the plugin runs. Without ofrt, activation fails and says how to install it.
|
|
8
|
+
export function apply(ctx, config) {
|
|
9
|
+
const server = findServer({ config: config ?? {} })
|
|
10
|
+
ctx.mcpManager.register('officeroutines', { transport: 'stdio', command: server.command, args: server.args })
|
|
11
|
+
}
|
package/locale/en.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"title": "OfficeRoutines",
|
|
4
|
+
"description": "Lets the agent read and change Excel, Word, and PowerPoint files through OfficeRoutines on this computer, and documents open in Office once the OfficeRoutines companion is set up. Its tools are named mcp__officeroutines__…. Install OfficeRoutines first: the plugin finds ofrt on PATH or where its installers put it, and its configuration can set command and args instead. Unless args include --allow-folder, the agent can open any file your account can."
|
|
5
|
+
}
|
|
6
|
+
}
|
package/locale/zh.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"title": "OfficeRoutines",
|
|
4
|
+
"description": "让智能体通过本机的 OfficeRoutines 读取和修改 Excel、Word 和 PowerPoint 文件;设置好 OfficeRoutines 配套程序后,还能修改在 Office 中打开的文档。工具名称以 mcp__officeroutines__ 开头。请先安装 OfficeRoutines:插件会在 PATH 和安装程序的默认位置查找 ofrt,也可以在插件配置中用 command 和 args 指定。除非 args 包含 --allow-folder,否则智能体可以打开当前账户能访问的任何文件。"
|
|
5
|
+
}
|
|
6
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@recued/dsh-officeroutines",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "DeepSeek Harness (DSH) plugin that connects OfficeRoutines, so the agent can read and change Excel, Word, and PowerPoint documents.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./index.js",
|
|
8
|
+
"./locale/*.json": "./locale/*.json",
|
|
9
|
+
"./icon": "./icon.svg"
|
|
10
|
+
},
|
|
11
|
+
"files": ["index.js", "server.js", "cordis.patch.yml", "locale/*.json", "icon.svg", "README.md", "LICENSE"],
|
|
12
|
+
"engines": {
|
|
13
|
+
"dsh": "^0.2.2-rc.5"
|
|
14
|
+
},
|
|
15
|
+
"dsh": {
|
|
16
|
+
"bundle": {
|
|
17
|
+
"patch": "./cordis.patch.yml"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"test": "node --test test/server.test.mjs"
|
|
22
|
+
},
|
|
23
|
+
"keywords": ["dsh", "dsh-plugin", "deepseek-harness", "deepseek", "mcp", "officeroutines", "excel", "word", "powerpoint", "office"],
|
|
24
|
+
"homepage": "https://github.com/recued/office-routines/tree/main/integrations/dsh#readme",
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/recued/office-routines.git",
|
|
28
|
+
"directory": "integrations/dsh"
|
|
29
|
+
},
|
|
30
|
+
"bugs": "https://github.com/recued/office-routines/issues",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"author": "Recued",
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
}
|
|
36
|
+
}
|
package/server.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { accessSync, constants, existsSync, statSync } from 'node:fs'
|
|
2
|
+
import { homedir } from 'node:os'
|
|
3
|
+
import path from 'node:path'
|
|
4
|
+
|
|
5
|
+
const releases = 'https://github.com/recued/office-routines/releases'
|
|
6
|
+
|
|
7
|
+
// findServer works out how DSH starts OfficeRoutines on this computer: the
|
|
8
|
+
// ofrt command, and the Office companion's connection file when the companion
|
|
9
|
+
// has run, so the agent can also reach documents open in Office. ofrt finds
|
|
10
|
+
// OfficeCLI itself. The row's config can name the command and arguments.
|
|
11
|
+
export function findServer({
|
|
12
|
+
config = {},
|
|
13
|
+
env = process.env,
|
|
14
|
+
platform = process.platform,
|
|
15
|
+
home = homedir(),
|
|
16
|
+
files = localFiles,
|
|
17
|
+
} = {}) {
|
|
18
|
+
const paths = platform === 'win32' ? path.win32 : path.posix
|
|
19
|
+
const command = text(config.command) || findOfrt(env, platform, home, files, paths)
|
|
20
|
+
if (!command) {
|
|
21
|
+
throw new Error(
|
|
22
|
+
`OfficeRoutines' ofrt command was not found. Install OfficeRoutines from ${releases}, then restart DSH, ` +
|
|
23
|
+
"or set command in this plugin's configuration to the full path of ofrt.",
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
if (Array.isArray(config.args) && config.args.every((arg) => typeof arg === 'string')) {
|
|
27
|
+
return { command, args: [...config.args] }
|
|
28
|
+
}
|
|
29
|
+
const args = ['job', 'mcp']
|
|
30
|
+
const connection = findConnection(env, platform, home, files, paths)
|
|
31
|
+
if (connection) {
|
|
32
|
+
args.push('--excel', connection)
|
|
33
|
+
}
|
|
34
|
+
return { command, args }
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const localFiles = {
|
|
38
|
+
exists: (file) => existsSync(file),
|
|
39
|
+
isProgram(file) {
|
|
40
|
+
try {
|
|
41
|
+
if (!statSync(file).isFile()) {
|
|
42
|
+
return false
|
|
43
|
+
}
|
|
44
|
+
accessSync(file, constants.X_OK)
|
|
45
|
+
return true
|
|
46
|
+
} catch {
|
|
47
|
+
return false
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
isFile(file) {
|
|
51
|
+
try {
|
|
52
|
+
return statSync(file).isFile()
|
|
53
|
+
} catch {
|
|
54
|
+
return false
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function text(value) {
|
|
60
|
+
return typeof value === 'string' && value.trim() !== '' ? value : ''
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// findOfrt looks on PATH, then where each OfficeRoutines installer puts ofrt,
|
|
64
|
+
// since DSH started from a desktop app may not have the shell's PATH.
|
|
65
|
+
function findOfrt(env, platform, home, files, paths) {
|
|
66
|
+
const program = platform === 'win32' ? 'ofrt.exe' : 'ofrt'
|
|
67
|
+
const onPath = (env.PATH ?? env.Path ?? '')
|
|
68
|
+
.split(platform === 'win32' ? ';' : ':')
|
|
69
|
+
.filter((dir) => paths.isAbsolute(dir))
|
|
70
|
+
.map((dir) => paths.join(dir, program))
|
|
71
|
+
const installed = {
|
|
72
|
+
darwin: [
|
|
73
|
+
'/Applications/OfficeRoutines.app/Contents/MacOS/ofrt',
|
|
74
|
+
paths.join(home, 'Applications', 'OfficeRoutines.app', 'Contents', 'MacOS', 'ofrt'),
|
|
75
|
+
'/opt/homebrew/bin/ofrt',
|
|
76
|
+
'/usr/local/bin/ofrt',
|
|
77
|
+
paths.join(home, '.local', 'bin', 'ofrt'),
|
|
78
|
+
],
|
|
79
|
+
linux: [paths.join(home, '.local', 'bin', 'ofrt')],
|
|
80
|
+
win32: env.LOCALAPPDATA ? [paths.join(env.LOCALAPPDATA, 'Programs', 'OfficeRoutines', 'ofrt.exe')] : [],
|
|
81
|
+
}[platform] ?? []
|
|
82
|
+
return [...onPath, ...installed].find((file) => files.isProgram(file)) ?? ''
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// findConnection finds the connection file the Office companion writes for
|
|
86
|
+
// its default port, the way ofrt job mcp install does.
|
|
87
|
+
function findConnection(env, platform, home, files, paths) {
|
|
88
|
+
let file = ''
|
|
89
|
+
if (platform === 'darwin') {
|
|
90
|
+
const config = paths.join(home, 'Library', 'Application Support')
|
|
91
|
+
const legacy = paths.join(config, 'OfficeRelay')
|
|
92
|
+
const state = setting(env, 'MAC_STATE') || (files.exists(legacy) ? legacy : paths.join(config, 'OfficeRoutines'))
|
|
93
|
+
file = paths.join(state, `connection-${setting(env, 'MAC_PORT') || '8765'}.json`)
|
|
94
|
+
} else if (platform === 'win32' && env.LOCALAPPDATA) {
|
|
95
|
+
const legacy = paths.join(env.LOCALAPPDATA, 'OfficeRelay', 'pilot')
|
|
96
|
+
const state = files.exists(legacy) ? legacy : paths.join(env.LOCALAPPDATA, 'OfficeRoutines', 'pilot')
|
|
97
|
+
file = paths.join(state, 'connection.json')
|
|
98
|
+
}
|
|
99
|
+
return file && files.isFile(file) ? file : ''
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// setting reads an ofrt setting, or the OfficeRelay one it replaced.
|
|
103
|
+
function setting(env, name) {
|
|
104
|
+
return Object.hasOwn(env, `OFRT_${name}`) ? env[`OFRT_${name}`] : (env[`OFFICERELAY_${name}`] ?? '')
|
|
105
|
+
}
|