toc-ocra 0.2.0 → 0.2.2

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/locales/en.json CHANGED
@@ -1,20 +1,29 @@
1
1
  {
2
- "nav": { "title": "Device agent" },
2
+ "nav": {
3
+ "title": "Device agent"
4
+ },
3
5
  "page": {
4
6
  "title": "Device agent",
5
- "subtitle": "Let this computer take tasks from task chains and run CLIs such as Codex and Claude locally."
7
+ "subtitle": "Let computers take tasks from task chains: enable this one with one click, connect others with one command."
8
+ },
9
+ "common": {
10
+ "copy": "Copy",
11
+ "copied": "Copied",
12
+ "checking": "Checking the local service…"
13
+ },
14
+ "error": {
15
+ "offline": "Can't reach the local service. Make sure toc-ocra is running."
6
16
  },
7
- "common": { "copy": "Copy", "copied": "Copied", "checking": "Checking the local service…" },
8
- "error": { "offline": "Can't reach the local service. Make sure toc-ocra is running." },
9
17
  "health": {
10
18
  "online": "Online: {{name}}",
11
19
  "disconnected": "Bound, but the server is not reachable right now",
12
20
  "unpaired": "Local service running, not bound to a server yet",
13
- "offline": "Local service not running"
21
+ "offline": "Local service not running",
22
+ "disabled": "The local device agent is off"
14
23
  },
15
24
  "offline": {
16
25
  "title": "Local service not running",
17
- "body": "The plugin talks to the local toc-ocra service at {{url}}. Start it in a terminal; the plugin never launches programs for you.",
26
+ "body": "The plugin talks to the local toc-ocra service at {{url}}. This desktop app version cannot start it for you, so start it in a terminal; after updating the app you can switch it on here.",
18
27
  "once": "Run once (stops when the terminal closes)",
19
28
  "service": "For everyday use: install it as a background service that starts at login",
20
29
  "node": "Requires Node.js 20 or newer. This page refreshes on its own once the service is up."
@@ -38,7 +47,12 @@
38
47
  "tokenFromEnv": "The device token comes from the TOC_OCRA_TOKEN environment variable, so binding can't be changed here.",
39
48
  "unpair": "Unbind"
40
49
  },
41
- "binding": { "unpaired": "Not bound", "revoked": "Credentials revoked", "online": "Online", "connecting": "Connecting" },
50
+ "binding": {
51
+ "unpaired": "Not bound",
52
+ "revoked": "Credentials revoked",
53
+ "online": "Online",
54
+ "connecting": "Connecting"
55
+ },
42
56
  "bind": {
43
57
  "title": "Bind to the current server",
44
58
  "rebindTitle": "Bind again",
@@ -56,11 +70,73 @@
56
70
  "noServer": "The server address is missing.",
57
71
  "done": "This computer is now bound to {{server}}"
58
72
  },
73
+ "auto": {
74
+ "done": "Switched to {{server}} automatically (device: {{device}})",
75
+ "deferred": "Tasks are running; this computer switches to {{server}} when they finish"
76
+ },
59
77
  "cli": {
60
78
  "title": "CLIs on this computer",
61
79
  "runnable": "Runnable",
62
80
  "detectOnly": "Detected only",
63
81
  "none": "No usable CLI detected.",
64
82
  "redetect": "Detect again"
83
+ },
84
+ "tabs": {
85
+ "local": "This computer",
86
+ "remote": "Other computers"
87
+ },
88
+ "service": {
89
+ "title": "Local device agent",
90
+ "onBody": "On: this computer takes tasks from task chains and runs CLIs such as Codex and Claude locally.",
91
+ "offBody": "Turn it on and the desktop app starts the device agent on this computer and binds it to the current server. No terminal needed.",
92
+ "followsApp": "The agent follows the desktop app: it starts with the app and stops when the app quits (it shows offline about 90 seconds later).",
93
+ "starting": "Starting the local device agent…",
94
+ "external": "A device agent is already running on this computer (a background service or toc-ocra started in a terminal), so the plugin connects to it. The switch only controls the agent the desktop app starts.",
95
+ "crashed": "The device agent stopped unexpectedly: {{error}}"
96
+ },
97
+ "remote": {
98
+ "title": "Install on another computer",
99
+ "body": "A Linux server, another Mac or a Windows PC: generate one command and run it in that computer's terminal. It installs, pairs and sets up the background service, and this page shows the match when it is done.",
100
+ "server": "Server address that computer uses",
101
+ "serverInvalid": "The server address is invalid. Use an address starting with http:// or https://.",
102
+ "loopback": "127.0.0.1 / localhost only works on this computer. Other computers cannot reach it; use this server's LAN or public address.",
103
+ "add": "Add a computer",
104
+ "platformLabel": "System",
105
+ "platform": {
106
+ "linux": "Linux server",
107
+ "mac": "macOS",
108
+ "win": "Windows"
109
+ },
110
+ "name": "Device name",
111
+ "namePlaceholder": "e.g. Test server",
112
+ "generate": "Generate install command",
113
+ "working": "Generating…",
114
+ "cancel": "Cancel",
115
+ "pendingTitle": "Run on \"{{name}}\"",
116
+ "pendingBody": "Copy this command and run it in that computer's terminal:",
117
+ "hintNode": "Requires Node.js 20 or newer.",
118
+ "hintLinux": "If npm reports a permission error, prefix npm install with sudo (or use Node from nvm). To stay online after logging out, run loginctl enable-linger \"$USER\" once.",
119
+ "hintWindows": "Run it in PowerShell.",
120
+ "expires": "The pairing code expires in {{minutes}}:{{seconds}} and works once.",
121
+ "expired": "The pairing code expired. Generate a new one.",
122
+ "waiting": "Waiting for that computer to run the command… This updates on its own.",
123
+ "regenerate": "Generate again",
124
+ "matched": "Matched",
125
+ "matchedBody": "\"{{name}}\" is online and ready to use in workstations.",
126
+ "matchedNotice": "\"{{name}}\" is online",
127
+ "done": "Done",
128
+ "listTitle": "My other computers",
129
+ "empty": "No other computers yet.",
130
+ "install": "Generate install command",
131
+ "repair": "Pair again",
132
+ "enabled": "Take tasks",
133
+ "disableHint": "Turning off \"Take tasks\" disables the device: the pairing is kept, no tasks are sent, and turning it back on restores it right away without touching that computer.",
134
+ "uninstall": "To uninstall completely, run on that computer",
135
+ "status": {
136
+ "online": "Online",
137
+ "offline": "Offline",
138
+ "disabled": "Disabled",
139
+ "notConnected": "Not paired"
140
+ }
65
141
  }
66
142
  }
@@ -1,20 +1,29 @@
1
1
  {
2
- "nav": { "title": "设备代理" },
2
+ "nav": {
3
+ "title": "设备代理"
4
+ },
3
5
  "page": {
4
6
  "title": "设备代理",
5
- "subtitle": "让这台电脑接收任务链派发的任务,并在本机运行 Codex、Claude 等 CLI。"
7
+ "subtitle": "让电脑接收任务链派发的任务:本机一键启用,其他电脑用一条命令接入。"
8
+ },
9
+ "common": {
10
+ "copy": "复制",
11
+ "copied": "已复制",
12
+ "checking": "正在检查本机服务…"
13
+ },
14
+ "error": {
15
+ "offline": "连不上本机服务,请确认 toc-ocra 正在运行。"
6
16
  },
7
- "common": { "copy": "复制", "copied": "已复制", "checking": "正在检查本机服务…" },
8
- "error": { "offline": "连不上本机服务,请确认 toc-ocra 正在运行。" },
9
17
  "health": {
10
18
  "online": "已在线:{{name}}",
11
19
  "disconnected": "已绑定,但暂时连不上服务器",
12
20
  "unpaired": "本机服务已运行,尚未绑定服务器",
13
- "offline": "本机服务未运行"
21
+ "offline": "本机服务未运行",
22
+ "disabled": "本机设备代理未启用"
14
23
  },
15
24
  "offline": {
16
25
  "title": "本机服务未运行",
17
- "body": "插件通过 {{url}} 连接本机的 toc-ocra 服务。请在终端启动它(需要你亲自运行一次,插件不会替你启动程序)。",
26
+ "body": "插件通过 {{url}} 连接本机的 toc-ocra 服务。当前桌面端版本不支持一键启用,请在终端启动它;升级桌面端后可以直接在这里开关。",
18
27
  "once": "临时运行(关闭终端即停止)",
19
28
  "service": "长期使用:安装为后台服务,开机自动启动",
20
29
  "node": "需要 Node.js 20 或以上。启动后本页会自动刷新。"
@@ -38,7 +47,12 @@
38
47
  "tokenFromEnv": "设备令牌来自环境变量 TOC_OCRA_TOKEN,不能在这里绑定或解绑。",
39
48
  "unpair": "解除绑定"
40
49
  },
41
- "binding": { "unpaired": "未绑定", "revoked": "凭据已失效", "online": "在线", "connecting": "连接中" },
50
+ "binding": {
51
+ "unpaired": "未绑定",
52
+ "revoked": "凭据已失效",
53
+ "online": "在线",
54
+ "connecting": "连接中"
55
+ },
42
56
  "bind": {
43
57
  "title": "绑定到当前服务器",
44
58
  "rebindTitle": "重新绑定",
@@ -56,11 +70,73 @@
56
70
  "noServer": "缺少服务器地址。",
57
71
  "done": "这台电脑已绑定到 {{server}}"
58
72
  },
73
+ "auto": {
74
+ "done": "已自动切换到 {{server}}(设备:{{device}})",
75
+ "deferred": "当前有任务在执行,完成后自动切换到 {{server}}"
76
+ },
59
77
  "cli": {
60
78
  "title": "本机 CLI",
61
79
  "runnable": "可执行",
62
80
  "detectOnly": "仅检测到",
63
81
  "none": "没有检测到可用的 CLI。",
64
82
  "redetect": "重新检测"
83
+ },
84
+ "tabs": {
85
+ "local": "本机",
86
+ "remote": "其他电脑"
87
+ },
88
+ "service": {
89
+ "title": "本机设备代理",
90
+ "onBody": "已启用:这台电脑会接收任务链派发的任务,并在本机运行 Codex、Claude 等 CLI。",
91
+ "offBody": "打开后,桌面端会在这台电脑上启动设备代理,并自动绑定到当前服务器,不需要打开终端。",
92
+ "followsApp": "设备代理跟随桌面端运行:打开桌面端时自动启动,退出桌面端即停止(停止后约 90 秒显示离线)。",
93
+ "starting": "正在启动本机设备代理…",
94
+ "external": "这台电脑上已有设备代理在运行(后台服务或终端启动的 toc-ocra),已直接连接它;开关只控制由桌面端启动的设备代理。",
95
+ "crashed": "设备代理意外退出:{{error}}"
96
+ },
97
+ "remote": {
98
+ "title": "在其他电脑上安装",
99
+ "body": "Linux 服务器、另一台 Mac 或 Windows:生成一条命令,到那台电脑的终端执行,完成安装、配对和后台服务,执行完这里会自动显示已匹配。",
100
+ "server": "那台电脑访问的服务器地址",
101
+ "serverInvalid": "服务器地址无效,请填写 http:// 或 https:// 开头的地址。",
102
+ "loopback": "127.0.0.1 / localhost 只在本机可用,其他电脑连不上,请改成这台服务器的局域网或公网地址。",
103
+ "add": "添加电脑",
104
+ "platformLabel": "系统",
105
+ "platform": {
106
+ "linux": "Linux 服务器",
107
+ "mac": "macOS",
108
+ "win": "Windows"
109
+ },
110
+ "name": "设备名称",
111
+ "namePlaceholder": "例如:测试服务器",
112
+ "generate": "生成安装命令",
113
+ "working": "正在生成…",
114
+ "cancel": "取消",
115
+ "pendingTitle": "在「{{name}}」上执行",
116
+ "pendingBody": "复制下面的命令,到那台电脑的终端执行:",
117
+ "hintNode": "需要 Node.js 20 或以上。",
118
+ "hintLinux": "npm 提示权限不足时,可在 npm install 前加 sudo(或使用 nvm 安装的 Node);需要退出登录后也保持在线,执行一次 loginctl enable-linger \"$USER\"。",
119
+ "hintWindows": "在 PowerShell 中执行。",
120
+ "expires": "配对码 {{minutes}}:{{seconds}} 后失效,只能使用一次。",
121
+ "expired": "配对码已失效,请重新生成。",
122
+ "waiting": "等待那台电脑执行命令…执行完成后这里会自动更新。",
123
+ "regenerate": "重新生成",
124
+ "matched": "已匹配",
125
+ "matchedBody": "「{{name}}」已上线,可以在工位里使用它了。",
126
+ "matchedNotice": "「{{name}}」已上线",
127
+ "done": "完成",
128
+ "listTitle": "我的其他电脑",
129
+ "empty": "还没有其他电脑。",
130
+ "install": "生成安装命令",
131
+ "repair": "重新配对",
132
+ "enabled": "接收任务",
133
+ "disableHint": "关闭「接收任务」即停用:保留配对,不再派发任务,重新打开立即恢复,不需要操作那台电脑。",
134
+ "uninstall": "彻底卸载:在那台电脑上执行",
135
+ "status": {
136
+ "online": "在线",
137
+ "offline": "离线",
138
+ "disabled": "已停用",
139
+ "notConnected": "未配对"
140
+ }
65
141
  }
66
142
  }
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "toc-ocra",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Echo device agent: local CLI execution service plus its desktop plugin (heartbeat + long-poll, headless CLIs)",
5
5
  "type": "module",
6
6
  "bin": {
7
- "toc-ocra": "./dist/src/index.js"
7
+ "toc-ocra": "dist/src/index.js"
8
8
  },
9
9
  "files": [
10
10
  "dist/src/",
11
11
  "dist/plugin/",
12
+ "dist/service/",
12
13
  "assets/",
13
14
  "locales/",
14
15
  "scripts/service.mjs",
@@ -16,7 +17,8 @@
16
17
  "LICENSE"
17
18
  ],
18
19
  "scripts": {
19
- "build": "tsc -p tsconfig.json && npm run build:plugin",
20
+ "build": "tsc -p tsconfig.json && npm run build:service && npm run build:plugin",
21
+ "build:service": "node scripts/build-service.mjs",
20
22
  "dev": "tsx src/index.ts run",
21
23
  "start": "node dist/src/index.js run",
22
24
  "doctor": "tsx src/index.ts doctor",
@@ -40,6 +42,7 @@
40
42
  "@toc-starter/plugin-sdk": "file:../echo_web/packages/plugin-sdk",
41
43
  "@types/node": "^22.15.0",
42
44
  "@types/react": "18.3.12",
45
+ "esbuild": "0.28.2",
43
46
  "tsx": "^4.20.0",
44
47
  "typescript": "^5.8.0",
45
48
  "vitest": "^3.2.0"
@@ -48,7 +51,7 @@
48
51
  "tocPlugin": {
49
52
  "id": "echo.device-agent",
50
53
  "displayName": "设备代理",
51
- "description": "让这台电脑接收任务链派发的任务:连接本机 toc-ocra 服务,一键绑定到当前服务器,查看在线状态和本机 CLI。",
54
+ "description": "让电脑接收任务链派发的任务:本机一键启用或关闭设备代理,其他电脑用一条命令接入并自动匹配,查看在线状态和 CLI。",
52
55
  "publisher": "Echo",
53
56
  "apiVersion": "1.x",
54
57
  "platforms": [
@@ -57,7 +60,8 @@
57
60
  "icon": "./assets/icon.svg",
58
61
  "entries": {
59
62
  "renderer": "./dist/plugin/renderer.js",
60
- "style": "./dist/plugin/renderer.css"
63
+ "style": "./dist/plugin/renderer.css",
64
+ "service": "./dist/service/agent.mjs"
61
65
  },
62
66
  "locales": {
63
67
  "en": "./locales/en.json",
@@ -67,7 +71,8 @@
67
71
  "storage:plugin",
68
72
  "secureStorage:plugin",
69
73
  "notifications:publish",
70
- "api:user"
74
+ "api:user",
75
+ "service:local"
71
76
  ],
72
77
  "contributes": {
73
78
  "navigation": [