@agimon-ai/po-computer-use 0.0.0-alpha.21 → 0.0.0-alpha.210

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.
Files changed (49) hide show
  1. package/LICENSE +110 -149
  2. package/README.md +9 -8
  3. package/dist/apiContracts.cjs +65 -45
  4. package/dist/apiContracts.cjs.map +1 -1
  5. package/dist/apiContracts.d.mts +2 -2
  6. package/dist/apiContracts.d.mts.map +1 -1
  7. package/dist/apiContracts.mjs +65 -45
  8. package/dist/apiContracts.mjs.map +1 -1
  9. package/dist/extensionService-BKBTsnkI.cjs +1243 -0
  10. package/dist/extensionService-BKBTsnkI.cjs.map +1 -0
  11. package/dist/extensionService-DqtoB79s.mjs +1077 -0
  12. package/dist/extensionService-DqtoB79s.mjs.map +1 -0
  13. package/dist/extensions/mcp-ui.mjs +12 -9
  14. package/dist/extensions/mcp-ui.mjs.map +1 -1
  15. package/dist/extensions/mcp.cjs +13 -5
  16. package/dist/extensions/mcp.cjs.map +1 -1
  17. package/dist/extensions/mcp.d.mts.map +1 -1
  18. package/dist/extensions/mcp.mjs +13 -5
  19. package/dist/extensions/mcp.mjs.map +1 -1
  20. package/dist/extensions/native.mjs +1493 -8
  21. package/dist/extensions/native.mjs.map +1 -1
  22. package/dist/extensions/server.cjs +1035 -645
  23. package/dist/extensions/server.cjs.map +1 -1
  24. package/dist/extensions/server.d.mts.map +1 -1
  25. package/dist/extensions/server.mjs +1020 -630
  26. package/dist/extensions/server.mjs.map +1 -1
  27. package/dist/extensions/web.mjs +1004 -480
  28. package/dist/extensions/web.mjs.map +1 -1
  29. package/dist/index.cjs +14 -5
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.mts +67 -10
  32. package/dist/index.d.mts.map +1 -1
  33. package/dist/index.mjs +14 -5
  34. package/dist/index.mjs.map +1 -1
  35. package/dist/po-runtime-identity.json +1 -0
  36. package/docs/computer-scripts.md +1 -1
  37. package/docs/remote-computer-use.md +11 -0
  38. package/llms.txt +1 -1
  39. package/locales/vi.json +153 -0
  40. package/locales/zh-CN.json +153 -0
  41. package/package.json +84 -24
  42. package/src/prompts/codemode-how-to-computer-use/SKILL.md +83 -0
  43. package/src/types/computerUse.ts +72 -7
  44. package/src/types/computerUseApi.ts +24 -5
  45. package/dist/extensionService-Bp0q295i.cjs +0 -504
  46. package/dist/extensionService-Bp0q295i.cjs.map +0 -1
  47. package/dist/extensionService-DXvF7esO.mjs +0 -434
  48. package/dist/extensionService-DXvF7esO.mjs.map +0 -1
  49. package/src/prompts/po-use-computer-use/SKILL.md +0 -34
@@ -0,0 +1,153 @@
1
+ {
2
+ "computerUse.activityGroup.label": "计算机使用",
3
+ "computerUse.approval.access": "本次会话的智能体和已配对的客户端可以访问会话产物。",
4
+ "computerUse.approval.application": "应用",
5
+ "computerUse.approval.bundleId": "应用包标识符",
6
+ "computerUse.approval.desktopSummary": "在 {minutes} 分钟内,Po 可以查看和控制你的整个桌面。",
7
+ "computerUse.approval.duration": "时长",
8
+ "computerUse.approval.fullValue": "下方列出了完整的{label}。",
9
+ "computerUse.approval.location": "本次会话产物的 computer-use/ 目录。",
10
+ "computerUse.approval.minutes": "{minutes} 分钟",
11
+ "computerUse.approval.processId": "进程 ID",
12
+ "computerUse.approval.reason": "原因",
13
+ "computerUse.approval.recording": "录制",
14
+ "computerUse.approval.recordingOn": "已开启屏幕和音频录制",
15
+ "computerUse.approval.recordingWithTrace": "录制屏幕和音频,并保留操作记录和窗口截图",
16
+ "computerUse.approval.savedTo": "保存位置",
17
+ "computerUse.approval.source": "计算机使用",
18
+ "computerUse.approval.stop": "停止",
19
+ "computerUse.approval.stopHint": "你可以随时在“活动”中停止控制。",
20
+ "computerUse.approval.target": "控制目标",
21
+ "computerUse.approval.title": "允许 Po 控制你的电脑",
22
+ "computerUse.approval.whoCanOpen": "谁可以打开",
23
+ "computerUse.approval.wholeDesktop": "整个桌面",
24
+ "computerUse.approval.window": "窗口",
25
+ "computerUse.approval.windowId": "窗口 ID",
26
+ "computerUse.approval.windowSummary": "在 {minutes} 分钟内,Po 可以查看和控制选中的窗口。",
27
+ "computerUse.guides.computerUse": "电脑操作",
28
+ "computerUse.guides.computerUseLetsPoControlAnApprovedWindowOrTheWholeDesktopOnASupportedMacOSPoDesktopYouChooseTheScopeAndDuration": "电脑操作让 Po 在受支持的 macOS Po Desktop 上控制经你批准的窗口或整个桌面。范围和时长由你决定。",
29
+ "computerUse.guides.enableComputerUseInHostSettingsSelectComputerUseModeThenApprovePoSRequestStopInActivityOrPressCmdShiftEscOnMacOS": "在主机设置中启用 Computer Use,选择 Computer Use 模式,然后批准 Po 的请求。在动态中停止,或在 macOS 上按 Cmd+Shift+Esc。",
30
+ "computerUse.guides.howDoIStartAndStopComputerUse": "如何开始和停止电脑操作?",
31
+ "computerUse.guides.whatCanComputerUseDoForMe": "电脑操作能帮我做什么?",
32
+ "computerUse.mode.activated": "已开启计算机使用。Po 会在接管控制前请求你的批准。",
33
+ "computerUse.mode.deactivated": "已关闭计算机使用。",
34
+ "computerUse.notification.noDetail": "未提供详细信息。",
35
+ "computerUse.notification.recordingFailed": "计算机使用录制失败:{error}",
36
+ "computerUse.notification.recordingNotSaved": "计算机使用的录制文件未能保存到产物中:{error}",
37
+ "computerUse.notification.recordingSaved": "计算机使用的录制文件已保存到 {path}。",
38
+ "computerUse.notification.traceNotSaved": "有一个计算机操作记录文件未能保存到产物中:{error}",
39
+ "computerUse.ui.accessibility": "辅助功能",
40
+ "computerUse.ui.action": "操作",
41
+ "computerUse.ui.actionCount": "{count} 个操作",
42
+ "computerUse.ui.actionCountOne": "{count} 个操作",
43
+ "computerUse.ui.actionsRan": "已执行 {count} 个操作",
44
+ "computerUse.ui.actionsRanOne": "已执行 {count} 个操作",
45
+ "computerUse.ui.allow": "允许",
46
+ "computerUse.ui.allowed": "已允许",
47
+ "computerUse.ui.amount": "数量",
48
+ "computerUse.ui.appliedToTheElement": "已应用到该元素。",
49
+ "computerUse.ui.askedPerApp": "按应用询问",
50
+ "computerUse.ui.authorizedWindow": "已授权的窗口",
51
+ "computerUse.ui.automation": "自动化",
52
+ "computerUse.ui.cancelActivation": "取消启用",
53
+ "computerUse.ui.checkAgain": "重新检查",
54
+ "computerUse.ui.checkingWithMacOS": "正在向 macOS 查询",
55
+ "computerUse.ui.chooseWhichLoginShellVariablesPoDesktop": "选择 Po Desktop 传递给智能体的登录 Shell 变量",
56
+ "computerUse.ui.computerUse": "电脑操作",
57
+ "computerUse.ui.computerUseText": "电脑操作",
58
+ "computerUse.ui.controlling": "Po 正在操作{target}",
59
+ "computerUse.ui.controlWhetherPoDesktopMayExposeSession": "控制 Po Desktop 是否允许会话使用电脑操作功能",
60
+ "computerUse.ui.coreOnly": "仅核心变量",
61
+ "computerUse.ui.desktopActivationIsPending": "等待启用桌面操作。",
62
+ "computerUse.ui.desktopEnvironment": "桌面环境",
63
+ "computerUse.ui.direction": "方向",
64
+ "computerUse.ui.disabled": "已禁用",
65
+ "computerUse.ui.element": "元素",
66
+ "computerUse.ui.elementCount": "{count} 个元素",
67
+ "computerUse.ui.elementCountOne": "{count} 个元素",
68
+ "computerUse.ui.elements": "元素",
69
+ "computerUse.ui.enableComputerUse": "启用电脑操作",
70
+ "computerUse.ui.endedOn": "结束于",
71
+ "computerUse.ui.everyExportedVariableIncludingAPIKeysMinus": "传递所有已导出的变量,包括 API 密钥,但不包括排除项。",
72
+ "computerUse.ui.everything": "全部",
73
+ "computerUse.ui.excluded": "排除项",
74
+ "computerUse.ui.fullDiskAccess": "完全磁盘访问权限",
75
+ "computerUse.ui.hOMEPATHUSERAndSimilarAddOthers": "HOME、PATH、USER 等变量。可在 ~/.po/config.yaml 的 desktopEnvironment.set 中添加其他变量。",
76
+ "computerUse.ui.interactWithApplication": "操作应用",
77
+ "computerUse.ui.letsPoAndItsAgentsControlOther": "允许 Po 及其智能体控制其他应用,例如访达或邮件。macOS 会为每个应用单独询问一次,你的选择可在系统设置中查看。",
78
+ "computerUse.ui.letsPoPressButtonsFillFieldsAnd": "允许 Po 在你批准操作的应用窗口中点击按钮、填写输入框和滚动。",
79
+ "computerUse.ui.letsPoSeeAndRecordTheWindow": "允许 Po 查看并录制你批准的窗口及其声音。授权后,macOS 会要求重新打开 Po。",
80
+ "computerUse.ui.letsYouTalkToPoAndAdds": "允许你与 Po 语音交流,并将你的声音加入电脑操作录制。",
81
+ "computerUse.ui.loginShell": "登录 Shell",
82
+ "computerUse.ui.logs": "日志",
83
+ "computerUse.ui.makesTheComputerUseModeAvailableEach": "启用电脑操作模式。每次操作会话仍需在本机确认。",
84
+ "computerUse.ui.microphone": "麦克风",
85
+ "computerUse.ui.moreElements": "还有 {count} 个元素",
86
+ "computerUse.ui.moreElementsOne": "还有 {count} 个元素",
87
+ "computerUse.ui.moreFromOffset": "从偏移量 {offset} 起还有内容",
88
+ "computerUse.ui.moreLines": "还有 {count} 行",
89
+ "computerUse.ui.moreLinesOne": "还有 {count} 行",
90
+ "computerUse.ui.moreLogLines": "还有 {count} 行日志",
91
+ "computerUse.ui.moreLogLinesOne": "还有 {count} 行日志",
92
+ "computerUse.ui.moreNotShown": "还有内容未显示",
93
+ "computerUse.ui.namePatternsKeptOutSuchAsTOKEN": "不传递的变量名模式,例如 *_TOKEN。可在 ~/.po/config.yaml 中编辑 desktopEnvironment.exclude。",
94
+ "computerUse.ui.notAllowed": "未允许",
95
+ "computerUse.ui.notAskedYet": "尚未询问",
96
+ "computerUse.ui.observationCount": "{count} 次观察",
97
+ "computerUse.ui.observationCountOne": "{count} 次观察",
98
+ "computerUse.ui.observeApplication": "查看应用",
99
+ "computerUse.ui.onlyThese": "仅这些变量",
100
+ "computerUse.ui.onThePairedMac": "在已配对的 Mac 上",
101
+ "computerUse.ui.onThisMac": "在此 Mac 上",
102
+ "computerUse.ui.opened": "已打开",
103
+ "computerUse.ui.openSystemSettings": "打开系统设置",
104
+ "computerUse.ui.optionalLetsAgentsAndTheirToolsRead": "可选。允许智能体及其工具读取文稿、下载和邮件,无需为每个文件夹单独授权。",
105
+ "computerUse.ui.permissionAction": "{action}:已配对 Mac 上的{permission}",
106
+ "computerUse.ui.permissions": "权限",
107
+ "computerUse.ui.permissionsActionsForThePairedMac": "已配对 Mac 的权限操作",
108
+ "computerUse.ui.permissionsBelongToTheMacRunningPo": "权限属于运行 Po Desktop 的 Mac。请在那里打开 Po Desktop 以查看和更改权限。",
109
+ "computerUse.ui.poAsksMacOSForEachOneWhen": "准备好后,Po 会逐项向 macOS 请求权限。提示会显示在运行 Po Desktop 的 Mac 上。你可以随时在系统设置的“隐私与安全性”中更改权限。",
110
+ "computerUse.ui.poAsksMacOSForEachOneWhenText": "准备好后,Po 会逐项向 macOS 请求权限。你可以随时在系统设置的“隐私与安全性”中更改权限。",
111
+ "computerUse.ui.poCouldnTReadThePermissionsJust": "Po 暂时无法读取权限",
112
+ "computerUse.ui.poDesktopDidNotAnswer": "Po Desktop 未响应。",
113
+ "computerUse.ui.poDesktopDidNotReturnPermissionStates": "Po Desktop 未返回权限状态。请重试。",
114
+ "computerUse.ui.poDesktopIsNotRunningHere": "此处未运行 Po Desktop",
115
+ "computerUse.ui.poDesktopReadsYourLoginShellOnce": "Po Desktop 启动时会读取一次登录 Shell。更改将在下次启动时生效。核心变量和 PO_ 设置始终会传递。",
116
+ "computerUse.ui.poIsHandingControlBack": "Po 正在交还控制权",
117
+ "computerUse.ui.recordingFinished": "录制已完成。",
118
+ "computerUse.ui.remainingTime": "剩余 {time}",
119
+ "computerUse.ui.result": "结果",
120
+ "computerUse.ui.runApplicationScript": "运行应用脚本",
121
+ "computerUse.ui.running": "运行中",
122
+ "computerUse.ui.screenAndSystemAudioRecording": "屏幕与系统音频录制",
123
+ "computerUse.ui.screenshotSaved": "截图已保存至 {path}",
124
+ "computerUse.ui.script": "脚本",
125
+ "computerUse.ui.secure": "受保护",
126
+ "computerUse.ui.selectASession": "请选择一个会话。",
127
+ "computerUse.ui.stopComputerUse": "停止电脑操作",
128
+ "computerUse.ui.theActivationCouldNotBeCancelled": "无法取消启用。",
129
+ "computerUse.ui.theChosenWindow": "所选窗口",
130
+ "computerUse.ui.theLastOutcomeIsUncertain": "最后一次操作的结果不确定",
131
+ "computerUse.ui.theseBelongToTheMacRunningPo": "这些权限属于运行 Po Desktop 的 Mac。从这里请求时,macOS 会在那台 Mac 上显示提示。",
132
+ "computerUse.ui.theStopRequestIsUnavailable": "无法发送停止请求。",
133
+ "computerUse.ui.thisTakesAMoment": "请稍候。",
134
+ "computerUse.ui.timeLeft": "剩余时间",
135
+ "computerUse.ui.tryAgain": "重试",
136
+ "computerUse.ui.tryReadingPermissionsFromThePairedMac": "重新尝试读取已配对 Mac 的权限",
137
+ "computerUse.ui.variablesToPass": "要传递的变量",
138
+ "computerUse.ui.waitingForMacOS": "等待 macOS",
139
+ "computerUse.ui.waitingForYourAnswerOnTheMac": "等待你在 Mac 上回答。",
140
+ "computerUse.ui.whatPoMayDoOnThePaired": "Po 在已配对 Mac 上可执行的操作",
141
+ "computerUse.ui.whenSetOnlyMatchingNamesPassEdit": "设置后,仅传递名称匹配的变量。可在 ~/.po/config.yaml 中编辑 desktopEnvironment.includeOnly。",
142
+ "computerUse.ui.yourWholeDesktop": "你的整个桌面",
143
+ "mode.computer-use.activate": "开启",
144
+ "mode.computer-use.computerUse": "计算机使用",
145
+ "mode.computer-use.deactivate": "关闭",
146
+ "mode.computer-use.doctor": "诊断",
147
+ "mode.computer-use.enableComputerUseForThisSession": "为本次会话开启计算机使用。",
148
+ "mode.computer-use.reportDesktopAvailabilityAndSessionState": "查看 Po Desktop 的可用性和会话状态。",
149
+ "mode.computer-use.sessionScopedSemanticControlThroughPoDesktop": "在本次会话中,通过 Po Desktop 识别并操作界面元素。",
150
+ "mode.computer-use.stopThisSessionComputerUseRun": "停止本次会话的计算机控制。",
151
+ "plugin.computer-use.settingsPanels.desktop-permissions.detail": "Po 在此 Mac 上可执行的操作",
152
+ "plugin.computer-use.settingsPanels.desktop-permissions.label": "权限"
153
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agimon-ai/po-computer-use",
3
- "version": "0.0.0-alpha.21",
3
+ "version": "0.0.0-alpha.210",
4
4
  "description": "Session scoped semantic computer control through the Po Desktop capability.",
5
5
  "keywords": [
6
6
  "ai",
@@ -17,12 +17,12 @@
17
17
  "bugs": {
18
18
  "url": "https://github.com/AgiFlow/po/issues"
19
19
  },
20
- "license": "BUSL-1.1",
20
+ "license": "FSL-1.1-MIT",
21
21
  "author": "Vuong Ngo",
22
22
  "repository": {
23
23
  "type": "git",
24
24
  "url": "git+https://github.com/AgiFlow/po.git",
25
- "directory": "packages/minor/po-computer-use"
25
+ "directory": "packages/modes/po-computer-use"
26
26
  },
27
27
  "files": [
28
28
  "dist",
@@ -33,7 +33,8 @@
33
33
  "llms.txt",
34
34
  "README.md",
35
35
  "LICENSE",
36
- "package.json"
36
+ "package.json",
37
+ "locales"
37
38
  ],
38
39
  "type": "module",
39
40
  "main": "./dist/index.cjs",
@@ -57,43 +58,47 @@
57
58
  "./extensions/web": {
58
59
  "import": "./dist/extensions/web.mjs"
59
60
  },
61
+ "./locales/vi.json": "./locales/vi.json",
62
+ "./locales/zh-CN.json": "./locales/zh-CN.json",
60
63
  "./package.json": "./package.json"
61
64
  },
62
65
  "publishConfig": {
63
66
  "access": "public"
64
67
  },
65
68
  "dependencies": {
66
- "@agimon-ai/po-config": "0.0.0-alpha.21",
67
- "@agimon-ai/po-core": "0.0.0-alpha.21",
68
- "@agimon-ai/po-minor-mode": "0.0.0-alpha.21",
69
- "@agimon-ai/po-web-components": "0.0.0-alpha.21",
70
- "@agimon-ai/po-web-security": "0.0.0-alpha.21",
69
+ "@agimon-ai/po-config": "0.0.0-alpha.210",
70
+ "@agimon-ai/po-core": "0.0.0-alpha.210",
71
+ "@agimon-ai/po-mode": "0.0.0-alpha.210",
72
+ "@agimon-ai/po-web-components": "0.0.0-alpha.210",
73
+ "@agimon-ai/po-web-security": "0.0.0-alpha.210",
71
74
  "@deepseek-ai/cordis": "4.0.5",
72
75
  "quickjs-emscripten": "0.32.0",
73
- "typebox": "1.3.37"
76
+ "typebox": "1.4.2"
74
77
  },
75
78
  "devDependencies": {
76
- "@agimon-ai/po-build": "0.0.0-alpha.21",
77
- "@agimon-ai/po-native-components": "0.0.0-alpha.21",
78
- "@agimon-ai/vibe-lint-plugin-po-extension": "0.0.0-alpha.21",
79
- "@earendil-works/pi-coding-agent": "1.3.0",
79
+ "@agimon-ai/po-build": "0.0.0-alpha.210",
80
+ "@agimon-ai/po-native-components": "0.0.0-alpha.210",
81
+ "@agimon-ai/po-profile": "0.0.0-alpha.210",
82
+ "@agimon-ai/po-vault": "0.0.0-alpha.210",
83
+ "@agimon-ai/vibe-lint-plugin-po-extension": "0.0.0-alpha.210",
84
+ "@earendil-works/pi-coding-agent": "1.6.1",
80
85
  "@tanstack/react-store": "0.11.2",
81
86
  "@tanstack/store": "0.11.2",
82
87
  "@types/node": "26.6.5",
83
88
  "@types/react": "19.3.0",
84
89
  "@vitest/coverage-v8": "5.0.4",
85
- "react": "19.3.0",
86
- "react-dom": "19.3.0",
87
- "react-native": "0.86.3",
88
- "react-native-unistyles": "3.5.3",
90
+ "react": "19.3.1",
91
+ "react-dom": "19.3.1",
92
+ "react-native": "0.88.1",
93
+ "react-native-unistyles": "3.7.0",
89
94
  "tsdown": "0.23.1",
90
95
  "typescript": "7.0.2",
91
96
  "vitest": "5.0.4"
92
97
  },
93
98
  "peerDependencies": {
94
- "@agimon-ai/po-native-components": "0.0.0-alpha.21",
95
- "@earendil-works/pi-coding-agent": "1.3.0",
96
- "react-native": "0.86.3",
99
+ "@agimon-ai/po-native-components": "0.0.0-alpha.210",
100
+ "@earendil-works/pi-coding-agent": "1.6.1",
101
+ "react-native": "0.88.1",
97
102
  "react-native-unistyles": "^3.5.3"
98
103
  },
99
104
  "peerDependenciesMeta": {
@@ -131,11 +136,40 @@
131
136
  },
132
137
  "poNative": {
133
138
  "pluginId": "computer-use",
139
+ "brain": {
140
+ "version": 1,
141
+ "slots": [
142
+ {
143
+ "name": "activity.computer-use",
144
+ "scope": "session",
145
+ "parent": "activity",
146
+ "kind": "component"
147
+ }
148
+ ],
149
+ "fills": [
150
+ {
151
+ "id": "computer-use",
152
+ "slot": "activity.computer-use",
153
+ "scope": "session",
154
+ "placement": "verified"
155
+ },
156
+ {
157
+ "id": "Computeruse",
158
+ "slot": "help.guides",
159
+ "scope": "session",
160
+ "placement": "verified"
161
+ }
162
+ ],
163
+ "diagnostics": [
164
+ "activity.computer-use: parent activity unavailable locally (may be supplied by host or another package)"
165
+ ]
166
+ },
134
167
  "channels": [
135
168
  "computer_use"
136
169
  ],
137
170
  "client": "./dist/extensions/native.mjs",
138
171
  "scopes": [
172
+ "host",
139
173
  "session"
140
174
  ]
141
175
  },
@@ -143,23 +177,49 @@
143
177
  "entry": "./generated/server.ts",
144
178
  "dist": "./dist/extensions/server.mjs",
145
179
  "scopes": [
146
- "global",
180
+ "host",
147
181
  "workspace",
148
182
  "session"
149
183
  ],
150
184
  "contracts": {
151
185
  "entry": "./src/exports/apiContracts.ts",
152
186
  "dist": "./dist/apiContracts.mjs"
187
+ },
188
+ "brain": {
189
+ "version": 1,
190
+ "provides": {}
153
191
  }
154
192
  },
155
193
  "poWeb": {
156
194
  "pluginId": "computer-use",
195
+ "brain": {
196
+ "version": 1,
197
+ "slots": [],
198
+ "fills": [
199
+ {
200
+ "id": "computer-use",
201
+ "slot": null,
202
+ "scope": "session",
203
+ "placement": "unverified"
204
+ },
205
+ {
206
+ "id": "Computeruse",
207
+ "slot": "help.guides",
208
+ "scope": "session",
209
+ "placement": "verified"
210
+ }
211
+ ],
212
+ "diagnostics": [
213
+ "src/extensions/workspaces/sessions/(frontend)/activity-group/computer-use.web.ts: activity-group metadata unavailable (dynamic declaration)",
214
+ "src/extensions/workspaces/sessions/(frontend)/fill/ComputerUse.activity.computer-use.web.tsx: fill identity unverified (spread or dynamic declaration); path is not placement evidence"
215
+ ]
216
+ },
157
217
  "channels": [
158
218
  "computer_use"
159
219
  ],
160
220
  "client": "./dist/extensions/web.mjs",
161
221
  "scopes": [
162
- "global",
222
+ "host",
163
223
  "workspace",
164
224
  "session"
165
225
  ]
@@ -168,7 +228,7 @@
168
228
  "build": "tsdown && tsdown --config tsdown.mcp.config.ts",
169
229
  "build:mcp": "tsdown --config tsdown.mcp.config.ts",
170
230
  "test": "vitest --run",
171
- "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.web.json && tsc --noEmit -p tsconfig.mcp.json && tsc --noEmit -p tsconfig.native.json",
231
+ "typecheck": "tsrs --noEmit && tsrs --noEmit -p tsconfig.web.json && tsrs --noEmit -p tsconfig.mcp.json && tsrs --noEmit -p tsconfig.native.json",
172
232
  "lint": "oxlint . && oxfmt . --check",
173
233
  "fixcode": "oxlint . --fix && oxfmt ."
174
234
  }
@@ -0,0 +1,83 @@
1
+ ---
2
+ name: codemode-how-to-computer-use
3
+ description: 'Request permission for computer use, then observe and act on the approved window or whole desktop. Use when Computer Use mode is on and a task needs Desktop controls.'
4
+ ---
5
+
6
+ # Computer Use in code mode
7
+
8
+ Selecting computer-use mode lets the agent ask for a time-limited grant; it does not give control. Computer use must also be enabled in Po Desktop settings. If `computer` is missing from `discover`, do not try another way in.
9
+
10
+ ## Request control only when needed
11
+
12
+ 1. Call `computer.targets()` for the available windows and the whole desktop. Use one window when it suffices. This list does not include screen contents.
13
+ 2. Call `computer.request({ target, durationMinutes, reason })` with the exact target and the shortest useful duration (5, 15 or 30 minutes). The approval card discloses the scope, time and recording. Extra action traces and window images are off unless you request `keepTrace: true` for one window and the person approves it.
14
+ 3. When the request is pending, end the turn and wait for the outcome as a new message. Do not request it again or expect the original script to resume. The person can deny the request; only the approved arguments may run.
15
+ 4. Observe once the outcome says the grant is active. Control functions appear only with a live grant. You cannot approve or extend it yourself, and old functions do not revive after cancellation or expiry.
16
+
17
+ Without code mode, use `computer_targets` and `computer_request` instead.
18
+
19
+ ## Members
20
+
21
+ | Call | Effect |
22
+ | ------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
23
+ | `computer.state({ includeScreenshot?, save?, skeleton?, root?, label?, role?, offset?, limit? })` | Read-only. Observes the authorized target. Use `skeleton: true` for a shallow outline of an approved window and `root` to drill into a ref from that outline. Pass `includeScreenshot: false` when text is enough. `save: true` keeps the screenshot in session artifacts. |
24
+ | `computer.act({ kind, snapshotId, elementRef, value?, text?, direction?, amount?, action? })` | Changes the application. Use the element’s supported actions. Window grants may offer `expand`, `collapse`, `toggle`, `check`, `uncheck`, `select`, `scroll_to` and `type`, in addition to the basic actions. |
25
+ | `computer.act({ kind: 'launch', app })` | Changes the desktop. Whole-desktop grants only. Opens an installed app by bundle id or name, including apps not in the Dock. Needs no snapshot. |
26
+ | `computer.run({ scriptPath, input, trusted?, includeScreenshot? })` | Changes the application. Runs a reusable function with only the authorized program API. No screenshot unless asked. |
27
+ | `computer.stop()` | Ends the current grant. It does not activate anything or change settings. |
28
+
29
+ Use only the `snapshotId` and `elementRef` values from the latest `state()`. Never infer coordinates, inspect another application, or bypass restrictions. The visible agent cursor is an indicator, not a second input device. Semantic actions do not move the person's pointer, but a `focus` action or an app's response can change focus. Do not edit the field the person is using. Re-observe to verify a result instead of sleeping for a guessed interval.
30
+
31
+ On a whole-desktop grant, each element `ref` starts with its root: `dock` (always first), an app window (`<pid>-<n>`, labelled `App: title`, frontmost first), or the frontmost app's `menubar`. Switch apps by pressing their Dock item; open an app that is not in the Dock with `launch`. Po's own windows, the system's security windows and protected apps are never observed and cannot be acted on or launched. A busy window can fill its share of the snapshot (`truncated: true`); narrow the snapshot instead of closing what the person has open.
32
+
33
+ ## Profile values and secret input
34
+
35
+ Pass references unchanged in `set_value.value`, for example `value: '{{ env.NAME }}'` or `value: '{{ secrets.TOKEN }}'`. The host resolves them privately from the selected profile. Legacy `${env.NAME}` and `${secrets.TOKEN}` also work. Only direct interpolation is accepted: no tags, filters, expressions, dynamic keys, arbitrary process environment, or direct vault access. Unknown names and malformed templates fail instead of being typed literally. The same path is used by direct tools, scripts' `program.act`, and code mode.
36
+
37
+ Secrets must be profile aliases with the `input` purpose and an exact `allowedTargets.computer` app bundle ID. An approved single-window grant can set a secure field with `set_value` and a secret reference. Literal text, `type`, and whole-desktop grants cannot write secure fields. Po rechecks the original process and window before dispatch.
38
+
39
+ Before secret input reaches the app, Po seals the trace and finishes screen and audio recording. Once a secret is resolved, later observations, screenshots, and new capture grants for this session are sealed, even when delivery fails. The return value confirms dispatch only. Do not re-observe, retry uncertain input, or open another surface to inspect the secret. Ask the person to verify or finish the interaction and call `computer.stop()`. Env-only references do not seal capture.
40
+
41
+ ## Narrowing and paging
42
+
43
+ `root` keeps one subtree: an element `ref`, or on the desktop `dock`, `menubar` or a window root id. `label` matches a substring in any case; `role` matches exactly, such as `AXButton`. `limit` is at most 500. While the result has `nextOffset`, pass it back as `offset` with the same filters for the next page. Each page has its own `snapshotId`; act with the id of the page the element came from. If the interface changed between pages, start again at offset 0.
44
+
45
+ Pass `action` with `kind: 'perform'` only for a name in that element's `nativeActions`. Window grants support only the equivalents provided by agent-desktop. Window `scroll` accepts a step count from 1 to 100; legacy `line` and `page` each request one approximate step. Check the result with a new observation.
46
+
47
+ ```ts
48
+ // read-only
49
+ const before = await computer.state({ includeScreenshot: false });
50
+ // state-changing: ids come from `before`
51
+ const result = await computer.act({
52
+ kind: 'press',
53
+ snapshotId: before.snapshotId,
54
+ elementRef: before.elements[0].ref,
55
+ });
56
+ // read-only: verify
57
+ const after = await computer.state({ includeScreenshot: false });
58
+ return { result, after };
59
+ ```
60
+
61
+ Each `exec` run shows at most 4 images and 5 MB in total. In a loop, pass `includeScreenshot: false`. If an image is refused, the result carries a `warning` and the action still happened. Calls time out with the `exec` deadline (30 s by default, 120 s at most).
62
+
63
+ Save screenshots only at key steps: `computer.state({ includeScreenshot: false, save: true })` keeps the file without spending an image. Finished recordings are copied automatically into `artifact:computer-use/`. If the person approved extra trace capture for a window grant, bounded action metadata and PNGs of that window are saved alongside the MP4. Do not copy or publish them elsewhere unless asked.
64
+
65
+ ## Reusable functions
66
+
67
+ For predictable multi-step work, write a `.ts`, `.js` or `.mjs` file below the session working directory with the file tools and export `run({ context: { program }, input, logger, signal })`. Then call it:
68
+
69
+ ```ts
70
+ // state-changing
71
+ return await computer.run({
72
+ scriptPath: 'scripts/fill-form.ts',
73
+ input: { name: 'Ada' },
74
+ });
75
+ ```
76
+
77
+ `program` exposes `observe(options?)` (the same options as `state()`) and `act(action)`. Scripts run with restricted capabilities, not as Node programs: no `node:` modules, installed packages, network APIs or host constructors. Each invocation starts fresh. Return compact JSON, not screenshots. `trusted: true` is a separate path that needs a host-allowlisted entry; never request it to get around a restricted-runtime error.
78
+
79
+ ## Failures and recovery
80
+
81
+ Failures say how many actions completed and whether the outcome is uncertain (`completedActions`, `outcomeUncertain`). Never retry an uncertain action or replay a partly completed chain. If the grant is still active after a recoverable rejection, call `state()` to see fresh state. If the outcome is uncertain, do not retry.
82
+
83
+ Call `computer.stop()` when the task is complete. The person can stop from Activity, the Po Desktop menu, or Cmd+Shift+Esc on macOS while a run is active. Expiry or cancellation always wins.
@@ -10,6 +10,18 @@ export interface ComputerUseSessionClient {
10
10
 
11
11
  export interface ComputerUseObservationOptions {
12
12
  includeScreenshot?: boolean;
13
+ /** Return only the outline: containers and interactive elements, without leaf text. */
14
+ skeleton?: boolean;
15
+ /** Observe only this subtree: an element ref, or on the desktop a root such as `dock` or `menubar`. */
16
+ root?: string;
17
+ /** Keep elements whose label contains this text, ignoring case. */
18
+ label?: string;
19
+ /** Keep elements with exactly this accessibility role, such as `AXButton`. */
20
+ role?: string;
21
+ /** Skip this many matching elements; pass the previous `nextOffset`. */
22
+ offset?: number;
23
+ /** At most this many elements, 1 to 500. */
24
+ limit?: number;
13
25
  }
14
26
 
15
27
  export const COMPUTER_USE_PHASES = [
@@ -54,6 +66,8 @@ export interface ComputerUseElement {
54
66
  readonly enabled: boolean;
55
67
  readonly secure: boolean;
56
68
  readonly actions: readonly ComputerUseActionKind[];
69
+ /** Native accessibility actions `perform` may run, such as `AXShowMenu`. */
70
+ readonly nativeActions?: readonly string[];
57
71
  }
58
72
 
59
73
  export interface ComputerUseObservation {
@@ -64,32 +78,71 @@ export interface ComputerUseObservation {
64
78
  readonly bundleId: string;
65
79
  readonly windowTitle: string;
66
80
  readonly elements: readonly ComputerUseElement[];
81
+ /** More elements exist than this page holds, or the scan stopped at its budget. */
82
+ readonly truncated?: boolean;
83
+ /** The `offset` of the next page, present when this page filled up. */
84
+ readonly nextOffset?: number;
67
85
  readonly screenshot?: {
68
86
  readonly mimeType: 'image/png';
69
87
  readonly data: string;
70
88
  };
89
+ /** The `artifact:` path of this screenshot when the caller asked to save it. */
90
+ readonly screenshotArtifact?: string;
71
91
  }
72
92
 
73
- export type ComputerUseActionKind = 'press' | 'focus' | 'set_value' | 'scroll';
93
+ export type ComputerUseActionKind =
94
+ | 'press'
95
+ | 'focus'
96
+ | 'set_value'
97
+ | 'scroll'
98
+ | 'perform'
99
+ | 'expand'
100
+ | 'collapse'
101
+ | 'toggle'
102
+ | 'check'
103
+ | 'uncheck'
104
+ | 'select'
105
+ | 'scroll_to'
106
+ | 'type';
74
107
 
75
108
  export type ComputerUseAction =
76
109
  | {
77
- readonly kind: 'press' | 'focus';
110
+ readonly kind: 'press' | 'focus' | 'expand' | 'collapse' | 'toggle' | 'check' | 'uncheck' | 'scroll_to';
78
111
  readonly snapshotId: string;
79
112
  readonly elementRef: string;
80
113
  }
81
114
  | {
82
- readonly kind: 'set_value';
115
+ readonly kind: 'set_value' | 'select';
83
116
  readonly snapshotId: string;
84
117
  readonly elementRef: string;
85
118
  readonly value: string;
86
119
  }
120
+ | {
121
+ readonly kind: 'type';
122
+ readonly snapshotId: string;
123
+ readonly elementRef: string;
124
+ readonly text: string;
125
+ }
87
126
  | {
88
127
  readonly kind: 'scroll';
89
128
  readonly snapshotId: string;
90
129
  readonly elementRef: string;
91
130
  readonly direction: 'up' | 'down' | 'left' | 'right';
92
- readonly amount: 'line' | 'page';
131
+ /** `line`, `page`, or a whole number from 1 to 100. */
132
+ readonly amount: 'line' | 'page' | number;
133
+ }
134
+ | {
135
+ readonly kind: 'perform';
136
+ readonly snapshotId: string;
137
+ readonly elementRef: string;
138
+ /** One of the element's `nativeActions`. */
139
+ readonly action: string;
140
+ }
141
+ | {
142
+ /** Opens an installed app on a whole-desktop grant. Never Po or a system security app. */
143
+ readonly kind: 'launch';
144
+ /** A bundle id such as `com.openai.chat`, or the app name as it appears in Applications. */
145
+ readonly app: string;
93
146
  };
94
147
 
95
148
  export type ComputerUseFailureCode =
@@ -121,12 +174,24 @@ export interface ComputerUseState {
121
174
  }
122
175
 
123
176
  export type ComputerUseStateEvent =
124
- | { readonly type: 'request'; readonly requestId: string; readonly target: ComputerUseTarget }
177
+ | {
178
+ readonly type: 'request';
179
+ readonly requestId: string;
180
+ readonly target: ComputerUseTarget;
181
+ }
125
182
  | { readonly type: 'await_confirmation'; readonly requestId: string }
126
183
  | { readonly type: 'confirm'; readonly requestId: string }
127
184
  | { readonly type: 'deny'; readonly requestId: string }
128
- | { readonly type: 'activated'; readonly requestId: string; readonly grant: ComputerUseGrant }
185
+ | {
186
+ readonly type: 'activated';
187
+ readonly requestId: string;
188
+ readonly grant: ComputerUseGrant;
189
+ }
129
190
  | { readonly type: 'stop' }
130
191
  | { readonly type: 'stopped' }
131
- | { readonly type: 'fail'; readonly code: ComputerUseFailureCode; readonly message: string }
192
+ | {
193
+ readonly type: 'fail';
194
+ readonly code: ComputerUseFailureCode;
195
+ readonly message: string;
196
+ }
132
197
  | { readonly type: 'reset' };
@@ -1,5 +1,3 @@
1
- import type { PoApiCaller } from '@agimon-ai/po-core/packageApi';
2
-
3
1
  export const API_BASE_PATH = 'computer-use';
4
2
  export const computerUseChannelType = 'computer_use_state';
5
3
  export const COMPUTER_USE_MODE_ID = 'computer-use';
@@ -7,6 +5,12 @@ export const COMPUTER_USE_STATUS_KEY = 'po-computer-use';
7
5
  export const COMPUTER_USE_MODE_STATUS_KEY = 'po-computer-use-mode';
8
6
  export const COMPUTER_USE_MAX_DURATION_MS = 1_800 * 1_000;
9
7
  export const COMPUTER_USE_DEFAULT_DURATION_MS = 300 * 1_000;
8
+ /** The session lengths a person can pick when granting control, up to the maximum. */
9
+ export const COMPUTER_USE_DURATION_CHOICES_MS = [
10
+ COMPUTER_USE_DEFAULT_DURATION_MS,
11
+ 900_000,
12
+ COMPUTER_USE_MAX_DURATION_MS,
13
+ ] as const;
10
14
  export const COMPUTER_USE_CONFIRMATION_WINDOW_MS = 2 * 60 * 1_000;
11
15
 
12
16
  /**
@@ -17,7 +21,6 @@ export const COMPUTER_USE_CONFIRMATION_WINDOW_MS = 2 * 60 * 1_000;
17
21
  * strings, so a route cannot move on one side alone.
18
22
  */
19
23
  export const COMPUTER_USE_ROUTES = {
20
- activate: '/activate',
21
24
  artifact: '/artifact',
22
25
  agentState: '/agent/state',
23
26
  agentObserve: '/agent/observe',
@@ -29,10 +32,18 @@ export const COMPUTER_USE_ROUTES = {
29
32
  hubNext: '/hub/next',
30
33
  hubComplete: '/hub/complete',
31
34
  hubStop: '/hub/stop',
35
+ hubRequestStop: '/hub/request-stop',
32
36
  } as const;
33
37
 
34
38
  export const COMPUTER_USE_WAKE_LIMIT = 1_000_000;
35
39
 
40
+ /** A consented trace extra, read through the same grant-bound host store as the recording. */
41
+ export interface ComputerUseTraceFileView {
42
+ readonly artifactId: string;
43
+ readonly sizeBytes: number;
44
+ readonly sequence?: number;
45
+ }
46
+
36
47
  export interface ComputerUseArtifactView {
37
48
  readonly artifactId: string;
38
49
  readonly status: 'ready' | 'failed';
@@ -41,6 +52,8 @@ export interface ComputerUseArtifactView {
41
52
  readonly previewUrl?: string;
42
53
  readonly actionCount?: number;
43
54
  readonly completedAt?: string;
55
+ readonly trace?: ComputerUseTraceFileView;
56
+ readonly windows?: readonly ComputerUseTraceFileView[];
44
57
  readonly failure?: { readonly code: string; readonly message: string };
45
58
  }
46
59
 
@@ -63,7 +76,11 @@ export interface ComputerUseActivationRequest {
63
76
  readonly durationSeconds: number;
64
77
  readonly createdAt: number;
65
78
  readonly confirmationExpiresAt: number;
66
- readonly caller: PoApiCaller;
79
+ /** Set by the session broker only after the person approves the saved request. */
80
+ readonly confirmedAt?: number;
81
+ /** True only when the person approved keeping a redacted trace and window images for this one window. */
82
+ readonly traceConsent: boolean;
83
+ readonly caller: { readonly locality: 'approval'; readonly approvalId: string };
67
84
  }
68
85
 
69
86
  export interface ComputerUseBrokerRequest {
@@ -80,4 +97,6 @@ export interface ComputerUseChannelPayload {
80
97
  readonly busy?: true;
81
98
  }
82
99
 
83
- export type ComputerUseBrowserCommand = { readonly action: 'status' | 'targets' | 'stop' | 'artifacts' };
100
+ export type ComputerUseBrowserCommand = {
101
+ readonly action: 'status' | 'stop';
102
+ };